@bastani/atomic 0.5.12-5 → 0.5.13-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/lib/path-root-guard.d.ts +4 -0
  2. package/dist/lib/path-root-guard.d.ts.map +1 -0
  3. package/dist/sdk/components/color-utils.d.ts +4 -0
  4. package/dist/sdk/components/color-utils.d.ts.map +1 -0
  5. package/dist/sdk/components/compact-switcher.d.ts +10 -0
  6. package/dist/sdk/components/compact-switcher.d.ts.map +1 -0
  7. package/dist/sdk/components/connectors.d.ts +15 -0
  8. package/dist/sdk/components/connectors.d.ts.map +1 -0
  9. package/dist/sdk/components/edge.d.ts +4 -0
  10. package/dist/sdk/components/edge.d.ts.map +1 -0
  11. package/dist/sdk/components/error-boundary.d.ts +23 -0
  12. package/dist/sdk/components/error-boundary.d.ts.map +1 -0
  13. package/dist/sdk/components/graph-theme.d.ts +17 -0
  14. package/dist/sdk/components/graph-theme.d.ts.map +1 -0
  15. package/dist/sdk/components/header.d.ts +3 -0
  16. package/dist/sdk/components/header.d.ts.map +1 -0
  17. package/dist/sdk/components/hooks.d.ts +15 -0
  18. package/dist/sdk/components/hooks.d.ts.map +1 -0
  19. package/dist/sdk/components/layout.d.ts +27 -0
  20. package/dist/sdk/components/layout.d.ts.map +1 -0
  21. package/dist/sdk/components/node-card.d.ts +10 -0
  22. package/dist/sdk/components/node-card.d.ts.map +1 -0
  23. package/dist/sdk/components/orchestrator-panel-contexts.d.ts +16 -0
  24. package/dist/sdk/components/orchestrator-panel-contexts.d.ts.map +1 -0
  25. package/dist/sdk/components/orchestrator-panel-store.d.ts +50 -0
  26. package/dist/sdk/components/orchestrator-panel-store.d.ts.map +1 -0
  27. package/dist/sdk/components/orchestrator-panel-types.d.ts +18 -0
  28. package/dist/sdk/components/orchestrator-panel-types.d.ts.map +1 -0
  29. package/dist/sdk/components/orchestrator-panel.d.ts +56 -0
  30. package/dist/sdk/components/orchestrator-panel.d.ts.map +1 -0
  31. package/dist/sdk/components/session-graph-panel.d.ts +7 -0
  32. package/dist/sdk/components/session-graph-panel.d.ts.map +1 -0
  33. package/dist/sdk/components/status-helpers.d.ts +6 -0
  34. package/dist/sdk/components/status-helpers.d.ts.map +1 -0
  35. package/dist/sdk/components/statusline.d.ts +7 -0
  36. package/dist/sdk/components/statusline.d.ts.map +1 -0
  37. package/dist/sdk/components/workflow-picker-panel.d.ts +128 -0
  38. package/dist/sdk/components/workflow-picker-panel.d.ts.map +1 -0
  39. package/dist/sdk/define-workflow.d.ts +91 -0
  40. package/dist/sdk/define-workflow.d.ts.map +1 -0
  41. package/dist/sdk/errors.d.ts +24 -0
  42. package/dist/sdk/errors.d.ts.map +1 -0
  43. package/dist/sdk/index.d.ts +13 -0
  44. package/dist/sdk/index.d.ts.map +1 -0
  45. package/dist/sdk/providers/claude.d.ts +187 -0
  46. package/dist/sdk/providers/claude.d.ts.map +1 -0
  47. package/dist/sdk/providers/copilot.d.ts +11 -0
  48. package/dist/sdk/providers/copilot.d.ts.map +1 -0
  49. package/dist/sdk/providers/opencode.d.ts +11 -0
  50. package/dist/sdk/providers/opencode.d.ts.map +1 -0
  51. package/dist/sdk/runtime/discovery.d.ts +86 -0
  52. package/dist/sdk/runtime/discovery.d.ts.map +1 -0
  53. package/dist/sdk/runtime/executor-entry.d.ts +11 -0
  54. package/dist/sdk/runtime/executor-entry.d.ts.map +1 -0
  55. package/dist/sdk/runtime/executor.d.ts +72 -0
  56. package/dist/sdk/runtime/executor.d.ts.map +1 -0
  57. package/dist/sdk/runtime/graph-inference.d.ts +35 -0
  58. package/dist/sdk/runtime/graph-inference.d.ts.map +1 -0
  59. package/dist/sdk/runtime/loader.d.ts +70 -0
  60. package/dist/sdk/runtime/loader.d.ts.map +1 -0
  61. package/dist/sdk/runtime/panel.d.ts +9 -0
  62. package/dist/sdk/runtime/panel.d.ts.map +1 -0
  63. package/dist/sdk/runtime/theme.d.ts +28 -0
  64. package/dist/sdk/runtime/theme.d.ts.map +1 -0
  65. package/dist/sdk/runtime/tmux.d.ts +297 -0
  66. package/dist/sdk/runtime/tmux.d.ts.map +1 -0
  67. package/dist/sdk/types.d.ts +309 -0
  68. package/dist/sdk/types.d.ts.map +1 -0
  69. package/dist/sdk/workflows/builtin/deep-research-codebase/claude/index.d.ts +62 -0
  70. package/dist/sdk/workflows/builtin/deep-research-codebase/claude/index.d.ts.map +1 -0
  71. package/dist/sdk/workflows/builtin/deep-research-codebase/copilot/index.d.ts +46 -0
  72. package/dist/sdk/workflows/builtin/deep-research-codebase/copilot/index.d.ts.map +1 -0
  73. package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/heuristic.d.ts +26 -0
  74. package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/heuristic.d.ts.map +1 -0
  75. package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/prompts.d.ts +92 -0
  76. package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/prompts.d.ts.map +1 -0
  77. package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/scout.d.ts +57 -0
  78. package/dist/sdk/workflows/builtin/deep-research-codebase/helpers/scout.d.ts.map +1 -0
  79. package/dist/sdk/workflows/builtin/deep-research-codebase/opencode/index.d.ts +49 -0
  80. package/dist/sdk/workflows/builtin/deep-research-codebase/opencode/index.d.ts.map +1 -0
  81. package/dist/sdk/workflows/builtin/ralph/claude/index.d.ts +18 -0
  82. package/dist/sdk/workflows/builtin/ralph/claude/index.d.ts.map +1 -0
  83. package/dist/sdk/workflows/builtin/ralph/copilot/index.d.ts +19 -0
  84. package/dist/sdk/workflows/builtin/ralph/copilot/index.d.ts.map +1 -0
  85. package/dist/sdk/workflows/builtin/ralph/helpers/git.d.ts +69 -0
  86. package/dist/sdk/workflows/builtin/ralph/helpers/git.d.ts.map +1 -0
  87. package/dist/sdk/workflows/builtin/ralph/helpers/prompts.d.ts +240 -0
  88. package/dist/sdk/workflows/builtin/ralph/helpers/prompts.d.ts.map +1 -0
  89. package/dist/sdk/workflows/builtin/ralph/helpers/review.d.ts +20 -0
  90. package/dist/sdk/workflows/builtin/ralph/helpers/review.d.ts.map +1 -0
  91. package/dist/sdk/workflows/builtin/ralph/opencode/index.d.ts +18 -0
  92. package/dist/sdk/workflows/builtin/ralph/opencode/index.d.ts.map +1 -0
  93. package/dist/sdk/workflows/index.d.ts +24 -0
  94. package/dist/sdk/workflows/index.d.ts.map +1 -0
  95. package/dist/services/config/definitions.d.ts +85 -0
  96. package/dist/services/config/definitions.d.ts.map +1 -0
  97. package/dist/services/system/copy.d.ts +77 -0
  98. package/dist/services/system/copy.d.ts.map +1 -0
  99. package/dist/services/system/detect.d.ts +75 -0
  100. package/dist/services/system/detect.d.ts.map +1 -0
  101. package/package.json +2 -1
@@ -0,0 +1,62 @@
1
+ /**
2
+ * deep-research-codebase / claude
3
+ *
4
+ * A deterministically-orchestrated, distributed version of the
5
+ * `research-codebase` skill. The research-codebase skill spawns
6
+ * codebase-locator / codebase-analyzer / codebase-pattern-finder /
7
+ * codebase-research-locator / codebase-research-analyzer /
8
+ * codebase-online-researcher sub-agents on the fly via LLM judgment;
9
+ * this workflow spawns the same agents on a deterministic schedule
10
+ * driven by the codebase's lines of code.
11
+ *
12
+ * Topology:
13
+ *
14
+ * ┌─→ codebase-scout
15
+ * parent ─┤
16
+ * └─→ research-history
17
+ * │
18
+ * ▼
19
+ * ┌──────────────────────────────────────────────────┐
20
+ * │ explorer-1 explorer-2 ... explorer-N │ (Promise.all)
21
+ * └──────────────────────────────────────────────────┘
22
+ * │
23
+ * ▼
24
+ * aggregator
25
+ *
26
+ * Stage 1a — codebase-scout
27
+ * Pure-TypeScript: lists files (git ls-files), counts LOC (batched wc -l),
28
+ * renders a depth-bounded ASCII tree, and bin-packs directories into N
29
+ * partitions where N is determined by the LOC heuristic. Then makes one
30
+ * short LLM call to produce an architectural orientation that primes the
31
+ * downstream explorers. Returns structured data via `handle.result` and
32
+ * the agent's prose via `ctx.transcript(handle)`.
33
+ *
34
+ * Stage 1b — research-history (parallel sibling of scout)
35
+ * Dispatches the codebase-research-locator and codebase-research-analyzer
36
+ * sub-agents over the project's existing research/ directory to surface
37
+ * prior decisions, completed investigations, and unresolved questions.
38
+ * Output is consumed via session transcript (≤400 words) and feeds into
39
+ * the aggregator as supplementary context.
40
+ *
41
+ * Stage 2 — explorer-1..N (parallel; depends on scout + history)
42
+ * Each explorer is a coordinator that dispatches specialized sub-agents
43
+ * over its assigned partition (single LOC-balanced slice of the codebase):
44
+ * - codebase-locator → finds relevant files in the partition
45
+ * - codebase-analyzer → documents how the most relevant files work
46
+ * - codebase-pattern-finder → finds existing pattern examples
47
+ * - codebase-online-researcher → (conditional) external library docs
48
+ * The explorer never reads files directly — it orchestrates specialists
49
+ * and writes a synthesized findings document to a known scratch path.
50
+ *
51
+ * Stage 3 — aggregator
52
+ * Reads each explorer's scratch file by path (file-based handoff to keep
53
+ * the aggregator's own context lean — we deliberately do NOT inline N
54
+ * transcripts into the prompt). Folds in the research-history overview
55
+ * as supplementary context. Synthesizes a single research document at
56
+ * research/docs/YYYY-MM-DD-<slug>.md.
57
+ *
58
+ * Context-engineering decisions are documented at each stage below.
59
+ */
60
+ declare const _default: import("../../../index.ts").WorkflowDefinition<"claude", "prompt">;
61
+ export default _default;
62
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/deep-research-codebase/claude/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;;AA4BH,wBAuNa"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * deep-research-codebase / copilot
3
+ *
4
+ * Copilot replica of the Claude deep-research-codebase workflow. The Claude
5
+ * version dispatches specialist sub-agents (codebase-locator, codebase-
6
+ * analyzer, etc.) inside a single explorer session via `@"name (agent)"`
7
+ * syntax — a Claude-specific feature. Copilot sessions are bound to a single
8
+ * agent for their entire lifetime, so we keep the SAME graph topology
9
+ * (scout ∥ history → explorer-1..N → aggregator) but drive each explorer
10
+ * through the locate → analyze → patterns → synthesize sequence inline using
11
+ * the default agent's built-in file tools.
12
+ *
13
+ * Topology (identical to Claude version):
14
+ *
15
+ * ┌─→ codebase-scout
16
+ * parent ─┤
17
+ * └─→ research-history
18
+ * │
19
+ * ▼
20
+ * ┌──────────────────────────────────────────────────┐
21
+ * │ explorer-1 explorer-2 ... explorer-N │ (Promise.all)
22
+ * └──────────────────────────────────────────────────┘
23
+ * │
24
+ * ▼
25
+ * aggregator
26
+ *
27
+ * Copilot-specific concerns baked in:
28
+ *
29
+ *
30
+ * • F5 — every `ctx.stage()` call is a FRESH session with no memory of prior
31
+ * stages. We forward the scout overview, history overview, and partition
32
+ * assignment explicitly into each explorer's first prompt. The aggregator
33
+ * gets the same plus the explorer scratch file paths.
34
+ *
35
+ * • F9 — `s.save()` receives `SessionEvent[]` via `s.session.getMessages()`
36
+ * (Copilot's correct shape). Passing anything else breaks downstream
37
+ * `transcript()` reads.
38
+ *
39
+ * • F6 — every prompt explicitly requires trailing prose AFTER any tool
40
+ * call, so `transcript()` is never empty. A Copilot turn whose final
41
+ * message is a tool call produces an empty assistant.message terminator
42
+ * (F1); trailing prose is our insurance.
43
+ */
44
+ declare const _default: import("../../../index.ts").WorkflowDefinition<"copilot", "prompt">;
45
+ export default _default;
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/deep-research-codebase/copilot/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;;AAuBH,wBA+La"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Determine how many parallel explorer sub-agents to spawn for the
3
+ * deep-research-codebase workflow, based on lines of code in the codebase.
4
+ *
5
+ * The heuristic balances coverage against coordination overhead:
6
+ * - Too few explorers leave parts of the codebase under-investigated.
7
+ * - Too many explorers flood the aggregator with redundant findings,
8
+ * burn tokens on coordination, and exhaust tmux/process budgets.
9
+ *
10
+ * Tier choices were anchored to the rough sizes of common project shapes:
11
+ *
12
+ * < 5,000 LOC → 2 explorers scripts, single-purpose tools
13
+ * < 25,000 LOC → 3 explorers small libraries, CLI utilities
14
+ * < 100,000 LOC → 5 explorers medium applications
15
+ * < 500,000 LOC → 7 explorers large applications, small monorepos
16
+ * <2,000,000 LOC → 9 explorers large monorepos
17
+ * ≥2,000,000 LOC → 12 explorers massive monorepos (hard cap)
18
+ *
19
+ * The hard cap of 12 prevents runaway parallelism: each explorer is a
20
+ * Claude tmux pane plus an LLM session, so the cost grows linearly in
21
+ * tokens, processes, and walltime as well as in aggregator context.
22
+ */
23
+ export declare function calculateExplorerCount(loc: number): number;
24
+ /** Human-readable rationale for the heuristic decision — surfaced in logs/prompts. */
25
+ export declare function explainHeuristic(loc: number, count: number): string;
26
+ //# sourceMappingURL=heuristic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"heuristic.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/deep-research-codebase/helpers/heuristic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQ1D;AAED,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAInE"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Prompt builders for the deep-research-codebase workflow.
3
+ *
4
+ * Context-engineering principles applied throughout:
5
+ * - Position-aware placement: the research question is repeated at the
6
+ * TOP and BOTTOM of every prompt (recall is 85-95% at the edges and
7
+ * drops to 76-82% in the middle — see context-fundamentals).
8
+ * - Informativity over exhaustiveness: each explorer prompt contains
9
+ * only that explorer's partition, never the full file list.
10
+ * - Explicit trailing commentary (F6): every prompt asks the agent to
11
+ * produce a short text summary AFTER any tool/file output, so the
12
+ * transcript is not empty when downstream stages read it.
13
+ * - File-based handoff (filesystem-context skill): explorer findings
14
+ * are written to disk and the aggregator reads them by path, instead
15
+ * of inlining N transcripts into the aggregator's prompt.
16
+ * - Documentarian role: every prompt explicitly forbids critique or
17
+ * improvement suggestions; we are recording what exists.
18
+ */
19
+ import type { PartitionUnit } from "./scout.ts";
20
+ /** Slugify the user's prompt for use in the final research filename. */
21
+ export declare function slugifyPrompt(prompt: string): string;
22
+ export declare function buildScoutPrompt(opts: {
23
+ question: string;
24
+ tree: string;
25
+ totalLoc: number;
26
+ totalFiles: number;
27
+ explorerCount: number;
28
+ partitionPreview: PartitionUnit[][];
29
+ }): string;
30
+ export declare function buildExplorerPrompt(opts: {
31
+ question: string;
32
+ index: number;
33
+ total: number;
34
+ partition: PartitionUnit[];
35
+ scoutOverview: string;
36
+ scratchPath: string;
37
+ root: string;
38
+ }): string;
39
+ /**
40
+ * The research-history scout dispatches specialized sub-agents to surface
41
+ * historical context from the project's `research/` directory:
42
+ * - codebase-research-locator → finds prior research docs about the topic
43
+ * - codebase-research-analyzer → extracts key insights from the most
44
+ * relevant docs
45
+ *
46
+ * Output is consumed via session transcript (not file write) — kept short
47
+ * (≤400 words) so the aggregator can embed it cheaply.
48
+ */
49
+ export declare function buildHistoryPrompt(opts: {
50
+ question: string;
51
+ root: string;
52
+ }): string;
53
+ /**
54
+ * Generic explorer prompt (Copilot / OpenCode). Drives a single default-agent
55
+ * session through the locate → analyze → patterns → synthesize sequence using
56
+ * built-in tools directly, instead of Claude's sub-agent dispatch.
57
+ */
58
+ export declare function buildExplorerPromptGeneric(opts: {
59
+ question: string;
60
+ index: number;
61
+ total: number;
62
+ partition: PartitionUnit[];
63
+ scoutOverview: string;
64
+ historyOverview: string;
65
+ scratchPath: string;
66
+ root: string;
67
+ }): string;
68
+ /**
69
+ * Generic research-history prompt (Copilot / OpenCode). A single default-agent
70
+ * session searches the project's research/ directory using its own file tools,
71
+ * instead of dispatching Claude's codebase-research-locator / analyzer
72
+ * sub-agents.
73
+ */
74
+ export declare function buildHistoryPromptGeneric(opts: {
75
+ question: string;
76
+ root: string;
77
+ }): string;
78
+ export declare function buildAggregatorPrompt(opts: {
79
+ question: string;
80
+ totalLoc: number;
81
+ totalFiles: number;
82
+ explorerCount: number;
83
+ explorerFiles: {
84
+ index: number;
85
+ scratchPath: string;
86
+ partition: PartitionUnit[];
87
+ }[];
88
+ finalPath: string;
89
+ scoutOverview: string;
90
+ historyOverview: string;
91
+ }): string;
92
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/deep-research-codebase/helpers/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAOhD,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUpD;AAMD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,aAAa,EAAE,EAAE,CAAC;CACrC,GAAG,MAAM,CA2DT;AAMD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,MAAM,CAwKT;AAMD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,MAAM,CAkET;AAkBD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,MAAM,CAgLT;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,MAAM,CAoET;AAMD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,aAAa,EAAE,CAAC;KAC5B,EAAE,CAAC;IACJ,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,CA6IT"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Codebase scout: deterministic helpers for the deep-research-codebase workflow.
3
+ *
4
+ * Responsibilities:
5
+ * 1. Discover the codebase root (git toplevel, falling back to cwd).
6
+ * 2. List all source files, respecting .gitignore when in a git repo.
7
+ * 3. Count lines of code per file using batched `wc -l`.
8
+ * 4. Render a compact directory tree (depth-bounded) for prompt context.
9
+ * 5. Build "partition units" by aggregating LOC at depth-1, then drilling
10
+ * down on any unit that is too large to live in a single explorer.
11
+ * 6. Bin-pack partition units into N balanced groups (largest-first).
12
+ *
13
+ * Everything here is pure TypeScript + child_process — no LLM calls.
14
+ */
15
+ /** Per-file LOC + path. */
16
+ export type FileStats = {
17
+ path: string;
18
+ loc: number;
19
+ };
20
+ /**
21
+ * A "partition unit" is the atomic chunk of work that gets bin-packed into
22
+ * an explorer. It is always one directory (possibly drilled down to depth 2)
23
+ * with all of the code files that live anywhere underneath it.
24
+ */
25
+ export type PartitionUnit = {
26
+ /** Repo-relative path, e.g. "src/cli" or "packages/foo/src". */
27
+ path: string;
28
+ loc: number;
29
+ fileCount: number;
30
+ /** Repo-relative file paths inside this unit (full recursive listing). */
31
+ files: string[];
32
+ };
33
+ export type CodebaseScout = {
34
+ /** Absolute path to the repository root. */
35
+ root: string;
36
+ totalLoc: number;
37
+ totalFiles: number;
38
+ /** Compact rendered directory tree (depth-bounded) for prompt context. */
39
+ tree: string;
40
+ /** Partition units, sorted by LOC descending. */
41
+ units: PartitionUnit[];
42
+ };
43
+ /** Resolve the project root. Prefers `git rev-parse --show-toplevel`. */
44
+ export declare function getCodebaseRoot(): string;
45
+ /**
46
+ * Run the full scout: list files, count LOC, render tree, build partition units.
47
+ */
48
+ export declare function scoutCodebase(root: string): CodebaseScout;
49
+ /**
50
+ * Bin-pack partition units into `count` balanced groups. Greedy
51
+ * largest-first: assign each unit to the currently-lightest bin.
52
+ *
53
+ * If there are fewer units than requested bins, the result has exactly
54
+ * `units.length` non-empty bins (we never return empty bins).
55
+ */
56
+ export declare function partitionUnits(units: PartitionUnit[], count: number): PartitionUnit[][];
57
+ //# sourceMappingURL=scout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scout.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/deep-research-codebase/helpers/scout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA+BH,2BAA2B;AAC3B,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB,CAAC;AAEF,yEAAyE;AACzE,wBAAgB,eAAe,IAAI,MAAM,CAUxC;AAmMD;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAiBzD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,aAAa,EAAE,EACtB,KAAK,EAAE,MAAM,GACZ,aAAa,EAAE,EAAE,CAwBnB"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * deep-research-codebase / opencode
3
+ *
4
+ * OpenCode replica of the Claude deep-research-codebase workflow. The Claude
5
+ * version dispatches specialist sub-agents (codebase-locator, codebase-
6
+ * analyzer, etc.) inside a single explorer session via `@"name (agent)"`
7
+ * syntax — a Claude-specific feature. OpenCode sessions are bound to a
8
+ * single agent for their lifetime, so we keep the SAME graph topology
9
+ * (scout ∥ history → explorer-1..N → aggregator) but drive each explorer
10
+ * through the locate → analyze → patterns → synthesize sequence inline using
11
+ * the default agent's built-in file tools.
12
+ *
13
+ * Topology (identical to Claude version):
14
+ *
15
+ * ┌─→ codebase-scout
16
+ * parent ─┤
17
+ * └─→ research-history
18
+ * │
19
+ * ▼
20
+ * ┌──────────────────────────────────────────────────┐
21
+ * │ explorer-1 explorer-2 ... explorer-N │ (Promise.all)
22
+ * └──────────────────────────────────────────────────┘
23
+ * │
24
+ * ▼
25
+ * aggregator
26
+ *
27
+ * OpenCode-specific concerns baked in:
28
+ *
29
+ * • F5 — every `ctx.stage()` call is a FRESH session with no memory of
30
+ * prior stages. We forward the scout overview, history overview, and
31
+ * partition assignment explicitly into each explorer's first prompt.
32
+ *
33
+ * • F9 — `s.save()` receives the `{ info, parts }` payload from
34
+ * `s.client.session.prompt()` via `result.data!`. Passing the full
35
+ * `result` (with its wrapping) or raw `result.data.parts` breaks
36
+ * downstream `transcript()` reads.
37
+ *
38
+ * • F6 — every prompt explicitly requires trailing prose AFTER any tool
39
+ * call so the rendered transcript has content. OpenCode's `parts` array
40
+ * mixes text/tool/reasoning/file parts; without trailing text the
41
+ * transcript extractor returns an empty string.
42
+ *
43
+ * • F3 — transcript extraction relies on the runtime's text-only rendering
44
+ * of `result.data.parts`. The helpers call `ctx.transcript(handle)` which
45
+ * returns `{ path, content }` where content is already text-filtered.
46
+ */
47
+ declare const _default: import("../../../index.ts").WorkflowDefinition<"opencode", "prompt">;
48
+ export default _default;
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/deep-research-codebase/opencode/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;;AAuBH,wBA2Na"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Ralph workflow for Claude Code — plan → orchestrate → review → debug loop.
3
+ *
4
+ * Each sub-agent invocation spawns its own visible session in the graph,
5
+ * so users can see each iteration's progress in real time. The loop
6
+ * terminates when:
7
+ * - {@link MAX_LOOPS} iterations have completed, OR
8
+ * - Two parallel reviewer passes both return zero findings.
9
+ *
10
+ * The reviewer stages use the Claude Agent SDK's structured output
11
+ * (`outputFormat`) to guarantee the review result matches the
12
+ * {@link ReviewResultSchema} — no manual JSON parsing required.
13
+ *
14
+ * Run: atomic workflow -n ralph -a claude "<your spec>"
15
+ */
16
+ declare const _default: import("../../../index.ts").WorkflowDefinition<"claude", "prompt">;
17
+ export default _default;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/ralph/claude/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AAiEH,wBAwJa"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Ralph workflow for Copilot — plan → orchestrate → review → debug loop.
3
+ *
4
+ * Each sub-agent invocation spawns its own visible session in the graph,
5
+ * so users can see each iteration's progress in real time. The loop
6
+ * terminates when:
7
+ * - {@link MAX_LOOPS} iterations have completed, OR
8
+ * - Two parallel reviewer passes both return zero findings.
9
+ *
10
+ * The reviewer stages use a `submit_review` custom tool (defined via
11
+ * `defineTool` with Zod schema validation) to guarantee the review result
12
+ * matches the {@link ReviewResultSchema}. The Copilot SDK validates tool
13
+ * call arguments against the Zod schema before the handler fires.
14
+ *
15
+ * Run: atomic workflow -n ralph -a copilot "<your spec>"
16
+ */
17
+ declare const _default: import("../../../index.ts").WorkflowDefinition<"copilot", "prompt">;
18
+ export default _default;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/ralph/copilot/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;AA6DH,wBA2La"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Deterministic changeset probes used by the Ralph loop.
3
+ *
4
+ * The reviewer and debugger sub-agents both benefit from knowing exactly which
5
+ * files were touched by the current work. We compute a diff relative to the
6
+ * parent branch (auto-discovered, defaulting to main) so the changeset
7
+ * includes BOTH committed and uncommitted changes — not just the working tree.
8
+ *
9
+ * Git command failures are captured — not swallowed — so downstream agents
10
+ * can distinguish "nothing changed" from "git broke" and course-correct.
11
+ */
12
+ /**
13
+ * Discover the parent (base) branch for the current HEAD.
14
+ *
15
+ * Strategy:
16
+ * 1. Find the merge-base between HEAD and each default-branch candidate.
17
+ * The candidate whose merge-base is closest to HEAD (fewest commits away)
18
+ * is the winner.
19
+ * 2. If no candidate exists locally, fall back to "main".
20
+ *
21
+ * This handles the common case of feature branches off main/master without
22
+ * requiring configuration.
23
+ */
24
+ export declare function discoverBaseBranch(cwd?: string): Promise<string>;
25
+ /** The result of capturing the full changeset for a review. */
26
+ export interface BranchChangeset {
27
+ /** The base branch the diff is relative to (e.g. "main") */
28
+ baseBranch: string;
29
+ /**
30
+ * `git diff --stat` output showing files changed, insertions, deletions
31
+ * relative to the merge-base with the parent branch. Includes both
32
+ * committed AND uncommitted changes.
33
+ */
34
+ diffStat: string;
35
+ /**
36
+ * Short list of uncommitted working-tree changes (`git status -s`).
37
+ * Useful for the reviewer to distinguish "already committed" from
38
+ * "still in-flight".
39
+ */
40
+ uncommitted: string;
41
+ /**
42
+ * `git diff --name-status` output listing each changed file with its
43
+ * status (A=added, M=modified, D=deleted, R=renamed).
44
+ */
45
+ nameStatus: string;
46
+ /**
47
+ * Human-readable error messages for any git commands that failed during
48
+ * changeset capture. Empty when everything succeeded. Downstream prompts
49
+ * surface these so the reviewing agent can course-correct (e.g. run the
50
+ * git commands itself, or flag the gap as a finding).
51
+ */
52
+ errors: string[];
53
+ }
54
+ /**
55
+ * Capture the full changeset for the current branch relative to its parent.
56
+ *
57
+ * Combines:
58
+ * - `git diff <merge-base>..HEAD --stat` (committed changes)
59
+ * - `git diff --stat` (uncommitted staged+unstaged changes)
60
+ * - `git status -s` (working tree snapshot)
61
+ *
62
+ * Into a single {@link BranchChangeset} that gives the reviewer complete
63
+ * visibility into everything this branch has done.
64
+ *
65
+ * Git failures are collected in {@link BranchChangeset.errors} rather than
66
+ * swallowed, so downstream agents see exactly what broke and can compensate.
67
+ */
68
+ export declare function captureBranchChangeset(cwd?: string): Promise<BranchChangeset>;
69
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/workflows/builtin/ralph/helpers/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA0DH;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA4BjB;AAID,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,eAAe,CAAC,CAuC1B"}