@pmelab/gtd 13.0.0 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -24
- package/dist/gtd.bundle.mjs +3569 -11747
- package/package.json +8 -3
- package/schema.json +5 -287
- package/src/flows/helpers.ts +93 -0
- package/src/flows/index.ts +3 -0
- package/src/flows/runtime.ts +295 -0
- package/src/flows/scripts.ts +116 -0
- package/src/workflows/health.ts +126 -0
- package/src/workflows/index.ts +1 -0
- package/src/workflows/packages.ts +93 -0
- package/src/workflows/planning.ts +99 -0
- package/src/workflows/prose.ts +200 -0
- package/src/workflows/review.ts +169 -0
- package/src/workflows/steps.ts +200 -0
- package/src/workflows/text.fixture.ts +38 -0
- package/src/workflows/text.test.ts +37 -0
- package/src/workflows/text.ts +682 -0
- package/src/workflows/unified.ts +128 -0
- package/src/workflows/vars.ts +23 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { installContext } from "../flows/index.js"
|
|
2
|
+
import { defaults } from "./vars.js"
|
|
3
|
+
|
|
4
|
+
export interface TextContext {
|
|
5
|
+
readonly vars?: Readonly<Record<string, string>>
|
|
6
|
+
readonly head?: string
|
|
7
|
+
readonly start?: string
|
|
8
|
+
readonly read?: (path: string) => string | undefined
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const unavailable = (): never => {
|
|
12
|
+
throw new Error("not available while rendering a text outside a replay")
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Evaluate one of the bundled workflow's texts the way replay would, against a fixed context. */
|
|
16
|
+
export const renderText = <T>(text: () => T, context: TextContext = {}): T => {
|
|
17
|
+
installContext({
|
|
18
|
+
step: unavailable,
|
|
19
|
+
refuse: unavailable,
|
|
20
|
+
pushScope: unavailable,
|
|
21
|
+
popScope: unavailable,
|
|
22
|
+
read: context.read ?? (() => undefined),
|
|
23
|
+
glob: () => [],
|
|
24
|
+
changes: () => [],
|
|
25
|
+
matches: () => false,
|
|
26
|
+
sections: () => [],
|
|
27
|
+
sectionBodies: () => [],
|
|
28
|
+
openQuestions: () => [],
|
|
29
|
+
vars: { ...defaults, ...context.vars },
|
|
30
|
+
head: () => context.head ?? "",
|
|
31
|
+
start: () => context.start ?? "",
|
|
32
|
+
})
|
|
33
|
+
try {
|
|
34
|
+
return text()
|
|
35
|
+
} finally {
|
|
36
|
+
installContext(undefined)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import { summaryPrompt, withSkills } from "./text.js"
|
|
3
|
+
import { renderText } from "./text.fixture.js"
|
|
4
|
+
|
|
5
|
+
describe("withSkills", () => {
|
|
6
|
+
const prompted = (skills: string | undefined) =>
|
|
7
|
+
renderText(() => withSkills(skills, "do-the-work"))
|
|
8
|
+
|
|
9
|
+
it("puts the preamble, naming the skills, ahead of the prompt", () => {
|
|
10
|
+
const prompt = prompted("code-review, testing")
|
|
11
|
+
expect(prompt).toContain("missing one: code-review, testing")
|
|
12
|
+
expect(prompt.endsWith("\n\ndo-the-work")).toBe(true)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it("leaves the prompt bare when there are no skills", () => {
|
|
16
|
+
expect(prompted(undefined)).toBe("do-the-work")
|
|
17
|
+
expect(prompted(" ")).toBe("do-the-work")
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
describe("summaryPrompt", () => {
|
|
22
|
+
it("puts the total and every model's cost on a line of its own", () => {
|
|
23
|
+
const prompt = summaryPrompt({
|
|
24
|
+
entryCommit: "e",
|
|
25
|
+
processBase: "b",
|
|
26
|
+
processTip: "t",
|
|
27
|
+
humanCommits: [],
|
|
28
|
+
processCost: 12,
|
|
29
|
+
processCostByModel: [
|
|
30
|
+
{ model: "smart", cost: 5 },
|
|
31
|
+
{ model: "base", cost: 7 },
|
|
32
|
+
],
|
|
33
|
+
vars: {},
|
|
34
|
+
})
|
|
35
|
+
expect(prompt).toContain("Token cost: 12\n- smart: 5\n- base: 7\n\nPrint the closing message")
|
|
36
|
+
})
|
|
37
|
+
})
|