@bastani/atomic 0.6.3 → 0.6.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 (49) hide show
  1. package/.agents/skills/ast-grep/SKILL.md +323 -0
  2. package/.agents/skills/ast-grep/references/rule_reference.md +297 -0
  3. package/.agents/skills/ripgrep/SKILL.md +382 -0
  4. package/.mcp.json +5 -6
  5. package/dist/commands/cli/claude-inflight-hook.d.ts +100 -0
  6. package/dist/commands/cli/claude-inflight-hook.d.ts.map +1 -0
  7. package/dist/commands/cli/claude-stop-hook.d.ts +2 -0
  8. package/dist/commands/cli/claude-stop-hook.d.ts.map +1 -1
  9. package/dist/lib/spawn.d.ts +1 -1
  10. package/dist/lib/spawn.d.ts.map +1 -1
  11. package/dist/sdk/providers/claude.d.ts +36 -0
  12. package/dist/sdk/providers/claude.d.ts.map +1 -1
  13. package/dist/sdk/providers/copilot.d.ts +17 -1
  14. package/dist/sdk/providers/copilot.d.ts.map +1 -1
  15. package/dist/sdk/runtime/executor.d.ts.map +1 -1
  16. package/dist/sdk/workflows/builtin/deep-research-codebase/claude/index.d.ts +49 -34
  17. package/dist/sdk/workflows/builtin/deep-research-codebase/claude/index.d.ts.map +1 -1
  18. package/dist/sdk/workflows/builtin/deep-research-codebase/copilot/index.d.ts +18 -16
  19. package/dist/sdk/workflows/builtin/deep-research-codebase/copilot/index.d.ts.map +1 -1
  20. package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/batching.d.ts +43 -0
  21. package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/batching.d.ts.map +1 -0
  22. package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/prompts.d.ts +30 -0
  23. package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/prompts.d.ts.map +1 -1
  24. package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/scout.d.ts +2 -1
  25. package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/scout.d.ts.map +1 -1
  26. package/dist/sdk/workflows/builtin/deep-research-codebase/opencode/index.d.ts +18 -16
  27. package/dist/sdk/workflows/builtin/deep-research-codebase/opencode/index.d.ts.map +1 -1
  28. package/dist/services/config/additional-instructions.d.ts +67 -0
  29. package/dist/services/config/additional-instructions.d.ts.map +1 -0
  30. package/package.json +3 -1
  31. package/src/cli.ts +18 -1
  32. package/src/commands/cli/chat/index.ts +52 -2
  33. package/src/commands/cli/claude-inflight-hook.test.ts +598 -0
  34. package/src/commands/cli/claude-inflight-hook.ts +359 -0
  35. package/src/commands/cli/claude-stop-hook.ts +40 -4
  36. package/src/commands/cli/init/index.ts +9 -0
  37. package/src/lib/spawn.ts +6 -2
  38. package/src/sdk/providers/claude.ts +131 -0
  39. package/src/sdk/providers/copilot.ts +30 -1
  40. package/src/sdk/runtime/executor.ts +43 -2
  41. package/src/sdk/workflows/builtin/deep-research-codebase/claude/index.ts +318 -158
  42. package/src/sdk/workflows/builtin/deep-research-codebase/copilot/index.ts +253 -129
  43. package/src/sdk/workflows/builtin/deep-research-codebase/helpers/batching.ts +65 -0
  44. package/src/sdk/workflows/builtin/deep-research-codebase/helpers/ignore-by-default.d.ts +8 -0
  45. package/src/sdk/workflows/builtin/deep-research-codebase/helpers/prompts.ts +203 -12
  46. package/src/sdk/workflows/builtin/deep-research-codebase/helpers/scout.ts +248 -78
  47. package/src/sdk/workflows/builtin/deep-research-codebase/opencode/index.ts +258 -146
  48. package/src/services/config/additional-instructions.ts +273 -0
  49. package/src/services/system/auto-sync.ts +10 -1
@@ -0,0 +1,382 @@
1
+ ---
2
+ name: ripgrep
3
+ description: Use when searching text in files, codebases, books, or documents. Use when finding files by pattern, searching large files that are too big to read fully, extracting specific content from many files, or when grep/find is too slow. Triggers on "search for", "find occurrences", "look for pattern", "search in files".
4
+ ---
5
+
6
+ # Ripgrep (rg) - Fast Text Search Tool
7
+
8
+ ## Overview
9
+
10
+ Ripgrep is a line-oriented search tool that recursively searches directories for regex patterns. It's **10-100x faster than grep** and respects `.gitignore` by default. Use it instead of grep, find, or manually reading large files.
11
+
12
+ **Core principle:** When you need to find text in files, use ripgrep. Don't read entire files into context when you can search them.
13
+
14
+ ## When to Use
15
+
16
+ **Use ripgrep when:**
17
+ - Searching for text patterns across a codebase or directory
18
+ - Finding all occurrences of a function, variable, or string
19
+ - Searching through books, documentation, or large text files
20
+ - Files are too large to read fully into context
21
+ - Looking for specific content in many files at once
22
+ - Finding files that contain (or don't contain) certain patterns
23
+ - Extracting matching lines for analysis
24
+
25
+ **Don't use when:**
26
+ - You need the full file content (use Read tool)
27
+ - Simple glob pattern matching for filenames only (use Glob tool)
28
+ - You need structured data extraction (consider jq, awk)
29
+
30
+ ## Quick Reference
31
+
32
+ | Task | Command |
33
+ |------|---------|
34
+ | Basic search | `rg "pattern" [path]` |
35
+ | Case insensitive | `rg -i "pattern"` |
36
+ | Smart case (auto) | `rg -S "pattern"` |
37
+ | Whole word only | `rg -w "word"` |
38
+ | Fixed string (no regex) | `rg -F "literal.string"` |
39
+ | Show context lines | `rg -C 3 "pattern"` (3 before & after) |
40
+ | Show line numbers | `rg -n "pattern"` (default in tty) |
41
+ | Only filenames | `rg -l "pattern"` |
42
+ | Files without match | `rg --files-without-match "pattern"` |
43
+ | Count matches | `rg -c "pattern"` |
44
+ | Only matching part | `rg -o "pattern"` |
45
+ | Invert match | `rg -v "pattern"` |
46
+ | Multiline search | `rg -U "pattern.*\nmore"` |
47
+
48
+ ## File Filtering
49
+
50
+ ### By File Type
51
+
52
+ Ripgrep has built-in file type definitions. Use `-t` to include, `-T` to exclude:
53
+
54
+ ```bash
55
+ # Search only Python files
56
+ rg -t py "def main"
57
+
58
+ # Search only JavaScript and TypeScript
59
+ rg -t js -t ts "import"
60
+
61
+ # Exclude test files
62
+ rg -T test "function"
63
+
64
+ # List all known types
65
+ rg --type-list
66
+ ```
67
+
68
+ **Common types:** `py`, `js`, `ts`, `rust`, `go`, `java`, `c`, `cpp`, `rb`, `php`, `html`, `css`, `json`, `yaml`, `md`, `txt`, `sh`
69
+
70
+ ### By Glob Pattern
71
+
72
+ ```bash
73
+ # Only .tsx files
74
+ rg -g "*.tsx" "useState"
75
+
76
+ # Exclude node_modules (in addition to gitignore)
77
+ rg -g "!node_modules/**" "pattern"
78
+
79
+ # Only files in src directory
80
+ rg -g "src/**" "pattern"
81
+
82
+ # Multiple globs
83
+ rg -g "*.js" -g "*.ts" "pattern"
84
+
85
+ # Case insensitive globs
86
+ rg --iglob "*.JSON" "pattern"
87
+ ```
88
+
89
+ ### By File Size
90
+
91
+ ```bash
92
+ # Skip files larger than 1MB
93
+ rg --max-filesize 1M "pattern"
94
+ ```
95
+
96
+ ## Directory Control
97
+
98
+ ```bash
99
+ # Limit depth
100
+ rg --max-depth 2 "pattern"
101
+
102
+ # Search hidden files (dotfiles)
103
+ rg --hidden "pattern"
104
+
105
+ # Follow symlinks
106
+ rg -L "pattern"
107
+
108
+ # Ignore all ignore files (.gitignore, etc.)
109
+ rg --no-ignore "pattern"
110
+
111
+ # Progressive unrestricted (-u can stack up to 3 times)
112
+ rg -u "pattern" # --no-ignore
113
+ rg -uu "pattern" # --no-ignore --hidden
114
+ rg -uuu "pattern" # --no-ignore --hidden --binary
115
+ ```
116
+
117
+ ## Context Options
118
+
119
+ ```bash
120
+ # Lines after match
121
+ rg -A 5 "pattern"
122
+
123
+ # Lines before match
124
+ rg -B 5 "pattern"
125
+
126
+ # Lines before and after
127
+ rg -C 5 "pattern"
128
+
129
+ # Print entire file on match (passthrough mode)
130
+ rg --passthru "pattern"
131
+ ```
132
+
133
+ ## Output Formats
134
+
135
+ ```bash
136
+ # Just filenames with matches
137
+ rg -l "pattern"
138
+
139
+ # Files without matches
140
+ rg --files-without-match "pattern"
141
+
142
+ # Count matches per file
143
+ rg -c "pattern"
144
+
145
+ # Count total matches (not lines)
146
+ rg --count-matches "pattern"
147
+
148
+ # Only the matched text (not full line)
149
+ rg -o "pattern"
150
+
151
+ # JSON output (for parsing)
152
+ rg --json "pattern"
153
+
154
+ # Vim-compatible output (file:line:col:match)
155
+ rg --vimgrep "pattern"
156
+
157
+ # With statistics
158
+ rg --stats "pattern"
159
+ ```
160
+
161
+ ## Regex Patterns
162
+
163
+ Ripgrep uses Rust regex syntax by default:
164
+
165
+ ```bash
166
+ # Alternation
167
+ rg "foo|bar"
168
+
169
+ # Character classes
170
+ rg "[0-9]+"
171
+ rg "[a-zA-Z_][a-zA-Z0-9_]*"
172
+
173
+ # Word boundaries
174
+ rg "\bword\b"
175
+
176
+ # Quantifiers
177
+ rg "colou?r" # 0 or 1
178
+ rg "go+gle" # 1 or more
179
+ rg "ha*" # 0 or more
180
+ rg "x{2,4}" # 2 to 4 times
181
+
182
+ # Groups
183
+ rg "(foo|bar)baz"
184
+
185
+ # Lookahead/lookbehind (requires -P for PCRE2)
186
+ rg -P "(?<=prefix)content"
187
+ rg -P "content(?=suffix)"
188
+ ```
189
+
190
+ ### Multiline Matching
191
+
192
+ ```bash
193
+ # Enable multiline mode
194
+ rg -U "start.*\nend"
195
+
196
+ # Dot matches newline too
197
+ rg -U --multiline-dotall "start.*end"
198
+
199
+ # Match across lines
200
+ rg -U "function\s+\w+\([^)]*\)\s*\{"
201
+ ```
202
+
203
+ ## Replacement (Preview Only)
204
+
205
+ Ripgrep can show what replacements would look like (doesn't modify files):
206
+
207
+ ```bash
208
+ # Simple replacement
209
+ rg "old" -r "new"
210
+
211
+ # Using capture groups
212
+ rg "(\w+)@(\w+)" -r "$2::$1"
213
+
214
+ # Remove matches (empty replacement)
215
+ rg "pattern" -r ""
216
+ ```
217
+
218
+ ## Searching Special Files
219
+
220
+ ### Compressed Files
221
+
222
+ ```bash
223
+ # Search in gzip, bzip2, xz, lz4, lzma, zstd files
224
+ rg -z "pattern" file.gz
225
+ rg -z "pattern" archive.tar.gz
226
+ ```
227
+
228
+ ### Binary Files
229
+
230
+ ```bash
231
+ # Include binary files
232
+ rg --binary "pattern"
233
+
234
+ # Treat binary as text (may produce garbage)
235
+ rg -a "pattern"
236
+ ```
237
+
238
+ ### Large Files
239
+
240
+ For files too large to read into context:
241
+
242
+ ```bash
243
+ # Search and show only matching lines
244
+ rg "specific pattern" large_file.txt
245
+
246
+ # Limit matches to first N per file
247
+ rg -m 10 "pattern" huge_file.log
248
+
249
+ # Show byte offset for large file navigation
250
+ rg -b "pattern" large_file.txt
251
+
252
+ # Use with head/tail for pagination
253
+ rg "pattern" large_file.txt | head -100
254
+ ```
255
+
256
+ ## Performance Tips
257
+
258
+ 1. **Be specific with paths** - Don't search from root when you know the subdir
259
+ 2. **Use file types** - `-t py` is faster than `-g "*.py"`
260
+ 3. **Use fixed strings** - `-F` when you don't need regex
261
+ 4. **Limit depth** - `--max-depth` when you know structure
262
+ 5. **Let gitignore work** - Don't use `--no-ignore` unless needed
263
+ 6. **Use word boundaries** - `-w` is optimized
264
+
265
+ ## Common Patterns
266
+
267
+ ### Find function definitions
268
+ ```bash
269
+ # Python
270
+ rg "def \w+\(" -t py
271
+
272
+ # JavaScript/TypeScript
273
+ rg "(function|const|let|var)\s+\w+\s*=" -t js -t ts
274
+ rg "^\s*(async\s+)?function" -t js
275
+
276
+ # Go
277
+ rg "^func\s+\w+" -t go
278
+ ```
279
+
280
+ ### Find imports/requires
281
+ ```bash
282
+ # Python
283
+ rg "^(import|from)\s+" -t py
284
+
285
+ # JavaScript
286
+ rg "^(import|require\()" -t js
287
+
288
+ # Go
289
+ rg "^import\s+" -t go
290
+ ```
291
+
292
+ ### Find TODO/FIXME comments
293
+ ```bash
294
+ rg "(TODO|FIXME|HACK|XXX):"
295
+ ```
296
+
297
+ ### Find error handling
298
+ ```bash
299
+ # Python
300
+ rg "except\s+\w+:" -t py
301
+
302
+ # JavaScript
303
+ rg "\.catch\(|catch\s*\(" -t js
304
+ ```
305
+
306
+ ### Find class definitions
307
+ ```bash
308
+ # Python
309
+ rg "^class\s+\w+" -t py
310
+
311
+ # JavaScript/TypeScript
312
+ rg "^(export\s+)?(default\s+)?class\s+\w+" -t js -t ts
313
+ ```
314
+
315
+ ### Search in books/documents
316
+ ```bash
317
+ # Find chapter headings
318
+ rg "^(Chapter|CHAPTER)\s+\d+" book.txt
319
+
320
+ # Find quoted text
321
+ rg '"[^"]{20,}"' document.txt
322
+
323
+ # Find paragraphs containing word
324
+ rg -C 2 "keyword" book.txt
325
+ ```
326
+
327
+ ## Combining with Other Tools
328
+
329
+ ```bash
330
+ # Find files, then search
331
+ rg --files | xargs rg "pattern"
332
+
333
+ # Search and count by file
334
+ rg -c "pattern" | sort -t: -k2 -rn
335
+
336
+ # Search and open in editor
337
+ rg -l "pattern" | xargs code
338
+
339
+ # Extract unique matches
340
+ rg -o "\b[A-Z]{2,}\b" | sort -u
341
+
342
+ # Search multiple patterns from file
343
+ rg -f patterns.txt
344
+ ```
345
+
346
+ ## Exit Codes
347
+
348
+ | Code | Meaning |
349
+ |------|---------|
350
+ | 0 | Matches found |
351
+ | 1 | No matches found |
352
+ | 2 | Error occurred |
353
+
354
+ Useful for scripting:
355
+ ```bash
356
+ if rg -q "pattern" file.txt; then
357
+ echo "Found"
358
+ fi
359
+ ```
360
+
361
+ ## Common Mistakes
362
+
363
+ | Mistake | Fix |
364
+ |---------|-----|
365
+ | Pattern has special chars | Use `-F` for fixed strings or escape: `rg "foo\.bar"` |
366
+ | Can't find hidden files | Add `--hidden` or `-uu` |
367
+ | Missing node_modules | Add `--no-ignore` (but it's usually right to skip) |
368
+ | Regex too complex | Try `-P` for PCRE2 with lookahead/lookbehind |
369
+ | Output too long | Use `-m N` to limit, or `-l` for just filenames |
370
+ | Binary file skipped | Add `--binary` or `-a` for text mode |
371
+ | Need to see full line | Remove `-o` (only-matching) flag |
372
+
373
+ ## When to Prefer Other Tools
374
+
375
+ | Task | Better Tool |
376
+ |------|-------------|
377
+ | Structured JSON queries | `jq` |
378
+ | Column-based text processing | `awk` |
379
+ | Stream editing/substitution | `sed` (actually modifies files) |
380
+ | Find files by name only | `fd` or `find` |
381
+ | Simple file listing | `ls` or `glob` |
382
+ | Full file content needed | Read tool |
package/.mcp.json CHANGED
@@ -2,16 +2,15 @@
2
2
  "mcpServers": {
3
3
  "github": {
4
4
  "type": "http",
5
- "url": "https://api.githubcopilot.com/mcp"
5
+ "url": "https://api.githubcopilot.com/mcp",
6
+ "headers": {
7
+ "Authorization": "Bearer ${GH_TOKEN}"
8
+ }
6
9
  },
7
10
  "azure-devops": {
8
11
  "type": "stdio",
9
12
  "command": "bunx",
10
- "args": [
11
- "-y",
12
- "@azure-devops/mcp",
13
- "<your-org>"
14
- ]
13
+ "args": ["-y", "@azure-devops/mcp", "<your-org>"]
15
14
  }
16
15
  }
17
16
  }
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Claude In-Flight Hook command — internal handler for the workflow's
3
+ * `SubagentStart` / `SubagentStop` / `TeammateIdle` hooks.
4
+ *
5
+ * Invoked as:
6
+ * atomic _claude-inflight-hook start (SubagentStart)
7
+ * atomic _claude-inflight-hook stop (SubagentStop)
8
+ * atomic _claude-inflight-hook wait (TeammateIdle)
9
+ *
10
+ * `start` / `stop` maintain a directory of one marker file per in-flight
11
+ * subagent under `~/.atomic/claude-inflight/<root_session_id>/<agent_id>`.
12
+ * `<root_session_id>` is the stage's top-level Claude session — for nested
13
+ * subagents (a subagent spawning its own subagent) we resolve the root by
14
+ * looking up the parent session's mapping, so all descendants of a stage
15
+ * funnel into the same marker dir.
16
+ *
17
+ * `wait` is the focused completion-signal handler used for `TeammateIdle`:
18
+ * read `session_id` from the payload, await `waitForInflightDrained`, exit
19
+ * 0. We don't reuse the Stop hook handler here because Stop also writes
20
+ * `~/.atomic/claude-stop/<session_id>` (which the runtime's `waitForIdle`
21
+ * watches) and polls queue/release — those are tied to the stage's root
22
+ * session, and TeammateIdle's `session_id` may be a teammate's session
23
+ * that the runtime never enqueues to or releases.
24
+ *
25
+ * Two consumers gate on the in-flight dir being empty:
26
+ *
27
+ * 1. `claudeStopHookCommand` — won't consume the `claude-release` marker
28
+ * until in-flight is empty, so Claude itself doesn't exit while
29
+ * backgrounded subagents are still running.
30
+ *
31
+ * 2. `clearClaudeSession` — calls `waitForInflightDrained` before tearing
32
+ * down the pane, so the executor doesn't advance to the next stage
33
+ * while the previous stage's subagents still hold FDs/PTYs on the
34
+ * atomic tmux server.
35
+ *
36
+ * Always exits 0 — a non-zero exit would surface as a hook error in
37
+ * Claude's transcript, and silent miss + stale-sweep recovery is preferable
38
+ * to red noise on every workflow run.
39
+ */
40
+ /**
41
+ * Shape of the JSON payload Claude pipes to the Subagent / TeammateIdle
42
+ * lifecycle hooks via stdin.
43
+ *
44
+ * SubagentStart / SubagentStop → `agent_id` (uuid), `agent_type`
45
+ * TeammateIdle → `session_id` only (used by `wait` mode)
46
+ *
47
+ * `session_id` is the parent Claude session that triggered the event — for
48
+ * a top-level subagent, that's the stage's root; for a nested subagent,
49
+ * that's the spawning agent's session, and we look up its root via
50
+ * `inflightRoots`.
51
+ *
52
+ * Extra fields are ignored; missing ones cause a graceful exit-0 no-op.
53
+ */
54
+ export interface ClaudeInflightHookPayload {
55
+ session_id: string;
56
+ hook_event_name?: string;
57
+ agent_id?: string;
58
+ agent_type?: string;
59
+ cwd?: string;
60
+ }
61
+ export type ClaudeInflightHookMode = "start" | "stop" | "wait";
62
+ /**
63
+ * Handler for the hidden `_claude-inflight-hook` subcommand.
64
+ *
65
+ * Always returns 0 — silently swallows all errors. A buggy tracker must
66
+ * never kill stages.
67
+ */
68
+ export declare function claudeInflightHookCommand(mode: ClaudeInflightHookMode): Promise<number>;
69
+ /** True when the per-root marker dir is missing or contains no marker files. */
70
+ export declare function inflightDirIsEmpty(rootSessionId: string): Promise<boolean>;
71
+ /**
72
+ * Remove markers older than `thresholdMs` (default `ATOMIC_INFLIGHT_STALE_MS`
73
+ * or 2 h). Returns the number of markers reaped. Used by the Stop hook and
74
+ * `waitForInflightDrained` to recover from subagents that crashed without
75
+ * firing `SubagentStop`.
76
+ */
77
+ export declare function sweepStaleInflight(rootSessionId: string, thresholdMs?: number): Promise<number>;
78
+ export interface WaitForInflightOptions {
79
+ /** How long to wait before giving up. Default 30 minutes. */
80
+ timeoutMs?: number;
81
+ /** Poll cadence. Default 100 ms. */
82
+ pollIntervalMs?: number;
83
+ /** Stale-marker TTL. Default `ATOMIC_INFLIGHT_STALE_MS` or 2 h. */
84
+ staleMs?: number;
85
+ }
86
+ /**
87
+ * Resolve when the per-root marker dir is empty. Sweeps stale markers on
88
+ * every tick. Resolves silently on timeout — the caller can't usefully
89
+ * recover, so wedging vs. leaking is the only trade.
90
+ */
91
+ export declare function waitForInflightDrained(rootSessionId: string, options?: WaitForInflightOptions): Promise<void>;
92
+ /**
93
+ * Remove the per-root marker dir and any roots-mapping entries that point
94
+ * at this root. Called by `clearClaudeSession` on stage teardown so
95
+ * leftovers cannot bleed into a future session that reuses the same id
96
+ * (UUID collision is astronomically unlikely, but stale-sweep + cleanup
97
+ * costs nothing).
98
+ */
99
+ export declare function clearInflightTracking(rootSessionId: string): Promise<void>;
100
+ //# sourceMappingURL=claude-inflight-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-inflight-hook.d.ts","sourceRoot":"","sources":["../../../src/commands/cli/claude-inflight-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAMH;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAsF/D;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,MAAM,CAAC,CA0EjB;AAMD,gFAAgF;AAChF,wBAAsB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAYhF;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAED,MAAM,WAAW,sBAAsB;IACrC,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAKD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CAaf;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BhF"}
@@ -47,6 +47,8 @@ export declare function claudeHookDirs(): {
47
47
  hil: string;
48
48
  pid: string;
49
49
  ready: string;
50
+ inflight: string;
51
+ inflightRoots: string;
50
52
  };
51
53
  /** Options for {@link claudeStopHookCommand}. Primarily used by tests to shrink the wait budget. */
52
54
  export interface ClaudeStopHookOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"claude-stop-hook.d.ts","sourceRoot":"","sources":["../../../src/commands/cli/claude-stop-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAQH,yEAAyE;AACzE,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAeD;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAkBA;AAED,oGAAoG;AACpG,MAAM,WAAW,qBAAqB;IACpC,4FAA4F;IAC5F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAsFD;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,MAAM,CAAC,CAyMjB"}
1
+ {"version":3,"file":"claude-stop-hook.d.ts","sourceRoot":"","sources":["../../../src/commands/cli/claude-stop-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAYH,yEAAyE;AACzE,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAeD;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,CAgCA;AAED,oGAAoG;AACpG,MAAM,WAAW,qBAAqB;IACpC,4FAA4F;IAC5F,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAsFD;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,MAAM,CAAC,CAyNjB"}
@@ -65,7 +65,7 @@ export interface EnsureOptions {
65
65
  * both packages (or the already-installed @bastani/atomic) share.
66
66
  */
67
67
  export declare function upgradeGlobalPackages(pkgs: string[]): Promise<void>;
68
- /** Upgrade @playwright/cli and @llamaindex/liteparse globally in one pass. */
68
+ /** Upgrade @playwright/cli, @llamaindex/liteparse, and @ast-grep/cli globally in one pass. */
69
69
  export declare function upgradeGlobalToolPackages(): Promise<void>;
70
70
  /**
71
71
  * Ensure a terminal multiplexer (tmux on Unix, psmux on Windows) is installed.
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../src/lib/spawn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,CAuCjG;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAUnD;AAMD,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAExE;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEtD,wBAAgB,sCAAsC,CACpD,QAAQ,GAAE,MAAM,CAAC,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B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAUzE;AAED,8FAA8F;AAC9F,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM/D;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6GpF;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAoExD;AAED;;;GAGG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAEjD;AAED;;GAEG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAUhD;AAMD,qBAAa,iBAAkB,SAAQ,KAAK;aACd,QAAQ,EAAE,MAAM,EAAE;gBAAlB,QAAQ,EAAE,MAAM,EAAE;CAQ/C;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,WAAW,EAAE,EACpB,OAAO,EAAE,oBAAoB,CAAC,OAAO,CAAC,EAAE,GACvC,MAAM,EAAE,CAaV"}
@@ -23,6 +23,19 @@ import { type SessionMessage, type SDKUserMessage, type Options as SDKOptions }
23
23
  * waiting out the hook's safety timeout.
24
24
  *
25
25
  * Called by the runtime when a Claude stage is being torn down. Idempotent.
26
+ *
27
+ * After writing the release marker, this waits for the per-session in-flight
28
+ * marker dir (`~/.atomic/claude-inflight/<session_id>/`) to drain. The
29
+ * marker dir is populated by the SubagentStart/Stop and TaskCreated/Completed
30
+ * hooks registered in {@link WORKFLOW_HOOK_SETTINGS}. This wait is the
31
+ * synchronization barrier that prevents the executor from advancing to the
32
+ * next stage while the previous stage's backgrounded subagents/tasks still
33
+ * hold FDs/PTYs on the atomic tmux server — the failure mode that surfaced
34
+ * intermittently as `tmux respawn-pane: fork failed: Device not configured`.
35
+ *
36
+ * The wait has its own bounded timeout (default 30 minutes) so a wedged
37
+ * subagent can't permanently block the workflow; the in-hook stale-sweep
38
+ * (~2 hours TTL) is the ultimate safety net.
26
39
  */
27
40
  export declare function clearClaudeSession(paneId: string): Promise<void>;
28
41
  export interface ClaudeSessionOptions {
@@ -227,6 +240,21 @@ export declare function claudeQuery(options: ClaudeQueryOptions): Promise<Sessio
227
240
  * any extras that aren't already present. Exported for unit testing.
228
241
  */
229
242
  export declare function mergeDisallowedTools(existing: string[] | undefined, extras: string[]): string[];
243
+ /**
244
+ * Fold the atomic-managed additional instructions into a caller's
245
+ * `systemPrompt` value. Behavior, in order of precedence:
246
+ *
247
+ * - **No caller value** → return a `claude_code` preset with our content
248
+ * in `append`. Preserves the SDK's full Claude Code persona.
249
+ * - **Caller passed a preset object** → concatenate our content onto the
250
+ * existing `append` (newline-separated when both are present).
251
+ * - **Caller passed a custom string or array** → leave it alone. The
252
+ * caller has explicitly opted into a custom prompt, and silently
253
+ * prepending the persona-style preset text would break that contract.
254
+ *
255
+ * Exported for unit testing.
256
+ */
257
+ export declare function mergeSystemPromptAppend(existing: SDKOptions["systemPrompt"], extra: string): SDKOptions["systemPrompt"];
230
258
  /**
231
259
  * Synthetic client wrapper for Claude stages.
232
260
  * Auto-starts the Claude CLI in the tmux pane during `start()`.
@@ -325,6 +353,13 @@ export declare function resolveHeadlessClaudeBin(): string;
325
353
  */
326
354
  export declare class HeadlessClaudeSessionWrapper {
327
355
  readonly paneId = "";
356
+ /**
357
+ * Project root the workflow is operating against. Used to resolve
358
+ * project-scoped config (e.g. `additional-instructions`) against the
359
+ * workflow's actual root rather than `process.cwd()`, which can drift
360
+ * when workflows are invoked programmatically or from a subdirectory.
361
+ */
362
+ private readonly _projectRoot;
328
363
  /**
329
364
  * The Claude session UUID of the most recently completed `query()`. Exposed
330
365
  * via `s.sessionId` so workflows can pass it to `s.save(s.sessionId)` and
@@ -332,6 +367,7 @@ export declare class HeadlessClaudeSessionWrapper {
332
367
  * Claude stages run in parallel (each call gets its own SDK-assigned UUID).
333
368
  */
334
369
  private _lastSessionId;
370
+ constructor(projectRoot: string);
335
371
  /**
336
372
  * Validated structured output captured from the most recent `query()`'s
337
373
  * `result` message. Populated only when callers pass
@@ -1 +1 @@
1
- {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../../src/sdk/providers/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,OAAO,IAAI,UAAU,EAC3B,MAAM,gCAAgC,CAAC;AA8BxC;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBtE;AA6KD,MAAM,WAAW,oBAAoB;IACnC,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,sIAAsI;IACtI,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBxF;AA8HD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAUnE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAClC,eAAe,EAAE,MAAM,EACvB,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,EACjC,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,IAAI,CAAC,CAyCf;AAMD;;;;;;GAMG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;GAIG;AACH,wBAAg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5B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAajD;AAED;;;;;;;;;;GAUG;AACH,qBAAa,4BAA4B;IACvC,QAAQ,CAAC,MAAM,MAAM;IACrB;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC;;;;;OAKG;IACH,OAAO,CAAC,cAAc,CAAc;gBAExB,WAAW,EAAE,MAAM;IAG/B;;;;;;;OAOG;IACH,OAAO,CAAC,qBAAqB,CAAsB;IAEnD,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,oBAAoB,IAAI,OAAO,CAElC;IAEK,KAAK,CACT,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,cAAc,CAAC,EAC9C,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAC5B,OAAO,CAAC,cAAc,EAAE,CAAC;IA+CtB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAClC;AAQD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,+DAejC,CAAC"}
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Copilot workflow source validation.
2
+ * Copilot workflow source validation + helpers.
3
3
  *
4
4
  * Checks that Copilot workflow source files use the runtime-managed
5
5
  * `s.client` and `s.session` instead of manual SDK client creation.
6
6
  */
7
+ import type { SessionConfig as CopilotSessionConfig } from "@github/copilot-sdk";
7
8
  /**
8
9
  * Env inherited by the Copilot CLI subprocess the SDK spawns.
9
10
  *
@@ -21,6 +22,21 @@
21
22
  * mutating shared state.
22
23
  */
23
24
  export declare function copilotSubprocessEnv(): Record<string, string | undefined>;
25
+ /**
26
+ * Fold the atomic-managed additional instructions into a caller's
27
+ * `systemMessage` value on `client.createSession`. Behavior:
28
+ *
29
+ * - **No caller value** → `{ mode: "append", content: extra }`. The
30
+ * SDK's default mode is append and preserves the SDK persona.
31
+ * - **Append/customize mode** → concatenate our content to the existing
32
+ * `content` field (newline-separated when both are present).
33
+ * - **Replace mode** → leave alone. The caller has explicitly opted out
34
+ * of SDK-managed sections; silently re-adding the persona-style append
35
+ * would violate that contract.
36
+ *
37
+ * Exported for unit testing.
38
+ */
39
+ export declare function mergeCopilotSystemMessage(existing: CopilotSessionConfig["systemMessage"], extra: string): CopilotSessionConfig["systemMessage"];
24
40
  /**
25
41
  * Validate a Copilot workflow source file for common mistakes.
26
42
  */
@@ -1 +1 @@
1
- {"version":3,"file":"copilot.d.ts","sourceRoot":"","sources":["../../../src/sdk/providers/copilot.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAEzE;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,+DAelC,CAAC"}
1
+ {"version":3,"file":"copilot.d.ts","sourceRoot":"","sources":["../../../src/sdk/providers/copilot.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGjF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAEzE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,oBAAoB,CAAC,eAAe,CAAC,EAC/C,KAAK,EAAE,MAAM,GACZ,oBAAoB,CAAC,eAAe,CAAC,CASvC;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,+DAelC,CAAC"}