@nathapp/nax 0.37.0 → 0.38.1

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.
Files changed (72) hide show
  1. package/dist/nax.js +3258 -2894
  2. package/package.json +4 -1
  3. package/src/agents/claude-complete.ts +72 -0
  4. package/src/agents/claude-execution.ts +189 -0
  5. package/src/agents/claude-interactive.ts +77 -0
  6. package/src/agents/claude-plan.ts +23 -8
  7. package/src/agents/claude.ts +64 -349
  8. package/src/analyze/classifier.ts +2 -1
  9. package/src/cli/config-descriptions.ts +206 -0
  10. package/src/cli/config-diff.ts +103 -0
  11. package/src/cli/config-display.ts +285 -0
  12. package/src/cli/config-get.ts +55 -0
  13. package/src/cli/config.ts +7 -618
  14. package/src/cli/prompts-export.ts +58 -0
  15. package/src/cli/prompts-init.ts +200 -0
  16. package/src/cli/prompts-main.ts +237 -0
  17. package/src/cli/prompts-tdd.ts +78 -0
  18. package/src/cli/prompts.ts +10 -541
  19. package/src/commands/logs-formatter.ts +201 -0
  20. package/src/commands/logs-reader.ts +171 -0
  21. package/src/commands/logs.ts +11 -362
  22. package/src/config/loader.ts +4 -15
  23. package/src/config/runtime-types.ts +448 -0
  24. package/src/config/schema-types.ts +53 -0
  25. package/src/config/types.ts +49 -486
  26. package/src/context/auto-detect.ts +2 -1
  27. package/src/context/builder.ts +3 -2
  28. package/src/execution/crash-heartbeat.ts +77 -0
  29. package/src/execution/crash-recovery.ts +23 -365
  30. package/src/execution/crash-signals.ts +149 -0
  31. package/src/execution/crash-writer.ts +154 -0
  32. package/src/execution/parallel-coordinator.ts +278 -0
  33. package/src/execution/parallel-executor-rectification-pass.ts +117 -0
  34. package/src/execution/parallel-executor-rectify.ts +135 -0
  35. package/src/execution/parallel-executor.ts +19 -211
  36. package/src/execution/parallel-worker.ts +148 -0
  37. package/src/execution/parallel.ts +5 -404
  38. package/src/execution/pid-registry.ts +3 -8
  39. package/src/execution/runner-completion.ts +160 -0
  40. package/src/execution/runner-execution.ts +221 -0
  41. package/src/execution/runner-setup.ts +82 -0
  42. package/src/execution/runner.ts +53 -202
  43. package/src/execution/timeout-handler.ts +100 -0
  44. package/src/hooks/runner.ts +11 -21
  45. package/src/metrics/tracker.ts +7 -30
  46. package/src/pipeline/runner.ts +2 -1
  47. package/src/pipeline/stages/completion.ts +0 -1
  48. package/src/pipeline/stages/context.ts +2 -1
  49. package/src/plugins/extensions.ts +225 -0
  50. package/src/plugins/loader.ts +2 -1
  51. package/src/plugins/types.ts +16 -221
  52. package/src/prd/index.ts +2 -1
  53. package/src/prd/validate.ts +41 -0
  54. package/src/precheck/checks-blockers.ts +15 -419
  55. package/src/precheck/checks-cli.ts +68 -0
  56. package/src/precheck/checks-config.ts +102 -0
  57. package/src/precheck/checks-git.ts +87 -0
  58. package/src/precheck/checks-system.ts +163 -0
  59. package/src/review/orchestrator.ts +19 -6
  60. package/src/review/runner.ts +17 -5
  61. package/src/routing/chain.ts +2 -1
  62. package/src/routing/loader.ts +2 -5
  63. package/src/tdd/orchestrator.ts +2 -1
  64. package/src/tdd/verdict-reader.ts +266 -0
  65. package/src/tdd/verdict.ts +6 -271
  66. package/src/utils/errors.ts +12 -0
  67. package/src/utils/git.ts +12 -5
  68. package/src/utils/json-file.ts +72 -0
  69. package/src/verification/executor.ts +2 -1
  70. package/src/verification/smart-runner.ts +23 -3
  71. package/src/worktree/manager.ts +9 -3
  72. package/src/worktree/merge.ts +3 -2
