mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 02:20:38 +09:00
feat(routines): add workspace-aware routine runs
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
parent
36376968af
commit
909e8cd4c8
38 changed files with 15468 additions and 250 deletions
34
packages/shared/src/routine-variables.test.ts
Normal file
34
packages/shared/src/routine-variables.test.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
extractRoutineVariableNames,
|
||||
interpolateRoutineTemplate,
|
||||
syncRoutineVariablesWithTemplate,
|
||||
} from "./routine-variables.js";
|
||||
|
||||
describe("routine variable helpers", () => {
|
||||
it("extracts placeholder names in first-appearance order", () => {
|
||||
expect(
|
||||
extractRoutineVariableNames("Review {{repo}} and {{priority}} for {{repo}}"),
|
||||
).toEqual(["repo", "priority"]);
|
||||
});
|
||||
|
||||
it("preserves existing metadata when syncing variables from a template", () => {
|
||||
expect(
|
||||
syncRoutineVariablesWithTemplate("Review {{repo}} and {{priority}}", [
|
||||
{ name: "repo", label: "Repository", type: "text", defaultValue: "paperclip", required: true, options: [] },
|
||||
]),
|
||||
).toEqual([
|
||||
{ name: "repo", label: "Repository", type: "text", defaultValue: "paperclip", required: true, options: [] },
|
||||
{ name: "priority", label: null, type: "text", defaultValue: null, required: true, options: [] },
|
||||
]);
|
||||
});
|
||||
|
||||
it("interpolates provided variable values into the routine template", () => {
|
||||
expect(
|
||||
interpolateRoutineTemplate("Review {{repo}} for {{priority}}", {
|
||||
repo: "paperclip",
|
||||
priority: "high",
|
||||
}),
|
||||
).toBe("Review paperclip for high");
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue