@bastani/atomic 0.9.0-alpha.2 → 0.9.0-alpha.4

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 (95) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/builtin/cursor/package.json +2 -2
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/mcp/package.json +1 -1
  5. package/dist/builtin/subagents/package.json +1 -1
  6. package/dist/builtin/web-access/package.json +1 -1
  7. package/dist/builtin/workflows/CHANGELOG.md +24 -0
  8. package/dist/builtin/workflows/README.md +12 -12
  9. package/dist/builtin/workflows/builtin/goal-ledger.ts +2 -0
  10. package/dist/builtin/workflows/builtin/goal-prompts.ts +8 -0
  11. package/dist/builtin/workflows/builtin/goal-reports.ts +5 -0
  12. package/dist/builtin/workflows/builtin/goal-runner.ts +103 -4
  13. package/dist/builtin/workflows/builtin/goal-types.ts +4 -0
  14. package/dist/builtin/workflows/builtin/goal.d.ts +4 -0
  15. package/dist/builtin/workflows/builtin/goal.ts +14 -2
  16. package/dist/builtin/workflows/builtin/index.d.ts +8 -8
  17. package/dist/builtin/workflows/builtin/open-claude-design-feedback.ts +359 -0
  18. package/dist/builtin/workflows/builtin/open-claude-design-phases.ts +254 -352
  19. package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +256 -414
  20. package/dist/builtin/workflows/builtin/open-claude-design-setup.ts +272 -0
  21. package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +58 -68
  22. package/dist/builtin/workflows/builtin/open-claude-design.d.ts +5 -9
  23. package/dist/builtin/workflows/builtin/open-claude-design.ts +14 -26
  24. package/dist/builtin/workflows/builtin/prompt-refinement.ts +102 -0
  25. package/dist/builtin/workflows/builtin/ralph-core.ts +6 -4
  26. package/dist/builtin/workflows/builtin/ralph-runner.ts +22 -24
  27. package/dist/builtin/workflows/builtin/ralph.d.ts +2 -0
  28. package/dist/builtin/workflows/builtin/ralph.ts +3 -1
  29. package/dist/builtin/workflows/package.json +1 -1
  30. package/dist/builtin/workflows/skills/impeccable/SKILL.md +14 -23
  31. package/dist/builtin/workflows/skills/impeccable/reference/brand.md +2 -2
  32. package/dist/builtin/workflows/skills/impeccable/reference/live.md +25 -4
  33. package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +1 -1
  34. package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +724 -29
  35. package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +1 -1
  36. package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +219 -7
  37. package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +57 -11
  38. package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +750 -0
  39. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +648 -53
  40. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns.mjs +7 -0
  41. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +29 -4
  42. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +44 -11
  43. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +29 -0
  44. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +27 -1
  45. package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +1 -1
  46. package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +29 -0
  47. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +401 -46
  48. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/inline-ignores.mjs +148 -0
  49. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +6 -6
  50. package/dist/builtin/workflows/skills/impeccable/scripts/{design-parser.mjs → lib/design-parser.mjs} +8 -1
  51. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +638 -0
  52. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-paths.mjs +128 -0
  53. package/dist/builtin/workflows/skills/impeccable/scripts/{is-generated.mjs → lib/is-generated.mjs} +2 -2
  54. package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-args.mjs +42 -0
  55. package/dist/builtin/workflows/skills/impeccable/scripts/live/browser-script-parts.mjs +49 -0
  56. package/dist/builtin/workflows/skills/impeccable/scripts/{live-completion.mjs → live/completion.mjs} +1 -0
  57. package/dist/builtin/workflows/skills/impeccable/scripts/{live-event-validation.mjs → live/event-validation.mjs} +6 -5
  58. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-apply.mjs +939 -0
  59. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-edit-routes.mjs +357 -0
  60. package/dist/builtin/workflows/skills/impeccable/scripts/{live-manual-edits-buffer.mjs → live/manual-edits-buffer.mjs} +1 -1
  61. package/dist/builtin/workflows/skills/impeccable/scripts/{live-session-store.mjs → live/session-store.mjs} +21 -3
  62. package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-component.mjs +835 -0
  63. package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +274 -0
  64. package/dist/builtin/workflows/skills/impeccable/scripts/live/ui-core.mjs +180 -0
  65. package/dist/builtin/workflows/skills/impeccable/scripts/live/vocabulary.mjs +36 -0
  66. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +185 -60
  67. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-dom.js +146 -0
  68. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +3369 -1026
  69. package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +2 -2
  70. package/dist/builtin/workflows/skills/impeccable/scripts/live-complete.mjs +2 -2
  71. package/dist/builtin/workflows/skills/impeccable/scripts/live-discard-manual-edits.mjs +1 -1
  72. package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +133 -9
  73. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +42 -2
  74. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +4 -4
  75. package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +21 -15
  76. package/dist/builtin/workflows/skills/impeccable/scripts/live-resume.mjs +1 -1
  77. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +205 -1269
  78. package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +2 -2
  79. package/dist/builtin/workflows/skills/impeccable/scripts/live-target.mjs +30 -0
  80. package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +69 -26
  81. package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +73 -22
  82. package/dist/builtin/workflows/src/extension/workflow-prompts.ts +3 -1
  83. package/dist/core/atomic-guide-command.d.ts.map +1 -1
  84. package/dist/core/atomic-guide-command.js +5 -5
  85. package/dist/core/atomic-guide-command.js.map +1 -1
  86. package/dist/core/system-prompt.d.ts.map +1 -1
  87. package/dist/core/system-prompt.js +0 -1
  88. package/dist/core/system-prompt.js.map +1 -1
  89. package/docs/index.md +2 -2
  90. package/docs/quickstart.md +9 -9
  91. package/docs/workflows.md +816 -47
  92. package/package.json +2 -2
  93. package/dist/builtin/workflows/skills/impeccable/scripts/cleanup-deprecated.mjs +0 -284
  94. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable-paths.mjs +0 -126
  95. /package/dist/builtin/workflows/skills/impeccable/scripts/{live-insert-ui.mjs → live/insert-ui.mjs} +0 -0
@@ -3,8 +3,8 @@
3
3
  * Print durable recovery status for Impeccable live sessions.
4
4
  */
5
5
 
6
- import { createLiveSessionStore } from './live-session-store.mjs';
7
- import { readLiveServerInfo } from './impeccable-paths.mjs';
6
+ import { createLiveSessionStore } from './live/session-store.mjs';
7
+ import { readLiveServerInfo } from './lib/impeccable-paths.mjs';
8
8
  import { manualApplyResumeHint } from './live-resume.mjs';
9
9
 
10
10
  function readServerInfo() {
@@ -0,0 +1,30 @@
1
+ import path from 'node:path';
2
+ import { resolveProjectRoot } from './context.mjs';
3
+ import { parseTargetPath } from './lib/target-args.mjs';
4
+
5
+ export function resolveLiveTarget(cwd = process.cwd(), args = []) {
6
+ const originalCwd = path.resolve(cwd);
7
+ let targetPath = null;
8
+ try {
9
+ targetPath = parseTargetPath(args, { strict: true });
10
+ } catch (err) {
11
+ if (err?.name === 'TargetArgError') {
12
+ process.stderr.write(`${err.message}\n`);
13
+ process.exit(1);
14
+ }
15
+ throw err;
16
+ }
17
+ const absoluteTargetPath = targetPath
18
+ ? path.isAbsolute(targetPath) ? targetPath : path.resolve(originalCwd, targetPath)
19
+ : null;
20
+ const projectRoot = targetPath
21
+ ? resolveProjectRoot(originalCwd, { targetPath: absoluteTargetPath })
22
+ : originalCwd;
23
+ return {
24
+ originalCwd,
25
+ projectRoot,
26
+ targetPath,
27
+ absoluteTargetPath,
28
+ targetOptions: absoluteTargetPath ? { targetPath: absoluteTargetPath } : {},
29
+ };
30
+ }
@@ -2,7 +2,7 @@
2
2
  * CLI helper: find an element in source and wrap it in a variant container.
3
3
  *
4
4
  * Usage:
5
- * npx impeccable wrap --id SESSION_ID --count N --query "hero-combined-left" [--file path]
5
+ * node <scripts_path>/live-wrap.mjs --id SESSION_ID --count N --query "hero-combined-left" [--file path]
6
6
  *
7
7
  * Searches project files for the element matching the query (class name, ID, or
8
8
  * text snippet), wraps it with the variant scaffolding, and prints the file path
@@ -13,8 +13,13 @@
13
13
 
14
14
  import fs from 'node:fs';
15
15
  import path from 'node:path';
16
- import { isGeneratedFile } from './is-generated.mjs';
17
- import { readBuffer as readManualEditsBuffer } from './live-manual-edits-buffer.mjs';
16
+ import { isGeneratedFile } from './lib/is-generated.mjs';
17
+ import { readBuffer as readManualEditsBuffer } from './live/manual-edits-buffer.mjs';
18
+ import {
19
+ buildSvelteComponentCssAuthoring,
20
+ scaffoldSvelteComponentSession,
21
+ shouldUseSvelteComponentInjection,
22
+ } from './live/svelte-component.mjs';
18
23
 
19
24
  const EXTENSIONS = ['.html', '.jsx', '.tsx', '.vue', '.svelte', '.astro'];
20
25
 
@@ -262,6 +267,8 @@ The agent should insert variant HTML at insertLine.`);
262
267
  .map((l) => (l.trim() === '' ? '' : indent + extra + l.slice(originalBaseIndent)))
263
268
  .join('\n');
264
269
  const originalIndented = reindentOriginal(' ');
270
+ const relTargetFile = path.relative(process.cwd(), targetFile).split(path.sep).join('/');
271
+ const useSvelteComponent = shouldUseSvelteComponentInjection(targetFile);
265
272
 
266
273
  // Wrapper attributes differ by syntax. HTML allows plain string attrs;
267
274
  // JSX requires object-literal style and parses string attrs as HTML (which
@@ -302,38 +309,74 @@ The agent should insert variant HTML at insertLine.`);
302
309
  indent + commentSyntax.open + ' impeccable-variants-end ' + id + ' ' + commentSyntax.close,
303
310
  ];
304
311
 
305
- // Replace the original element with the wrapper
306
- const newLines = [
307
- ...lines.slice(0, startLine),
308
- ...wrapperLines,
309
- ...lines.slice(endLine + 1),
310
- ];
311
- fs.writeFileSync(targetFile, newLines.join('\n'), 'utf-8');
312
+ let outputFile = targetFile;
313
+ let outputStartLine = startLine + 1;
314
+ let outputEndLine = startLine + wrapperLines.length + (originalLines.length - 1);
315
+ let insertLine;
316
+ let svelteSession = null;
317
+
318
+ if (useSvelteComponent) {
319
+ // Svelte/SvelteKit resets component-local state on markup HMR updates.
320
+ // Keep generation source-neutral: agents write real variant components
321
+ // under the generated componentDir, the browser mounts them into the live
322
+ // DOM, and live-accept.mjs inlines the accepted variant back into the route.
323
+ svelteSession = scaffoldSvelteComponentSession({
324
+ id,
325
+ count,
326
+ sourceFile: relTargetFile,
327
+ sourceStartLine: startLine + 1,
328
+ sourceEndLine: endLine + 1,
329
+ originalLines,
330
+ cwd: process.cwd(),
331
+ });
332
+ outputFile = path.resolve(process.cwd(), svelteSession.manifestFile);
333
+ outputStartLine = 1;
334
+ outputEndLine = 1;
335
+ insertLine = 1;
336
+ } else {
337
+ // Replace the original element with the wrapper
338
+ const newLines = [
339
+ ...lines.slice(0, startLine),
340
+ ...wrapperLines,
341
+ ...lines.slice(endLine + 1),
342
+ ];
343
+ fs.writeFileSync(targetFile, newLines.join('\n'), 'utf-8');
312
344
 
313
- // Calculate insert line (the "insert below this line" comment).
314
- // 0-indexed file position. Both HTML and JSX wrappers have 6 lines above
315
- // the insert marker (HTML: start-comment + outer-div + Original-comment +
316
- // original-div + content + close-original-div; JSX: outer-div +
317
- // start-comment + Original-comment + original-div + content +
318
- // close-original-div). Multi-line originals push the marker by their
319
- // extra line count.
320
- const insertLine = startLine + 6 + (originalLines.length - 1);
345
+ // Calculate insert line (the "insert below this line" comment).
346
+ // 0-indexed file position. Both HTML and JSX wrappers have 6 lines above
347
+ // the insert marker (HTML: start-comment + outer-div + Original-comment +
348
+ // original-div + content + close-original-div; JSX: outer-div +
349
+ // start-comment + Original-comment + original-div + content +
350
+ // close-original-div). Multi-line originals push the marker by their
351
+ // extra line count.
352
+ insertLine = startLine + 6 + (originalLines.length - 1) + 1;
353
+ }
354
+
355
+ const outputRelFile = path.relative(process.cwd(), outputFile).split(path.sep).join('/');
356
+
357
+ const svelteComponentAuthoring = useSvelteComponent ? buildSvelteComponentCssAuthoring(count) : null;
321
358
 
322
359
  console.log(JSON.stringify({
323
- file: path.relative(process.cwd(), targetFile),
324
- startLine: startLine + 1, // 1-indexed for the agent
360
+ file: outputRelFile,
361
+ sourceFile: useSvelteComponent ? relTargetFile : undefined,
362
+ previewMode: useSvelteComponent ? 'svelte-component' : undefined,
363
+ componentDir: svelteSession?.componentDir,
364
+ propContract: svelteSession?.propContract,
365
+ sourceStartLine: useSvelteComponent ? startLine + 1 : undefined,
366
+ sourceEndLine: useSvelteComponent ? endLine + 1 : undefined,
367
+ startLine: outputStartLine, // 1-indexed for the agent
325
368
  // wrapperLines is an array but one element (the original-content slot)
326
369
  // is a `\n`-joined multi-line string, so the actual file-row count is
327
370
  // wrapperLines.length + (originalLines.length - 1). Without the offset,
328
371
  // endLine pointed inside the wrapper for any picked element that
329
372
  // spanned more than one source line.
330
- endLine: startLine + wrapperLines.length + (originalLines.length - 1), // 1-indexed
331
- insertLine: insertLine + 1, // 1-indexed: where variants go
373
+ endLine: outputEndLine, // 1-indexed
374
+ insertLine, // 1-indexed: where variants go
332
375
  commentSyntax: commentSyntax,
333
- styleMode: styleMode.mode,
334
- styleTag: styleMode.styleTag,
335
- cssSelectorPrefixExamples: buildCssSelectorPrefixExamples(styleMode.mode, count),
336
- cssAuthoring: buildCssAuthoring(styleMode, count),
376
+ styleMode: useSvelteComponent ? 'svelte-component' : styleMode.mode,
377
+ styleTag: useSvelteComponent ? null : styleMode.styleTag,
378
+ cssSelectorPrefixExamples: useSvelteComponent ? [] : buildCssSelectorPrefixExamples(styleMode.mode, count),
379
+ cssAuthoring: useSvelteComponent ? svelteComponentAuthoring : buildCssAuthoring(styleMode, count),
337
380
  originalLineCount: originalLines.length,
338
381
  }));
339
382
  }
@@ -21,14 +21,16 @@ import { execSync } from 'node:child_process';
21
21
  import fs from 'node:fs';
22
22
  import path from 'node:path';
23
23
  import { fileURLToPath } from 'node:url';
24
- import { loadContext } from './context.mjs';
24
+ import { loadContext, resolveTargetSelection } from './context.mjs';
25
25
  import { resolveFiles } from './live-inject.mjs';
26
- import { readLiveServerInfo } from './impeccable-paths.mjs';
26
+ import { readLiveServerInfo } from './lib/impeccable-paths.mjs';
27
+ import { resolveLiveTarget } from './live-target.mjs';
27
28
 
28
29
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
29
30
 
30
31
  async function liveCli() {
31
32
  const args = process.argv.slice(2);
33
+ const liveTarget = resolveLiveTarget(process.cwd(), args);
32
34
 
33
35
  if (args.includes('--help') || args.includes('-h')) {
34
36
  console.log(`Usage: node live.mjs
@@ -38,37 +40,78 @@ Prepare everything for live variant mode in a single command:
38
40
  - Starts (or reuses) the live server in the background
39
41
  - Injects the browser script tag
40
42
  - Reads PRODUCT.md / DESIGN.md for project context
43
+ - In monorepos, choose a child app first; --target <path> is the fallback/manual path
41
44
 
42
45
  On success, prints a JSON blob with:
43
- { ok, serverPort, serverToken, pageFile, hasContext, context }
46
+ { ok, serverPort, serverToken, pageFiles, projectRoot, repoRoot, targetPath, productPath, designPath }
47
+
48
+ On target_selection_required, prints:
49
+ { ok: false, error: "target_selection_required", targetCandidates }
44
50
 
45
51
  On config_missing, prints:
46
52
  { ok: false, error: "config_missing", configPath, hint }
47
53
 
48
54
  The agent should then:
49
- 1. If config_missing, create the config and re-run this script
50
- 2. Optionally open the project's dev/preview URL in the browser (see reference/live.md—not serverPort)
51
- 3. Enter the poll loop: node live-poll.mjs`);
55
+ 1. If target_selection_required, ask which app to use and rerun from that child cwd
56
+ 2. If config_missing, create the config and re-run this script
57
+ 3. Optionally open the project's dev/preview URL in the browser (see reference/live.md—not serverPort)
58
+ 4. Enter the poll loop: node live-poll.mjs`);
59
+ process.exit(0);
60
+ }
61
+
62
+ const targetSelection = resolveTargetSelection(liveTarget.originalCwd, liveTarget.targetOptions);
63
+ if (targetSelection) {
64
+ console.log(JSON.stringify({
65
+ ok: false,
66
+ error: 'target_selection_required',
67
+ ...targetSelection,
68
+ hint: 'Ask the user which app Impeccable should use, then rerun live from that child app cwd. Use --target <path> only as a fallback or explicit path diagnostic.',
69
+ }, null, 2));
70
+ process.exit(0);
71
+ }
72
+
73
+ const ctx = loadContext(liveTarget.originalCwd, liveTarget.targetOptions);
74
+ const activeCwd = ctx.projectRoot;
75
+ const outputTargetPath = liveTarget.targetPath || null;
76
+
77
+ const missingContext = missingLiveContext(ctx);
78
+ if (missingContext.length > 0) {
79
+ console.log(JSON.stringify({
80
+ ok: false,
81
+ error: 'context_missing',
82
+ missing: missingContext,
83
+ nextCommand: missingContext.includes('PRODUCT.md') ? 'init' : 'document',
84
+ targetPath: outputTargetPath,
85
+ projectRoot: ctx.projectRoot,
86
+ repoRoot: ctx.repoRoot,
87
+ productPath: ctx.productPath,
88
+ designPath: ctx.designPath,
89
+ }, null, 2));
52
90
  process.exit(0);
53
91
  }
54
92
 
55
93
  // 1. Check config (fail fast if missing — no point starting anything else)
56
- const checkOut = runScript('live-inject.mjs', ['--check']);
94
+ const checkOut = runScript('live-inject.mjs', ['--check'], { cwd: activeCwd });
57
95
  const checkResult = safeParse(checkOut);
58
96
  if (!checkResult || !checkResult.ok) {
59
- console.log(JSON.stringify(checkResult || { ok: false, error: 'check_failed', raw: checkOut }));
97
+ console.log(JSON.stringify({
98
+ ...(checkResult || { ok: false, error: 'check_failed', raw: checkOut }),
99
+ targetPath: outputTargetPath,
100
+ projectRoot: ctx.projectRoot,
101
+ repoRoot: ctx.repoRoot,
102
+ }));
60
103
  process.exit(0);
61
104
  }
62
105
 
63
106
  // 2. Start server (or reuse existing)
64
- const serverInfo = ensureServerRunning();
107
+ const serverInfo = ensureServerRunning(activeCwd);
65
108
  if (!serverInfo) {
66
109
  console.log(JSON.stringify({ ok: false, error: 'server_start_failed' }));
67
110
  process.exit(1);
68
111
  }
69
112
 
70
113
  // 3. Inject the script tag at the current port
71
- const injectOut = runScript('live-inject.mjs', ['--port', String(serverInfo.port)]);
114
+ const injectOut = runScript('live-inject.mjs', ['--port', String(serverInfo.port)], { cwd: activeCwd });
72
115
  const injectResult = safeParse(injectOut);
73
116
  if (!injectResult || !injectResult.ok) {
74
117
  console.log(JSON.stringify({
@@ -80,22 +123,23 @@ The agent should then:
80
123
  process.exit(1);
81
124
  }
82
125
 
83
- // 4. Load PRODUCT.md + DESIGN.md context.
84
- const ctx = loadContext(process.cwd());
85
-
86
- // 5. Compute drift-heal: compare resolved inject targets against the
126
+ // 4. Compute drift-heal: compare resolved inject targets against the
87
127
  // project's HTML files. Orphans are HTML files not covered by config.
88
128
  // Warning only — the agent decides whether to act.
89
- const resolvedFiles = resolveFiles(process.cwd(), checkResult.config);
90
- const drift = scanForDrift(process.cwd(), resolvedFiles, checkResult.config);
129
+ const resolvedFiles = resolveFiles(activeCwd, checkResult.config);
130
+ const drift = scanForDrift(activeCwd, resolvedFiles, checkResult.config);
91
131
 
92
- // 6. Emit everything the agent needs
132
+ // 5. Emit everything the agent needs
93
133
  console.log(JSON.stringify({
94
134
  ok: true,
95
135
  serverPort: serverInfo.port,
96
136
  serverToken: serverInfo.token,
97
137
  pageFiles: resolvedFiles,
138
+ liveConfigPath: checkResult.path,
98
139
  configDrift: drift,
140
+ targetPath: outputTargetPath,
141
+ projectRoot: ctx.projectRoot,
142
+ repoRoot: ctx.repoRoot,
99
143
  hasProduct: ctx.hasProduct,
100
144
  product: ctx.product,
101
145
  productPath: ctx.productPath,
@@ -105,6 +149,13 @@ The agent should then:
105
149
  }, null, 2));
106
150
  }
107
151
 
152
+ function missingLiveContext(ctx) {
153
+ const missing = [];
154
+ if (!ctx.hasProduct) missing.push('PRODUCT.md');
155
+ if (!ctx.hasDesign) missing.push('DESIGN.md');
156
+ return missing;
157
+ }
158
+
108
159
  /**
109
160
  * Drift-heal scan. Walks the project for HTML files under common
110
161
  * page-source directories (public/, src/, app/, pages/) and reports any
@@ -201,11 +252,11 @@ function globToRegex(pattern) {
201
252
  // Helpers
202
253
  // ---------------------------------------------------------------------------
203
254
 
204
- function runScript(name, args) {
255
+ function runScript(name, args, options = {}) {
205
256
  const scriptPath = path.join(__dirname, name);
206
257
  const cmd = `node "${scriptPath}" ${args.map(a => `"${a}"`).join(' ')}`;
207
258
  try {
208
- return execSync(cmd, { encoding: 'utf-8', cwd: process.cwd(), timeout: 15_000 });
259
+ return execSync(cmd, { encoding: 'utf-8', cwd: options.cwd || process.cwd(), timeout: 15_000 });
209
260
  } catch (err) {
210
261
  // execSync throws on non-zero exit; return stdout if any
211
262
  return err.stdout || err.message || '';
@@ -219,10 +270,10 @@ function safeParse(out) {
219
270
  /**
220
271
  * Return { pid, port, token } for the running live server, starting one if needed.
221
272
  */
222
- function ensureServerRunning() {
273
+ function ensureServerRunning(cwd = process.cwd()) {
223
274
  // Try to reuse an existing server
224
275
  try {
225
- const existing = readLiveServerInfo(process.cwd())?.info;
276
+ const existing = readLiveServerInfo(cwd)?.info;
226
277
  if (existing && existing.pid) {
227
278
  try {
228
279
  process.kill(existing.pid, 0); // throws if dead
@@ -232,7 +283,7 @@ function ensureServerRunning() {
232
283
  } catch { /* no PID file */ }
233
284
 
234
285
  // Start a new server
235
- const out = runScript('live-server.mjs', ['--background']);
286
+ const out = runScript('live-server.mjs', ['--background'], { cwd });
236
287
  return safeParse(out);
237
288
  }
238
289
 
@@ -19,5 +19,7 @@ export const DEFAULT_PROMPT_GUIDANCE: string[] = [
19
19
  - For transcripts, avoid reading whole session transcripts at once. Use \`stages\` or \`stage\` to get \`sessionFile\`/\`transcriptPath\`, quote the exact path without rewriting separators (preserve Windows backslashes), search it with \`rg\`/\`grep\`, and read small relevant ranges; use \`transcript\` with explicit \`tail\` or \`limit\` only for quick recent-context checks.
20
20
  - If a user asks to create or edit a workflow, use the create-spec skill when available and ask detailed clarifying questions until you understand its purpose, inputs, stages, handoffs, validation, success criteria, and selected starter pattern. Then read the workflow docs/examples and implement the workflow from the created spec directly as a TypeScript definition. After you implement the workflow, reload it to access it and run it with test inputs to validate it works as intended before presenting it to the user.
21
21
  - Tip: when designing workflows, implement it in a way that you pass information from stage to stage by writing it to a file or artifact (either deterministic or model-driven), pass the path with \`reads\`, and explicitly prompt the downstream agent with wording like \`Read the file at <path>...\`; do not inject large \`previous\` payloads or session history into the next prompt unless explicitly requested to.
22
- - If you run \`ralph\` or \`goal\` workflow, define an objective that includes tight scope, concrete and verifiable done criteria, and validation steps; then monitor progress as above instead of doing parallel implementation yourself.`,
22
+ - Prefer using the \`goal\` workflow for small fixes/quick fixes and the \`ralph\` workflow for tasks that are non-trivial (over 2K LoC estimated diff).
23
+ - Adjust the \`max_loops\` based on task complexity (estimated LoC and number of unique files that are touched).
24
+ - Define an objective that includes tight scope, concrete and verifiable done criteria, and validation steps; then monitor progress as above instead of doing parallel implementation yourself.`,
23
25
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"atomic-guide-command.d.ts","sourceRoot":"","sources":["../../src/core/atomic-guide-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,gCAAgC,qCACT,CAAC;AAuNrC,QAAA,MAAM,cAAc;mBAEV,UAAU;;oBAET,UAAU;0BACJ,oBAAoB;;;mBAI3B,WAAW;;oBAEV,WAAW;0BACL,iBAAiB;;;mBAIxB,SAAS;;oBAER,SAAS;0BACH,0BAA0B;;;mBAIjC,WAAW;;oBAEV,YAAY;0BACN,sBAAsB;;EASpC,CAAC;AAEJ,KAAK,kBAAkB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1D,KAAK,sBAAsB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,sBAAsB,CAAC;AAE9D,eAAO,MAAM,yBAAyB,EAAE,SAAS,qBAAqB,EACtB,CAAC;AAiBjD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,GACb,MAAM,IAAI,qBAAqB,CAEjC;AAoCD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAOtE;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,MAAM,GACb,gBAAgB,EAAE,GAAG,IAAI,CAa3B;AAED,iBAAS,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CActD;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,eAAe,EACrB,GAAG,EAAE,MAAM,GACV,MAAM,CAGR;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,qBAAqB,GAC5B,eAAe,CAEjB","sourcesContent":["import * as path from \"node:path\";\nimport type { AutocompleteItem } from \"@earendil-works/pi-tui\";\nimport { getChangelogPath, parseChangelog } from \"../utils/changelog.ts\";\n\nexport const ATOMIC_GUIDE_COMMAND_NAME = \"atomic\";\nexport const ATOMIC_GUIDE_COMMAND_DESCRIPTION =\n \"Atomic onboarding and help guide\";\n\nconst OVERVIEW = `# Atomic overview\n\nAtomic turns one-off prompts into developer workflows: on-call debugging, repo research that turns into implementation, testing and review loops, and larger multi-stage automation. Use \\`/workflow goal\\` for small-to-medium changes with a clear work surface, exact outcome, and named validation; keep \\`/workflow ralph\\` for larger migrations, broad refactors, and multi-package research-first implementation work. Start Atomic in a project with \\`atomic\\`, then talk to it normally. Use \\`@file\\` to attach files, \\`!command\\` to run shell output through the model, and \\`!!command\\` to run shell output without adding it to context.\n\n## Core session commands\n\n| Command | Use |\n|---|---|\n| \\`/login\\` | configure auth |\n| \\`/model\\` | switch model |\n| \\`/settings\\` | thinking level, theme, message delivery, transport |\n| \\`/new\\`, \\`/resume\\` | start or resume sessions |\n| \\`/tree\\`, \\`/fork\\`, \\`/clone\\` | branch or navigate session history |\n| \\`/compact\\` | delete safe older context verbatim |\n| \\`/hotkeys\\`, \\`/changelog\\` | local help and release notes |\n\n## Examples of using Atomic\n\n| Goal | How to use |\n|---|---|\n| On-call / broken behavior | Run \\`/run debugger \"Reproduce the failure, patch the root cause, and validate it\"\\` for a focused fix loop, or ask Atomic in chat to build a reusable workflow that does the same |\n| Research → spec → implementation | Chain \\`/skill:research-codebase\\` → \\`/skill:create-spec\\` → \\`/workflow goal objective=\"...\"\\` for bounded scoped work with explicit validation; use \\`/workflow ralph ...\\` when the work needs research-first broad refactoring or final-stage PR prep with \\`create_pr=true\\` |\n| Testing / regression hardening | Run \\`/skill:tdd\\` for test-first work, then \\`/parallel-review current diff\\`, then land the change |\n| Large repo discovery | Run \\`/parallel codebase-locator \"map the area\" -> codebase-analyzer \"trace the current flow\" -> codebase-pattern-finder \"find patterns\" --bg\\`, or \\`/workflow deep-research-codebase\\` for whole-repo synthesis |\n| UI / product polish | Run \\`/skill:impeccable\\` for interface critique and refinement, or \\`/workflow open-claude-design\\` for generation + refinement loops |\n\n## Built-in workflows\n\n| Workflow | When to use | How to run |\n|---|---|---|\n| \\`deep-research-codebase\\` | broad repo or cross-cutting research before you decide what to change (for one area, use \\`/skill:research-codebase\\`; this indexes the whole repo) | \\`/workflow deep-research-codebase prompt=\"How do payment retries work end to end?\"\\` |\n| \\`goal\\` | small-to-medium scoped changes when you can name the work surface, outcome, and validation; keeps receipts in a ledger and stops as \\`complete\\`, \\`blocked\\`, or \\`needs_human\\` | \\`/workflow goal objective=\"Implement specs/<date>-<topic>.md, run focused tests, and validate the changed behavior\"\\` |\n| \\`ralph\\` | larger migrations, broad refactors, and multi-package changes where you want Atomic to research first, delegate, review, and iterate; add \\`create_pr=true\\` only when you want the final pull-request stage and report | \\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\" create_pr=true\\` |\n| \\`open-claude-design\\` | UI and design-system work that benefits from generation and refinement loops | \\`/workflow open-claude-design prompt=\"Refresh the settings page hierarchy\"\\` |\n\nUse \\`/workflow list\\` to see what is available and \\`/workflow inputs <name>\\` to inspect inputs in your environment.\n\n## Top skills\n\n| Skill | When to use | How to run |\n|---|---|---|\n| \\`research-codebase\\` | write a grounded research artifact for one subsystem or question | \\`/skill:research-codebase how the rate limiter works in src/middleware/\\` |\n| \\`create-spec\\` | turn research into an implementation-ready plan | \\`/skill:create-spec from research/docs/<date>-<topic>.md\\` |\n| \\`tdd\\` | do test-first feature or bug work | \\`/skill:tdd\\` |\n| \\`prompt-engineer\\` | tighten a vague prompt before a long run | \\`/skill:prompt-engineer Draft a sharper implementation prompt for ...\\` |\n| \\`subagent\\` | learn delegation patterns and exact \\`/run\\`, \\`/parallel\\`, and \\`/chain\\` usage | \\`/skill:subagent\\` |\n| \\`impeccable\\` | critique or refine frontend and product UI | \\`/skill:impeccable\\` |\n\n## Subagents\n\nSubagents are focused child Atomic sessions you can point at one job inside the repo.\n\n| Built-in subagent | Use |\n|---|---|\n| \\`codebase-locator\\` | find relevant files, tests, entrypoints, and configs |\n| \\`codebase-analyzer\\` | explain current behavior with file:line refs |\n| \\`codebase-pattern-finder\\` | find existing code to model after |\n| \\`debugger\\` | reproduce, diagnose, and fix broken behavior |\n\nHow the direct commands map to repo work:\n- \\`/run\\` = one specialist on one job, for example \\`/run codebase-locator \"Map the webhook retry flow\"\\`\n- \\`/parallel\\` = several independent specialists at once, for example \\`/parallel codebase-locator \"map retry files\" -> codebase-pattern-finder \"find existing retry/backoff patterns\" -> codebase-online-researcher \"research current retry guidance\" --bg\\`\n- \\`/chain\\` = ordered handoffs, for example \\`/chain codebase-locator \"find the auth files\" -> codebase-analyzer \"trace the auth flow\" -> debugger \"patch the failing auth edge case\"\\`\n\n─────────────────────────────────────────────────────────────────\n\nWhere to next:\n\n\\`/atomic example\\` — see the pieces used on a code task\n\\`/atomic workflows\\` — learn when to use workflows`;\n\nconst EXAMPLE = `# Practical example\n\nThis is an example of a spec-driven development process using Atomic workflows. Use it when you are new to a repo or the task has non-trivial scope. Type the examples below into the Atomic TUI chat after starting \\`atomic\\` in your project.\n\n## 1. Research what exists\n\nUse \\`/skill:research-codebase\\` for a scoped area, subsystem, or directory:\n\n\\`/skill:research-codebase how the rate limiter works in src/middleware/\\`\n\nUse \\`deep-research-codebase\\` when the answer spans the whole repo or a cross-cutting implementation path:\n\n\\`/workflow deep-research-codebase prompt=\"How do payment retries work end to end?\"\\`\n\nIf the research prompt is vague, tighten it first with \\`/skill:prompt-engineer\\`:\n\n\\`/skill:prompt-engineer Draft a sharper repo-research prompt for understanding payment retries end to end, including retries, queues, and failure handling.\\`\n\n## 2. Create a spec when requirements are fuzzy\n\nSkip this if the implementation request is already precise.\n\n\\`/skill:create-spec from research/docs/<date>-<topic>.md\\`\n\n## 3. Implement with review built in\n\nFor ordinary work, ask Atomic directly and require validation:\n\n\\`Implement the approved spec in specs/<date>-<topic>.md. Run focused tests and summarize validation.\\`\n\nFor small-to-medium scoped changes where you can identify the work surface, exact outcome, and validation, use \\`goal\\`:\n\n\\`/workflow goal objective=\"Implement specs/<date>-<topic>.md, run focused tests, and finish when the documented behavior is validated\"\\`\n\nFor larger migrations, broad refactors, or multi-package changes that need research-first implementation, use \\`ralph\\`:\n\n\\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\"\\`\n\nAdd \\`create_pr=true\\` only when you want Ralph's final pull-request stage and report.\n\n## 4. Decide and land\n\nIf you used \\`goal\\`, the workflow already persisted receipts in a goal ledger and reviewer-gated completion. Use its final status — \\`complete\\`, \\`blocked\\`, or \\`needs_human\\` — plus the remaining-work report to decide whether to ship, unblock, or clarify.\n\nIf you used \\`ralph\\`, the workflow transformed the prompt into a research question, researched the codebase, delegated implementation through sub-agents, reviewed, and iterated. If you enabled \\`create_pr=true\\`, use its final pull-request report to decide whether to ship or iterate again.\n\nIf you implemented directly instead of using a workflow, you can still run:\n\n\\`/parallel-review current diff\\`\n\nAtomic will synthesize reviewer feedback and ask before applying fixes.\n\n─────────────────────────────────────────────────────────────────\n\nWhere to next:\n\n\\`/atomic workflows\\` — learn when to use workflows\n\\`/atomic overview\\` — quick refresh`;\n\nconst WORKFLOWS = `# Workflows primer\n\nA workflow is a TypeScript-defined pipeline exported from \\`workflow({...})\\`. It can run tasks, chains, parallel fan-out, human-in-the-loop prompts, background status, and model fallback chains.\n\nYou do not have to write TypeScript to add one. Describe the workflow you want in plain chat — goal, inputs, stages, which steps are parallel or sequential, handoff/output shape, and any model or thinking-level preferences — and Atomic will use the workflow docs to scaffold a reusable definition under \\`.atomic/workflows/\\` and reload it for you. Hand-edit the TypeScript afterward when you want precise control.\n\n## Built-in workflows\n\n| Workflow | When to use | How to run |\n|---|---|---|\n| \\`deep-research-codebase\\` | broad repo or cross-cutting research before you decide what to change (for one area, use \\`/skill:research-codebase\\`; this indexes the whole repo) | \\`/workflow deep-research-codebase prompt=\"How do payment retries work end to end?\"\\` |\n| \\`goal\\` | small-to-medium scoped changes with a clear outcome and named validation | \\`/workflow goal objective=\"Update the CLI docs, include one usage example, and verify the docs build passes\"\\` |\n| \\`ralph\\` | larger migrations, broad refactors, and multi-package research-first implementation work | \\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\" create_pr=true\\` |\n| \\`open-claude-design\\` | frontend and product design work | \\`/workflow open-claude-design prompt=\"Refresh the settings page hierarchy\"\\` |\n\nUse \\`/workflow inputs <name>\\` to inspect the exact inputs in your environment.\n\nUse \\`/skill:research-codebase ...\\` when you want research on one subsystem, directory, or focused question. Use \\`/workflow deep-research-codebase ...\\` when the answer needs end-to-end tracing across many parts of the repo.\n\nIf you are drafting research, reviewer, or synthesis prompts for a workflow, use \\`/skill:prompt-engineer\\` first. It is a good fit when a stage prompt feels vague, overloaded, or underspecified.\n\n## What good workflow authoring looks like\n\nA good workflow request is explicit about stage purpose, model choice, handoff, and the decision each step must return.\n\nExample: ask Atomic in chat with something like this:\n\n~~~text\nCreate a reusable workflow called review-changes.\n\nIt should accept one required text input called target for a diff, PR summary, or review target.\n\nRun two independent review stages in parallel with fresh context:\n- one reviewer focused on correctness, regressions, and missing tests using openai-codex/gpt-5.5 at xhigh thinking\n- one reviewer focused on edge cases, maintainability, and hidden risks using anthropic/claude-opus-4-8 at xhigh thinking\n\nThen add an aggregate stage that consolidates both reviews, deduplicates overlap, keeps only evidence-backed issues, and separates blockers from optional suggestions using openai/gpt-5.5 at high thinking.\n\nFinally add an adjudicate stage using anthropic/claude-sonnet-4 at high thinking that decides what to fix now, what to defer, and what to reject. Return a short action list with rationale.\n\nThe workflow should return structured output with consolidated_review and decision fields.\n~~~\n\nWhy this is good:\n- it names the workflow and required input\n- it specifies which stages are parallel vs sequential\n- each stage has one job\n- it defines the handoff and final outputs\n- it calls out model choice and thinking level where that matters\n\n## Run and inspect\n\n\\`/workflow list\\`\n\n\\`/workflow inputs goal\\`\n\n\\`/workflow goal objective=\"Fix the settings form validation bug, add the focused test, and finish when invalid emails show the inline error without submitting\"\\`\n\n\\`/workflow inputs ralph\\`\n\n\\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\" create_pr=true\\`\n\n\\`/workflow status\\`\n\n\\`/workflow connect <run-id>\\`\n\n\\`/workflow interrupt <run-id>\\`\n\n\\`/workflow resume <run-id>\\`\n\nWorkflows run as background tasks. Use F2 or \\`/workflow connect <run-id>\\` for the graph viewer. Human-in-the-loop prompts appear there, not as chat modals, and awaiting-input states do not wake the main chat agent. Completion and failure notices are steered back into the main chat; answers submitted in the workflow UI interrupt stale main-chat questions so the model does not ask again.\n\n## Author your own\n\nDescribe your workflow in plain chat — say what you want the workflow to accomplish, what inputs it should accept, what stages should run, and what final output or decision it should return. Atomic will use the workflow docs to scaffold a reusable definition under \\`.atomic/workflows/\\`, ask clarifying questions when stage purpose, models, or handoffs are ambiguous, and run \\`/workflow reload\\` so you can launch it immediately.\n\n─────────────────────────────────────────────────────────────────\n\nWhere to next:\n\n\\`/atomic example\\` — see workflows in a normal task flow\n\\`/atomic overview\\` — quick refresh`;\n\nconst GUIDE_SECTIONS = [\n {\n name: \"overview\",\n aliases: [],\n label: \"overview\",\n description: \"30-second overview\",\n render: () => OVERVIEW,\n },\n {\n name: \"workflows\",\n aliases: [\"workflow\"],\n label: \"workflows\",\n description: \"Workflow primer\",\n render: () => WORKFLOWS,\n },\n {\n name: \"example\",\n aliases: [\"examples\"],\n label: \"example\",\n description: \"Practical first workflow\",\n render: () => EXAMPLE,\n },\n {\n name: \"whats-new\",\n aliases: [\"what's new\", \"whats new\", \"news\", \"updates\", \"changelog\"],\n label: \"what's new\",\n description: \"Recent release notes\",\n render: readLatestStableChangelog,\n },\n] as const satisfies readonly {\n readonly name: string;\n readonly aliases: readonly string[];\n readonly label: string;\n readonly description: string;\n readonly render: (cwd: string) => string;\n}[];\n\ntype AtomicGuideSection = (typeof GUIDE_SECTIONS)[number];\ntype AtomicGuideSectionName = AtomicGuideSection[\"name\"];\n\nexport type AtomicGuideHelpChoice = AtomicGuideSection[\"label\"];\n\nexport type AtomicGuideMode = \"help\" | AtomicGuideSectionName;\n\nexport const ATOMIC_GUIDE_HELP_CHOICES: readonly AtomicGuideHelpChoice[] =\n GUIDE_SECTIONS.map((section) => section.label);\n\nconst GUIDE_SECTIONS_BY_NAME = new Map<\n AtomicGuideSectionName,\n AtomicGuideSection\n>(GUIDE_SECTIONS.map((section) => [section.name, section]));\nconst GUIDE_SECTIONS_BY_LABEL = new Map<string, AtomicGuideSection>(\n GUIDE_SECTIONS.map((section) => [section.label, section]),\n);\nconst GUIDE_SECTIONS_BY_INPUT = new Map<string, AtomicGuideSection>(\n GUIDE_SECTIONS.flatMap((section) =>\n [section.name, section.label, ...section.aliases].map(\n (input) => [input, section] as const,\n ),\n ),\n);\n\nexport function isAtomicGuideHelpChoice(\n choice: string,\n): choice is AtomicGuideHelpChoice {\n return GUIDE_SECTIONS_BY_LABEL.has(choice);\n}\n\nconst ATOMIC_GUIDE_TRAILING_PUNCTUATION = \"?!.,;:\";\n\nfunction stripTrailingAtomicGuidePunctuation(value: string): string {\n let end = value.length;\n while (\n end > 0 &&\n ATOMIC_GUIDE_TRAILING_PUNCTUATION.includes(value.charAt(end - 1))\n ) {\n end--;\n }\n return value.slice(0, end);\n}\n\nfunction getGuideSectionForChoice(\n choice: string,\n): AtomicGuideSection | undefined {\n return GUIDE_SECTIONS_BY_LABEL.get(choice);\n}\n\nfunction getGuideSectionForMode(\n mode: AtomicGuideSectionName,\n): AtomicGuideSection {\n const section = GUIDE_SECTIONS_BY_NAME.get(mode);\n if (!section) throw new Error(`Unknown Atomic guide section: ${mode}`);\n return section;\n}\n\nfunction getAtomicGuideHelpMenu(): string {\n const sectionHelp = GUIDE_SECTIONS.map(\n (section) => `- \\`${section.label}\\` — run \\`/atomic ${section.label}\\``,\n ).join(\"\\n\");\n return `# Atomic\\n\\nSelect where to start:\\n\\n${sectionHelp}`;\n}\n\nexport function normalizeAtomicGuideMode(args: string): AtomicGuideMode {\n const normalized = stripTrailingAtomicGuidePunctuation(\n args.trim().toLowerCase(),\n );\n if (!normalized) return \"help\";\n\n return GUIDE_SECTIONS_BY_INPUT.get(normalized)?.name ?? \"help\";\n}\n\nexport function getAtomicGuideArgumentCompletions(\n prefix: string,\n): AutocompleteItem[] | null {\n const query = prefix.trim().toLowerCase();\n const items = GUIDE_SECTIONS.map((section) => ({\n value: section.label,\n label: section.label,\n description: section.description,\n }));\n const filtered = query\n ? items.filter(\n (item) => item.value.startsWith(query) || item.label.startsWith(query),\n )\n : items;\n return filtered.length > 0 ? filtered : null;\n}\n\nfunction readLatestStableChangelog(cwd: string): string {\n const changelogPath = getChangelogPath();\n const stableSections = parseChangelog(changelogPath)\n .filter((entry) => entry.prerelease === null)\n .slice(0, 3)\n .map((entry) => entry.content.trim())\n .filter(Boolean);\n\n if (stableSections.length === 0) {\n return `# What's new\\n\\nNo stable release sections were found. Try \\`/changelog\\` for the interactive changelog viewer.\\n\\n─────────────────────────────────────────────────────────────────\\n\\nWhere to next:\\n\\n\\`/atomic example\\` — see a practical first workflow\\n\\`/atomic overview\\` — quick refresh`;\n }\n\n const relativePath = path.relative(cwd, changelogPath) || changelogPath;\n return `# What's new\\n\\n${stableSections.join(\"\\n\\n\")}\\n\\nSource: \\`${relativePath}\\`\\n\\n─────────────────────────────────────────────────────────────────\\n\\nWhere to next:\\n\\n\\`/atomic example\\` — see a practical first workflow\\n\\`/atomic overview\\` — quick refresh`;\n}\n\nexport function getAtomicGuideMessage(\n mode: AtomicGuideMode,\n cwd: string,\n): string {\n if (mode === \"help\") return getAtomicGuideHelpMenu();\n return getGuideSectionForMode(mode).render(cwd);\n}\n\nexport function atomicGuideModeForChoice(\n choice: AtomicGuideHelpChoice,\n): AtomicGuideMode {\n return getGuideSectionForChoice(choice)?.name ?? \"help\";\n}\n"]}
1
+ {"version":3,"file":"atomic-guide-command.d.ts","sourceRoot":"","sources":["../../src/core/atomic-guide-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,eAAO,MAAM,yBAAyB,WAAW,CAAC;AAClD,eAAO,MAAM,gCAAgC,qCACT,CAAC;AAuNrC,QAAA,MAAM,cAAc;mBAEV,UAAU;;oBAET,UAAU;0BACJ,oBAAoB;;;mBAI3B,WAAW;;oBAEV,WAAW;0BACL,iBAAiB;;;mBAIxB,SAAS;;oBAER,SAAS;0BACH,0BAA0B;;;mBAIjC,WAAW;;oBAEV,YAAY;0BACN,sBAAsB;;EASpC,CAAC;AAEJ,KAAK,kBAAkB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1D,KAAK,sBAAsB,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,sBAAsB,CAAC;AAE9D,eAAO,MAAM,yBAAyB,EAAE,SAAS,qBAAqB,EACtB,CAAC;AAiBjD,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,GACb,MAAM,IAAI,qBAAqB,CAEjC;AAoCD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAOtE;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,MAAM,GACb,gBAAgB,EAAE,GAAG,IAAI,CAa3B;AAED,iBAAS,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CActD;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,eAAe,EACrB,GAAG,EAAE,MAAM,GACV,MAAM,CAGR;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,qBAAqB,GAC5B,eAAe,CAEjB","sourcesContent":["import * as path from \"node:path\";\nimport type { AutocompleteItem } from \"@earendil-works/pi-tui\";\nimport { getChangelogPath, parseChangelog } from \"../utils/changelog.ts\";\n\nexport const ATOMIC_GUIDE_COMMAND_NAME = \"atomic\";\nexport const ATOMIC_GUIDE_COMMAND_DESCRIPTION =\n \"Atomic onboarding and help guide\";\n\nconst OVERVIEW = `# Atomic overview\n\nAtomic turns one-off prompts into developer workflows: on-call debugging, repo research that turns into implementation, testing and review loops, and larger multi-stage automation. Use \\`/workflow goal\\` for small-to-medium changes with a clear work surface, exact outcome, and named validation; keep \\`/workflow ralph\\` for larger migrations, broad refactors, and multi-package research-first implementation work. Start Atomic in a project with \\`atomic\\`, then talk to it normally. Use \\`@file\\` to attach files, \\`!command\\` to run shell output through the model, and \\`!!command\\` to run shell output without adding it to context.\n\n## Core session commands\n\n| Command | Use |\n|---|---|\n| \\`/login\\` | configure auth |\n| \\`/model\\` | switch model |\n| \\`/settings\\` | thinking level, theme, message delivery, transport |\n| \\`/new\\`, \\`/resume\\` | start or resume sessions |\n| \\`/tree\\`, \\`/fork\\`, \\`/clone\\` | branch or navigate session history |\n| \\`/compact\\` | delete safe older context verbatim |\n| \\`/hotkeys\\`, \\`/changelog\\` | local help and release notes |\n\n## Examples of using Atomic\n\n| Goal | How to use |\n|---|---|\n| On-call / broken behavior | Run \\`/run debugger \"Reproduce the failure, patch the root cause, and validate it\"\\` for a focused fix loop, or ask Atomic in chat to build a reusable workflow that does the same |\n| Research → spec → implementation | Chain \\`/skill:research-codebase\\` → \\`/skill:create-spec\\` → \\`/workflow goal objective=\"...\"\\` for bounded scoped work with explicit validation; add \\`create_pr=true\\` for Goal's final PR handoff after approval, or use \\`/workflow ralph ...\\` when the work needs research-first broad refactoring |\n| Testing / regression hardening | Run \\`/skill:tdd\\` for test-first work, then \\`/parallel-review current diff\\`, then land the change |\n| Large repo discovery | Run \\`/parallel codebase-locator \"map the area\" -> codebase-analyzer \"trace the current flow\" -> codebase-pattern-finder \"find patterns\" --bg\\`, or \\`/workflow deep-research-codebase\\` for whole-repo synthesis |\n| UI / product polish | Run \\`/skill:impeccable\\` for interface critique and refinement, or \\`/workflow open-claude-design\\` for generation + refinement loops |\n\n## Built-in workflows\n\n| Workflow | When to use | How to run |\n|---|---|---|\n| \\`deep-research-codebase\\` | broad repo or cross-cutting research before you decide what to change (for one area, use \\`/skill:research-codebase\\`; this indexes the whole repo) | \\`/workflow deep-research-codebase prompt=\"How do payment retries work end to end?\"\\` |\n| \\`goal\\` | small-to-medium scoped changes when you can name the work surface, outcome, and validation; keeps receipts in a ledger, stops as \\`complete\\`, \\`blocked\\`, or \\`needs_human\\`, and can run a final PR handoff with \\`create_pr=true\\` after approval | \\`/workflow goal objective=\"Implement specs/<date>-<topic>.md, run focused tests, and validate the changed behavior\"\\` |\n| \\`ralph\\` | larger migrations, broad refactors, and multi-package changes where you want Atomic to research first, delegate, review, and iterate; add \\`create_pr=true\\` only when you want the final pull-request stage and report | \\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\" create_pr=true\\` |\n| \\`open-claude-design\\` | UI and design-system work that benefits from generation and refinement loops | \\`/workflow open-claude-design prompt=\"Refresh the settings page hierarchy\"\\` |\n\nUse \\`/workflow list\\` to see what is available and \\`/workflow inputs <name>\\` to inspect inputs in your environment.\n\n## Top skills\n\n| Skill | When to use | How to run |\n|---|---|---|\n| \\`research-codebase\\` | write a grounded research artifact for one subsystem or question | \\`/skill:research-codebase how the rate limiter works in src/middleware/\\` |\n| \\`create-spec\\` | turn research into an implementation-ready plan | \\`/skill:create-spec from research/docs/<date>-<topic>.md\\` |\n| \\`tdd\\` | do test-first feature or bug work | \\`/skill:tdd\\` |\n| \\`prompt-engineer\\` | tighten a vague prompt before a long run | \\`/skill:prompt-engineer Draft a sharper implementation prompt for ...\\` |\n| \\`subagent\\` | learn delegation patterns and exact \\`/run\\`, \\`/parallel\\`, and \\`/chain\\` usage | \\`/skill:subagent\\` |\n| \\`impeccable\\` | critique or refine frontend and product UI | \\`/skill:impeccable\\` |\n\n## Subagents\n\nSubagents are focused child Atomic sessions you can point at one job inside the repo.\n\n| Built-in subagent | Use |\n|---|---|\n| \\`codebase-locator\\` | find relevant files, tests, entrypoints, and configs |\n| \\`codebase-analyzer\\` | explain current behavior with file:line refs |\n| \\`codebase-pattern-finder\\` | find existing code to model after |\n| \\`debugger\\` | reproduce, diagnose, and fix broken behavior |\n\nHow the direct commands map to repo work:\n- \\`/run\\` = one specialist on one job, for example \\`/run codebase-locator \"Map the webhook retry flow\"\\`\n- \\`/parallel\\` = several independent specialists at once, for example \\`/parallel codebase-locator \"map retry files\" -> codebase-pattern-finder \"find existing retry/backoff patterns\" -> codebase-online-researcher \"research current retry guidance\" --bg\\`\n- \\`/chain\\` = ordered handoffs, for example \\`/chain codebase-locator \"find the auth files\" -> codebase-analyzer \"trace the auth flow\" -> debugger \"patch the failing auth edge case\"\\`\n\n─────────────────────────────────────────────────────────────────\n\nWhere to next:\n\n\\`/atomic example\\` — see the pieces used on a code task\n\\`/atomic workflows\\` — learn when to use workflows`;\n\nconst EXAMPLE = `# Practical example\n\nThis is an example of a spec-driven development process using Atomic workflows. Use it when you are new to a repo or the task has non-trivial scope. Type the examples below into the Atomic TUI chat after starting \\`atomic\\` in your project.\n\n## 1. Research what exists\n\nUse \\`/skill:research-codebase\\` for a scoped area, subsystem, or directory:\n\n\\`/skill:research-codebase how the rate limiter works in src/middleware/\\`\n\nUse \\`deep-research-codebase\\` when the answer spans the whole repo or a cross-cutting implementation path:\n\n\\`/workflow deep-research-codebase prompt=\"How do payment retries work end to end?\"\\`\n\nIf the research prompt is vague, tighten it first with \\`/skill:prompt-engineer\\`:\n\n\\`/skill:prompt-engineer Draft a sharper repo-research prompt for understanding payment retries end to end, including retries, queues, and failure handling.\\`\n\n## 2. Create a spec when requirements are fuzzy\n\nSkip this if the implementation request is already precise.\n\n\\`/skill:create-spec from research/docs/<date>-<topic>.md\\`\n\n## 3. Implement with review built in\n\nFor ordinary work, ask Atomic directly and require validation:\n\n\\`Implement the approved spec in specs/<date>-<topic>.md. Run focused tests and summarize validation.\\`\n\nFor small-to-medium scoped changes where you can identify the work surface, exact outcome, and validation, use \\`goal\\`:\n\n\\`/workflow goal objective=\"Implement specs/<date>-<topic>.md, run focused tests, and finish when the documented behavior is validated\"\\`\n\nFor larger migrations, broad refactors, or multi-package changes that need research-first implementation, use \\`ralph\\`:\n\n\\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\"\\`\n\nAdd \\`create_pr=true\\` only when you want the final pull-request stage and report after the review gate approves.\n\n## 4. Decide and land\n\nIf you used \\`goal\\`, the workflow already persisted receipts in a goal ledger and reviewer-gated completion. Use its final status — \\`complete\\`, \\`blocked\\`, or \\`needs_human\\` — plus the remaining-work report to decide whether to ship, unblock, or clarify. If you enabled \\`create_pr=true\\`, use its final pull-request report to decide whether to ship or iterate again.\n\nIf you used \\`ralph\\`, the workflow transformed the prompt into a research question, researched the codebase, delegated implementation through sub-agents, reviewed, and iterated. If you enabled \\`create_pr=true\\`, use its final pull-request report to decide whether to ship or iterate again.\n\nIf you implemented directly instead of using a workflow, you can still run:\n\n\\`/parallel-review current diff\\`\n\nAtomic will synthesize reviewer feedback and ask before applying fixes.\n\n─────────────────────────────────────────────────────────────────\n\nWhere to next:\n\n\\`/atomic workflows\\` — learn when to use workflows\n\\`/atomic overview\\` — quick refresh`;\n\nconst WORKFLOWS = `# Workflows primer\n\nA workflow is a TypeScript-defined pipeline exported from \\`workflow({...})\\`. It can run tasks, chains, parallel fan-out, human-in-the-loop prompts, background status, and model fallback chains.\n\nYou do not have to write TypeScript to add one. Describe the workflow you want in plain chat — goal, inputs, stages, which steps are parallel or sequential, handoff/output shape, and any model or thinking-level preferences — and Atomic will use the workflow docs to scaffold a reusable definition under \\`.atomic/workflows/\\` and reload it for you. Hand-edit the TypeScript afterward when you want precise control.\n\n## Built-in workflows\n\n| Workflow | When to use | How to run |\n|---|---|---|\n| \\`deep-research-codebase\\` | broad repo or cross-cutting research before you decide what to change (for one area, use \\`/skill:research-codebase\\`; this indexes the whole repo) | \\`/workflow deep-research-codebase prompt=\"How do payment retries work end to end?\"\\` |\n| \\`goal\\` | small-to-medium scoped changes with a clear outcome and named validation; add \\`create_pr=true\\` only for final PR handoff after approval | \\`/workflow goal objective=\"Update the CLI docs, include one usage example, and verify the docs build passes\"\\` |\n| \\`ralph\\` | larger migrations, broad refactors, and multi-package research-first implementation work | \\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\" create_pr=true\\` |\n| \\`open-claude-design\\` | frontend and product design work | \\`/workflow open-claude-design prompt=\"Refresh the settings page hierarchy\"\\` |\n\nUse \\`/workflow inputs <name>\\` to inspect the exact inputs in your environment.\n\nUse \\`/skill:research-codebase ...\\` when you want research on one subsystem, directory, or focused question. Use \\`/workflow deep-research-codebase ...\\` when the answer needs end-to-end tracing across many parts of the repo.\n\nIf you are drafting research, reviewer, or synthesis prompts for a workflow, use \\`/skill:prompt-engineer\\` first. It is a good fit when a stage prompt feels vague, overloaded, or underspecified.\n\n## What good workflow authoring looks like\n\nA good workflow request is explicit about stage purpose, model choice, handoff, and the decision each step must return.\n\nExample: ask Atomic in chat with something like this:\n\n~~~text\nCreate a reusable workflow called review-changes.\n\nIt should accept one required text input called target for a diff, PR summary, or review target.\n\nRun two independent review stages in parallel with fresh context:\n- one reviewer focused on correctness, regressions, and missing tests using openai-codex/gpt-5.5 at xhigh thinking\n- one reviewer focused on edge cases, maintainability, and hidden risks using anthropic/claude-opus-4-8 at xhigh thinking\n\nThen add an aggregate stage that consolidates both reviews, deduplicates overlap, keeps only evidence-backed issues, and separates blockers from optional suggestions using openai/gpt-5.5 at high thinking.\n\nFinally add an adjudicate stage using anthropic/claude-sonnet-4 at high thinking that decides what to fix now, what to defer, and what to reject. Return a short action list with rationale.\n\nThe workflow should return structured output with consolidated_review and decision fields.\n~~~\n\nWhy this is good:\n- it names the workflow and required input\n- it specifies which stages are parallel vs sequential\n- each stage has one job\n- it defines the handoff and final outputs\n- it calls out model choice and thinking level where that matters\n\n## Run and inspect\n\n\\`/workflow list\\`\n\n\\`/workflow inputs goal\\`\n\n\\`/workflow goal objective=\"Fix the settings form validation bug, add the focused test, and finish when invalid emails show the inline error without submitting\"\\`\n\n\\`/workflow inputs ralph\\`\n\n\\`/workflow ralph prompt=\"Migrate the database layer to Drizzle\" create_pr=true\\`\n\n\\`/workflow status\\`\n\n\\`/workflow connect <run-id>\\`\n\n\\`/workflow interrupt <run-id>\\`\n\n\\`/workflow resume <run-id>\\`\n\nWorkflows run as background tasks. Use F2 or \\`/workflow connect <run-id>\\` for the graph viewer. Human-in-the-loop prompts appear there, not as chat modals, and awaiting-input states do not wake the main chat agent. Completion and failure notices are steered back into the main chat; answers submitted in the workflow UI interrupt stale main-chat questions so the model does not ask again.\n\n## Author your own\n\nDescribe your workflow in plain chat — say what you want the workflow to accomplish, what inputs it should accept, what stages should run, and what final output or decision it should return. Atomic will use the workflow docs to scaffold a reusable definition under \\`.atomic/workflows/\\`, ask clarifying questions when stage purpose, models, or handoffs are ambiguous, and run \\`/workflow reload\\` so you can launch it immediately.\n\n─────────────────────────────────────────────────────────────────\n\nWhere to next:\n\n\\`/atomic example\\` — see workflows in a normal task flow\n\\`/atomic overview\\` — quick refresh`;\n\nconst GUIDE_SECTIONS = [\n {\n name: \"overview\",\n aliases: [],\n label: \"overview\",\n description: \"30-second overview\",\n render: () => OVERVIEW,\n },\n {\n name: \"workflows\",\n aliases: [\"workflow\"],\n label: \"workflows\",\n description: \"Workflow primer\",\n render: () => WORKFLOWS,\n },\n {\n name: \"example\",\n aliases: [\"examples\"],\n label: \"example\",\n description: \"Practical first workflow\",\n render: () => EXAMPLE,\n },\n {\n name: \"whats-new\",\n aliases: [\"what's new\", \"whats new\", \"news\", \"updates\", \"changelog\"],\n label: \"what's new\",\n description: \"Recent release notes\",\n render: readLatestStableChangelog,\n },\n] as const satisfies readonly {\n readonly name: string;\n readonly aliases: readonly string[];\n readonly label: string;\n readonly description: string;\n readonly render: (cwd: string) => string;\n}[];\n\ntype AtomicGuideSection = (typeof GUIDE_SECTIONS)[number];\ntype AtomicGuideSectionName = AtomicGuideSection[\"name\"];\n\nexport type AtomicGuideHelpChoice = AtomicGuideSection[\"label\"];\n\nexport type AtomicGuideMode = \"help\" | AtomicGuideSectionName;\n\nexport const ATOMIC_GUIDE_HELP_CHOICES: readonly AtomicGuideHelpChoice[] =\n GUIDE_SECTIONS.map((section) => section.label);\n\nconst GUIDE_SECTIONS_BY_NAME = new Map<\n AtomicGuideSectionName,\n AtomicGuideSection\n>(GUIDE_SECTIONS.map((section) => [section.name, section]));\nconst GUIDE_SECTIONS_BY_LABEL = new Map<string, AtomicGuideSection>(\n GUIDE_SECTIONS.map((section) => [section.label, section]),\n);\nconst GUIDE_SECTIONS_BY_INPUT = new Map<string, AtomicGuideSection>(\n GUIDE_SECTIONS.flatMap((section) =>\n [section.name, section.label, ...section.aliases].map(\n (input) => [input, section] as const,\n ),\n ),\n);\n\nexport function isAtomicGuideHelpChoice(\n choice: string,\n): choice is AtomicGuideHelpChoice {\n return GUIDE_SECTIONS_BY_LABEL.has(choice);\n}\n\nconst ATOMIC_GUIDE_TRAILING_PUNCTUATION = \"?!.,;:\";\n\nfunction stripTrailingAtomicGuidePunctuation(value: string): string {\n let end = value.length;\n while (\n end > 0 &&\n ATOMIC_GUIDE_TRAILING_PUNCTUATION.includes(value.charAt(end - 1))\n ) {\n end--;\n }\n return value.slice(0, end);\n}\n\nfunction getGuideSectionForChoice(\n choice: string,\n): AtomicGuideSection | undefined {\n return GUIDE_SECTIONS_BY_LABEL.get(choice);\n}\n\nfunction getGuideSectionForMode(\n mode: AtomicGuideSectionName,\n): AtomicGuideSection {\n const section = GUIDE_SECTIONS_BY_NAME.get(mode);\n if (!section) throw new Error(`Unknown Atomic guide section: ${mode}`);\n return section;\n}\n\nfunction getAtomicGuideHelpMenu(): string {\n const sectionHelp = GUIDE_SECTIONS.map(\n (section) => `- \\`${section.label}\\` — run \\`/atomic ${section.label}\\``,\n ).join(\"\\n\");\n return `# Atomic\\n\\nSelect where to start:\\n\\n${sectionHelp}`;\n}\n\nexport function normalizeAtomicGuideMode(args: string): AtomicGuideMode {\n const normalized = stripTrailingAtomicGuidePunctuation(\n args.trim().toLowerCase(),\n );\n if (!normalized) return \"help\";\n\n return GUIDE_SECTIONS_BY_INPUT.get(normalized)?.name ?? \"help\";\n}\n\nexport function getAtomicGuideArgumentCompletions(\n prefix: string,\n): AutocompleteItem[] | null {\n const query = prefix.trim().toLowerCase();\n const items = GUIDE_SECTIONS.map((section) => ({\n value: section.label,\n label: section.label,\n description: section.description,\n }));\n const filtered = query\n ? items.filter(\n (item) => item.value.startsWith(query) || item.label.startsWith(query),\n )\n : items;\n return filtered.length > 0 ? filtered : null;\n}\n\nfunction readLatestStableChangelog(cwd: string): string {\n const changelogPath = getChangelogPath();\n const stableSections = parseChangelog(changelogPath)\n .filter((entry) => entry.prerelease === null)\n .slice(0, 3)\n .map((entry) => entry.content.trim())\n .filter(Boolean);\n\n if (stableSections.length === 0) {\n return `# What's new\\n\\nNo stable release sections were found. Try \\`/changelog\\` for the interactive changelog viewer.\\n\\n─────────────────────────────────────────────────────────────────\\n\\nWhere to next:\\n\\n\\`/atomic example\\` — see a practical first workflow\\n\\`/atomic overview\\` — quick refresh`;\n }\n\n const relativePath = path.relative(cwd, changelogPath) || changelogPath;\n return `# What's new\\n\\n${stableSections.join(\"\\n\\n\")}\\n\\nSource: \\`${relativePath}\\`\\n\\n─────────────────────────────────────────────────────────────────\\n\\nWhere to next:\\n\\n\\`/atomic example\\` — see a practical first workflow\\n\\`/atomic overview\\` — quick refresh`;\n}\n\nexport function getAtomicGuideMessage(\n mode: AtomicGuideMode,\n cwd: string,\n): string {\n if (mode === \"help\") return getAtomicGuideHelpMenu();\n return getGuideSectionForMode(mode).render(cwd);\n}\n\nexport function atomicGuideModeForChoice(\n choice: AtomicGuideHelpChoice,\n): AtomicGuideMode {\n return getGuideSectionForChoice(choice)?.name ?? \"help\";\n}\n"]}
@@ -23,7 +23,7 @@ Atomic turns one-off prompts into developer workflows: on-call debugging, repo r
23
23
  | Goal | How to use |
24
24
  |---|---|
25
25
  | On-call / broken behavior | Run \`/run debugger "Reproduce the failure, patch the root cause, and validate it"\` for a focused fix loop, or ask Atomic in chat to build a reusable workflow that does the same |
26
- | Research → spec → implementation | Chain \`/skill:research-codebase\` → \`/skill:create-spec\` → \`/workflow goal objective="..."\` for bounded scoped work with explicit validation; use \`/workflow ralph ...\` when the work needs research-first broad refactoring or final-stage PR prep with \`create_pr=true\` |
26
+ | Research → spec → implementation | Chain \`/skill:research-codebase\` → \`/skill:create-spec\` → \`/workflow goal objective="..."\` for bounded scoped work with explicit validation; add \`create_pr=true\` for Goal's final PR handoff after approval, or use \`/workflow ralph ...\` when the work needs research-first broad refactoring |
27
27
  | Testing / regression hardening | Run \`/skill:tdd\` for test-first work, then \`/parallel-review current diff\`, then land the change |
28
28
  | Large repo discovery | Run \`/parallel codebase-locator "map the area" -> codebase-analyzer "trace the current flow" -> codebase-pattern-finder "find patterns" --bg\`, or \`/workflow deep-research-codebase\` for whole-repo synthesis |
29
29
  | UI / product polish | Run \`/skill:impeccable\` for interface critique and refinement, or \`/workflow open-claude-design\` for generation + refinement loops |
@@ -33,7 +33,7 @@ Atomic turns one-off prompts into developer workflows: on-call debugging, repo r
33
33
  | Workflow | When to use | How to run |
34
34
  |---|---|---|
35
35
  | \`deep-research-codebase\` | broad repo or cross-cutting research before you decide what to change (for one area, use \`/skill:research-codebase\`; this indexes the whole repo) | \`/workflow deep-research-codebase prompt="How do payment retries work end to end?"\` |
36
- | \`goal\` | small-to-medium scoped changes when you can name the work surface, outcome, and validation; keeps receipts in a ledger and stops as \`complete\`, \`blocked\`, or \`needs_human\` | \`/workflow goal objective="Implement specs/<date>-<topic>.md, run focused tests, and validate the changed behavior"\` |
36
+ | \`goal\` | small-to-medium scoped changes when you can name the work surface, outcome, and validation; keeps receipts in a ledger, stops as \`complete\`, \`blocked\`, or \`needs_human\`, and can run a final PR handoff with \`create_pr=true\` after approval | \`/workflow goal objective="Implement specs/<date>-<topic>.md, run focused tests, and validate the changed behavior"\` |
37
37
  | \`ralph\` | larger migrations, broad refactors, and multi-package changes where you want Atomic to research first, delegate, review, and iterate; add \`create_pr=true\` only when you want the final pull-request stage and report | \`/workflow ralph prompt="Migrate the database layer to Drizzle" create_pr=true\` |
38
38
  | \`open-claude-design\` | UI and design-system work that benefits from generation and refinement loops | \`/workflow open-claude-design prompt="Refresh the settings page hierarchy"\` |
39
39
 
@@ -110,11 +110,11 @@ For larger migrations, broad refactors, or multi-package changes that need resea
110
110
 
111
111
  \`/workflow ralph prompt="Migrate the database layer to Drizzle"\`
112
112
 
113
- Add \`create_pr=true\` only when you want Ralph's final pull-request stage and report.
113
+ Add \`create_pr=true\` only when you want the final pull-request stage and report after the review gate approves.
114
114
 
115
115
  ## 4. Decide and land
116
116
 
117
- If you used \`goal\`, the workflow already persisted receipts in a goal ledger and reviewer-gated completion. Use its final status — \`complete\`, \`blocked\`, or \`needs_human\` — plus the remaining-work report to decide whether to ship, unblock, or clarify.
117
+ If you used \`goal\`, the workflow already persisted receipts in a goal ledger and reviewer-gated completion. Use its final status — \`complete\`, \`blocked\`, or \`needs_human\` — plus the remaining-work report to decide whether to ship, unblock, or clarify. If you enabled \`create_pr=true\`, use its final pull-request report to decide whether to ship or iterate again.
118
118
 
119
119
  If you used \`ralph\`, the workflow transformed the prompt into a research question, researched the codebase, delegated implementation through sub-agents, reviewed, and iterated. If you enabled \`create_pr=true\`, use its final pull-request report to decide whether to ship or iterate again.
120
120
 
@@ -141,7 +141,7 @@ You do not have to write TypeScript to add one. Describe the workflow you want i
141
141
  | Workflow | When to use | How to run |
142
142
  |---|---|---|
143
143
  | \`deep-research-codebase\` | broad repo or cross-cutting research before you decide what to change (for one area, use \`/skill:research-codebase\`; this indexes the whole repo) | \`/workflow deep-research-codebase prompt="How do payment retries work end to end?"\` |
144
- | \`goal\` | small-to-medium scoped changes with a clear outcome and named validation | \`/workflow goal objective="Update the CLI docs, include one usage example, and verify the docs build passes"\` |
144
+ | \`goal\` | small-to-medium scoped changes with a clear outcome and named validation; add \`create_pr=true\` only for final PR handoff after approval | \`/workflow goal objective="Update the CLI docs, include one usage example, and verify the docs build passes"\` |
145
145
  | \`ralph\` | larger migrations, broad refactors, and multi-package research-first implementation work | \`/workflow ralph prompt="Migrate the database layer to Drizzle" create_pr=true\` |
146
146
  | \`open-claude-design\` | frontend and product design work | \`/workflow open-claude-design prompt="Refresh the settings page hierarchy"\` |
147
147