@@ -1,548 +1,17 @@
1
1
  /**
2
- * Prompts CLI Command
2
+ * Prompts CLI Commands
3
3
  *
4
- * Assembles prompts for all stories in a feature without executing agents.
5
- * Used for debugging prompt isolation and context leakage.
6
- *
7
- * Executes: routing → constitution → context → prompt stages only.
8
- */
9
-
10
- import { existsSync, mkdirSync } from "node:fs";
11
- import { join } from "node:path";
12
- import type { NaxConfig } from "../config";
13
- import { getLogger } from "../logger";
14
- import { runPipeline } from "../pipeline";
15
- import type { PipelineContext } from "../pipeline";
16
- import { constitutionStage, contextStage, promptStage, routingStage } from "../pipeline/stages";
17
- import type { UserStory } from "../prd";
18
- import { loadPRD } from "../prd";
19
- import { PromptBuilder } from "../prompts";
20
- import { buildRoleTaskSection } from "../prompts/sections/role-task";
21
-
22
- export interface PromptsCommandOptions {
23
- /** Feature name */
24
- feature: string;
25
- /** Working directory (project root) */
26
- workdir: string;
27
- /** Ngent configuration */
28
- config: NaxConfig;
29
- /** Optional: filter to single story ID */
30
- storyId?: string;
31
- /** Optional: output directory (stdout if not provided) */
32
- outputDir?: string;
33
- }
34
-
35
- /**
36
- * Execute the `nax prompts` command.
37
- *
38
- * Runs the pipeline through routing → constitution → context → prompt stages
39
- * for each story, then outputs the assembled prompts to stdout or files.
40
- *
41
- * @param options - Command options
42
- * @returns Array of story IDs that were processed
43
- *
44
- * @example
45
- * ```bash
46
- * # Dump all story prompts to stdout
47
- * nax prompts -f core
48
- *
49
- * # Write to directory
50
- * nax prompts -f core --out ./prompt-dump/
51
- *
52
- * # Single story
53
- * nax prompts -f core --story US-003
54
- * ```
55
- */
56
- export async function promptsCommand(options: PromptsCommandOptions): Promise<string[]> {
57
- const logger = getLogger();
58
- const { feature, workdir, config, storyId, outputDir } = options;
59
-
60
- // Find nax directory
61
- const naxDir = join(workdir, "nax");
62
- if (!existsSync(naxDir)) {
63
- throw new Error(`nax directory not found. Run 'nax init' first in ${workdir}`);
64
- }
65
-
66
- // Load PRD
67
- const featureDir = join(naxDir, "features", feature);
68
- const prdPath = join(featureDir, "prd.json");
69
-
70
- if (!existsSync(prdPath)) {
71
- throw new Error(`Feature "${feature}" not found or missing prd.json`);
72
- }
73
-
74
- const prd = await loadPRD(prdPath);
75
-
76
- // Filter stories
77
- const stories = storyId ? prd.userStories.filter((s) => s.id === storyId) : prd.userStories;
78
-
79
- if (stories.length === 0) {
80
- throw new Error(
81
- storyId ? `Story "${storyId}" not found in feature "${feature}"` : `No stories found in feature "${feature}"`,
82
- );
83
- }
84
-
85
- // Create output directory if specified
86
- if (outputDir) {
87
- mkdirSync(outputDir, { recursive: true });
88
- }
89
-
90
- logger.info("cli", "Assembling prompts", {
91
- feature,
92
- storyCount: stories.length,
93
- outputMode: outputDir ? "files" : "stdout",
94
- });
95
-
96
- // Process each story through the pipeline (routing → constitution → context → prompt)
97
- const processedStories: string[] = [];
98
- const promptPipeline = [routingStage, constitutionStage, contextStage, promptStage];
99
-
100
- for (const story of stories) {
101
- // Build initial pipeline context
102
- const ctx: PipelineContext = {
103
- config,
104
- prd,
105
- story,
106
- stories: [story], // Single story, not batch
107
- routing: {
108
- complexity: "simple",
109
- modelTier: "fast",
110
- testStrategy: "test-after",
111
- reasoning: "Placeholder routing",
112
- }, // Will be set by routingStage
113
- workdir,
114
- featureDir,
115
- hooks: { hooks: {} }, // Empty hooks config
116
- };
117
-
118
- // Run the prompt assembly pipeline
119
- const result = await runPipeline(promptPipeline, ctx);
120
-
121
- if (!result.success) {
122
- logger.warn("cli", "Failed to assemble prompt for story", {
123
- storyId: story.id,
124
- reason: result.reason,
125
- });
126
- continue;
127
- }
128
-
129
- // Handle three-session TDD stories separately
130
- if (ctx.routing.testStrategy === "three-session-tdd") {
131
- await handleThreeSessionTddPrompts(story, ctx, outputDir, logger);
132
- processedStories.push(story.id);
133
- continue;
134
- }
135
-
136
- // For non-TDD stories, ensure prompt was built
137
- if (!ctx.prompt) {
138
- logger.warn("cli", "No prompt generated for story", {
139
- storyId: story.id,
140
- });
141
- continue;
142
- }
143
-
144
- // Build YAML frontmatter
145
- const frontmatter = buildFrontmatter(story, ctx);
146
-
147
- // Full output: frontmatter + prompt
148
- const fullOutput = `---\n${frontmatter}---\n\n${ctx.prompt}`;
149
-
150
- // Write to file or stdout
151
- if (outputDir) {
152
- const promptFile = join(outputDir, `${story.id}.prompt.md`);
153
- await Bun.write(promptFile, fullOutput);
154
-
155
- // Also write context-only file for isolation audit
156
- if (ctx.contextMarkdown) {
157
- const contextFile = join(outputDir, `${story.id}.context.md`);
158
- const contextOutput = `---\n${frontmatter}---\n\n${ctx.contextMarkdown}`;
159
- await Bun.write(contextFile, contextOutput);
160
- }
161
-
162
- logger.info("cli", "Written prompt files", {
163
- storyId: story.id,
164
- promptFile,
165
- });
166
- } else {
167
- // Stdout mode: print separator + story ID + prompt
168
- console.log(`\n${"=".repeat(80)}`);
169
- console.log(`Story: ${story.id} — ${story.title}`);
170
- console.log("=".repeat(80));
171
- console.log(fullOutput);
172
- }
173
-
174
- processedStories.push(story.id);
175
- }
176
-
177
- logger.info("cli", "Prompt assembly complete", {
178
- processedCount: processedStories.length,
179
- });
180
-
181
- return processedStories;
182
- }
183
-
184
- /**
185
- * Build YAML frontmatter for a story prompt.
186
- *
187
- * Uses actual token counts from BuiltContext elements (computed by context builder
188
- * using CHARS_PER_TOKEN=3) rather than re-estimating independently.
189
- *
190
- * @param story - User story
191
- * @param ctx - Pipeline context after running prompt assembly
192
- * @param role - Optional role for three-session TDD (test-writer, implementer, verifier)
193
- * @returns YAML frontmatter string (without delimiters)
194
- */
195
- function buildFrontmatter(story: UserStory, ctx: PipelineContext, role?: string): string {
196
- const lines: string[] = [];
197
-
198
- lines.push(`storyId: ${story.id}`);
199
- lines.push(`title: "${story.title}"`);
200
- lines.push(`testStrategy: ${ctx.routing.testStrategy}`);
201
- lines.push(`modelTier: ${ctx.routing.modelTier}`);
202
-
203
- if (role) {
204
- lines.push(`role: ${role}`);
205
- }
206
-
207
- // Use actual token counts from BuiltContext if available
208
- const builtContext = ctx.builtContext;
209
- const contextTokens = builtContext?.totalTokens ?? 0;
210
- const promptTokens = ctx.prompt ? Math.ceil(ctx.prompt.length / 3) : 0;
211
-
212
- lines.push(`contextTokens: ${contextTokens}`);
213
- lines.push(`promptTokens: ${promptTokens}`);
214
-
215
- // Dependencies
216
- if (story.dependencies && story.dependencies.length > 0) {
217
- lines.push(`dependencies: [${story.dependencies.join(", ")}]`);
218
- }
219
-
220
- // Context elements breakdown from actual BuiltContext
221
- lines.push("contextElements:");
222
-
223
- if (builtContext) {
224
- for (const element of builtContext.elements) {
225
- lines.push(` - type: ${element.type}`);
226
- if (element.storyId) {
227
- lines.push(` storyId: ${element.storyId}`);
228
- }
229
- if (element.filePath) {
230
- lines.push(` filePath: ${element.filePath}`);
231
- }
232
- lines.push(` tokens: ${element.tokens}`);
233
- }
234
- }
235
-
236
- if (builtContext?.truncated) {
237
- lines.push("truncated: true");
238
- }
239
-
240
- return `${lines.join("\n")}\n`;
241
- }
242
-
243
- export interface PromptsInitCommandOptions {
244
- /** Working directory (project root) */
245
- workdir: string;
246
- /** Overwrite existing files if true */
247
- force?: boolean;
248
- /** Auto-wire prompts.overrides in nax.config.json (default: true) */
249
- autoWireConfig?: boolean;
250
- }
251
-
252
- const TEMPLATE_ROLES = [
253
- { file: "test-writer.md", role: "test-writer" as const },
254
- { file: "implementer.md", role: "implementer" as const, variant: "standard" as const },
255
- { file: "verifier.md", role: "verifier" as const },
256
- { file: "single-session.md", role: "single-session" as const },
257
- { file: "tdd-simple.md", role: "tdd-simple" as const },
258
- ] as const;
259
-
260
- const TEMPLATE_HEADER = `<!--
261
- This file controls the role-body section of the nax prompt for this role.
262
- Edit the content below to customize the task instructions given to the agent.
263
-
264
- NON-OVERRIDABLE SECTIONS (always injected by nax, cannot be changed here):
265
- - Isolation rules (scope, file access boundaries)
266
- - Story context (acceptance criteria, description, dependencies)
267
- - Conventions (project coding standards)
268
-
269
- To activate overrides, add to your nax/config.json:
270
- { "prompts": { "overrides": { "<role>": "nax/templates/<role>.md" } } }
271
- -->
272
-
273
- `;
274
-
275
- /**
276
- * Execute the `nax prompts --init` command.
277
- *
278
- * Creates nax/templates/ and writes 5 default role-body template files
279
- * (test-writer, implementer, verifier, single-session, tdd-simple).
280
- * Auto-wires prompts.overrides in nax.config.json if the file exists and overrides are not already set.
281
- * Returns the list of file paths written. Returns empty array if files
282
- * already exist and force is not set.
283
- *
284
- * @param options - Command options
285
- * @returns Array of file paths written
286
- */
287
- export async function promptsInitCommand(options: PromptsInitCommandOptions): Promise<string[]> {
288
- const { workdir, force = false, autoWireConfig = true } = options;
289
- const templatesDir = join(workdir, "nax", "templates");
290
-
291
- mkdirSync(templatesDir, { recursive: true });
292
-
293
- // Check for existing files
294
- const existingFiles = TEMPLATE_ROLES.map((t) => t.file).filter((f) => existsSync(join(templatesDir, f)));
295
-
296
- if (existingFiles.length > 0 && !force) {
297
- console.warn(
298
- `[WARN] nax/templates/ already contains files: ${existingFiles.join(", ")}. No files overwritten.\n Pass --force to overwrite existing templates.`,
299
- );
300
- return [];
301
- }
302
-
303
- const written: string[] = [];
304
-
305
- for (const template of TEMPLATE_ROLES) {
306
- const filePath = join(templatesDir, template.file);
307
- const roleBody =
308
- template.role === "implementer"
309
- ? buildRoleTaskSection(template.role, template.variant)
310
- : buildRoleTaskSection(template.role);
311
- const content = TEMPLATE_HEADER + roleBody;
312
- await Bun.write(filePath, content);
313
- written.push(filePath);
314
- }
315
-
316
- console.log(`[OK] Written ${written.length} template files to nax/templates/:`);
317
- for (const filePath of written) {
318
- console.log(` - ${filePath.replace(`${workdir}/`, "")}`);
319
- }
320
-
321
- // Auto-wire prompts.overrides in nax.config.json (if enabled)
322
- if (autoWireConfig) {
323
- await autoWirePromptsConfig(workdir);
324
- }
325
-
326
- return written;
327
- }
328
-
329
- /**
330
- * Auto-wire prompts.overrides in nax.config.json after template init.
331
- *
332
- * If nax.config.json exists and prompts.overrides is not already set,
333
- * add the override paths. If overrides are already set, print a note.
334
- * If nax.config.json doesn't exist, print manual instructions.
335
- *
336
- * @param workdir - Project working directory
4
+ * Re-exports prompts-related commands for assembling, initializing, and exporting prompts.
337
5
  */
