@trailstep/create-flows 0.2.0 → 0.3.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/dist/index.js CHANGED
@@ -742,7 +742,7 @@ function grillPrompt() {
742
742
  return promptSections6(
743
743
  section6(
744
744
  "Role",
745
- "You are the interactive front door for starting a new TrailStep feature. Open by asking the user what they want to build."
745
+ "You are the interactive front door for starting a new feature in the current project. Open by asking the user what they want to build."
746
746
  ),
747
747
  section6(
748
748
  "Task",
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/grill-it-away/workflow.ts","../src/feature-implementation/shared/output-schema.ts","../src/grill-it-away/grill/step.ts","../src/feature-implementation/create-feature-doc/step.ts","../src/feature-implementation/create-or-improve-implementation-doc/step.ts","../src/feature-implementation/review-implementation-doc/step.ts","../src/feature-implementation/shared/constants.ts","../src/feature-implementation/shared/review-schema.ts","../src/feature-implementation/split-implementation-stories/step.ts","../src/feature-implementation/implement-story/step.ts","../src/feature-implementation/review-story-implementation/step.ts","../src/feature-implementation/commit-reviewed-story/step.ts","../src/feature-implementation/shared/story-state.ts","../src/feature-implementation/commit-reviewed-story/run-git.ts","../src/feature-implementation/review-story-implementation/prompt.ts","../src/feature-implementation/shared/feature-methodology.md","../src/feature-implementation/shared/story-implementation-contract.md","../src/feature-implementation/implement-story/prompt.ts","../src/feature-implementation/shared/project-architecture-guidance.md","../src/feature-implementation/review-implementation-doc/prompt.ts","../src/feature-implementation/shared/implementation-doc-format.md","../src/feature-implementation/create-or-improve-implementation-doc/prompt.ts","../src/feature-implementation/create-feature-doc/prompt.ts","../src/feature-implementation/shared/feature-doc-format.md","../src/feature-implementation/shared/input-schema.ts","../src/grill-it-away/grill/prompt.ts","../src/take-it-away/workflow.ts"],"sourcesContent":["import { defineWorkflow, shape } from \"@trailstep/authoring\";\nimport { takeItAwayOutput } from \"../feature-implementation/shared/output-schema.js\";\nimport { grillStep } from \"./grill/step.js\";\n\nexport const grillItAway = defineWorkflow({\n id: \"grill-it-away\",\n description: \"Interactively grills the user until it understands the requested feature.\",\n inputShape: shape<Record<string, never>>({}),\n outputShape: takeItAwayOutput,\n agents: {\n grillingAgent: {\n size: \"medium\",\n thinking: \"medium\",\n description: \"Grills the user until it understands the requested feature.\",\n },\n featureWriter: {\n size: \"medium\",\n thinking: \"medium\",\n description: \"Turns a conversation/feature request into a standalone feature doc.\",\n },\n planner: {\n size: \"large\",\n thinking: \"high\",\n description:\n \"Creates or improves the implementation doc: architecture-aware, TDD/vertical-slice/tracer-bullet story design.\",\n },\n reviewer: {\n size: \"large\",\n thinking: \"high\",\n description: \"Reviews isolated implementation docs and story diffs against methodology.\",\n },\n implementer: {\n size: \"medium\",\n thinking: \"medium\",\n description: \"Implements one story at a time using strict behavioral-red TDD.\",\n },\n },\n start() {\n return grillStep();\n },\n});\n","import { jsonSchema } from \"@trailstep/authoring\";\n\nexport interface TakeItAwayOutput extends Record<string, unknown> {\n readonly status: \"implemented\";\n readonly featureDocPath: string;\n readonly implementationDocPath: string;\n readonly storyCount: number;\n readonly completedStories: readonly string[];\n readonly summary: string;\n}\n\nexport const takeItAwayOutput = jsonSchema<TakeItAwayOutput>({\n type: \"object\",\n properties: {\n status: { type: \"string\", const: \"implemented\" },\n featureDocPath: { type: \"string\" },\n implementationDocPath: { type: \"string\" },\n storyCount: { type: \"number\" },\n completedStories: { type: \"array\", items: { type: \"string\" } },\n summary: { type: \"string\" },\n },\n required: [\n \"status\",\n \"featureDocPath\",\n \"implementationDocPath\",\n \"storyCount\",\n \"completedStories\",\n \"summary\",\n ],\n additionalProperties: false,\n});\n\nexport function extractStoryTitle(storyContent: string, fallbackIndex: number): string {\n const heading = /^#{1,6}\\s+(.+)$/m.exec(storyContent);\n return heading?.[1]?.trim() || `Story ${fallbackIndex}`;\n}\n","import { step } from \"@trailstep/authoring\";\nimport { createFeatureDocStep } from \"../../feature-implementation/create-feature-doc/step.js\";\nimport { takeItAwayInput } from \"../../feature-implementation/shared/input-schema.js\";\nimport { grillPrompt } from \"./prompt.js\";\n\nexport const grillStep = step({ id: \"grill\" })\n .prompt(grillPrompt, {\n agent: \"grillingAgent\",\n mode: \"interactive\",\n output: takeItAwayInput,\n })\n .do((output) => createFeatureDocStep(output));\n","import { Document, state, step } from \"@trailstep/authoring\";\nimport { createOrImproveImplementationDocStep } from \"../create-or-improve-implementation-doc/step.js\";\nimport { createFeatureDocPrompt } from \"./prompt.js\";\n\nexport const createFeatureDocStep = step({ id: \"create-feature-doc\" })\n .prompt(createFeatureDocPrompt, {\n agent: \"featureWriter\",\n output: Document,\n })\n .do(async (featureDoc) => {\n await state.set(\"featureDoc\", featureDoc);\n return createOrImproveImplementationDocStep({ featureDoc, attempt: 1 });\n });\n","import { Document, state, step } from \"@trailstep/authoring\";\nimport { reviewImplementationDocStep } from \"../review-implementation-doc/step.js\";\nimport { createOrImproveImplementationDocPrompt } from \"./prompt.js\";\n\nexport const createOrImproveImplementationDocStep = step({\n id: \"create-or-improve-implementation-doc\",\n})\n .prompt(createOrImproveImplementationDocPrompt, {\n agent: \"planner\",\n output: Document,\n })\n .do(async (implementationDoc, input) => {\n await state.set(\"implementationDoc\", implementationDoc);\n return reviewImplementationDocStep({\n featureDoc: input.featureDoc,\n implementationDoc,\n attempt: input.attempt,\n });\n });\n","import { fail, step } from \"@trailstep/authoring\";\nimport { createOrImproveImplementationDocStep } from \"../create-or-improve-implementation-doc/step.js\";\nimport { MAX_IMPLEMENTATION_DOC_REVIEW_ATTEMPTS } from \"../shared/constants.js\";\nimport type { ReviewResult } from \"../shared/review-schema.js\";\nimport { reviewOutput, reviewPasses } from \"../shared/review-schema.js\";\nimport { splitImplementationStoriesStep } from \"../split-implementation-stories/step.js\";\nimport { type ReviewImplementationDocInput, reviewImplementationDocPrompt } from \"./prompt.js\";\n\nexport const reviewImplementationDocStep = step({ id: \"review-implementation-doc\" })\n .prompt<ReviewImplementationDocInput, ReviewResult>(reviewImplementationDocPrompt, {\n agent: \"reviewer\",\n output: reviewOutput,\n })\n .do((review, input) => {\n if (reviewPasses(review)) {\n return splitImplementationStoriesStep({ implementationDoc: input.implementationDoc });\n }\n\n if (input.attempt >= MAX_IMPLEMENTATION_DOC_REVIEW_ATTEMPTS) {\n return fail({\n code: \"implementation_doc_review_exhausted\",\n message: `implementation-doc.md failed review ${MAX_IMPLEMENTATION_DOC_REVIEW_ATTEMPTS} times in a row (last score ${review.score}/5).`,\n details: { review, implementationDocPath: input.implementationDoc.path },\n });\n }\n\n return createOrImproveImplementationDocStep({\n featureDoc: input.featureDoc,\n previousReview: review,\n attempt: input.attempt + 1,\n });\n });\n","export const STORY_BOUNDARY = \"<!-- trailstep-story-boundary -->\";\n\nexport const STORY_CONTEXT_START = \"<context>\";\n\nexport const STORY_CONTEXT_END = \"</context>\";\n\nexport const REVIEW_PASS_THRESHOLD = 4;\n\nexport const MAX_IMPLEMENTATION_DOC_REVIEW_ATTEMPTS = 5;\n\nexport const MAX_STORY_REVIEW_ATTEMPTS = 3;\n","import { jsonSchema } from \"@trailstep/authoring\";\n\nimport { REVIEW_PASS_THRESHOLD } from \"./constants.js\";\n\nexport interface MethodologyRatings extends Record<string, unknown> {\n readonly tdd: number;\n readonly verticalSlicing: number;\n readonly tracerBullet: number;\n readonly dependencies: number;\n readonly architecture: number;\n}\n\nexport interface ReviewResult extends Record<string, unknown> {\n readonly score: number;\n readonly summary: string;\n readonly methodologyRatings: MethodologyRatings;\n readonly requiredImprovements: readonly string[];\n}\n\nconst RATING_SCHEMA = { type: \"integer\", minimum: 1, maximum: 5 } as const;\n\nexport const reviewOutput = jsonSchema<ReviewResult>({\n type: \"object\",\n properties: {\n score: RATING_SCHEMA,\n summary: { type: \"string\" },\n methodologyRatings: {\n type: \"object\",\n properties: {\n tdd: RATING_SCHEMA,\n verticalSlicing: RATING_SCHEMA,\n tracerBullet: RATING_SCHEMA,\n dependencies: RATING_SCHEMA,\n architecture: RATING_SCHEMA,\n },\n required: [\"tdd\", \"verticalSlicing\", \"tracerBullet\", \"dependencies\", \"architecture\"],\n additionalProperties: false,\n },\n requiredImprovements: { type: \"array\", items: { type: \"string\" } },\n },\n required: [\"score\", \"summary\", \"methodologyRatings\", \"requiredImprovements\"],\n additionalProperties: false,\n});\n\nexport function reviewPasses(review: ReviewResult): boolean {\n return review.score >= REVIEW_PASS_THRESHOLD;\n}\n","import { type Document, document, fail, state, step } from \"@trailstep/authoring\";\nimport type { ContinuationResult } from \"@trailstep/core\";\nimport { implementStoryStep } from \"../implement-story/step.js\";\nimport { STORY_BOUNDARY, STORY_CONTEXT_END, STORY_CONTEXT_START } from \"../shared/constants.js\";\nimport { recordActiveStoryStartCommit, STORY_STATE_KEYS } from \"../shared/story-state.js\";\n\nexport interface SplitImplementationStoriesInput extends Record<string, unknown> {\n readonly implementationDoc: Document;\n}\n\nexport const splitImplementationStoriesStep = step({ id: \"split-implementation-stories\" }).do(\n async ({ implementationDoc }: SplitImplementationStoriesInput): Promise<ContinuationResult> => {\n const contextStartCount = countOccurrences(implementationDoc.content, STORY_CONTEXT_START);\n const contextEndCount = countOccurrences(implementationDoc.content, STORY_CONTEXT_END);\n\n if (contextStartCount !== contextEndCount) {\n return fail({\n code: \"unbalanced_story_context\",\n message: `Found ${contextStartCount} \\`${STORY_CONTEXT_START}\\` marker(s) and ${contextEndCount} \\`${STORY_CONTEXT_END}\\` marker(s) in implementation-doc.md. Context blocks must be balanced.`,\n details: { implementationDocPath: implementationDoc.path },\n });\n }\n\n const contextMatches = Array.from(implementationDoc.content.matchAll(storyContextPattern()));\n if (contextMatches.length !== contextStartCount) {\n return fail({\n code: \"invalid_story_context_order\",\n message: `Every \\`${STORY_CONTEXT_START}\\` marker in implementation-doc.md must be followed by a matching \\`${STORY_CONTEXT_END}\\` marker.`,\n details: { implementationDocPath: implementationDoc.path },\n });\n }\n\n const contextBlocks = contextMatches\n .map(([, context]) => context?.trim() ?? \"\")\n .filter((context) => context.length > 0);\n const sharedContext = contextBlocks.join(\"\\n\\n---\\n\\n\");\n const contentWithoutContextBlocks = implementationDoc.content.replace(\n storyContextPattern(),\n \"\",\n );\n\n const chunks = contentWithoutContextBlocks\n .split(STORY_BOUNDARY)\n .slice(1) // drop overview-only text before the first boundary; <context> blocks are prepended below\n .map((chunk) => chunk.trim())\n .filter((chunk) => chunk.length > 0)\n .map((chunk) => prependSharedContext(chunk, sharedContext));\n\n if (chunks.length === 0) {\n return fail({\n code: \"no_stories_found\",\n message: `No \\`${STORY_BOUNDARY}\\`-delimited stories found in implementation-doc.md.`,\n details: { implementationDocPath: implementationDoc.path },\n });\n }\n\n const storyDocs: Document[] = [];\n for (const chunk of chunks) {\n storyDocs.push(await document(chunk));\n }\n\n // storyDocs.length === chunks.length, already guarded above to be > 0.\n const [firstStory, ...remaining] = storyDocs as [Document, ...Document[]];\n await state.set(STORY_STATE_KEYS.storyQueue, remaining);\n await state.set(STORY_STATE_KEYS.completedStories, []);\n await state.set(STORY_STATE_KEYS.activeStory, firstStory);\n await recordActiveStoryStartCommit();\n\n return implementStoryStep({ currentStory: firstStory, attempt: 1 });\n },\n);\n\nfunction countOccurrences(value: string, needle: string): number {\n if (needle.length === 0) {\n return 0;\n }\n\n let count = 0;\n let offset = 0;\n while (true) {\n const index = value.indexOf(needle, offset);\n if (index === -1) {\n return count;\n }\n\n count += 1;\n offset = index + needle.length;\n }\n}\n\nfunction storyContextPattern(): RegExp {\n return new RegExp(\n `${escapeRegExp(STORY_CONTEXT_START)}([\\\\s\\\\S]*?)${escapeRegExp(STORY_CONTEXT_END)}`,\n \"g\",\n );\n}\n\nfunction prependSharedContext(story: string, sharedContext: string): string {\n if (sharedContext.length === 0) {\n return story;\n }\n\n return [\"## Shared implementation context\", sharedContext, \"## Active story\", story].join(\"\\n\\n\");\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n","import { fail, step } from \"@trailstep/authoring\";\nimport { reviewStoryImplementationStep } from \"../review-story-implementation/step.js\";\nimport { loadStoryReviewGitContext } from \"../shared/story-state.js\";\nimport {\n type ImplementStoryInput,\n type ImplementStoryOutput,\n implementStoryOutput,\n implementStoryPrompt,\n} from \"./prompt.js\";\n\nexport const implementStoryStep = step({ id: \"implement-story\" })\n .prompt<ImplementStoryInput, ImplementStoryOutput>(implementStoryPrompt, {\n agent: \"implementer\",\n output: implementStoryOutput,\n })\n .do(async (promptOutput, input) => {\n if (promptOutput.blocked) {\n return fail({\n code: \"story_blocked\",\n message: promptOutput.blockedReason ?? \"Story implementation reported a blocked state.\",\n details: { storyPath: input.currentStory.path },\n });\n }\n\n return reviewStoryImplementationStep({\n currentStory: input.currentStory,\n attempt: input.attempt,\n implementationSummary: promptOutput.summary,\n gitContext: await loadStoryReviewGitContext(),\n });\n });\n","import { fail, step } from \"@trailstep/authoring\";\nimport { commitReviewedStoryStep } from \"../commit-reviewed-story/step.js\";\nimport { implementStoryStep } from \"../implement-story/step.js\";\nimport { MAX_STORY_REVIEW_ATTEMPTS } from \"../shared/constants.js\";\nimport type { ReviewResult } from \"../shared/review-schema.js\";\nimport { reviewOutput, reviewPasses } from \"../shared/review-schema.js\";\nimport { type ReviewStoryImplementationInput, reviewStoryImplementationPrompt } from \"./prompt.js\";\n\nexport const reviewStoryImplementationStep = step({ id: \"review-story-implementation\" })\n .prompt<ReviewStoryImplementationInput, ReviewResult>(reviewStoryImplementationPrompt, {\n agent: \"reviewer\",\n output: reviewOutput,\n })\n .do(async (review, input) => {\n if (!reviewPasses(review)) {\n if (input.attempt >= MAX_STORY_REVIEW_ATTEMPTS) {\n return fail({\n code: \"story_review_exhausted\",\n message: `Story failed review ${MAX_STORY_REVIEW_ATTEMPTS} times in a row (last score ${review.score}/5).`,\n details: { review, storyPath: input.currentStory.path },\n });\n }\n\n return implementStoryStep({\n currentStory: input.currentStory,\n previousStoryReview: review,\n attempt: input.attempt + 1,\n });\n }\n\n return commitReviewedStoryStep({\n currentStory: input.currentStory,\n implementationSummary: input.implementationSummary,\n });\n });\n","import type { Document } from \"@trailstep/authoring\";\nimport { done, fail, state, step } from \"@trailstep/authoring\";\nimport type { ContinuationResult } from \"@trailstep/core\";\nimport { implementStoryStep } from \"../implement-story/step.js\";\nimport { extractStoryTitle, type TakeItAwayOutput } from \"../shared/output-schema.js\";\nimport {\n type ActiveStoryStartCommit,\n recordActiveStoryStartCommit,\n resetActiveStoryStartCommit,\n STORY_STATE_KEYS,\n} from \"../shared/story-state.js\";\nimport { runGit } from \"./run-git.js\";\n\nexport interface CommitReviewedStoryInput extends Record<string, unknown> {\n readonly currentStory: Document;\n readonly implementationSummary?: string;\n}\n\nexport const commitReviewedStoryStep = step({ id: \"commit-reviewed-story\" }).do(\n async (input: CommitReviewedStoryInput): Promise<ContinuationResult> => {\n const activeStory =\n (await state.get<Document | null>(STORY_STATE_KEYS.activeStory)) ?? input.currentStory;\n\n if (storyAutoCommitEnabled()) {\n const commitResult = await commitReviewedStoryChanges(\n activeStory,\n input.implementationSummary,\n );\n if (!commitResult.ok) {\n return fail({\n code: commitResult.code,\n message: commitResult.message,\n details: commitResult.details,\n });\n }\n }\n\n return completeReviewedStory(activeStory);\n },\n);\n\nfunction storyAutoCommitEnabled(): boolean {\n const mode = process.env.TRAILSTEP_STORY_COMMIT_MODE;\n return [\"1\", \"true\", \"enabled\", \"worktree\"].includes(mode?.toLowerCase() ?? \"\");\n}\n\nasync function commitReviewedStoryChanges(\n activeStory: Document,\n implementationSummary: string | undefined,\n): Promise<\n | { readonly ok: true }\n | {\n readonly ok: false;\n readonly code: string;\n readonly message: string;\n readonly details: Record<string, unknown>;\n }\n> {\n const cwd = state.cwd;\n if (!cwd) {\n return {\n ok: false,\n code: \"story_commit_missing_cwd\",\n message: \"Cannot commit reviewed story because the TrailStep workflow cwd is unavailable.\",\n details: { storyPath: activeStory.path },\n };\n }\n\n const insideWorkTree = await runGit([\"rev-parse\", \"--is-inside-work-tree\"], cwd);\n if (!insideWorkTree.ok || insideWorkTree.stdout !== \"true\") {\n return {\n ok: false,\n code: \"story_commit_not_git_worktree\",\n message:\n \"Cannot commit reviewed story because the workflow is not running inside a git worktree.\",\n details: {\n storyPath: activeStory.path,\n gitError: insideWorkTree.ok ? undefined : insideWorkTree.error,\n },\n };\n }\n\n const add = await runGit([\"add\", \"-A\"], cwd);\n if (!add.ok) {\n return {\n ok: false,\n code: \"story_commit_stage_failed\",\n message: \"Cannot commit reviewed story because `git add -A` failed.\",\n details: { storyPath: activeStory.path, gitError: add.error },\n };\n }\n\n const staged = await runGit([\"diff\", \"--cached\", \"--name-only\"], cwd);\n if (!staged.ok) {\n return {\n ok: false,\n code: \"story_commit_status_failed\",\n message: \"Cannot commit reviewed story because staged changes could not be inspected.\",\n details: { storyPath: activeStory.path, gitError: staged.error },\n };\n }\n\n if (staged.stdout.trim().length === 0) {\n const baseline = await state.get<ActiveStoryStartCommit | null>(\n STORY_STATE_KEYS.activeStoryStartCommit,\n );\n const head = await runGit([\"rev-parse\", \"HEAD\"], cwd);\n if (baseline?.commit && head.ok && head.stdout !== baseline.commit) {\n return { ok: true };\n }\n\n return {\n ok: false,\n code: \"story_commit_empty\",\n message:\n \"The story passed review, but there are no staged or already-committed changes since the story baseline to commit.\",\n details: {\n storyPath: activeStory.path,\n storyStartCommit: baseline?.commit,\n head: head.ok ? head.stdout : undefined,\n gitError: head.ok ? undefined : head.error,\n },\n };\n }\n\n const storyTitle = extractStoryTitle(activeStory.content, 1);\n const commit = await runGit(\n [\n \"commit\",\n \"-m\",\n truncateCommitSubject(`trailstep: ${storyTitle}`),\n \"-m\",\n commitBody(activeStory, implementationSummary, staged.stdout),\n ],\n cwd,\n );\n\n if (!commit.ok) {\n return {\n ok: false,\n code: \"story_commit_failed\",\n message: \"The story passed review, but TrailStep could not create the story commit.\",\n details: { storyPath: activeStory.path, gitError: commit.error },\n };\n }\n\n return { ok: true };\n}\n\nasync function completeReviewedStory(activeStory: Document): Promise<ContinuationResult> {\n const completed = (await state.get<string[]>(STORY_STATE_KEYS.completedStories)) ?? [];\n const updatedCompleted = [\n ...completed,\n extractStoryTitle(activeStory.content, completed.length + 1),\n ];\n await state.set(STORY_STATE_KEYS.completedStories, updatedCompleted);\n\n const storyQueue = (await state.get<Document[]>(STORY_STATE_KEYS.storyQueue)) ?? [];\n const [nextStory, ...remaining] = storyQueue;\n\n if (!nextStory) {\n await state.set(STORY_STATE_KEYS.activeStory, null);\n await resetActiveStoryStartCommit();\n const featureDoc = await state.get<Document>(\"featureDoc\");\n const implementationDoc = await state.get<Document>(\"implementationDoc\");\n const output: TakeItAwayOutput = {\n status: \"implemented\",\n featureDocPath: featureDoc?.path ?? \"\",\n implementationDocPath: implementationDoc?.path ?? \"\",\n storyCount: updatedCompleted.length,\n completedStories: updatedCompleted,\n summary: `Implemented and reviewed ${updatedCompleted.length} ${updatedCompleted.length === 1 ? \"story\" : \"stories\"}.`,\n };\n return done(output);\n }\n\n await state.set(STORY_STATE_KEYS.storyQueue, remaining);\n await state.set(STORY_STATE_KEYS.activeStory, nextStory);\n await resetActiveStoryStartCommit();\n await recordActiveStoryStartCommit();\n return implementStoryStep({ currentStory: nextStory, attempt: 1 });\n}\n\nfunction truncateCommitSubject(subject: string): string {\n return subject.length <= 72 ? subject : `${subject.slice(0, 69)}...`;\n}\n\nfunction commitBody(\n activeStory: Document,\n implementationSummary: string | undefined,\n stagedFiles: string,\n): string {\n return [\n \"Committed automatically by TrailStep after a passing story review.\",\n \"\",\n `Story artifact: ${activeStory.path}`,\n \"\",\n \"Implementer summary:\",\n implementationSummary?.trim() || \"Not provided.\",\n \"\",\n \"Staged files:\",\n stagedFiles\n .split(\"\\n\")\n .filter((file) => file.length > 0)\n .map((file) => `- ${file}`)\n .join(\"\\n\"),\n ].join(\"\\n\");\n}\n","import { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nimport { state } from \"@trailstep/authoring\";\n\nconst execFileAsync = promisify(execFile);\n\nexport const STORY_STATE_KEYS = {\n activeStory: \"activeStory\",\n activeStoryStartCommit: \"activeStoryStartCommit\",\n completedStories: \"completedStories\",\n storyQueue: \"storyQueue\",\n} as const;\n\nexport interface ActiveStoryStartCommit {\n readonly commit?: string;\n readonly warning?: string;\n}\n\nexport interface StoryReviewGitContext {\n readonly storyStartCommit?: string;\n readonly statusShort?: string;\n readonly committedDiff?: string;\n readonly uncommittedDiff?: string;\n readonly warnings: readonly string[];\n}\n\nasync function runGit(\n args: readonly string[],\n cwd: string,\n): Promise<\n { readonly ok: true; readonly stdout: string } | { readonly ok: false; readonly error: string }\n> {\n try {\n const { stdout } = await execFileAsync(\"git\", [...args], {\n cwd,\n maxBuffer: 1024 * 1024 * 10,\n });\n return { ok: true, stdout: stdout.trimEnd() };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return { ok: false, error: message };\n }\n}\n\nexport async function recordActiveStoryStartCommit(): Promise<ActiveStoryStartCommit> {\n const existing = await state.get<ActiveStoryStartCommit | null>(\n STORY_STATE_KEYS.activeStoryStartCommit,\n );\n if (existing?.commit || existing?.warning) {\n return existing;\n }\n\n const cwd = state.cwd;\n if (!cwd) {\n const missingCwd = {\n warning:\n \"Workflow cwd is unavailable; the story reviewer cannot verify committed story changes from a durable git baseline.\",\n };\n await state.set(STORY_STATE_KEYS.activeStoryStartCommit, missingCwd);\n return missingCwd;\n }\n\n const result = await runGit([\"rev-parse\", \"HEAD\"], cwd);\n if (!result.ok || result.stdout.length === 0) {\n const missingGitBaseline = {\n warning: `Unable to record story start commit with \\`git rev-parse HEAD\\`: ${result.ok ? \"no commit was returned\" : result.error}`,\n };\n await state.set(STORY_STATE_KEYS.activeStoryStartCommit, missingGitBaseline);\n return missingGitBaseline;\n }\n\n const baseline = { commit: result.stdout };\n await state.set(STORY_STATE_KEYS.activeStoryStartCommit, baseline);\n return baseline;\n}\n\nexport async function resetActiveStoryStartCommit(): Promise<void> {\n await state.set(STORY_STATE_KEYS.activeStoryStartCommit, null);\n}\n\nexport async function loadStoryReviewGitContext(): Promise<StoryReviewGitContext> {\n const baseline = await state.get<ActiveStoryStartCommit | null>(\n STORY_STATE_KEYS.activeStoryStartCommit,\n );\n const warnings: string[] = [];\n\n if (baseline?.warning) {\n warnings.push(baseline.warning);\n }\n\n const cwd = state.cwd;\n if (!cwd) {\n warnings.push(\n \"Workflow cwd is unavailable; reviewer must treat committed story-change context as missing.\",\n );\n return { storyStartCommit: baseline?.commit, warnings };\n }\n\n const status = await runGit([\"status\", \"--short\"], cwd);\n if (!status.ok) {\n warnings.push(`Unable to inspect \\`git status --short\\`: ${status.error}`);\n }\n\n const uncommittedDiff = await runGit([\"diff\"], cwd);\n if (!uncommittedDiff.ok) {\n warnings.push(\n `Unable to inspect uncommitted changes with \\`git diff\\`: ${uncommittedDiff.error}`,\n );\n }\n\n const storyStartCommit = baseline?.commit;\n let committedDiff: string | undefined;\n if (!storyStartCommit) {\n warnings.push(\n \"No durable story start commit is recorded; reviewer must not silently review only the current working tree diff.\",\n );\n } else {\n const baselineReachable = await runGit([\"cat-file\", \"-e\", `${storyStartCommit}^{commit}`], cwd);\n if (!baselineReachable.ok) {\n warnings.push(\n `Recorded story start commit \\`${storyStartCommit}\\` is invalid or unreachable: ${baselineReachable.error}`,\n );\n } else {\n const committed = await runGit([\"diff\", `${storyStartCommit}..HEAD`], cwd);\n if (!committed.ok) {\n warnings.push(\n `Unable to inspect committed story changes with \\`git diff ${storyStartCommit}..HEAD\\`: ${committed.error}`,\n );\n } else {\n committedDiff = committed.stdout;\n }\n }\n }\n\n return {\n storyStartCommit,\n statusShort: status.ok ? status.stdout : undefined,\n committedDiff,\n uncommittedDiff: uncommittedDiff.ok ? uncommittedDiff.stdout : undefined,\n warnings,\n };\n}\n","import { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nconst execFileAsync = promisify(execFile);\n\nexport type GitResult =\n | { readonly ok: true; readonly stdout: string }\n | { readonly ok: false; readonly error: string };\n\nexport async function runGit(args: readonly string[], cwd: string): Promise<GitResult> {\n try {\n const { stdout } = await execFileAsync(\"git\", [...args], {\n cwd,\n maxBuffer: 1024 * 1024 * 10,\n });\n return { ok: true, stdout: stdout.trimEnd() };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return { ok: false, error: message };\n }\n}\n","import type { Document } from \"@trailstep/authoring\";\nimport { promptSections, section } from \"@trailstep/authoring\";\nimport methodologyFragment from \"../shared/feature-methodology.md?raw\";\nimport storyImplementationContractFragment from \"../shared/story-implementation-contract.md?raw\";\nimport type { StoryReviewGitContext } from \"../shared/story-state.js\";\n\nconst fragments = {\n methodology: methodologyFragment.trimEnd(),\n storyContract: storyImplementationContractFragment.trimEnd(),\n};\n\nexport interface ReviewStoryImplementationInput extends Record<string, unknown> {\n readonly currentStory: Document;\n readonly attempt: number;\n readonly implementationSummary?: string;\n readonly gitContext: StoryReviewGitContext;\n}\n\nexport function reviewStoryImplementationPrompt({\n input,\n}: {\n readonly input: ReviewStoryImplementationInput;\n}): string {\n const committedDiffCommand = input.gitContext.storyStartCommit\n ? `git diff ${input.gitContext.storyStartCommit}..HEAD`\n : \"git diff <missing-story-start-commit>..HEAD\";\n\n return promptSections(\n fragments.methodology,\n fragments.storyContract,\n section(\"Story\", input.currentStory.content),\n section(\"Implementer summary\", input.implementationSummary ?? \"Not provided.\"),\n section(\n \"Story review git baseline\",\n [\n `Recorded story start commit: ${input.gitContext.storyStartCommit ?? \"MISSING\"}`,\n `Inspect committed story changes with: \\`${committedDiffCommand}\\``,\n \"Inspect uncommitted working tree changes with: `git diff`\",\n \"Inspect status with: `git status --short`\",\n input.gitContext.warnings.length > 0\n ? [\n \"\",\n \"Warnings / blocked context:\",\n ...input.gitContext.warnings.map((warning) => `- ${warning}`),\n ].join(\"\\n\")\n : \"\",\n ]\n .filter((line) => line.length > 0)\n .join(\"\\n\"),\n ),\n section(\n \"Committed story changes (`git diff <storyStartCommit>..HEAD`)\",\n input.gitContext.committedDiff ?? \"Not available.\",\n ),\n section(\n \"Uncommitted working tree changes (`git diff`)\",\n input.gitContext.uncommittedDiff ?? \"Not available.\",\n ),\n section(\n \"Working tree status (`git status --short`)\",\n input.gitContext.statusShort ?? \"Not available.\",\n ),\n section(\n \"Task\",\n \"Review only the active story slice represented by the recorded story start commit through HEAD, plus the current uncommitted working tree changes, against the story above and the implementer summary. Prefer the supplied diff/status sections; if you need to inspect locally, use read-only commands only (`git status --short`, the listed `git diff <storyStartCommit>..HEAD`, and `git diff`) — do not run tests, edit code, revert files, clean files, or try to isolate the diff by changing the repository. If unrelated dirty files, a missing/invalid baseline, or ambiguous context prevents a trustworthy review, say so in the structured review and require the implementer/workflow to fix the isolation; never remove changes yourself. Respond only with the structured review.\",\n ),\n );\n}\n","# Feature workflow methodology\n\n## Planning principles\n\n- Start from observable behavior and user value.\n- Preserve uncertainty explicitly; do not invent missing product decisions.\n- Prefer the smallest vertical slice that proves a complete path through the system.\n- Use tracer bullets to de-risk integration seams early with thin end-to-end behavior.\n- Every implementation story must begin with a behavioral red test that fails for the right reason.\n- The green phase should add only enough production code to pass the focused red test.\n- Refactor only after focused tests pass, and keep refactors scoped to the feature.\n- Dependencies are hard dependencies only: story B depends on story A when B cannot pass its own tests until A is complete.\n\n## Review scoring\n\nScore on a 1-5 integer scale:\n\n- 5: excellent; strongly aligned with TDD, vertical slicing, tracer-bullet risk reduction, dependency clarity, and local architecture.\n- 4: good; acceptable with only minor non-blocking improvements.\n- 3: incomplete; useful but needs material changes before continuing.\n- 2: poor; misses core methodology or important requirements.\n- 1: unusable; unsafe, incoherent, or not traceable to the feature.\n\nScores of 4 or 5 pass. Scores below 4 must list specific `requiredImprovements` so the next attempt can address them directly.\n","# Story implementation contract\n\nThe story loop works one story at a time. Each story is self-contained. You will not see non-context overview text or other stories; you will see only the active story plus any shared `<context>` content prepended by the split-stories step.\n\n## Protect pre-existing uncommitted work\n\nRun `git status --short` before making any change.\n\n- The preferred execution mode is a TrailStep-created isolated worktree/branch. In that mode, a successful review is followed by an automatic story commit, so the next story starts from a clean diff boundary.\n- Treat every pre-existing uncommitted file as protected — it may be unfinished human work, another run's in-progress work, or a sign that isolation failed.\n- Do not run destructive cleanup: no `git reset`, `git checkout --`, broad `git clean`, or equivalent revert/format-away operations.\n- Do not delete or rewrite unrelated chunks in a file that already has changes.\n- If this story requires editing a file that is already dirty, preserve the existing changes and make only the minimal additional change the story requires.\n- If dirty work makes the story ambiguous or blocked, stop and report a blocked state instead of removing it.\n- Do not create git commits yourself unless the story explicitly requires it. TrailStep creates the reviewed story commit after the reviewer passes the story when auto-commit mode is enabled.\n\n## Implementer responsibilities\n\n- Implement only the current story and required dependency-compatible adjustments. Do not start later stories.\n- Use strict behavioral-red TDD: write or update a focused failing behavioral test first, confirm it fails for the intended reason when feasible, implement the smallest change to pass it, then refactor only after it's green.\n- Run the story's validation commands before reporting completion when feasible.\n- Do not report success until implementation and focused validation are done, or until a true blocked state is reached — report the blocker clearly instead of pretending the story is complete.\n\n## Reviewer responsibilities\n\n- Review only the active story diff from the recorded story baseline through HEAD plus the current uncommitted diff. Do not try to review every dirty change in the checkout as global context.\n- Inspect with read-only commands only (`git status --short`, the exact `git diff <storyStartCommit>..HEAD` command supplied in your prompt, and `git diff`). Do not run tests or other commands — the implementer is responsible for passing focused validation; this is an AI-only review.\n- Never edit code, delete files, revert files, run cleanup, stage files, commit files, or otherwise modify the working tree to isolate your review.\n- If unrelated dirty files, missing baseline information, or overlapping changes make the active story diff unreviewable, return a failing structured review that explains the isolation problem instead of changing the repository.\n- Review against: the story's acceptance criteria, TDD evidence and test quality, vertical-slice completeness, tracer-bullet alignment where applicable, minimal scope with no gold-plating, and integration with existing architecture/project conventions.\n\n## Completion\n\nA story is complete when code is changed as needed, behavioral tests exist, focused validation passes according to the implementer, and the implementation is well integrated with the existing architecture.\n","import { type Document, jsonSchema, list, promptSections, section } from \"@trailstep/authoring\";\nimport methodologyFragment from \"../shared/feature-methodology.md?raw\";\nimport projectArchitectureGuidanceFragment from \"../shared/project-architecture-guidance.md?raw\";\nimport type { ReviewResult } from \"../shared/review-schema.js\";\nimport storyImplementationContractFragment from \"../shared/story-implementation-contract.md?raw\";\n\nconst fragments = {\n methodology: methodologyFragment.trimEnd(),\n architectureGuidance: projectArchitectureGuidanceFragment.trimEnd(),\n storyContract: storyImplementationContractFragment.trimEnd(),\n};\n\nexport interface ImplementStoryInput extends Record<string, unknown> {\n readonly currentStory: Document;\n readonly attempt: number;\n readonly previousStoryReview?: ReviewResult;\n}\n\nexport interface ImplementStoryOutput extends Record<string, unknown> {\n readonly blocked: boolean;\n readonly blockedReason?: string;\n readonly summary: string;\n}\n\nexport const implementStoryOutput = jsonSchema<ImplementStoryOutput>({\n type: \"object\",\n properties: {\n blocked: { type: \"boolean\" },\n blockedReason: { type: \"string\" },\n summary: {\n type: \"string\",\n description: \"Files changed, commands run, and their results.\",\n },\n },\n required: [\"blocked\", \"summary\"],\n additionalProperties: false,\n});\n\nexport function implementStoryPrompt({ input }: { readonly input: ImplementStoryInput }): string {\n const taskBody =\n input.previousStoryReview === undefined\n ? \"Implement this story.\"\n : promptSections(\n `This is retry attempt ${input.attempt} for this story. A previous review scored the implementation ${input.previousStoryReview.score}/5: ${input.previousStoryReview.summary}`,\n `Required improvements to address, without discarding what already works:\\n\\n${list(input.previousStoryReview.requiredImprovements)}`,\n );\n\n return promptSections(\n fragments.methodology,\n fragments.architectureGuidance,\n fragments.storyContract,\n section(\"Story\", input.currentStory.content),\n section(\n \"Task\",\n `${taskBody}\\n\\nSet \\`blocked: true\\` with a clear \\`blockedReason\\` instead of guessing or pretending the story is complete. Otherwise set \\`blocked: false\\` and use \\`summary\\` to report files changed, commands run, and their results.`,\n ),\n );\n}\n","# Architecture awareness\n\nBefore naming files, choosing package/module boundaries, picking integration seams, or ordering stories/dependencies, ground the decision in the target project's own conventions rather than inventing structure:\n\n- Look for and read the project's own architecture/convention docs at its root and nearby — `CLAUDE.md`, `AGENTS.md`, `.pi/rules/`, ADRs, architecture docs, or an equivalent README section.\n- Prefer existing module/package boundaries, naming conventions, and file layout patterns already established in the project over introducing new ones.\n- When the project's own guidance is silent or ambiguous on a non-trivial integration choice, say so explicitly as an assumption rather than silently picking one convention over another.\n","import type { Document } from \"@trailstep/authoring\";\nimport { list, promptSections, section } from \"@trailstep/authoring\";\nimport methodologyFragment from \"../shared/feature-methodology.md?raw\";\nimport implementationDocFormatFragment from \"../shared/implementation-doc-format.md?raw\";\n\nconst fragments = {\n methodology: methodologyFragment.trimEnd(),\n implementationDocFormat: implementationDocFormatFragment.trimEnd(),\n};\n\nexport interface ReviewImplementationDocInput extends Record<string, unknown> {\n readonly featureDoc: Document;\n readonly implementationDoc: Document;\n readonly attempt: number;\n}\n\nexport function reviewImplementationDocPrompt({\n input,\n}: {\n readonly input: ReviewImplementationDocInput;\n}): string {\n const reviewCriteria = list([\n \"traceability to the feature doc\",\n \"strict behavioral-red TDD story design\",\n \"vertical slices rather than horizontal tasks\",\n \"a clear tracer-bullet strategy\",\n \"hard dependency labels and topological ordering\",\n \"acceptance criteria and validation commands\",\n \"story instructions self-contained enough for an implementer who will only see one story plus the prepended shared context at a time\",\n \"correct use of balanced `<context>` ... `</context>` blocks for shared implementer context\",\n \"correct use of the `<!-- trailstep-story-boundary -->` marker between stories, and that no story-critical detail lives only in non-context overview text above the first marker\",\n ]);\n\n return promptSections(\n fragments.methodology,\n fragments.implementationDocFormat,\n section(\"Feature doc\", input.featureDoc.content),\n section(\"Implementation doc under review\", input.implementationDoc.content),\n section(\n \"Task\",\n `Critically review the implementation doc above against the feature doc and the methodology. Review for:\\n\\n${reviewCriteria}\\n\\nDo not edit the implementation doc. Respond only with the structured review.`,\n ),\n );\n}\n","# Implementation doc format\n\n`implementation-doc.md` converts `feature-doc.md` into implementation-ready stories.\n\nUse this structure:\n\n```markdown\n# Implementation Plan: <Feature Name>\n\n## Overview for planner/reviewer\n\nOptional high-level planning notes that do not need to be seen by story implementers.\n\n<context>\n\n## Shared Implementation Context\n\nPut every cross-story detail that an implementer may need here: outcome and constraints, architecture/integration notes, tracer-bullet strategy, repository conventions, shared validation commands, edge cases, assumptions, and hard dependency graph notes.\n\nAnything inside this balanced `<context>` block is prepended programmatically to every story by the split-stories step.\n\n</context>\n\n<!-- trailstep-story-boundary -->\n\n### Story 001: <title>\n\nDependencies: none\n\n#### Goal\n\n#### User-Visible / Integration-Visible Slice\n\n#### Acceptance Criteria\n\n#### Red Phase\n\n- Test file:\n- Test case:\n- Expected failing assertion:\n\n#### Green Phase\n\n#### Refactor Phase\n\n#### Validation Commands\n\n#### Notes for Implementer\n\n<!-- trailstep-story-boundary -->\n\n### Story 002: <title>\n\nDependencies: Story 001\n\n...\n```\n\nRules:\n\n- Text above the first `<!-- trailstep-story-boundary -->` is never read by an implementer unless it is inside a balanced `<context>` ... `</context>` block. The split-stories step prepends all context blocks to every story.\n- If a detail applies to most/all stories, put it in `<context>`; if it applies only to selected stories, repeat it inside those stories. No story-critical detail may live only in non-context overview text.\n- Every `<context>` marker must have a matching `</context>` marker, and context blocks should be outside story bodies unless there is a deliberate reason to prepend that block to every story.\n- Every story must start right after a `<!-- trailstep-story-boundary -->` line, on its own line, with nothing else on that line. Splitting is mechanical and depends on this exact marker — do not use markdown headings alone to separate stories, and do not add or omit a boundary marker except between/before stories.\n- Stories must be topologically ordered.\n- Every story must be implementation-ready and self-contained, written as instructions to an implementer who will not see this file, only their own story's content.\n- Avoid horizontal stories unless they are embedded in an observable vertical slice.\n- Name concrete files/tests/commands when they can be inferred from the repository.\n- Preserve uncertainty as assumptions or blocked states instead of guessing.\n","import type { Document } from \"@trailstep/authoring\";\nimport { list, promptSections, section } from \"@trailstep/authoring\";\nimport methodologyFragment from \"../shared/feature-methodology.md?raw\";\nimport implementationDocFormatFragment from \"../shared/implementation-doc-format.md?raw\";\nimport projectArchitectureGuidanceFragment from \"../shared/project-architecture-guidance.md?raw\";\nimport type { ReviewResult } from \"../shared/review-schema.js\";\n\nconst fragments = {\n methodology: methodologyFragment.trimEnd(),\n architectureGuidance: projectArchitectureGuidanceFragment.trimEnd(),\n implementationDocFormat: implementationDocFormatFragment.trimEnd(),\n};\n\nexport interface CreateOrImproveImplementationDocInput extends Record<string, unknown> {\n readonly featureDoc: Document;\n readonly previousReview?: ReviewResult;\n readonly attempt: number;\n}\n\nexport function createOrImproveImplementationDocPrompt({\n input,\n}: {\n readonly input: CreateOrImproveImplementationDocInput;\n}): string {\n const taskBody =\n input.previousReview === undefined\n ? \"Create `implementation-doc.md` from the feature doc above, following the format exactly enough that stories can later be split mechanically on the `<!-- trailstep-story-boundary -->` marker and shared context can be prepended from balanced `<context>` blocks.\"\n : promptSections(\n `This is improvement attempt ${input.attempt}. A previous review scored this plan ${input.previousReview.score}/5: ${input.previousReview.summary}`,\n `Required improvements to address, without discarding what already works:\\n\\n${list(input.previousReview.requiredImprovements)}`,\n );\n\n return promptSections(\n fragments.methodology,\n fragments.architectureGuidance,\n fragments.implementationDocFormat,\n section(\"Feature doc\", input.featureDoc.content),\n section(\n \"Task\",\n `${taskBody}\\n\\nDesign stories around strict behavioral-red TDD, vertical slicing, tracer-bullet methodology, and hard dependency labels only. Topologically order stories by dependency. Put shared implementation details in balanced \\`<context>\\` ... \\`</context>\\` blocks so split-stories prepends them to every story; repeat details inside individual stories when only selected stories need them. Write every story as implementation-ready instructions for an implementer who will only see that story plus the prepended context.`,\n ),\n );\n}\n","import { promptSections, section } from \"@trailstep/authoring\";\nimport featureDocFormatFragment from \"../shared/feature-doc-format.md?raw\";\nimport methodologyFragment from \"../shared/feature-methodology.md?raw\";\nimport type { TakeItAwayInput } from \"../shared/input-schema.js\";\n\nconst fragments = {\n methodology: methodologyFragment.trimEnd(),\n featureDocFormat: featureDocFormatFragment.trimEnd(),\n};\n\nexport function createFeatureDocPrompt({ input }: { readonly input: TakeItAwayInput }): string {\n return promptSections(\n fragments.methodology,\n fragments.featureDocFormat,\n section(\"Conversation / feature request\", input.conversation),\n section(\n \"Task\",\n 'Write `feature-doc.md` following the format above, based on the conversation/request. Make it detailed enough that another agent can plan implementation without reading the original conversation. Preserve uncertainty explicitly in \"Open Questions and Assumptions\" — do not invent missing product decisions.',\n ),\n );\n}\n","# Feature doc format\n\n`feature-doc.md` is an intermediate product-quality feature description used as input to implementation planning.\n\nUse this structure:\n\n```markdown\n# <Feature Name>\n\n## Outcome\n\n## Users / Jobs / Pain\n\n## Proposed Behavior\n\n## Non-Goals\n\n## Examples and Acceptance Criteria\n\n## Edge Cases and Failure Modes\n\n## Affected Areas and Integration Points\n\n## Testing Expectations\n\n## Documentation / Migration / Rollout Notes\n\n## Open Questions and Assumptions\n```\n\nThe document should be detailed enough that another agent can plan implementation without reading the original conversation, while still preserving important uncertainty.\n","import { shape } from \"@trailstep/authoring\";\n\nexport interface TakeItAwayInput extends Record<string, unknown> {\n readonly conversation: string;\n}\n\nexport const takeItAwayInput = shape<TakeItAwayInput>({ conversation: \"string\" });\n","import { promptSections, section } from \"@trailstep/authoring\";\n\nexport function grillPrompt(): string {\n return promptSections(\n section(\n \"Role\",\n \"You are the interactive front door for starting a new TrailStep feature. Open by asking the user what they want to build.\",\n ),\n section(\n \"Task\",\n \"Keep asking follow-up questions until you are confident you understand the feature request well enough to hand off to a planning agent. There is no fixed checklist of required topics — use your judgment, and do not end the conversation prematurely just to finish quickly.\",\n ),\n section(\n \"Output\",\n \"Your structured output's `conversation` field must contain the full raw transcript of the conversation so far, not a summary. Preserve as much of the actual back-and-forth as possible.\",\n ),\n );\n}\n","import { defineWorkflow } from \"@trailstep/authoring\";\nimport { createFeatureDocStep } from \"../feature-implementation/create-feature-doc/step.js\";\nimport { takeItAwayInput } from \"../feature-implementation/shared/input-schema.js\";\nimport { takeItAwayOutput } from \"../feature-implementation/shared/output-schema.js\";\n\nexport type { TakeItAwayInput } from \"../feature-implementation/shared/input-schema.js\";\n\nexport const takeItAway = defineWorkflow({\n id: \"take-it-away\",\n description:\n \"Turns an already-organic conversation/feature request into a reviewed implementation plan, then implements it story by story.\",\n inputShape: takeItAwayInput,\n outputShape: takeItAwayOutput,\n agents: {\n featureWriter: {\n size: \"medium\",\n thinking: \"medium\",\n description: \"Turns a conversation/feature request into a standalone feature doc.\",\n },\n planner: {\n size: \"large\",\n thinking: \"high\",\n description:\n \"Creates or improves the implementation doc: architecture-aware, TDD/vertical-slice/tracer-bullet story design.\",\n },\n reviewer: {\n size: \"large\",\n thinking: \"high\",\n description: \"Reviews isolated implementation docs and story diffs against methodology.\",\n },\n implementer: {\n size: \"medium\",\n thinking: \"medium\",\n description: \"Implements one story at a time using strict behavioral-red TDD.\",\n },\n },\n start(input) {\n return createFeatureDocStep(input);\n },\n});\n"],"mappings":";AAAA,SAAS,gBAAgB,SAAAA,cAAa;;;ACAtC,SAAS,kBAAkB;AAWpB,IAAM,mBAAmB,WAA6B;AAAA,EAC3D,MAAM;AAAA,EACN,YAAY;AAAA,IACV,QAAQ,EAAE,MAAM,UAAU,OAAO,cAAc;AAAA,IAC/C,gBAAgB,EAAE,MAAM,SAAS;AAAA,IACjC,uBAAuB,EAAE,MAAM,SAAS;AAAA,IACxC,YAAY,EAAE,MAAM,SAAS;AAAA,IAC7B,kBAAkB,EAAE,MAAM,SAAS,OAAO,EAAE,MAAM,SAAS,EAAE;AAAA,IAC7D,SAAS,EAAE,MAAM,SAAS;AAAA,EAC5B;AAAA,EACA,UAAU;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,sBAAsB;AACxB,CAAC;AAEM,SAAS,kBAAkB,cAAsB,eAA+B;AACrF,QAAM,UAAU,mBAAmB,KAAK,YAAY;AACpD,SAAO,UAAU,CAAC,GAAG,KAAK,KAAK,SAAS,aAAa;AACvD;;;ACnCA,SAAS,QAAAC,aAAY;;;ACArB,SAAS,YAAAC,WAAU,SAAAC,QAAO,QAAAC,aAAY;;;ACAtC,SAAS,UAAU,SAAAC,QAAO,QAAAC,aAAY;;;ACAtC,SAAS,QAAAC,OAAM,QAAAC,aAAY;;;ACApB,IAAM,iBAAiB;AAEvB,IAAM,sBAAsB;AAE5B,IAAM,oB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MACN,UAAU;AAAA,MACV,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,QAAQ;AACN,WAAO,UAAU;AAAA,EACnB;AACF,CAAC;;;A0BxCD,SAAS,kBAAAC,uBAAsB;AAOxB,IAAM,aAAaC,gBAAe;AAAA,EACvC,IAAI;AAAA,EACJ,aACE;AAAA,EACF,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,QAAQ;AAAA,IACN,eAAe;AAAA,MACb,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aAAa;AAAA,IACf;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aACE;AAAA,IACJ;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aAAa;AAAA,IACf;AAAA,IACA,aAAa;AAAA,MACX,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,MAAM,OAAO;AACX,WAAO,qBAAqB,KAAK;AAAA,EACnC;AACF,CAAC;","names":["shape","step","Document","state","step","state","step","fail","step","jsonSchema","jsonSchema","fail","state","step","fail","step","fail","step","state","execFile","promisify","execFileAsync","runGit","state","runGit","step","fail","jsonSchema","promptSections","section","fragments","jsonSchema","promptSections","section","step","fail","step","fail","state","list","promptSections","section","fragments","list","promptSections","section","step","fail","list","promptSections","section","fragments","promptSections","list","section","step","state","promptSections","section","fragments","promptSections","section","step","Document","state","promptSections","section","step","shape","defineWorkflow","defineWorkflow"]}
1
+ {"version":3,"sources":["../src/grill-it-away/workflow.ts","../src/feature-implementation/shared/output-schema.ts","../src/grill-it-away/grill/step.ts","../src/feature-implementation/create-feature-doc/step.ts","../src/feature-implementation/create-or-improve-implementation-doc/step.ts","../src/feature-implementation/review-implementation-doc/step.ts","../src/feature-implementation/shared/constants.ts","../src/feature-implementation/shared/review-schema.ts","../src/feature-implementation/split-implementation-stories/step.ts","../src/feature-implementation/implement-story/step.ts","../src/feature-implementation/review-story-implementation/step.ts","../src/feature-implementation/commit-reviewed-story/step.ts","../src/feature-implementation/shared/story-state.ts","../src/feature-implementation/commit-reviewed-story/run-git.ts","../src/feature-implementation/review-story-implementation/prompt.ts","../src/feature-implementation/shared/feature-methodology.md","../src/feature-implementation/shared/story-implementation-contract.md","../src/feature-implementation/implement-story/prompt.ts","../src/feature-implementation/shared/project-architecture-guidance.md","../src/feature-implementation/review-implementation-doc/prompt.ts","../src/feature-implementation/shared/implementation-doc-format.md","../src/feature-implementation/create-or-improve-implementation-doc/prompt.ts","../src/feature-implementation/create-feature-doc/prompt.ts","../src/feature-implementation/shared/feature-doc-format.md","../src/feature-implementation/shared/input-schema.ts","../src/grill-it-away/grill/prompt.ts","../src/take-it-away/workflow.ts"],"sourcesContent":["import { defineWorkflow, shape } from \"@trailstep/authoring\";\nimport { takeItAwayOutput } from \"../feature-implementation/shared/output-schema.js\";\nimport { grillStep } from \"./grill/step.js\";\n\nexport const grillItAway = defineWorkflow({\n id: \"grill-it-away\",\n description: \"Interactively grills the user until it understands the requested feature.\",\n inputShape: shape<Record<string, never>>({}),\n outputShape: takeItAwayOutput,\n agents: {\n grillingAgent: {\n size: \"medium\",\n thinking: \"medium\",\n description: \"Grills the user until it understands the requested feature.\",\n },\n featureWriter: {\n size: \"medium\",\n thinking: \"medium\",\n description: \"Turns a conversation/feature request into a standalone feature doc.\",\n },\n planner: {\n size: \"large\",\n thinking: \"high\",\n description:\n \"Creates or improves the implementation doc: architecture-aware, TDD/vertical-slice/tracer-bullet story design.\",\n },\n reviewer: {\n size: \"large\",\n thinking: \"high\",\n description: \"Reviews isolated implementation docs and story diffs against methodology.\",\n },\n implementer: {\n size: \"medium\",\n thinking: \"medium\",\n description: \"Implements one story at a time using strict behavioral-red TDD.\",\n },\n },\n start() {\n return grillStep();\n },\n});\n","import { jsonSchema } from \"@trailstep/authoring\";\n\nexport interface TakeItAwayOutput extends Record<string, unknown> {\n readonly status: \"implemented\";\n readonly featureDocPath: string;\n readonly implementationDocPath: string;\n readonly storyCount: number;\n readonly completedStories: readonly string[];\n readonly summary: string;\n}\n\nexport const takeItAwayOutput = jsonSchema<TakeItAwayOutput>({\n type: \"object\",\n properties: {\n status: { type: \"string\", const: \"implemented\" },\n featureDocPath: { type: \"string\" },\n implementationDocPath: { type: \"string\" },\n storyCount: { type: \"number\" },\n completedStories: { type: \"array\", items: { type: \"string\" } },\n summary: { type: \"string\" },\n },\n required: [\n \"status\",\n \"featureDocPath\",\n \"implementationDocPath\",\n \"storyCount\",\n \"completedStories\",\n \"summary\",\n ],\n additionalProperties: false,\n});\n\nexport function extractStoryTitle(storyContent: string, fallbackIndex: number): string {\n const heading = /^#{1,6}\\s+(.+)$/m.exec(storyContent);\n return heading?.[1]?.trim() || `Story ${fallbackIndex}`;\n}\n","import { step } from \"@trailstep/authoring\";\nimport { createFeatureDocStep } from \"../../feature-implementation/create-feature-doc/step.js\";\nimport { takeItAwayInput } from \"../../feature-implementation/shared/input-schema.js\";\nimport { grillPrompt } from \"./prompt.js\";\n\nexport const grillStep = step({ id: \"grill\" })\n .prompt(grillPrompt, {\n agent: \"grillingAgent\",\n mode: \"interactive\",\n output: takeItAwayInput,\n })\n .do((output) => createFeatureDocStep(output));\n","import { Document, state, step } from \"@trailstep/authoring\";\nimport { createOrImproveImplementationDocStep } from \"../create-or-improve-implementation-doc/step.js\";\nimport { createFeatureDocPrompt } from \"./prompt.js\";\n\nexport const createFeatureDocStep = step({ id: \"create-feature-doc\" })\n .prompt(createFeatureDocPrompt, {\n agent: \"featureWriter\",\n output: Document,\n })\n .do(async (featureDoc) => {\n await state.set(\"featureDoc\", featureDoc);\n return createOrImproveImplementationDocStep({ featureDoc, attempt: 1 });\n });\n","import { Document, state, step } from \"@trailstep/authoring\";\nimport { reviewImplementationDocStep } from \"../review-implementation-doc/step.js\";\nimport { createOrImproveImplementationDocPrompt } from \"./prompt.js\";\n\nexport const createOrImproveImplementationDocStep = step({\n id: \"create-or-improve-implementation-doc\",\n})\n .prompt(createOrImproveImplementationDocPrompt, {\n agent: \"planner\",\n output: Document,\n })\n .do(async (implementationDoc, input) => {\n await state.set(\"implementationDoc\", implementationDoc);\n return reviewImplementationDocStep({\n featureDoc: input.featureDoc,\n implementationDoc,\n attempt: input.attempt,\n });\n });\n","import { fail, step } from \"@trailstep/authoring\";\nimport { createOrImproveImplementationDocStep } from \"../create-or-improve-implementation-doc/step.js\";\nimport { MAX_IMPLEMENTATION_DOC_REVIEW_ATTEMPTS } from \"../shared/constants.js\";\nimport type { ReviewResult } from \"../shared/review-schema.js\";\nimport { reviewOutput, reviewPasses } from \"../shared/review-schema.js\";\nimport { splitImplementationStoriesStep } from \"../split-implementation-stories/step.js\";\nimport { type ReviewImplementationDocInput, reviewImplementationDocPrompt } from \"./prompt.js\";\n\nexport const reviewImplementationDocStep = step({ id: \"review-implementation-doc\" })\n .prompt<ReviewImplementationDocInput, ReviewResult>(reviewImplementationDocPrompt, {\n agent: \"reviewer\",\n output: reviewOutput,\n })\n .do((review, input) => {\n if (reviewPasses(review)) {\n return splitImplementationStoriesStep({ implementationDoc: input.implementationDoc });\n }\n\n if (input.attempt >= MAX_IMPLEMENTATION_DOC_REVIEW_ATTEMPTS) {\n return fail({\n code: \"implementation_doc_review_exhausted\",\n message: `implementation-doc.md failed review ${MAX_IMPLEMENTATION_DOC_REVIEW_ATTEMPTS} times in a row (last score ${review.score}/5).`,\n details: { review, implementationDocPath: input.implementationDoc.path },\n });\n }\n\n return createOrImproveImplementationDocStep({\n featureDoc: input.featureDoc,\n previousReview: review,\n attempt: input.attempt + 1,\n });\n });\n","export const STORY_BOUNDARY = \"<!-- trailstep-story-boundary -->\";\n\nexport const STORY_CONTEXT_START = \"<context>\";\n\nexport const STORY_CONTEXT_END = \"</context>\";\n\nexport const REVIEW_PASS_THRESHOLD = 4;\n\nexport const MAX_IMPLEMENTATION_DOC_REVIEW_ATTEMPTS = 5;\n\nexport const MAX_STORY_REVIEW_ATTEMPTS = 3;\n","import { jsonSchema } from \"@trailstep/authoring\";\n\nimport { REVIEW_PASS_THRESHOLD } from \"./constants.js\";\n\nexport interface MethodologyRatings extends Record<string, unknown> {\n readonly tdd: number;\n readonly verticalSlicing: number;\n readonly tracerBullet: number;\n readonly dependencies: number;\n readonly architecture: number;\n}\n\nexport interface ReviewResult extends Record<string, unknown> {\n readonly score: number;\n readonly summary: string;\n readonly methodologyRatings: MethodologyRatings;\n readonly requiredImprovements: readonly string[];\n}\n\nconst RATING_SCHEMA = { type: \"integer\", minimum: 1, maximum: 5 } as const;\n\nexport const reviewOutput = jsonSchema<ReviewResult>({\n type: \"object\",\n properties: {\n score: RATING_SCHEMA,\n summary: { type: \"string\" },\n methodologyRatings: {\n type: \"object\",\n properties: {\n tdd: RATING_SCHEMA,\n verticalSlicing: RATING_SCHEMA,\n tracerBullet: RATING_SCHEMA,\n dependencies: RATING_SCHEMA,\n architecture: RATING_SCHEMA,\n },\n required: [\"tdd\", \"verticalSlicing\", \"tracerBullet\", \"dependencies\", \"architecture\"],\n additionalProperties: false,\n },\n requiredImprovements: { type: \"array\", items: { type: \"string\" } },\n },\n required: [\"score\", \"summary\", \"methodologyRatings\", \"requiredImprovements\"],\n additionalProperties: false,\n});\n\nexport function reviewPasses(review: ReviewResult): boolean {\n return review.score >= REVIEW_PASS_THRESHOLD;\n}\n","import { type Document, document, fail, state, step } from \"@trailstep/authoring\";\nimport type { ContinuationResult } from \"@trailstep/core\";\nimport { implementStoryStep } from \"../implement-story/step.js\";\nimport { STORY_BOUNDARY, STORY_CONTEXT_END, STORY_CONTEXT_START } from \"../shared/constants.js\";\nimport { recordActiveStoryStartCommit, STORY_STATE_KEYS } from \"../shared/story-state.js\";\n\nexport interface SplitImplementationStoriesInput extends Record<string, unknown> {\n readonly implementationDoc: Document;\n}\n\nexport const splitImplementationStoriesStep = step({ id: \"split-implementation-stories\" }).do(\n async ({ implementationDoc }: SplitImplementationStoriesInput): Promise<ContinuationResult> => {\n const contextStartCount = countOccurrences(implementationDoc.content, STORY_CONTEXT_START);\n const contextEndCount = countOccurrences(implementationDoc.content, STORY_CONTEXT_END);\n\n if (contextStartCount !== contextEndCount) {\n return fail({\n code: \"unbalanced_story_context\",\n message: `Found ${contextStartCount} \\`${STORY_CONTEXT_START}\\` marker(s) and ${contextEndCount} \\`${STORY_CONTEXT_END}\\` marker(s) in implementation-doc.md. Context blocks must be balanced.`,\n details: { implementationDocPath: implementationDoc.path },\n });\n }\n\n const contextMatches = Array.from(implementationDoc.content.matchAll(storyContextPattern()));\n if (contextMatches.length !== contextStartCount) {\n return fail({\n code: \"invalid_story_context_order\",\n message: `Every \\`${STORY_CONTEXT_START}\\` marker in implementation-doc.md must be followed by a matching \\`${STORY_CONTEXT_END}\\` marker.`,\n details: { implementationDocPath: implementationDoc.path },\n });\n }\n\n const contextBlocks = contextMatches\n .map(([, context]) => context?.trim() ?? \"\")\n .filter((context) => context.length > 0);\n const sharedContext = contextBlocks.join(\"\\n\\n---\\n\\n\");\n const contentWithoutContextBlocks = implementationDoc.content.replace(\n storyContextPattern(),\n \"\",\n );\n\n const chunks = contentWithoutContextBlocks\n .split(STORY_BOUNDARY)\n .slice(1) // drop overview-only text before the first boundary; <context> blocks are prepended below\n .map((chunk) => chunk.trim())\n .filter((chunk) => chunk.length > 0)\n .map((chunk) => prependSharedContext(chunk, sharedContext));\n\n if (chunks.length === 0) {\n return fail({\n code: \"no_stories_found\",\n message: `No \\`${STORY_BOUNDARY}\\`-delimited stories found in implementation-doc.md.`,\n details: { implementationDocPath: implementationDoc.path },\n });\n }\n\n const storyDocs: Document[] = [];\n for (const chunk of chunks) {\n storyDocs.push(await document(chunk));\n }\n\n // storyDocs.length === chunks.length, already guarded above to be > 0.\n const [firstStory, ...remaining] = storyDocs as [Document, ...Document[]];\n await state.set(STORY_STATE_KEYS.storyQueue, remaining);\n await state.set(STORY_STATE_KEYS.completedStories, []);\n await state.set(STORY_STATE_KEYS.activeStory, firstStory);\n await recordActiveStoryStartCommit();\n\n return implementStoryStep({ currentStory: firstStory, attempt: 1 });\n },\n);\n\nfunction countOccurrences(value: string, needle: string): number {\n if (needle.length === 0) {\n return 0;\n }\n\n let count = 0;\n let offset = 0;\n while (true) {\n const index = value.indexOf(needle, offset);\n if (index === -1) {\n return count;\n }\n\n count += 1;\n offset = index + needle.length;\n }\n}\n\nfunction storyContextPattern(): RegExp {\n return new RegExp(\n `${escapeRegExp(STORY_CONTEXT_START)}([\\\\s\\\\S]*?)${escapeRegExp(STORY_CONTEXT_END)}`,\n \"g\",\n );\n}\n\nfunction prependSharedContext(story: string, sharedContext: string): string {\n if (sharedContext.length === 0) {\n return story;\n }\n\n return [\"## Shared implementation context\", sharedContext, \"## Active story\", story].join(\"\\n\\n\");\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n","import { fail, step } from \"@trailstep/authoring\";\nimport { reviewStoryImplementationStep } from \"../review-story-implementation/step.js\";\nimport { loadStoryReviewGitContext } from \"../shared/story-state.js\";\nimport {\n type ImplementStoryInput,\n type ImplementStoryOutput,\n implementStoryOutput,\n implementStoryPrompt,\n} from \"./prompt.js\";\n\nexport const implementStoryStep = step({ id: \"implement-story\" })\n .prompt<ImplementStoryInput, ImplementStoryOutput>(implementStoryPrompt, {\n agent: \"implementer\",\n output: implementStoryOutput,\n })\n .do(async (promptOutput, input) => {\n if (promptOutput.blocked) {\n return fail({\n code: \"story_blocked\",\n message: promptOutput.blockedReason ?? \"Story implementation reported a blocked state.\",\n details: { storyPath: input.currentStory.path },\n });\n }\n\n return reviewStoryImplementationStep({\n currentStory: input.currentStory,\n attempt: input.attempt,\n implementationSummary: promptOutput.summary,\n gitContext: await loadStoryReviewGitContext(),\n });\n });\n","import { fail, step } from \"@trailstep/authoring\";\nimport { commitReviewedStoryStep } from \"../commit-reviewed-story/step.js\";\nimport { implementStoryStep } from \"../implement-story/step.js\";\nimport { MAX_STORY_REVIEW_ATTEMPTS } from \"../shared/constants.js\";\nimport type { ReviewResult } from \"../shared/review-schema.js\";\nimport { reviewOutput, reviewPasses } from \"../shared/review-schema.js\";\nimport { type ReviewStoryImplementationInput, reviewStoryImplementationPrompt } from \"./prompt.js\";\n\nexport const reviewStoryImplementationStep = step({ id: \"review-story-implementation\" })\n .prompt<ReviewStoryImplementationInput, ReviewResult>(reviewStoryImplementationPrompt, {\n agent: \"reviewer\",\n output: reviewOutput,\n })\n .do(async (review, input) => {\n if (!reviewPasses(review)) {\n if (input.attempt >= MAX_STORY_REVIEW_ATTEMPTS) {\n return fail({\n code: \"story_review_exhausted\",\n message: `Story failed review ${MAX_STORY_REVIEW_ATTEMPTS} times in a row (last score ${review.score}/5).`,\n details: { review, storyPath: input.currentStory.path },\n });\n }\n\n return implementStoryStep({\n currentStory: input.currentStory,\n previousStoryReview: review,\n attempt: input.attempt + 1,\n });\n }\n\n return commitReviewedStoryStep({\n currentStory: input.currentStory,\n implementationSummary: input.implementationSummary,\n });\n });\n","import type { Document } from \"@trailstep/authoring\";\nimport { done, fail, state, step } from \"@trailstep/authoring\";\nimport type { ContinuationResult } from \"@trailstep/core\";\nimport { implementStoryStep } from \"../implement-story/step.js\";\nimport { extractStoryTitle, type TakeItAwayOutput } from \"../shared/output-schema.js\";\nimport {\n type ActiveStoryStartCommit,\n recordActiveStoryStartCommit,\n resetActiveStoryStartCommit,\n STORY_STATE_KEYS,\n} from \"../shared/story-state.js\";\nimport { runGit } from \"./run-git.js\";\n\nexport interface CommitReviewedStoryInput extends Record<string, unknown> {\n readonly currentStory: Document;\n readonly implementationSummary?: string;\n}\n\nexport const commitReviewedStoryStep = step({ id: \"commit-reviewed-story\" }).do(\n async (input: CommitReviewedStoryInput): Promise<ContinuationResult> => {\n const activeStory =\n (await state.get<Document | null>(STORY_STATE_KEYS.activeStory)) ?? input.currentStory;\n\n if (storyAutoCommitEnabled()) {\n const commitResult = await commitReviewedStoryChanges(\n activeStory,\n input.implementationSummary,\n );\n if (!commitResult.ok) {\n return fail({\n code: commitResult.code,\n message: commitResult.message,\n details: commitResult.details,\n });\n }\n }\n\n return completeReviewedStory(activeStory);\n },\n);\n\nfunction storyAutoCommitEnabled(): boolean {\n const mode = process.env.TRAILSTEP_STORY_COMMIT_MODE;\n return [\"1\", \"true\", \"enabled\", \"worktree\"].includes(mode?.toLowerCase() ?? \"\");\n}\n\nasync function commitReviewedStoryChanges(\n activeStory: Document,\n implementationSummary: string | undefined,\n): Promise<\n | { readonly ok: true }\n | {\n readonly ok: false;\n readonly code: string;\n readonly message: string;\n readonly details: Record<string, unknown>;\n }\n> {\n const cwd = state.cwd;\n if (!cwd) {\n return {\n ok: false,\n code: \"story_commit_missing_cwd\",\n message: \"Cannot commit reviewed story because the TrailStep workflow cwd is unavailable.\",\n details: { storyPath: activeStory.path },\n };\n }\n\n const insideWorkTree = await runGit([\"rev-parse\", \"--is-inside-work-tree\"], cwd);\n if (!insideWorkTree.ok || insideWorkTree.stdout !== \"true\") {\n return {\n ok: false,\n code: \"story_commit_not_git_worktree\",\n message:\n \"Cannot commit reviewed story because the workflow is not running inside a git worktree.\",\n details: {\n storyPath: activeStory.path,\n gitError: insideWorkTree.ok ? undefined : insideWorkTree.error,\n },\n };\n }\n\n const add = await runGit([\"add\", \"-A\"], cwd);\n if (!add.ok) {\n return {\n ok: false,\n code: \"story_commit_stage_failed\",\n message: \"Cannot commit reviewed story because `git add -A` failed.\",\n details: { storyPath: activeStory.path, gitError: add.error },\n };\n }\n\n const staged = await runGit([\"diff\", \"--cached\", \"--name-only\"], cwd);\n if (!staged.ok) {\n return {\n ok: false,\n code: \"story_commit_status_failed\",\n message: \"Cannot commit reviewed story because staged changes could not be inspected.\",\n details: { storyPath: activeStory.path, gitError: staged.error },\n };\n }\n\n if (staged.stdout.trim().length === 0) {\n const baseline = await state.get<ActiveStoryStartCommit | null>(\n STORY_STATE_KEYS.activeStoryStartCommit,\n );\n const head = await runGit([\"rev-parse\", \"HEAD\"], cwd);\n if (baseline?.commit && head.ok && head.stdout !== baseline.commit) {\n return { ok: true };\n }\n\n return {\n ok: false,\n code: \"story_commit_empty\",\n message:\n \"The story passed review, but there are no staged or already-committed changes since the story baseline to commit.\",\n details: {\n storyPath: activeStory.path,\n storyStartCommit: baseline?.commit,\n head: head.ok ? head.stdout : undefined,\n gitError: head.ok ? undefined : head.error,\n },\n };\n }\n\n const storyTitle = extractStoryTitle(activeStory.content, 1);\n const commit = await runGit(\n [\n \"commit\",\n \"-m\",\n truncateCommitSubject(`trailstep: ${storyTitle}`),\n \"-m\",\n commitBody(activeStory, implementationSummary, staged.stdout),\n ],\n cwd,\n );\n\n if (!commit.ok) {\n return {\n ok: false,\n code: \"story_commit_failed\",\n message: \"The story passed review, but TrailStep could not create the story commit.\",\n details: { storyPath: activeStory.path, gitError: commit.error },\n };\n }\n\n return { ok: true };\n}\n\nasync function completeReviewedStory(activeStory: Document): Promise<ContinuationResult> {\n const completed = (await state.get<string[]>(STORY_STATE_KEYS.completedStories)) ?? [];\n const updatedCompleted = [\n ...completed,\n extractStoryTitle(activeStory.content, completed.length + 1),\n ];\n await state.set(STORY_STATE_KEYS.completedStories, updatedCompleted);\n\n const storyQueue = (await state.get<Document[]>(STORY_STATE_KEYS.storyQueue)) ?? [];\n const [nextStory, ...remaining] = storyQueue;\n\n if (!nextStory) {\n await state.set(STORY_STATE_KEYS.activeStory, null);\n await resetActiveStoryStartCommit();\n const featureDoc = await state.get<Document>(\"featureDoc\");\n const implementationDoc = await state.get<Document>(\"implementationDoc\");\n const output: TakeItAwayOutput = {\n status: \"implemented\",\n featureDocPath: featureDoc?.path ?? \"\",\n implementationDocPath: implementationDoc?.path ?? \"\",\n storyCount: updatedCompleted.length,\n completedStories: updatedCompleted,\n summary: `Implemented and reviewed ${updatedCompleted.length} ${updatedCompleted.length === 1 ? \"story\" : \"stories\"}.`,\n };\n return done(output);\n }\n\n await state.set(STORY_STATE_KEYS.storyQueue, remaining);\n await state.set(STORY_STATE_KEYS.activeStory, nextStory);\n await resetActiveStoryStartCommit();\n await recordActiveStoryStartCommit();\n return implementStoryStep({ currentStory: nextStory, attempt: 1 });\n}\n\nfunction truncateCommitSubject(subject: string): string {\n return subject.length <= 72 ? subject : `${subject.slice(0, 69)}...`;\n}\n\nfunction commitBody(\n activeStory: Document,\n implementationSummary: string | undefined,\n stagedFiles: string,\n): string {\n return [\n \"Committed automatically by TrailStep after a passing story review.\",\n \"\",\n `Story artifact: ${activeStory.path}`,\n \"\",\n \"Implementer summary:\",\n implementationSummary?.trim() || \"Not provided.\",\n \"\",\n \"Staged files:\",\n stagedFiles\n .split(\"\\n\")\n .filter((file) => file.length > 0)\n .map((file) => `- ${file}`)\n .join(\"\\n\"),\n ].join(\"\\n\");\n}\n","import { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nimport { state } from \"@trailstep/authoring\";\n\nconst execFileAsync = promisify(execFile);\n\nexport const STORY_STATE_KEYS = {\n activeStory: \"activeStory\",\n activeStoryStartCommit: \"activeStoryStartCommit\",\n completedStories: \"completedStories\",\n storyQueue: \"storyQueue\",\n} as const;\n\nexport interface ActiveStoryStartCommit {\n readonly commit?: string;\n readonly warning?: string;\n}\n\nexport interface StoryReviewGitContext {\n readonly storyStartCommit?: string;\n readonly statusShort?: string;\n readonly committedDiff?: string;\n readonly uncommittedDiff?: string;\n readonly warnings: readonly string[];\n}\n\nasync function runGit(\n args: readonly string[],\n cwd: string,\n): Promise<\n { readonly ok: true; readonly stdout: string } | { readonly ok: false; readonly error: string }\n> {\n try {\n const { stdout } = await execFileAsync(\"git\", [...args], {\n cwd,\n maxBuffer: 1024 * 1024 * 10,\n });\n return { ok: true, stdout: stdout.trimEnd() };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return { ok: false, error: message };\n }\n}\n\nexport async function recordActiveStoryStartCommit(): Promise<ActiveStoryStartCommit> {\n const existing = await state.get<ActiveStoryStartCommit | null>(\n STORY_STATE_KEYS.activeStoryStartCommit,\n );\n if (existing?.commit || existing?.warning) {\n return existing;\n }\n\n const cwd = state.cwd;\n if (!cwd) {\n const missingCwd = {\n warning:\n \"Workflow cwd is unavailable; the story reviewer cannot verify committed story changes from a durable git baseline.\",\n };\n await state.set(STORY_STATE_KEYS.activeStoryStartCommit, missingCwd);\n return missingCwd;\n }\n\n const result = await runGit([\"rev-parse\", \"HEAD\"], cwd);\n if (!result.ok || result.stdout.length === 0) {\n const missingGitBaseline = {\n warning: `Unable to record story start commit with \\`git rev-parse HEAD\\`: ${result.ok ? \"no commit was returned\" : result.error}`,\n };\n await state.set(STORY_STATE_KEYS.activeStoryStartCommit, missingGitBaseline);\n return missingGitBaseline;\n }\n\n const baseline = { commit: result.stdout };\n await state.set(STORY_STATE_KEYS.activeStoryStartCommit, baseline);\n return baseline;\n}\n\nexport async function resetActiveStoryStartCommit(): Promise<void> {\n await state.set(STORY_STATE_KEYS.activeStoryStartCommit, null);\n}\n\nexport async function loadStoryReviewGitContext(): Promise<StoryReviewGitContext> {\n const baseline = await state.get<ActiveStoryStartCommit | null>(\n STORY_STATE_KEYS.activeStoryStartCommit,\n );\n const warnings: string[] = [];\n\n if (baseline?.warning) {\n warnings.push(baseline.warning);\n }\n\n const cwd = state.cwd;\n if (!cwd) {\n warnings.push(\n \"Workflow cwd is unavailable; reviewer must treat committed story-change context as missing.\",\n );\n return { storyStartCommit: baseline?.commit, warnings };\n }\n\n const status = await runGit([\"status\", \"--short\"], cwd);\n if (!status.ok) {\n warnings.push(`Unable to inspect \\`git status --short\\`: ${status.error}`);\n }\n\n const uncommittedDiff = await runGit([\"diff\"], cwd);\n if (!uncommittedDiff.ok) {\n warnings.push(\n `Unable to inspect uncommitted changes with \\`git diff\\`: ${uncommittedDiff.error}`,\n );\n }\n\n const storyStartCommit = baseline?.commit;\n let committedDiff: string | undefined;\n if (!storyStartCommit) {\n warnings.push(\n \"No durable story start commit is recorded; reviewer must not silently review only the current working tree diff.\",\n );\n } else {\n const baselineReachable = await runGit([\"cat-file\", \"-e\", `${storyStartCommit}^{commit}`], cwd);\n if (!baselineReachable.ok) {\n warnings.push(\n `Recorded story start commit \\`${storyStartCommit}\\` is invalid or unreachable: ${baselineReachable.error}`,\n );\n } else {\n const committed = await runGit([\"diff\", `${storyStartCommit}..HEAD`], cwd);\n if (!committed.ok) {\n warnings.push(\n `Unable to inspect committed story changes with \\`git diff ${storyStartCommit}..HEAD\\`: ${committed.error}`,\n );\n } else {\n committedDiff = committed.stdout;\n }\n }\n }\n\n return {\n storyStartCommit,\n statusShort: status.ok ? status.stdout : undefined,\n committedDiff,\n uncommittedDiff: uncommittedDiff.ok ? uncommittedDiff.stdout : undefined,\n warnings,\n };\n}\n","import { execFile } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\nconst execFileAsync = promisify(execFile);\n\nexport type GitResult =\n | { readonly ok: true; readonly stdout: string }\n | { readonly ok: false; readonly error: string };\n\nexport async function runGit(args: readonly string[], cwd: string): Promise<GitResult> {\n try {\n const { stdout } = await execFileAsync(\"git\", [...args], {\n cwd,\n maxBuffer: 1024 * 1024 * 10,\n });\n return { ok: true, stdout: stdout.trimEnd() };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return { ok: false, error: message };\n }\n}\n","import type { Document } from \"@trailstep/authoring\";\nimport { promptSections, section } from \"@trailstep/authoring\";\nimport methodologyFragment from \"../shared/feature-methodology.md?raw\";\nimport storyImplementationContractFragment from \"../shared/story-implementation-contract.md?raw\";\nimport type { StoryReviewGitContext } from \"../shared/story-state.js\";\n\nconst fragments = {\n methodology: methodologyFragment.trimEnd(),\n storyContract: storyImplementationContractFragment.trimEnd(),\n};\n\nexport interface ReviewStoryImplementationInput extends Record<string, unknown> {\n readonly currentStory: Document;\n readonly attempt: number;\n readonly implementationSummary?: string;\n readonly gitContext: StoryReviewGitContext;\n}\n\nexport function reviewStoryImplementationPrompt({\n input,\n}: {\n readonly input: ReviewStoryImplementationInput;\n}): string {\n const committedDiffCommand = input.gitContext.storyStartCommit\n ? `git diff ${input.gitContext.storyStartCommit}..HEAD`\n : \"git diff <missing-story-start-commit>..HEAD\";\n\n return promptSections(\n fragments.methodology,\n fragments.storyContract,\n section(\"Story\", input.currentStory.content),\n section(\"Implementer summary\", input.implementationSummary ?? \"Not provided.\"),\n section(\n \"Story review git baseline\",\n [\n `Recorded story start commit: ${input.gitContext.storyStartCommit ?? \"MISSING\"}`,\n `Inspect committed story changes with: \\`${committedDiffCommand}\\``,\n \"Inspect uncommitted working tree changes with: `git diff`\",\n \"Inspect status with: `git status --short`\",\n input.gitContext.warnings.length > 0\n ? [\n \"\",\n \"Warnings / blocked context:\",\n ...input.gitContext.warnings.map((warning) => `- ${warning}`),\n ].join(\"\\n\")\n : \"\",\n ]\n .filter((line) => line.length > 0)\n .join(\"\\n\"),\n ),\n section(\n \"Committed story changes (`git diff <storyStartCommit>..HEAD`)\",\n input.gitContext.committedDiff ?? \"Not available.\",\n ),\n section(\n \"Uncommitted working tree changes (`git diff`)\",\n input.gitContext.uncommittedDiff ?? \"Not available.\",\n ),\n section(\n \"Working tree status (`git status --short`)\",\n input.gitContext.statusShort ?? \"Not available.\",\n ),\n section(\n \"Task\",\n \"Review only the active story slice represented by the recorded story start commit through HEAD, plus the current uncommitted working tree changes, against the story above and the implementer summary. Prefer the supplied diff/status sections; if you need to inspect locally, use read-only commands only (`git status --short`, the listed `git diff <storyStartCommit>..HEAD`, and `git diff`) — do not run tests, edit code, revert files, clean files, or try to isolate the diff by changing the repository. If unrelated dirty files, a missing/invalid baseline, or ambiguous context prevents a trustworthy review, say so in the structured review and require the implementer/workflow to fix the isolation; never remove changes yourself. Respond only with the structured review.\",\n ),\n );\n}\n","# Feature workflow methodology\n\n## Planning principles\n\n- Start from observable behavior and user value.\n- Preserve uncertainty explicitly; do not invent missing product decisions.\n- Prefer the smallest vertical slice that proves a complete path through the system.\n- Use tracer bullets to de-risk integration seams early with thin end-to-end behavior.\n- Every implementation story must begin with a behavioral red test that fails for the right reason.\n- The green phase should add only enough production code to pass the focused red test.\n- Refactor only after focused tests pass, and keep refactors scoped to the feature.\n- Dependencies are hard dependencies only: story B depends on story A when B cannot pass its own tests until A is complete.\n\n## Review scoring\n\nScore on a 1-5 integer scale:\n\n- 5: excellent; strongly aligned with TDD, vertical slicing, tracer-bullet risk reduction, dependency clarity, and local architecture.\n- 4: good; acceptable with only minor non-blocking improvements.\n- 3: incomplete; useful but needs material changes before continuing.\n- 2: poor; misses core methodology or important requirements.\n- 1: unusable; unsafe, incoherent, or not traceable to the feature.\n\nScores of 4 or 5 pass. Scores below 4 must list specific `requiredImprovements` so the next attempt can address them directly.\n","# Story implementation contract\n\nThe story loop works one story at a time. Each story is self-contained. You will not see non-context overview text or other stories; you will see only the active story plus any shared `<context>` content prepended by the split-stories step.\n\n## Protect pre-existing uncommitted work\n\nRun `git status --short` before making any change.\n\n- The preferred execution mode is a TrailStep-created isolated worktree/branch. In that mode, a successful review is followed by an automatic story commit, so the next story starts from a clean diff boundary.\n- Treat every pre-existing uncommitted file as protected — it may be unfinished human work, another run's in-progress work, or a sign that isolation failed.\n- Do not run destructive cleanup: no `git reset`, `git checkout --`, broad `git clean`, or equivalent revert/format-away operations.\n- Do not delete or rewrite unrelated chunks in a file that already has changes.\n- If this story requires editing a file that is already dirty, preserve the existing changes and make only the minimal additional change the story requires.\n- If dirty work makes the story ambiguous or blocked, stop and report a blocked state instead of removing it.\n- Do not create git commits yourself unless the story explicitly requires it. TrailStep creates the reviewed story commit after the reviewer passes the story when auto-commit mode is enabled.\n\n## Implementer responsibilities\n\n- Implement only the current story and required dependency-compatible adjustments. Do not start later stories.\n- Use strict behavioral-red TDD: write or update a focused failing behavioral test first, confirm it fails for the intended reason when feasible, implement the smallest change to pass it, then refactor only after it's green.\n- Run the story's validation commands before reporting completion when feasible.\n- Do not report success until implementation and focused validation are done, or until a true blocked state is reached — report the blocker clearly instead of pretending the story is complete.\n\n## Reviewer responsibilities\n\n- Review only the active story diff from the recorded story baseline through HEAD plus the current uncommitted diff. Do not try to review every dirty change in the checkout as global context.\n- Inspect with read-only commands only (`git status --short`, the exact `git diff <storyStartCommit>..HEAD` command supplied in your prompt, and `git diff`). Do not run tests or other commands — the implementer is responsible for passing focused validation; this is an AI-only review.\n- Never edit code, delete files, revert files, run cleanup, stage files, commit files, or otherwise modify the working tree to isolate your review.\n- If unrelated dirty files, missing baseline information, or overlapping changes make the active story diff unreviewable, return a failing structured review that explains the isolation problem instead of changing the repository.\n- Review against: the story's acceptance criteria, TDD evidence and test quality, vertical-slice completeness, tracer-bullet alignment where applicable, minimal scope with no gold-plating, and integration with existing architecture/project conventions.\n\n## Completion\n\nA story is complete when code is changed as needed, behavioral tests exist, focused validation passes according to the implementer, and the implementation is well integrated with the existing architecture.\n","import { type Document, jsonSchema, list, promptSections, section } from \"@trailstep/authoring\";\nimport methodologyFragment from \"../shared/feature-methodology.md?raw\";\nimport projectArchitectureGuidanceFragment from \"../shared/project-architecture-guidance.md?raw\";\nimport type { ReviewResult } from \"../shared/review-schema.js\";\nimport storyImplementationContractFragment from \"../shared/story-implementation-contract.md?raw\";\n\nconst fragments = {\n methodology: methodologyFragment.trimEnd(),\n architectureGuidance: projectArchitectureGuidanceFragment.trimEnd(),\n storyContract: storyImplementationContractFragment.trimEnd(),\n};\n\nexport interface ImplementStoryInput extends Record<string, unknown> {\n readonly currentStory: Document;\n readonly attempt: number;\n readonly previousStoryReview?: ReviewResult;\n}\n\nexport interface ImplementStoryOutput extends Record<string, unknown> {\n readonly blocked: boolean;\n readonly blockedReason?: string;\n readonly summary: string;\n}\n\nexport const implementStoryOutput = jsonSchema<ImplementStoryOutput>({\n type: \"object\",\n properties: {\n blocked: { type: \"boolean\" },\n blockedReason: { type: \"string\" },\n summary: {\n type: \"string\",\n description: \"Files changed, commands run, and their results.\",\n },\n },\n required: [\"blocked\", \"summary\"],\n additionalProperties: false,\n});\n\nexport function implementStoryPrompt({ input }: { readonly input: ImplementStoryInput }): string {\n const taskBody =\n input.previousStoryReview === undefined\n ? \"Implement this story.\"\n : promptSections(\n `This is retry attempt ${input.attempt} for this story. A previous review scored the implementation ${input.previousStoryReview.score}/5: ${input.previousStoryReview.summary}`,\n `Required improvements to address, without discarding what already works:\\n\\n${list(input.previousStoryReview.requiredImprovements)}`,\n );\n\n return promptSections(\n fragments.methodology,\n fragments.architectureGuidance,\n fragments.storyContract,\n section(\"Story\", input.currentStory.content),\n section(\n \"Task\",\n `${taskBody}\\n\\nSet \\`blocked: true\\` with a clear \\`blockedReason\\` instead of guessing or pretending the story is complete. Otherwise set \\`blocked: false\\` and use \\`summary\\` to report files changed, commands run, and their results.`,\n ),\n );\n}\n","# Architecture awareness\n\nBefore naming files, choosing package/module boundaries, picking integration seams, or ordering stories/dependencies, ground the decision in the target project's own conventions rather than inventing structure:\n\n- Look for and read the project's own architecture/convention docs at its root and nearby — `CLAUDE.md`, `AGENTS.md`, `.pi/rules/`, ADRs, architecture docs, or an equivalent README section.\n- Prefer existing module/package boundaries, naming conventions, and file layout patterns already established in the project over introducing new ones.\n- When the project's own guidance is silent or ambiguous on a non-trivial integration choice, say so explicitly as an assumption rather than silently picking one convention over another.\n","import type { Document } from \"@trailstep/authoring\";\nimport { list, promptSections, section } from \"@trailstep/authoring\";\nimport methodologyFragment from \"../shared/feature-methodology.md?raw\";\nimport implementationDocFormatFragment from \"../shared/implementation-doc-format.md?raw\";\n\nconst fragments = {\n methodology: methodologyFragment.trimEnd(),\n implementationDocFormat: implementationDocFormatFragment.trimEnd(),\n};\n\nexport interface ReviewImplementationDocInput extends Record<string, unknown> {\n readonly featureDoc: Document;\n readonly implementationDoc: Document;\n readonly attempt: number;\n}\n\nexport function reviewImplementationDocPrompt({\n input,\n}: {\n readonly input: ReviewImplementationDocInput;\n}): string {\n const reviewCriteria = list([\n \"traceability to the feature doc\",\n \"strict behavioral-red TDD story design\",\n \"vertical slices rather than horizontal tasks\",\n \"a clear tracer-bullet strategy\",\n \"hard dependency labels and topological ordering\",\n \"acceptance criteria and validation commands\",\n \"story instructions self-contained enough for an implementer who will only see one story plus the prepended shared context at a time\",\n \"correct use of balanced `<context>` ... `</context>` blocks for shared implementer context\",\n \"correct use of the `<!-- trailstep-story-boundary -->` marker between stories, and that no story-critical detail lives only in non-context overview text above the first marker\",\n ]);\n\n return promptSections(\n fragments.methodology,\n fragments.implementationDocFormat,\n section(\"Feature doc\", input.featureDoc.content),\n section(\"Implementation doc under review\", input.implementationDoc.content),\n section(\n \"Task\",\n `Critically review the implementation doc above against the feature doc and the methodology. Review for:\\n\\n${reviewCriteria}\\n\\nDo not edit the implementation doc. Respond only with the structured review.`,\n ),\n );\n}\n","# Implementation doc format\n\n`implementation-doc.md` converts `feature-doc.md` into implementation-ready stories.\n\nUse this structure:\n\n```markdown\n# Implementation Plan: <Feature Name>\n\n## Overview for planner/reviewer\n\nOptional high-level planning notes that do not need to be seen by story implementers.\n\n<context>\n\n## Shared Implementation Context\n\nPut every cross-story detail that an implementer may need here: outcome and constraints, architecture/integration notes, tracer-bullet strategy, repository conventions, shared validation commands, edge cases, assumptions, and hard dependency graph notes.\n\nAnything inside this balanced `<context>` block is prepended programmatically to every story by the split-stories step.\n\n</context>\n\n<!-- trailstep-story-boundary -->\n\n### Story 001: <title>\n\nDependencies: none\n\n#### Goal\n\n#### User-Visible / Integration-Visible Slice\n\n#### Acceptance Criteria\n\n#### Red Phase\n\n- Test file:\n- Test case:\n- Expected failing assertion:\n\n#### Green Phase\n\n#### Refactor Phase\n\n#### Validation Commands\n\n#### Notes for Implementer\n\n<!-- trailstep-story-boundary -->\n\n### Story 002: <title>\n\nDependencies: Story 001\n\n...\n```\n\nRules:\n\n- Text above the first `<!-- trailstep-story-boundary -->` is never read by an implementer unless it is inside a balanced `<context>` ... `</context>` block. The split-stories step prepends all context blocks to every story.\n- If a detail applies to most/all stories, put it in `<context>`; if it applies only to selected stories, repeat it inside those stories. No story-critical detail may live only in non-context overview text.\n- Every `<context>` marker must have a matching `</context>` marker, and context blocks should be outside story bodies unless there is a deliberate reason to prepend that block to every story.\n- Every story must start right after a `<!-- trailstep-story-boundary -->` line, on its own line, with nothing else on that line. Splitting is mechanical and depends on this exact marker — do not use markdown headings alone to separate stories, and do not add or omit a boundary marker except between/before stories.\n- Stories must be topologically ordered.\n- Every story must be implementation-ready and self-contained, written as instructions to an implementer who will not see this file, only their own story's content.\n- Avoid horizontal stories unless they are embedded in an observable vertical slice.\n- Name concrete files/tests/commands when they can be inferred from the repository.\n- Preserve uncertainty as assumptions or blocked states instead of guessing.\n","import type { Document } from \"@trailstep/authoring\";\nimport { list, promptSections, section } from \"@trailstep/authoring\";\nimport methodologyFragment from \"../shared/feature-methodology.md?raw\";\nimport implementationDocFormatFragment from \"../shared/implementation-doc-format.md?raw\";\nimport projectArchitectureGuidanceFragment from \"../shared/project-architecture-guidance.md?raw\";\nimport type { ReviewResult } from \"../shared/review-schema.js\";\n\nconst fragments = {\n methodology: methodologyFragment.trimEnd(),\n architectureGuidance: projectArchitectureGuidanceFragment.trimEnd(),\n implementationDocFormat: implementationDocFormatFragment.trimEnd(),\n};\n\nexport interface CreateOrImproveImplementationDocInput extends Record<string, unknown> {\n readonly featureDoc: Document;\n readonly previousReview?: ReviewResult;\n readonly attempt: number;\n}\n\nexport function createOrImproveImplementationDocPrompt({\n input,\n}: {\n readonly input: CreateOrImproveImplementationDocInput;\n}): string {\n const taskBody =\n input.previousReview === undefined\n ? \"Create `implementation-doc.md` from the feature doc above, following the format exactly enough that stories can later be split mechanically on the `<!-- trailstep-story-boundary -->` marker and shared context can be prepended from balanced `<context>` blocks.\"\n : promptSections(\n `This is improvement attempt ${input.attempt}. A previous review scored this plan ${input.previousReview.score}/5: ${input.previousReview.summary}`,\n `Required improvements to address, without discarding what already works:\\n\\n${list(input.previousReview.requiredImprovements)}`,\n );\n\n return promptSections(\n fragments.methodology,\n fragments.architectureGuidance,\n fragments.implementationDocFormat,\n section(\"Feature doc\", input.featureDoc.content),\n section(\n \"Task\",\n `${taskBody}\\n\\nDesign stories around strict behavioral-red TDD, vertical slicing, tracer-bullet methodology, and hard dependency labels only. Topologically order stories by dependency. Put shared implementation details in balanced \\`<context>\\` ... \\`</context>\\` blocks so split-stories prepends them to every story; repeat details inside individual stories when only selected stories need them. Write every story as implementation-ready instructions for an implementer who will only see that story plus the prepended context.`,\n ),\n );\n}\n","import { promptSections, section } from \"@trailstep/authoring\";\nimport featureDocFormatFragment from \"../shared/feature-doc-format.md?raw\";\nimport methodologyFragment from \"../shared/feature-methodology.md?raw\";\nimport type { TakeItAwayInput } from \"../shared/input-schema.js\";\n\nconst fragments = {\n methodology: methodologyFragment.trimEnd(),\n featureDocFormat: featureDocFormatFragment.trimEnd(),\n};\n\nexport function createFeatureDocPrompt({ input }: { readonly input: TakeItAwayInput }): string {\n return promptSections(\n fragments.methodology,\n fragments.featureDocFormat,\n section(\"Conversation / feature request\", input.conversation),\n section(\n \"Task\",\n 'Write `feature-doc.md` following the format above, based on the conversation/request. Make it detailed enough that another agent can plan implementation without reading the original conversation. Preserve uncertainty explicitly in \"Open Questions and Assumptions\" — do not invent missing product decisions.',\n ),\n );\n}\n","# Feature doc format\n\n`feature-doc.md` is an intermediate product-quality feature description used as input to implementation planning.\n\nUse this structure:\n\n```markdown\n# <Feature Name>\n\n## Outcome\n\n## Users / Jobs / Pain\n\n## Proposed Behavior\n\n## Non-Goals\n\n## Examples and Acceptance Criteria\n\n## Edge Cases and Failure Modes\n\n## Affected Areas and Integration Points\n\n## Testing Expectations\n\n## Documentation / Migration / Rollout Notes\n\n## Open Questions and Assumptions\n```\n\nThe document should be detailed enough that another agent can plan implementation without reading the original conversation, while still preserving important uncertainty.\n","import { shape } from \"@trailstep/authoring\";\n\nexport interface TakeItAwayInput extends Record<string, unknown> {\n readonly conversation: string;\n}\n\nexport const takeItAwayInput = shape<TakeItAwayInput>({ conversation: \"string\" });\n","import { promptSections, section } from \"@trailstep/authoring\";\n\nexport function grillPrompt(): string {\n return promptSections(\n section(\n \"Role\",\n \"You are the interactive front door for starting a new feature in the current project. Open by asking the user what they want to build.\",\n ),\n section(\n \"Task\",\n \"Keep asking follow-up questions until you are confident you understand the feature request well enough to hand off to a planning agent. There is no fixed checklist of required topics — use your judgment, and do not end the conversation prematurely just to finish quickly.\",\n ),\n section(\n \"Output\",\n \"Your structured output's `conversation` field must contain the full raw transcript of the conversation so far, not a summary. Preserve as much of the actual back-and-forth as possible.\",\n ),\n );\n}\n","import { defineWorkflow } from \"@trailstep/authoring\";\nimport { createFeatureDocStep } from \"../feature-implementation/create-feature-doc/step.js\";\nimport { takeItAwayInput } from \"../feature-implementation/shared/input-schema.js\";\nimport { takeItAwayOutput } from \"../feature-implementation/shared/output-schema.js\";\n\nexport type { TakeItAwayInput } from \"../feature-implementation/shared/input-schema.js\";\n\nexport const takeItAway = defineWorkflow({\n id: \"take-it-away\",\n description:\n \"Turns an already-organic conversation/feature request into a reviewed implementation plan, then implements it story by story.\",\n inputShape: takeItAwayInput,\n outputShape: takeItAwayOutput,\n agents: {\n featureWriter: {\n size: \"medium\",\n thinking: \"medium\",\n description: \"Turns a conversation/feature request into a standalone feature doc.\",\n },\n planner: {\n size: \"large\",\n thinking: \"high\",\n description:\n \"Creates or improves the implementation doc: architecture-aware, TDD/vertical-slice/tracer-bullet story design.\",\n },\n reviewer: {\n size: \"large\",\n thinking: \"high\",\n description: \"Reviews isolated implementation docs and story diffs against methodology.\",\n },\n implementer: {\n size: \"medium\",\n thinking: \"medium\",\n description: \"Implements one story at a time using strict behavioral-red TDD.\",\n },\n },\n start(input) {\n return createFeatureDocStep(input);\n },\n});\n"],"mappings":";AAAA,SAAS,gBAAgB,SAAAA,cAAa;;;ACAtC,SAAS,kBAAkB;AAWpB,IAAM,mBAAmB,WAA6B;AAAA,EAC3D,MAAM;AAAA,EACN,YAAY;AAAA,IACV,QAAQ,EAAE,MAAM,UAAU,OAAO,cAAc;AAAA,IAC/C,gBAAgB,EAAE,MAAM,SAAS;AAAA,IACjC,uBAAuB,EAAE,MAAM,SAAS;AAAA,IACxC,YAAY,EAAE,MAAM,SAAS;AAAA,IAC7B,kBAAkB,EAAE,MA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","names":["shape","step","Document","state","step","state","step","fail","step","jsonSchema","jsonSchema","fail","state","step","fail","step","fail","step","state","execFile","promisify","execFileAsync","runGit","state","runGit","step","fail","jsonSchema","promptSections","section","fragments","jsonSchema","promptSections","section","step","fail","step","fail","state","list","promptSections","section","fragments","list","promptSections","section","step","fail","list","promptSections","section","fragments","promptSections","list","section","step","state","promptSections","section","fragments","promptSections","section","step","Document","state","promptSections","section","step","shape","defineWorkflow","defineWorkflow"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trailstep/create-flows",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Public reusable general-purpose TrailStep workflows.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",