338
- async function autoWirePromptsConfig(workdir: string): Promise<void> {
339
- const configPath = join(workdir, "nax.config.json");
340
-
341
- // If config file doesn't exist, print manual instructions
342
- if (!existsSync(configPath)) {
343
- const exampleConfig = JSON.stringify(
344
- {
345
- prompts: {
346
- overrides: {
347
- "test-writer": "nax/templates/test-writer.md",
348
- implementer: "nax/templates/implementer.md",
349
- verifier: "nax/templates/verifier.md",
350
- "single-session": "nax/templates/single-session.md",
351
- "tdd-simple": "nax/templates/tdd-simple.md",
352
- },
353
- },
354
- },
355
- null,
356
- 2,
357
- );
358
- console.log(`\nNo nax.config.json found. To activate overrides, create nax/config.json with:\n${exampleConfig}`);
359
- return;
360
- }
361
-
362
- // Read existing config
363
- const configFile = Bun.file(configPath);
364
- const configContent = await configFile.text();
365
- const config = JSON.parse(configContent);
366
-
367
- // Check if prompts.overrides is already set
368
- if (config.prompts?.overrides && Object.keys(config.prompts.overrides).length > 0) {
369
- console.log(
370
- "[INFO] prompts.overrides already configured in nax.config.json. Skipping auto-wiring.\n" +
371
- " To reset overrides, remove the prompts.overrides section and re-run this command.",
372
- );
373
- return;
374
- }
375
-
376
- // Build the override paths
377
- const overrides = {
378
- "test-writer": "nax/templates/test-writer.md",
379
- implementer: "nax/templates/implementer.md",
380
- verifier: "nax/templates/verifier.md",
381
- "single-session": "nax/templates/single-session.md",
382
- "tdd-simple": "nax/templates/tdd-simple.md",
383
- };
384
-
385
- // Add or update prompts section
386
- if (!config.prompts) {
387
- config.prompts = {};
388
- }
389
- config.prompts.overrides = overrides;
390
-
391
- // Write config with custom formatting that avoids 4-space indentation
392
- // by putting the overrides object on a single line
393
- const updatedConfig = formatConfigJson(config);
394
- await Bun.write(configPath, updatedConfig);
395
-
396
- console.log("[OK] Auto-wired prompts.overrides in nax.config.json");
397
- }
398
-
399
- /**
400
- * Format config JSON with 2-space indentation, keeping overrides object inline.
401
- *
402
- * This avoids 4-space indentation by putting the overrides object on the same line.
403
- *
404
- * @param config - Configuration object
405
- * @returns Formatted JSON string
406
- */
407
- function formatConfigJson(config: Record<string, unknown>): string {
408
- const lines: string[] = ["{"];
409
-
410
- const keys = Object.keys(config);
411
- for (let i = 0; i < keys.length; i++) {
412
- const key = keys[i];
413
- const value = config[key];
414
- const isLast = i === keys.length - 1;
415
-
416
- if (key === "prompts" && typeof value === "object" && value !== null) {
417
- // Special handling for prompts object - keep overrides inline
418
- const promptsObj = value as Record<string, unknown>;
419
- if (promptsObj.overrides) {
420
- const overridesJson = JSON.stringify(promptsObj.overrides);
421
- lines.push(` "${key}": { "overrides": ${overridesJson} }${isLast ? "" : ","}`);
422
- } else {
423
- lines.push(` "${key}": ${JSON.stringify(value)}${isLast ? "" : ","}`);
424
- }
425
- } else {
426
- lines.push(` "${key}": ${JSON.stringify(value)}${isLast ? "" : ","}`);
427
- }
428
- }
429
-
430
- lines.push("}");
431
- return lines.join("\n");
432
- }
433
-
434
- const VALID_EXPORT_ROLES = ["test-writer", "implementer", "verifier", "single-session", "tdd-simple"] as const;
435
-
436
- export interface ExportPromptCommandOptions {
437
- /** Role to export prompt for */
438
- role: string;
439
- /** Optional output file path (stdout if not provided) */
440
- out?: string;
441
- }
442
-
443
- /**
444
- * Execute the `nax prompts --export <role>` command.
445
- *
446
- * Builds the full default prompt for the given role using a stub story
447
- * and empty context, then writes it to stdout or a file.
448
- *
449
- * @param options - Command options
450
- */
451
- export async function exportPromptCommand(options: ExportPromptCommandOptions): Promise<void> {
452
- const { role, out } = options;
453
-
454
- if (!VALID_EXPORT_ROLES.includes(role as (typeof VALID_EXPORT_ROLES)[number])) {
455
- console.error(`[ERROR] Invalid role: "${role}". Valid roles: ${VALID_EXPORT_ROLES.join(", ")}`);
456
- process.exit(1);
457
- }
458
-
459
- const stubStory: UserStory = {
460
- id: "EXAMPLE",
461
- title: "Example story",
462
- description: "Story ID: EXAMPLE. This is a placeholder story used to demonstrate the default prompt.",
463
- acceptanceCriteria: ["AC-1: Example criterion"],
464
- tags: [],
465
- dependencies: [],
466
- status: "pending",
467
- passes: false,
468
- escalations: [],
469
- attempts: 0,
470
- };
471
-
472
- const prompt = await PromptBuilder.for(role as (typeof VALID_EXPORT_ROLES)[number])
473
- .story(stubStory)
474
- .build();
475
-
476
- if (out) {
477
- await Bun.write(out, prompt);
478
- console.log(`[OK] Exported prompt for "${role}" to ${out}`);
479
- } else {
480
- console.log(prompt);
481
- }
482
- }
483
-
484
- /**
485
- * Handle three-session TDD prompts by building separate prompts for each role.
486
- *
487
- * @param story - User story
488
- * @param ctx - Pipeline context
489
- * @param outputDir - Output directory (undefined for stdout)
490
- * @param logger - Logger instance
491
- */
492
- async function handleThreeSessionTddPrompts(
493
- story: UserStory,
494
- ctx: PipelineContext,
495
- outputDir: string | undefined,
496
- logger: ReturnType<typeof getLogger>,
497
- ): Promise<void> {
498
- // Build prompts for each session using PromptBuilder
499
- const [testWriterPrompt, implementerPrompt, verifierPrompt] = await Promise.all([
500
- PromptBuilder.for("test-writer", { isolation: "strict" })
501
- .withLoader(ctx.workdir, ctx.config)
502
- .story(story)
503
- .context(ctx.contextMarkdown)
504
- .build(),
505
- PromptBuilder.for("implementer", { variant: "standard" })
506
- .withLoader(ctx.workdir, ctx.config)
507
- .story(story)
508
- .context(ctx.contextMarkdown)
509
- .build(),
510
- PromptBuilder.for("verifier").withLoader(ctx.workdir, ctx.config).story(story).context(ctx.contextMarkdown).build(),
511
- ]);
512
-
513
- const sessions = [
514
- { role: "test-writer", prompt: testWriterPrompt },
515
- { role: "implementer", prompt: implementerPrompt },
516
- { role: "verifier", prompt: verifierPrompt },
517
- ];
518
6
 
519
- for (const session of sessions) {
520
- const frontmatter = buildFrontmatter(story, ctx, session.role);
521
- const fullOutput = `---\n${frontmatter}---\n\n${session.prompt}`;
7
+ // Main prompts command exports
8
+ export { promptsCommand, buildFrontmatter, type PromptsCommandOptions } from "./prompts-main";
522
9
 
523
- if (outputDir) {
524
- const promptFile = join(outputDir, `${story.id}.${session.role}.md`);
525
- await Bun.write(promptFile, fullOutput);
10
+ // Init command exports
11
+ export { promptsInitCommand, type PromptsInitCommandOptions } from "./prompts-init";
526
12
 
527
- logger.info("cli", "Written TDD prompt file", {
528
- storyId: story.id,
529
- role: session.role,
530
- promptFile,
531
- });
532
- } else {
533
- // Stdout mode: print separator + story ID + role + prompt
534
- console.log(`\n${"=".repeat(80)}`);
535
- console.log(`Story: ${story.id} — ${story.title} [${session.role}]`);
536
- console.log("=".repeat(80));
537
- console.log(fullOutput);
538
- }
539
- }
13
+ // Export command exports
14
+ export { exportPromptCommand, type ExportPromptCommandOptions } from "./prompts-export";
540
15
 
541
- // Also write context-only file for isolation audit
542
- if (outputDir && ctx.contextMarkdown) {
543
- const contextFile = join(outputDir, `${story.id}.context.md`);
544
- const frontmatter = buildFrontmatter(story, ctx);
545
- const contextOutput = `---\n${frontmatter}---\n\n${ctx.contextMarkdown}`;
546
- await Bun.write(contextFile, contextOutput);
547
- }
548
- }
16
+ // TDD handling exports
17
+ export { handleThreeSessionTddPrompts } from "./prompts-tdd";