nightralph 0.0.19 → 0.0.22

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 (38) hide show
  1. package/README.md +74 -10
  2. package/dist/display.js +0 -12
  3. package/dist/display.js.map +2 -2
  4. package/dist/docs-templates/issue-tracker-github.md +15 -85
  5. package/dist/docs-templates/issue-tracker.md +16 -10
  6. package/dist/index.js +681 -191
  7. package/dist/index.js.map +4 -4
  8. package/dist/meta.json +68 -14
  9. package/dist/orchestrator.js +517 -142
  10. package/dist/orchestrator.js.map +3 -3
  11. package/dist/progress.js +10 -0
  12. package/dist/progress.js.map +2 -2
  13. package/dist/setup.js +2 -1
  14. package/dist/setup.js.map +2 -2
  15. package/dist/skills/codebase-design/DEEPENING.md +37 -0
  16. package/dist/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
  17. package/dist/skills/codebase-design/SKILL.md +114 -0
  18. package/dist/skills/codebase-design/agents/openai.yaml +3 -0
  19. package/dist/skills/to-spec/SKILL.md +1 -1
  20. package/dist/skills/to-tickets/SKILL.md +2 -2
  21. package/dist/src/display.d.ts +0 -1
  22. package/dist/src/display.d.ts.map +1 -1
  23. package/dist/src/index.d.ts.map +1 -1
  24. package/dist/src/orchestrator.d.ts +25 -2
  25. package/dist/src/orchestrator.d.ts.map +1 -1
  26. package/dist/src/progress.d.ts +1 -1
  27. package/dist/src/progress.d.ts.map +1 -1
  28. package/dist/src/setup.d.ts +1 -1
  29. package/dist/src/setup.d.ts.map +1 -1
  30. package/dist/src/testcmd.d.ts +11 -0
  31. package/dist/src/testcmd.d.ts.map +1 -0
  32. package/dist/src/worktree.d.ts +3 -1
  33. package/dist/src/worktree.d.ts.map +1 -1
  34. package/dist/testcmd.js +67 -0
  35. package/dist/testcmd.js.map +7 -0
  36. package/dist/worktree.js +19 -6
  37. package/dist/worktree.js.map +2 -2
  38. package/package.json +3 -3
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: codebase-design
3
+ description: Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
4
+ ---
5
+
6
+ # Codebase Design
7
+
8
+ Design **deep modules**: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Use this language and these principles wherever code is being designed or restructured. The aim is leverage for callers, locality for maintainers, and testability for everyone.
9
+
10
+ ## Glossary
11
+
12
+ Use these terms exactly: don't substitute "component," "service," "API," or "boundary." Consistent language is the whole point.
13
+
14
+ **Module**: anything with an interface and an implementation. Deliberately scale-agnostic: a function, class, package, or tier-spanning slice. _Avoid_: unit, component, service.
15
+
16
+ **Interface**: everything a caller must know to use the module correctly: the type signature, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (too narrow, they refer only to the type-level surface).
17
+
18
+ **Implementation**: what's inside a module, its body of code. Distinct from **Adapter**: a thing can be a small adapter with a large implementation (a Postgres repo) or a large adapter with a small implementation (an in-memory fake). Reach for "adapter" when the seam is the topic; "implementation" otherwise.
19
+
20
+ **Depth**: leverage at the interface. The amount of behaviour a caller (or test) can exercise per unit of interface they have to learn. A module is **deep** when a large amount of behaviour sits behind a small interface, **shallow** when the interface is nearly as complex as the implementation.
21
+
22
+ **Seam** _(Michael Feathers)_: a place where you can alter behaviour without editing in that place; the *location* at which a module's interface lives. Where to put the seam is its own design decision, distinct from what goes behind it. _Avoid_: boundary (overloaded with DDD's bounded context).
23
+
24
+ **Adapter**: a concrete thing that satisfies an interface at a seam. Describes *role* (what slot it fills), not substance (what's inside).
25
+
26
+ **Leverage**: what callers get from depth. More capability per unit of interface they learn. One implementation pays back across N call sites and M tests.
27
+
28
+ **Locality**: what maintainers get from depth. Change, bugs, knowledge, and verification concentrate in one place rather than spreading across callers. Fix once, fixed everywhere.
29
+
30
+ ## Deep vs shallow
31
+
32
+ **Deep module** = small interface + lots of implementation:
33
+
34
+ ```
35
+ ┌─────────────────────┐
36
+ │ Small Interface │ ← Few methods, simple params
37
+ ├─────────────────────┤
38
+ │ │
39
+ │ Deep Implementation│ ← Complex logic hidden
40
+ │ │
41
+ └─────────────────────┘
42
+ ```
43
+
44
+ **Shallow module** = large interface + little implementation (avoid):
45
+
46
+ ```
47
+ ┌─────────────────────────────────┐
48
+ │ Large Interface │ ← Many methods, complex params
49
+ ├─────────────────────────────────┤
50
+ │ Thin Implementation │ ← Just passes through
51
+ └─────────────────────────────────┘
52
+ ```
53
+
54
+ When designing an interface, ask:
55
+
56
+ - Can I reduce the number of methods?
57
+ - Can I simplify the parameters?
58
+ - Can I hide more complexity inside?
59
+
60
+ ## Principles
61
+
62
+ - **Depth is a property of the interface, not the implementation.** A deep module can be internally composed of small, mockable, swappable parts; they just aren't part of the interface. A module can have **internal seams** (private to its implementation, used by its own tests) as well as the **external seam** at its interface.
63
+ - **The deletion test.** Imagine deleting the module. If complexity vanishes, it was a pass-through. If complexity reappears across N callers, it was earning its keep.
64
+ - **The interface is the test surface.** Callers and tests cross the same seam. If you want to test *past* the interface, the module is probably the wrong shape.
65
+ - **One adapter means a hypothetical seam. Two adapters means a real one.** Don't introduce a seam unless something actually varies across it.
66
+
67
+ ## Designing for testability
68
+
69
+ Good interfaces make testing natural:
70
+
71
+ 1. **Accept dependencies, don't create them.**
72
+
73
+ ```typescript
74
+ // Testable
75
+ function processOrder(order, paymentGateway) {}
76
+
77
+ // Hard to test
78
+ function processOrder(order) {
79
+ const gateway = new StripeGateway();
80
+ }
81
+ ```
82
+
83
+ 2. **Return results, don't produce side effects.**
84
+
85
+ ```typescript
86
+ // Testable
87
+ function calculateDiscount(cart): Discount {}
88
+
89
+ // Hard to test
90
+ function applyDiscount(cart): void {
91
+ cart.total -= discount;
92
+ }
93
+ ```
94
+
95
+ 3. **Small surface area.** Fewer methods = fewer tests needed. Fewer params = simpler test setup.
96
+
97
+ ## Relationships
98
+
99
+ - A **Module** has exactly one **Interface** (the surface it presents to callers and tests).
100
+ - **Depth** is a property of a **Module**, measured against its **Interface**.
101
+ - A **Seam** is where a **Module**'s **Interface** lives.
102
+ - An **Adapter** sits at a **Seam** and satisfies the **Interface**.
103
+ - **Depth** produces **Leverage** for callers and **Locality** for maintainers.
104
+
105
+ ## Rejected framings
106
+
107
+ - **Depth as ratio of implementation-lines to interface-lines** (Ousterhout): rewards padding the implementation. We use depth-as-leverage instead.
108
+ - **"Interface" as the TypeScript `interface` keyword or a class's public methods**: too narrow: interface here includes every fact a caller must know.
109
+ - **"Boundary"**: overloaded with DDD's bounded context. Say **seam** or **interface**.
110
+
111
+ ## Going deeper
112
+
113
+ - **Deepening a cluster given its dependencies**, see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.
114
+ - **Exploring alternative interfaces**, see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): spin up parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.
@@ -0,0 +1,3 @@
1
+ interface:
2
+ display_name: "Codebase Design"
3
+ short_description: "Vocabulary for deep-module design"
@@ -6,7 +6,7 @@ disable-model-invocation: true
6
6
 
7
7
  This skill takes the current conversation context and codebase understanding and produces a spec. Do NOT interview the user; just synthesize what you already know.
8
8
 
9
- The issue tracker and triage label vocabulary should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.
9
+ The issue tracker and triage label vocabulary should have been provided to you. If not, tell the user to run `npx nightralph init`.
10
10
 
11
11
  ## Process
12
12
 
@@ -8,7 +8,7 @@ disable-model-invocation: true
8
8
 
9
9
  Break a plan, spec, or conversation into a set of **tickets**: tracer-bullet vertical slices, each declaring the tickets that **block** it.
10
10
 
11
- The issue tracker and triage label vocabulary should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.
11
+ The issue tracker and triage label vocabulary should have been provided to you. If not, tell the user to run `npx nightralph init`.
12
12
 
13
13
  ## Process
14
14
 
@@ -57,7 +57,7 @@ Iterate until the user approves the breakdown.
57
57
 
58
58
  ### 5. Publish the tickets to the configured tracker
59
59
 
60
- Publish the approved tickets. **How** depends on the tracker `/setup-matt-pocock-skills` configured; the tickets are the same either way, only the shape of the blocking edges changes:
60
+ Publish the approved tickets. **How** depends on the tracker `npx nightralph init` configured; the tickets are the same either way, only the shape of the blocking edges changes:
61
61
 
62
62
  - **Local files** → write one file per ticket under `.scratch/<feature-slug>/issues/<NN>-<slug>.md`, numbered from `01` in dependency order (blockers first). Each file's "Blocked by" lists the numbers/titles it depends on. Use the per-ticket file template below: one ticket per file, never a single combined file.
63
63
  - **A real issue tracker (GitHub, Linear, …)** → publish one issue per ticket in dependency order (blockers first) so each ticket's blocking edges can reference real identifiers. Use the platform's native blocking / sub-issue relationship where it has one; otherwise set each ticket's "Blocked by" to the blocking issues. Apply the `ready-for-agent` triage label unless instructed otherwise; the tickets are agent-grabbable by construction.
@@ -63,7 +63,6 @@ export declare class StatusDisplay implements Display {
63
63
  private config;
64
64
  private viewportStart;
65
65
  private resizeListener;
66
- private signalHandler;
67
66
  constructor(config?: Readonly<Partial<DisplayConfig>>);
68
67
  private getAvailableRows;
69
68
  startWave(waveNum: number, totalWaves: number, tickets: Array<Readonly<{
@@ -1 +1 @@
1
- {"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/display.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAClB,SAAS,GACT,aAAa,GACb,MAAM,GACN,QAAQ,CAAA;AAEd,MAAM,MAAM,aAAa,GAAG;IACxB,QAAQ,CAAC,GAAG,EAAC,MAAM,CAAA;IACnB,QAAQ,CAAC,QAAQ,EAAC,MAAM,CAAA;IACxB,MAAM,EAAC,YAAY,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACpB,QAAQ,CAAC,OAAO,EAAC,MAAM,CAAA;IACvB,QAAQ,CAAC,UAAU,EAAC,MAAM,CAAA;IAC1B,QAAQ,CAAC,OAAO,EAAC,KAAK,CAAC,aAAa,CAAC,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,Q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E,CAAC,CAAC,EACxD,QAAQ,CAAC,EAAC,WAAW,EACrB,SAAS,CAAC,EAAC,aAAa,CAAC;QACrB,GAAG,EAAC,MAAM,CAAA;QACV,QAAQ,EAAC,MAAM,CAAA;KAClB,CAAC,GACJ,IAAI;IAiCN,eAAe,CAAE,GAAG,EAAC,MAAM,EAAE,MAAM,EAAC,YAAY,GAAE,IAAI;IA6BtD,GAAG,CAAE,OAAO,EAAC,MAAM,GAAE,IAAI;IAQzB,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,MAAM;CAkIjB;AAED,qBAAa,YAAa,YAAW,OAAO;IACxC,SAAS,CACL,OAAO,EAAC,MAAM,EACd,WAAW,EAAC,MAAM,EAClB,OAAO,EAAC,aAAa,CAAC;QAAE,GAAG,EAAC,MAAM,CAAC;QAAC,QAAQ,EAAC,MAAM,CAAA;KAAE,CAAC,EACtD,QAAQ,CAAC,EAAC,WAAW,EACrB,UAAU,CAAC,EAAC,aAAa,CAAC;QACtB,GAAG,EAAC,MAAM,CAAA;QACV,QAAQ,EAAC,MAAM,CAAA;KAClB,CAAC,GACJ,IAAI;IAUN,eAAe,CAAE,IAAI,EAAC,MAAM,EAAE,OAAO,EAAC,YAAY,GAAE,IAAI;IAIxD,GAAG,CAAE,OAAO,EAAC,MAAM,GAAE,IAAI;IAIzB,OAAO,IAAI,IAAI;CAGlB;AAED,wBAAgB,aAAa,CAAE,MAAM,CAAC,EAAC,MAAM,CAAC,WAAW,GAAE,OAAO,CAOjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAgBA,OAAO,EACH,eAAe,EACf,gBAAgB,EAEnB,MAAM,cAAc,CAAA;AAGrB,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAuBA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAgB,MAAM,cAAc,CAAA;AAG9E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAA"}
@@ -23,9 +23,15 @@ export declare const COMPLETED_RE: RegExp;
23
23
  export declare const TOOL_USE_RE: RegExp;
24
24
  export declare function checkItems(ticket: Ticket, completedItems: string[]): void;
25
25
  export declare function markDone(ticket: Ticket): void;
26
- export declare function renderPrompt(specBody: string, ticket: Ticket): string;
26
+ export declare function stripSpecSection(specBody: string, heading: string): string;
27
+ export declare function renderPrompt(specBody: string, ticket: Ticket, opts?: {
28
+ testCmd?: string | null;
29
+ }): string;
27
30
  export declare function renderMergePrompt(specBody: string, ticket: Ticket): string;
28
31
  export declare function getProviderArgs(cmd: string): string[];
32
+ export declare const THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
33
+ export type ThinkingLevel = typeof THINKING_LEVELS[number];
34
+ export declare function escalateThinking(level?: ThinkingLevel): ThinkingLevel;
29
35
  export declare function formatStreamLine(line: string): string | null;
30
36
  export type PiStreamFormatter = {
31
37
  process: (line: string) => string[];
@@ -35,7 +41,10 @@ export declare function createPiStreamFormatter(): PiStreamFormatter;
35
41
  export type AgentResult = {
36
42
  exitCode: number;
37
43
  completedItems: string[];
44
+ timedOut: boolean;
38
45
  };
46
+ export declare function killProcessGroup(pid: number | undefined): void;
47
+ export declare function killRunningAgents(): void;
39
48
  export declare function spawnAgent(opts: {
40
49
  prompt: string;
41
50
  agentCmd: string;
@@ -44,6 +53,8 @@ export declare function spawnAgent(opts: {
44
53
  logPath: string;
45
54
  cwd?: string;
46
55
  label?: string;
56
+ maxTurns?: number;
57
+ thinking?: ThinkingLevel;
47
58
  onLine?: (line: string) => void;
48
59
  }): Promise<AgentResult>;
49
60
  export declare function dryRun(tickets: Array<Ticket>, specBody: string): void;
@@ -53,8 +64,15 @@ export declare function dryRunIsolated(opts: {
53
64
  repoName: string;
54
65
  conflictStrategy: MergeConflictStrategy;
55
66
  progressPath: string;
67
+ testCmd?: string | null;
68
+ thinking?: ThinkingLevel;
69
+ retries?: number;
70
+ retryDelay?: number;
56
71
  }): void;
57
- export declare function runWaves(tickets: Ticket[], specBody: string, agentCmd: string, model: string | null, timeout: number, logsDir: string, display?: Display): Promise<{
72
+ export declare const DEFAULT_RETRIES = 2;
73
+ export declare const DEFAULT_RETRY_DELAY = 30;
74
+ export declare function retryDelayFor(base: number, attempt: number): number;
75
+ export declare function runWaves(tickets: Ticket[], specBody: string, agentCmd: string, model: string | null, timeout: number, logsDir: string, display?: Display, maxTurns?: number, thinking?: ThinkingLevel, retries?: number, retryDelay?: number): Promise<{
58
76
  allDone: boolean;
59
77
  }>;
60
78
  export declare function runWavesIsolated(opts: {
@@ -67,6 +85,11 @@ export declare function runWavesIsolated(opts: {
67
85
  featureName: string;
68
86
  conflictStrategy: MergeConflictStrategy;
69
87
  display?: Display;
88
+ testCmd?: string | null;
89
+ maxTurns?: number;
90
+ thinking?: ThinkingLevel;
91
+ retries?: number;
92
+ retryDelay?: number;
70
93
  }): Promise<{
71
94
  allDone: boolean;
72
95
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/orchestrator.ts"],"names":[],"mappings":"AA+BA,OAAO,EAIH,KAAK,qBAAqB,EAC7B,MAAM,YAAY,CAAA;AACnB,OAAO,EAGH,KAAK,OAAO,EACf,MAAM,cAAc,CAAA;AAErB,MAAM,MAAM,MAAM,GAAG;IACjB,GAAG,EAAC,MAAM,CAAA;IACV,IAAI,EAAC,MAAM,CAAA;IACX,QAAQ,EAAC,MAAM,CAAA;IACf,QAAQ,EAAC,MAAM,CAAA;IACf,IAAI,EAAC,MAAM,CAAA;IACX,MAAM,EAAC,MAAM,CAAA;IACb,QAAQ,EAAC,MAAM,EAAE,CAAA;CACpB,CAAA;AAED,wBAAgB,kBAAkB,CAAE,KAAK,EAAC,OAAO,GAAE,MAAM,CAIxD;AAED,eAAO,MAAM,SAAS,QAAqB,CAAA;AAE3C,wB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M,CAEjE;AAoPD,wBAAsB,QAAQ,CAC1B,OAAO,EAAC,MAAM,EAAE,EAChB,QAAQ,EAAC,MAAM,EACf,QAAQ,EAAC,MAAM,EACf,KAAK,EAAC,MAAM,GAAC,IAAI,EACjB,OAAO,EAAC,MAAM,EACd,OAAO,EAAC,MAAM,EACd,OAAO,CAAC,EAAC,OAAO,EAChB,QAAQ,CAAC,EAAC,MAAM,EAChB,QAAQ,CAAC,EAAC,aAAa,EACvB,OAAO,CAAC,EAAC,MAAM,EACf,UAAU,CAAC,EAAC,MAAM,GACpB,OAAO,CAAC;IAAE,OAAO,EAAC,OAAO,CAAA;CAAE,CAAC,CAmJ7B;AAED,wBAAsB,gBAAgB,CAAE,IAAI,EAAC;IACzC,OAAO,EAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACrB,QAAQ,EAAC,MAAM,CAAA;IACf,QAAQ,EAAC,MAAM,CAAA;IACf,KAAK,EAAC,MAAM,GAAC,IAAI,CAAA;IACjB,OAAO,EAAC,MAAM,CAAA;IACd,OAAO,EAAC,MAAM,CAAA;IACd,WAAW,EAAC,MAAM,CAAA;IAClB,gBAAgB,EAAC,qBAAqB,CAAA;IACtC,OAAO,CAAC,EAAC,OAAO,CAAA;IAChB,OAAO,CAAC,EAAC,MAAM,GAAC,IAAI,CAAA;IACpB,QAAQ,CAAC,EAAC,MAAM,CAAA;IAEhB,QAAQ,CAAC,EAAC,aAAa,CAAA;IAEvB,OAAO,CAAC,EAAC,MAAM,CAAA;IAEf,UAAU,CAAC,EAAC,MAAM,CAAA;CACrB,GAAE,OAAO,CAAC;IAAE,OAAO,EAAC,OAAO,CAAA;CAAE,CAAC,CAwW9B"}
@@ -23,5 +23,5 @@ export declare function checkTicket(data: ProgressData, ticketNum: number, resul
23
23
  done?: boolean;
24
24
  }): void;
25
25
  export declare function writeProgress(progressPath: string, data: ProgressData): void;
26
- export declare function commitProgress(repoRoot: string, progressPath: string, message: string): Promise<void>;
26
+ export declare function commitProgress(repoRoot: string, progressPath: string, message: string): Promise<boolean>;
27
27
  //# sourceMappingURL=progress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/progress.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAM/C,MAAM,MAAM,cAAc,GAAG;IACzB,GAAG,EAAC,MAAM,CAAA;IACV,IAAI,EAAC,MAAM,CAAA;IACX,QAAQ,EAAC,MAAM,CAAA;IACf,IAAI,EAAC,OAAO,CAAA;IACZ,MAAM,EAAC,MAAM,GAAC,IAAI,CAAA;IAClB,QAAQ,EAAC,MAAM,GAAC,IAAI,CAAA;IACpB,WAAW,EAAC,MAAM,GAAC,IAAI,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACvB,OAAO,EAAC,MAAM,CAAA;IACd,SAAS,EAAC,MAAM,CAAA;IAChB,OAAO,EAAC,KAAK,CAAC,cAAc,CAAC,CAAA;CAChC,CAAA;AAED,wBAAgB,gBAAgB,CAC5B,OAAO,EAAC,MAAM,EACd,OAAO,EAAC,aAAa,CAAC,MAAM,CAAC,GAC/B,YAAY,CAcb;AAED,wBAAgB,YAAY,CACxB,YAAY,EAAC,MAAM,GACrB,YAAY,GAAC,IAAI,CAwDlB;AAED,wBAAgB,aAAa,CACzB,KAAK,EAAC,YAAY,EAClB,QAAQ,EAAC,YAAY,GAAC,IAAI,GAC5B,YAAY,CAcb;AAED,wBAAgB,cAAc,CAAE,IAAI,EAAC,YAAY,GAAE,MAAM,CAgCxD;AAED,wBAAgB,WAAW,CACvB,IAAI,EAAC,YAAY,EACjB,SAAS,EAAC,MAAM,EAChB,MAAM,EAAC;IAAE,MAAM,EAAC,MAAM,CAAC;IAAC,QAAQ,EAAC,MAAM,CAAC;IAAC,IAAI,CAAC,EAAC,OAAO,CAAA;CAAE,GAC1D,IAAI,CAYL;AAED,wBAAgB,aAAa,CACzB,YAAY,EAAC,MAAM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AC,IAAI,CAAC,EAAC,OAAO,CAAA;CAAE,GAC1D,IAAI,CAYL;AAED,wBAAgB,aAAa,CACzB,YAAY,EAAC,MAAM,EACnB,IAAI,EAAC,YAAY,GACnB,IAAI,CAKL;AAED,wBAAsB,cAAc,CAChC,QAAQ,EAAC,MAAM,EACf,YAAY,EAAC,MAAM,EACnB,OAAO,EAAC,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC,CAwBjB"}
@@ -1,4 +1,4 @@
1
- export declare const SKILL_DIRS: readonly ["grill", "grilling", "domain-modeling", "to-spec", "to-tickets", "tdd"];
1
+ export declare const SKILL_DIRS: readonly ["grill", "grilling", "domain-modeling", "to-spec", "to-tickets", "tdd", "codebase-design"];
2
2
  export declare const DOC_TEMPLATES: readonly ["triage-labels.md", "domain.md"];
3
3
  export declare function writeManagedSection(filePath: string, content: string): void;
4
4
  export declare function checkGhAuth(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/setup.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,UAAU,mFAGb,CAAA;AAEV,eAAO,MAAM,aAAa,4CAGhB,CAAA;AAKV,wBAAgB,mBAAmB,CAC/B,QAAQ,EAAC,MAAM,EACf,OAAO,EAAC,MAAM,GAChB,IAAI,CA0BL;AAED,wBAAgB,WAAW,IAAI,OAAO,CAOrC;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAC,OAAO,CAAA;AAE1C,MAAM,MAAM,SAAS,GAAG;IACpB,gBAAgB,EAAC,MAAM,CAAA;IACvB,gBAAgB,EAAC,MAAM,CAAA;IACvB,UAAU,EAAC,MAAM,CAAA;IACjB,MAAM,CAAC,EAAC,OAAO,CAAA;IACf,OAAO,EAAC,WAAW,CAAA;CACtB,CAAA;AAOD,wBAAgB,KAAK,CAAE,IAAI,EAAC,SAAS,GAAE,IAAI,CA8G1C"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/setup.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,UAAU,sGAIb,CAAA;AAEV,eAAO,MAAM,aAAa,4CAGhB,CAAA;AAKV,wBAAgB,mBAAmB,CAC/B,QAAQ,EAAC,MAAM,EACf,OAAO,EAAC,MAAM,GAChB,IAAI,CA0BL;AAED,wBAAgB,WAAW,IAAI,OAAO,CAOrC;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAC,OAAO,CAAA;AAE1C,MAAM,MAAM,SAAS,GAAG;IACpB,gBAAgB,EAAC,MAAM,CAAA;IACvB,gBAAgB,EAAC,MAAM,CAAA;IACvB,UAAU,EAAC,MAAM,CAAA;IACjB,MAAM,CAAC,EAAC,OAAO,CAAA;IACf,OAAO,EAAC,WAAW,CAAA;CACtB,CAAA;AAOD,wBAAgB,KAAK,CAAE,IAAI,EAAC,SAAS,GAAE,IAAI,CA8G1C"}
@@ -0,0 +1,11 @@
1
+ export type TestResult = {
2
+ exitCode: number;
3
+ output: string;
4
+ };
5
+ export declare function detectTestCmd(projectDir: string): string | null;
6
+ export declare function runTestCmd(opts: {
7
+ cmd: string;
8
+ cwd: string;
9
+ timeout: number;
10
+ }): Promise<TestResult>;
11
+ //# sourceMappingURL=testcmd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testcmd.d.ts","sourceRoot":"","sources":["../../src/testcmd.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG;IACrB,QAAQ,EAAC,MAAM,CAAA;IACf,MAAM,EAAC,MAAM,CAAA;CAChB,CAAA;AAID,wBAAgB,aAAa,CAAE,UAAU,EAAC,MAAM,GAAE,MAAM,GAAC,IAAI,CAa5D;AAED,wBAAgB,UAAU,CAAE,IAAI,EAAC;IAC7B,GAAG,EAAC,MAAM,CAAA;IACV,GAAG,EAAC,MAAM,CAAA;IACV,OAAO,EAAC,MAAM,CAAA;CACjB,GAAE,OAAO,CAAC,UAAU,CAAC,CA+CrB"}
@@ -11,7 +11,9 @@ export declare function createWorktree(opts: {
11
11
  worktreePath: string;
12
12
  branchName: string;
13
13
  }>;
14
- export declare function removeWorktree(worktreePath: string): Promise<void>;
14
+ export declare function removeWorktree(worktreePath: string, opts?: {
15
+ force?: boolean;
16
+ }): Promise<void>;
15
17
  export declare function hasNewCommits(repoRoot: string, base: string, branch: string): boolean;
16
18
  export declare function isDirty(cwd: string): boolean;
17
19
  export declare function commitDirty(cwd: string, message?: string): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../src/worktree.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAI/C,wBAAgB,WAAW,IAAI,MAAM,CAOpC;AAED,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAOzC;AAkBD,wBAAsB,cAAc,CAChC,IAAI,EAAC;IACD,QAAQ,EAAC,MAAM,CAAA;IACf,QAAQ,EAAC,MAAM,CAAA;IACf,UAAU,EAAC,MAAM,CAAA;IACjB,MAAM,EAAC,MAAM,CAAA;CAChB,GACH,OAAO,CAAC;IAAE,YAAY,EAAC,MAAM,CAAC;IAAC,UAAU,EAAC,MAAM,CAAA;CAAE,CAAC,CA2DpD;AAED,wBAAsB,cAAc,CAChC,YAAY,EAAC,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC,CAOd;AAED,wBAAgB,aAAa,CACzB,QAAQ,EAAC,MAAM,EACf,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,MAAM,GACf,OAAO,CAOR;AAED,wBAAgB,OAAO,CAAE,GAAG,EAAC,MAAM,GAAE,OAAO,CAO3C;AAED,wBAAsB,WAAW,CAC7B,GAAG,EAAC,MAAM,EACV,OAAO,CAAC,EAAC,MAAM,GACjB,OAAO,CAAC,OAAO,CAAC,CAsBjB;AAED,wBAAsB,aAAa,CAC/B,QAAQ,EAAC,MAAM,GACjB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAWvB"}
1
+ {"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../src/worktree.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAI/C,wBAAgB,WAAW,IAAI,MAAM,CAOpC;AAED,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAOzC;AAwFD,wBAAgB,cAAc,CAC1B,IAAI,EAAC;IACD,QAAQ,EAAC,MAAM,CAAA;IACf,QAAQ,EAAC,MAAM,CAAA;IACf,UAAU,EAAC,MAAM,CAAA;IACjB,MAAM,EAAC,MAAM,CAAA;CAChB,GACH,OAAO,CAAC;IAAE,YAAY,EAAC,MAAM,CAAC;IAAC,UAAU,EAAC,MAAM,CAAA;CAAE,CAAC,CAIpD;AAED,wBAAsB,cAAc,CAChC,YAAY,EAAC,MAAM,EACnB,IAAI,CAAC,EAAC;IAAE,KAAK,CAAC,EAAC,OAAO,CAAA;CAAE,GAC1B,OAAO,CAAC,IAAI,CAAC,CAQd;AAED,wBAAgB,aAAa,CACzB,QAAQ,EAAC,MAAM,EACf,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,MAAM,GACf,OAAO,CAOR;AAED,wBAAgB,OAAO,CAAE,GAAG,EAAC,MAAM,GAAE,OAAO,CAO3C;AAED,wBAAsB,WAAW,CAC7B,GAAG,EAAC,MAAM,EACV,OAAO,CAAC,EAAC,MAAM,GACjB,OAAO,CAAC,OAAO,CAAC,CAsBjB;AAED,wBAAsB,aAAa,CAC/B,QAAQ,EAAC,MAAM,GACjB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAWvB"}
@@ -0,0 +1,67 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+ import { spawn } from "node:child_process";
4
+ import { existsSync, readFileSync } from "node:fs";
5
+ import { join } from "node:path";
6
+ function detectTestCmd(projectDir) {
7
+ const pkgPath = join(projectDir, "package.json");
8
+ if (!existsSync(pkgPath)) return null;
9
+ try {
10
+ const pkg = JSON.parse(
11
+ readFileSync(pkgPath, "utf8")
12
+ );
13
+ return pkg.scripts?.test ? "npm test" : null;
14
+ } catch {
15
+ return null;
16
+ }
17
+ }
18
+ __name(detectTestCmd, "detectTestCmd");
19
+ function runTestCmd(opts) {
20
+ return new Promise((resolve) => {
21
+ let settled = false;
22
+ const child = spawn("sh", ["-c", opts.cmd], {
23
+ cwd: opts.cwd,
24
+ stdio: ["ignore", "pipe", "pipe"],
25
+ detached: true
26
+ });
27
+ const chunks = [];
28
+ child.stdout.on("data", (d) => chunks.push(String(d)));
29
+ child.stderr.on("data", (d) => chunks.push(String(d)));
30
+ const timer = setTimeout(() => {
31
+ if (child.pid) {
32
+ try {
33
+ process.kill(-child.pid, "SIGKILL");
34
+ } catch {
35
+ child.kill("SIGKILL");
36
+ }
37
+ } else {
38
+ child.kill("SIGKILL");
39
+ }
40
+ }, opts.timeout * 1e3);
41
+ child.on("error", (err) => {
42
+ if (settled) return;
43
+ settled = true;
44
+ clearTimeout(timer);
45
+ chunks.push(String(err));
46
+ resolve({
47
+ exitCode: 1,
48
+ output: chunks.join("")
49
+ });
50
+ });
51
+ child.on("close", (code) => {
52
+ if (settled) return;
53
+ settled = true;
54
+ clearTimeout(timer);
55
+ resolve({
56
+ exitCode: code ?? 1,
57
+ output: chunks.join("")
58
+ });
59
+ });
60
+ });
61
+ }
62
+ __name(runTestCmd, "runTestCmd");
63
+ export {
64
+ detectTestCmd,
65
+ runTestCmd
66
+ };
67
+ //# sourceMappingURL=testcmd.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/testcmd.ts"],
4
+ "sourcesContent": ["import { spawn } from 'node:child_process'\nimport { existsSync, readFileSync } from 'node:fs'\nimport { join } from 'node:path'\n\nexport type TestResult = {\n exitCode:number\n output:string\n}\n\n// Returns the command to run the project's tests, or null\n// when the project does not declare one.\nexport function detectTestCmd (projectDir:string):string|null {\n const pkgPath = join(projectDir, 'package.json')\n if (!existsSync(pkgPath)) return null\n try {\n const pkg = JSON.parse(\n readFileSync(pkgPath, 'utf8')\n ) as { scripts?:Record<string, string> }\n return pkg.scripts?.test ?\n 'npm test' :\n null\n } catch {\n return null\n }\n}\n\nexport function runTestCmd (opts:{\n cmd:string\n cwd:string\n timeout:number\n}):Promise<TestResult> {\n return new Promise(resolve => {\n let settled = false\n const child = spawn('sh', ['-c', opts.cmd], {\n cwd:opts.cwd,\n stdio:['ignore', 'pipe', 'pipe'],\n detached:true,\n })\n const chunks:string[] = []\n child.stdout.on('data', d => chunks.push(String(d)))\n child.stderr.on('data', d => chunks.push(String(d)))\n\n const timer = setTimeout(() => {\n if (child.pid) {\n try {\n process.kill(-child.pid, 'SIGKILL')\n } catch {\n // No process group (or it already\n // exited); fall back to the child.\n child.kill('SIGKILL')\n }\n } else {\n child.kill('SIGKILL')\n }\n }, opts.timeout * 1000)\n\n child.on('error', err => {\n if (settled) return\n settled = true\n clearTimeout(timer)\n chunks.push(String(err))\n resolve({\n exitCode:1,\n output:chunks.join(''),\n })\n })\n\n child.on('close', code => {\n if (settled) return\n settled = true\n clearTimeout(timer)\n resolve({\n exitCode:code ?? 1,\n output:chunks.join(''),\n })\n })\n })\n}\n"],
5
+ "mappings": ";;AAAA,SAAS,aAAa;AACtB,SAAS,YAAY,oBAAoB;AACzC,SAAS,YAAY;AASd,SAAS,cAAe,YAA+B;AAC1D,QAAM,UAAU,KAAK,YAAY,cAAc;AAC/C,MAAI,CAAC,WAAW,OAAO,EAAG,QAAO;AACjC,MAAI;AACA,UAAM,MAAM,KAAK;AAAA,MACb,aAAa,SAAS,MAAM;AAAA,IAChC;AACA,WAAO,IAAI,SAAS,OAChB,aACA;AAAA,EACR,QAAQ;AACJ,WAAO;AAAA,EACX;AACJ;AAbgB;AAeT,SAAS,WAAY,MAIL;AACnB,SAAO,IAAI,QAAQ,aAAW;AAC1B,QAAI,UAAU;AACd,UAAM,QAAQ,MAAM,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG;AAAA,MACxC,KAAI,KAAK;AAAA,MACT,OAAM,CAAC,UAAU,QAAQ,MAAM;AAAA,MAC/B,UAAS;AAAA,IACb,CAAC;AACD,UAAM,SAAkB,CAAC;AACzB,UAAM,OAAO,GAAG,QAAQ,OAAK,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC;AACnD,UAAM,OAAO,GAAG,QAAQ,OAAK,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC;AAEnD,UAAM,QAAQ,WAAW,MAAM;AAC3B,UAAI,MAAM,KAAK;AACX,YAAI;AACA,kBAAQ,KAAK,CAAC,MAAM,KAAK,SAAS;AAAA,QACtC,QAAQ;AAGJ,gBAAM,KAAK,SAAS;AAAA,QACxB;AAAA,MACJ,OAAO;AACH,cAAM,KAAK,SAAS;AAAA,MACxB;AAAA,IACJ,GAAG,KAAK,UAAU,GAAI;AAEtB,UAAM,GAAG,SAAS,SAAO;AACrB,UAAI,QAAS;AACb,gBAAU;AACV,mBAAa,KAAK;AAClB,aAAO,KAAK,OAAO,GAAG,CAAC;AACvB,cAAQ;AAAA,QACJ,UAAS;AAAA,QACT,QAAO,OAAO,KAAK,EAAE;AAAA,MACzB,CAAC;AAAA,IACL,CAAC;AAED,UAAM,GAAG,SAAS,UAAQ;AACtB,UAAI,QAAS;AACb,gBAAU;AACV,mBAAa,KAAK;AAClB,cAAQ;AAAA,QACJ,UAAS,QAAQ;AAAA,QACjB,QAAO,OAAO,KAAK,EAAE;AAAA,MACzB,CAAC;AAAA,IACL,CAAC;AAAA,EACL,CAAC;AACL;AAnDgB;",
6
+ "names": []
7
+ }
package/dist/worktree.js CHANGED
@@ -40,7 +40,7 @@ async function branchExists(repoRoot, branchName) {
40
40
  }
41
41
  }
42
42
  __name(branchExists, "branchExists");
43
- async function createWorktree(opts) {
43
+ async function createWorktreeNow(opts) {
44
44
  const { repoRoot, repoName, baseBranch, ticket } = opts;
45
45
  const branchName = `${repoName}/${String(
46
46
  ticket.num
@@ -91,12 +91,25 @@ async function createWorktree(opts) {
91
91
  );
92
92
  return { worktreePath, branchName };
93
93
  }
94
+ __name(createWorktreeNow, "createWorktreeNow");
95
+ let worktreeQueue = Promise.resolve();
96
+ function createWorktree(opts) {
97
+ const result = worktreeQueue.then(() => createWorktreeNow(opts));
98
+ worktreeQueue = result.catch(() => {
99
+ });
100
+ return result;
101
+ }
94
102
  __name(createWorktree, "createWorktree");
95
- async function removeWorktree(worktreePath) {
96
- await execFileAsync(
97
- "git",
98
- ["-C", worktreePath, "worktree", "remove", worktreePath]
99
- );
103
+ async function removeWorktree(worktreePath, opts) {
104
+ const args = [
105
+ "-C",
106
+ worktreePath,
107
+ "worktree",
108
+ "remove"
109
+ ];
110
+ if (opts?.force) args.push("--force");
111
+ args.push(worktreePath);
112
+ await execFileAsync("git", args);
100
113
  }
101
114
  __name(removeWorktree, "removeWorktree");
102
115
  function hasNewCommits(repoRoot, base, branch) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/worktree.ts"],
4
- "sourcesContent": ["import { execFile, execFileSync } from 'node:child_process'\nimport { promisify } from 'node:util'\nimport { basename, join } from 'node:path'\nimport { existsSync } from 'node:fs'\nimport type { Ticket } from './orchestrator.js'\n\nconst execFileAsync = promisify(execFile)\n\nexport function getRepoRoot ():string {\n const stdout = execFileSync(\n 'git',\n ['rev-parse', '--show-toplevel'],\n { encoding:'utf8' }\n )\n return stdout.trim()\n}\n\nexport function getRepoName ():string {\n return basename(getRepoRoot())\n}\n\nexport function getCurrentBranch ():string {\n const stdout = execFileSync(\n 'git',\n ['rev-parse', '--abbrev-ref', 'HEAD'],\n { encoding:'utf8' }\n )\n return stdout.trim()\n}\n\nasync function branchExists (\n repoRoot:string,\n branchName:string\n):Promise<boolean> {\n try {\n await execFileAsync(\n 'git',\n ['show-ref', '--verify', '--quiet', `refs/heads/${branchName}`],\n { cwd:repoRoot }\n )\n return true\n } catch {\n return false\n }\n}\n\nexport async function createWorktree (\n opts:{\n repoRoot:string\n repoName:string\n baseBranch:string\n ticket:Ticket\n }\n):Promise<{ worktreePath:string; branchName:string }> {\n const { repoRoot, repoName, baseBranch, ticket } = opts\n const branchName = `${repoName}/${String(\n ticket.num\n ).padStart(2, '0')}-${ticket.slug}`\n const worktreePath = join(\n repoRoot,\n '..',\n `${repoName}.${String(\n ticket.num\n ).padStart(2, '0')}-${ticket.slug}`\n )\n\n if (existsSync(worktreePath)) {\n try {\n await execFileAsync(\n 'git',\n ['worktree', 'remove', '--force', worktreePath],\n { cwd:repoRoot }\n )\n } catch {\n // directory may not be a registered worktree anymore;\n // prune stale entries below and let worktree add fail\n // loudly if the path is still unusable\n }\n }\n\n try {\n await execFileAsync(\n 'git',\n ['worktree', 'prune'],\n { cwd:repoRoot }\n )\n } catch {\n // best-effort cleanup of stale worktree metadata\n }\n\n if (await branchExists(repoRoot, branchName)) {\n await execFileAsync(\n 'git',\n ['branch', '-D', branchName],\n { cwd:repoRoot }\n )\n }\n\n await execFileAsync(\n 'git',\n [\n 'worktree',\n 'add',\n '-b',\n branchName,\n worktreePath,\n baseBranch,\n ],\n { cwd:repoRoot }\n )\n\n return { worktreePath, branchName }\n}\n\nexport async function removeWorktree (\n worktreePath:string\n):Promise<void> {\n // Use git -C to run the command from the worktree directory context\n // so git can resolve the repository\n await execFileAsync(\n 'git',\n ['-C', worktreePath, 'worktree', 'remove', worktreePath]\n )\n}\n\nexport function hasNewCommits (\n repoRoot:string,\n base:string,\n branch:string\n):boolean {\n const stdout = execFileSync(\n 'git',\n ['rev-list', '--count', `${base}..${branch}`],\n { cwd:repoRoot, encoding:'utf8' }\n )\n return Number(stdout.trim()) > 0\n}\n\nexport function isDirty (cwd:string):boolean {\n const stdout = execFileSync(\n 'git',\n ['status', '--porcelain'],\n { cwd, encoding:'utf8' }\n )\n return stdout.trim().length > 0\n}\n\nexport async function commitDirty (\n cwd:string,\n message?:string\n):Promise<boolean> {\n if (!isDirty(cwd)) return false\n await execFileAsync(\n 'git',\n ['add', '-A'],\n { cwd }\n )\n try {\n await execFileAsync(\n 'git',\n [\n 'commit', '-m',\n message ??\n 'nightralph: auto-commit ' +\n 'remaining changes',\n ],\n { cwd }\n )\n return true\n } catch {\n return false\n }\n}\n\nexport async function listWorktrees (\n repoRoot:string\n):Promise<Array<string>> {\n const { stdout } = await execFileAsync(\n 'git',\n ['worktree', 'list', '--porcelain'],\n { cwd:repoRoot }\n )\n return stdout\n .trim()\n .split('\\n')\n .filter(line => line.startsWith('worktree '))\n .map(line => line.substring('worktree '.length))\n}\n"],
5
- "mappings": ";;AAAA,SAAS,UAAU,oBAAoB;AACvC,SAAS,iBAAiB;AAC1B,SAAS,UAAU,YAAY;AAC/B,SAAS,kBAAkB;AAG3B,MAAM,gBAAgB,UAAU,QAAQ;AAEjC,SAAS,cAAsB;AAClC,QAAM,SAAS;AAAA,IACX;AAAA,IACA,CAAC,aAAa,iBAAiB;AAAA,IAC/B,EAAE,UAAS,OAAO;AAAA,EACtB;AACA,SAAO,OAAO,KAAK;AACvB;AAPgB;AAST,SAAS,cAAsB;AAClC,SAAO,SAAS,YAAY,CAAC;AACjC;AAFgB;AAIT,SAAS,mBAA2B;AACvC,QAAM,SAAS;AAAA,IACX;AAAA,IACA,CAAC,aAAa,gBAAgB,MAAM;AAAA,IACpC,EAAE,UAAS,OAAO;AAAA,EACtB;AACA,SAAO,OAAO,KAAK;AACvB;AAPgB;AAShB,eAAe,aACX,UACA,YACe;AACf,MAAI;AACA,UAAM;AAAA,MACF;AAAA,MACA,CAAC,YAAY,YAAY,WAAW,cAAc,UAAU,EAAE;AAAA,MAC9D,EAAE,KAAI,SAAS;AAAA,IACnB;AACA,WAAO;AAAA,EACX,QAAQ;AACJ,WAAO;AAAA,EACX;AACJ;AAde;AAgBf,eAAsB,eAClB,MAMkD;AAClD,QAAM,EAAE,UAAU,UAAU,YAAY,OAAO,IAAI;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,OAAO;AAAA,EACpC;AACA,SAAO,OAAO,OAAO,KAAK,CAAC,IAAI;AACnC;AAXgB;AAaT,SAAS,QAAS,KAAoB;AACzC,QAAM,SAAS;AAAA,IACX;AAAA,IACA,CAAC,UAAU,aAAa;AAAA,IACxB,EAAE,KAAK,UAAS,OAAO;AAAA,EAC3B;AACA,SAAO,OAAO,KAAK,EAAE,SAAS;AAClC;AAPgB;AAShB,eAAsB,YAClB,KACA,SACe;AACf,MAAI,CAAC,QAAQ,GAAG,EAAG,QAAO;AAC1B,QAAM;AAAA,IACF;AAAA,IACA,CAAC,OAAO,IAAI;AAAA,IACZ,EAAE,IAAI;AAAA,EACV;AACA,MAAI;AACA,UAAM;AAAA,MACF;AAAA,MACA;AAAA,QACI;AAAA,QAAU;AAAA,QACV,WACI;AAAA,MAER;AAAA,MACA,EAAE,IAAI;AAAA,IACV;AACA,WAAO;AAAA,EACX,QAAQ;AACJ,WAAO;AAAA,EACX;AACJ;AAzBsB;AA2BtB,eAAsB,cAClB,UACqB;AACrB,QAAM,EAAE,OAAO,IAAI,MAAM;AAAA,IACrB;AAAA,IACA,CAAC,YAAY,QAAQ,aAAa;AAAA,IAClC,EAAE,KAAI,SAAS;AAAA,EACnB;AACA,SAAO,OACF,KAAK,EACL,MAAM,IAAI,EACV,OAAO,UAAQ,KAAK,WAAW,WAAW,CAAC,EAC3C,IAAI,UAAQ,KAAK,UAAU,YAAY,MAAM,CAAC;AACvD;AAbsB;",
4
+ "sourcesContent": ["import { execFile, execFileSync } from 'node:child_process'\nimport { promisify } from 'node:util'\nimport { basename, join } from 'node:path'\nimport { existsSync } from 'node:fs'\nimport type { Ticket } from './orchestrator.js'\n\nconst execFileAsync = promisify(execFile)\n\nexport function getRepoRoot ():string {\n const stdout = execFileSync(\n 'git',\n ['rev-parse', '--show-toplevel'],\n { encoding:'utf8' }\n )\n return stdout.trim()\n}\n\nexport function getRepoName ():string {\n return basename(getRepoRoot())\n}\n\nexport function getCurrentBranch ():string {\n const stdout = execFileSync(\n 'git',\n ['rev-parse', '--abbrev-ref', 'HEAD'],\n { encoding:'utf8' }\n )\n return stdout.trim()\n}\n\nasync function branchExists (\n repoRoot:string,\n branchName:string\n):Promise<boolean> {\n try {\n await execFileAsync(\n 'git',\n ['show-ref', '--verify', '--quiet', `refs/heads/${branchName}`],\n { cwd:repoRoot }\n )\n return true\n } catch {\n return false\n }\n}\n\nasync function createWorktreeNow (\n opts:{\n repoRoot:string\n repoName:string\n baseBranch:string\n ticket:Ticket\n }\n):Promise<{ worktreePath:string; branchName:string }> {\n const { repoRoot, repoName, baseBranch, ticket } = opts\n const branchName = `${repoName}/${String(\n ticket.num\n ).padStart(2, '0')}-${ticket.slug}`\n const worktreePath = join(\n repoRoot,\n '..',\n `${repoName}.${String(\n ticket.num\n ).padStart(2, '0')}-${ticket.slug}`\n )\n\n if (existsSync(worktreePath)) {\n try {\n await execFileAsync(\n 'git',\n ['worktree', 'remove', '--force', worktreePath],\n { cwd:repoRoot }\n )\n } catch {\n // directory may not be a registered worktree anymore;\n // prune stale entries below and let worktree add fail\n // loudly if the path is still unusable\n }\n }\n\n try {\n await execFileAsync(\n 'git',\n ['worktree', 'prune'],\n { cwd:repoRoot }\n )\n } catch {\n // best-effort cleanup of stale worktree metadata\n }\n\n if (await branchExists(repoRoot, branchName)) {\n await execFileAsync(\n 'git',\n ['branch', '-D', branchName],\n { cwd:repoRoot }\n )\n }\n\n await execFileAsync(\n 'git',\n [\n 'worktree',\n 'add',\n '-b',\n branchName,\n worktreePath,\n baseBranch,\n ],\n { cwd:repoRoot }\n )\n\n return { worktreePath, branchName }\n}\n\nlet worktreeQueue:Promise<unknown> = Promise.resolve()\n\nexport function createWorktree (\n opts:{\n repoRoot:string\n repoName:string\n baseBranch:string\n ticket:Ticket\n }\n):Promise<{ worktreePath:string; branchName:string }> {\n const result = worktreeQueue.then(() => createWorktreeNow(opts))\n worktreeQueue = result.catch(() => {})\n return result\n}\n\nexport async function removeWorktree (\n worktreePath:string,\n opts?:{ force?:boolean }\n):Promise<void> {\n const args = [\n '-C', worktreePath,\n 'worktree', 'remove',\n ]\n if (opts?.force) args.push('--force')\n args.push(worktreePath)\n await execFileAsync('git', args)\n}\n\nexport function hasNewCommits (\n repoRoot:string,\n base:string,\n branch:string\n):boolean {\n const stdout = execFileSync(\n 'git',\n ['rev-list', '--count', `${base}..${branch}`],\n { cwd:repoRoot, encoding:'utf8' }\n )\n return Number(stdout.trim()) > 0\n}\n\nexport function isDirty (cwd:string):boolean {\n const stdout = execFileSync(\n 'git',\n ['status', '--porcelain'],\n { cwd, encoding:'utf8' }\n )\n return stdout.trim().length > 0\n}\n\nexport async function commitDirty (\n cwd:string,\n message?:string\n):Promise<boolean> {\n if (!isDirty(cwd)) return false\n await execFileAsync(\n 'git',\n ['add', '-A'],\n { cwd }\n )\n try {\n await execFileAsync(\n 'git',\n [\n 'commit', '-m',\n message ??\n 'nightralph: auto-commit ' +\n 'remaining changes',\n ],\n { cwd }\n )\n return true\n } catch {\n return false\n }\n}\n\nexport async function listWorktrees (\n repoRoot:string\n):Promise<Array<string>> {\n const { stdout } = await execFileAsync(\n 'git',\n ['worktree', 'list', '--porcelain'],\n { cwd:repoRoot }\n )\n return stdout\n .trim()\n .split('\\n')\n .filter(line => line.startsWith('worktree '))\n .map(line => line.substring('worktree '.length))\n}\n"],
5
+ "mappings": ";;AAAA,SAAS,UAAU,oBAAoB;AACvC,SAAS,iBAAiB;AAC1B,SAAS,UAAU,YAAY;AAC/B,SAAS,kBAAkB;AAG3B,MAAM,gBAAgB,UAAU,QAAQ;AAEjC,SAAS,cAAsB;AAClC,QAAM,SAAS;AAAA,IACX;AAAA,IACA,CAAC,aAAa,iBAAiB;AAAA,IAC/B,EAAE,UAAS,OAAO;AAAA,EACtB;AACA,SAAO,OAAO,KAAK;AACvB;AAPgB;AAST,SAAS,cAAsB;AAClC,SAAO,SAAS,YAAY,CAAC;AACjC;AAFgB;AAIT,SAAS,mBAA2B;AACvC,QAAM,SAAS;A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AA,IACV;AACA,WAAO;AAAA,EACX,QAAQ;AACJ,WAAO;AAAA,EACX;AACJ;AAzBsB;AA2BtB,eAAsB,cAClB,UACqB;AACrB,QAAM,EAAE,OAAO,IAAI,MAAM;AAAA,IACrB;AAAA,IACA,CAAC,YAAY,QAAQ,aAAa;AAAA,IAClC,EAAE,KAAI,SAAS;AAAA,EACnB;AACA,SAAO,OACF,KAAK,EACL,MAAM,IAAI,EACV,OAAO,UAAQ,KAAK,WAAW,WAAW,CAAC,EAC3C,IAAI,UAAQ,KAAK,UAAU,YAAY,MAAM,CAAC;AACvD;AAbsB;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nightralph",
3
- "version": "0.0.19",
3
+ "version": "0.0.22",
4
4
  "type": "module",
5
5
  "description": "Orchestrator that runs a single-agent session per issue.",
6
6
  "bin": {
@@ -17,14 +17,14 @@
17
17
  "lint": "eslint \"./**/*.{ts,js}\"",
18
18
  "start": "npm run build && node dist/index.js",
19
19
  "build": "mkdir -p ./dist && rm -rf ./dist/* && npm run build-esm && npm run copy",
20
- "build-esm": "esbuild src/index.ts --bundle --format=esm --platform=node --packages=external --metafile=dist/meta.json --keep-names --tsconfig=tsconfig.build.json --outfile=./dist/index.js --sourcemap && esbuild src/orchestrator.ts src/setup.ts src/resolve.ts src/worktree.ts src/progress.ts src/merge.ts src/display.ts --format=esm --keep-names --tsconfig=tsconfig.build.json --outdir=./dist --sourcemap && tsc --emitDeclarationOnly --project tsconfig.build.json",
20
+ "build-esm": "esbuild src/index.ts --bundle --format=esm --platform=node --packages=external --metafile=dist/meta.json --keep-names --tsconfig=tsconfig.build.json --outfile=./dist/index.js --sourcemap && esbuild src/orchestrator.ts src/setup.ts src/resolve.ts src/worktree.ts src/progress.ts src/merge.ts src/display.ts src/testcmd.ts --format=esm --keep-names --tsconfig=tsconfig.build.json --outdir=./dist --sourcemap && tsc --emitDeclarationOnly --project tsconfig.build.json",
21
21
  "copy": "mkdir -p ./dist/skills ./dist/docs-templates && cp -r ./src/skills/* ./dist/skills && cp -r ./src/docs-templates/* ./dist/docs-templates",
22
22
  "clone-skills": "bash scripts/clone-skills.sh",
23
23
  "toc": "markdown-toc --maxdepth 3 -i README.md",
24
24
  "preversion": "npm run lint",
25
25
  "version": "npm run toc",
26
26
  "postversion": "git push --follow-tags && npm publish",
27
- "test": "esbuild test/setup.test.ts test/orchestrator.test.ts test/worktree.test.ts test/progress.test.ts test/merge.test.ts test/display.test.ts test/integration.test.ts --format=esm --bundle --packages=external --outdir=dist/test --sourcemap && node dist/test/setup.test.js && node dist/test/orchestrator.test.js && node dist/test/worktree.test.js && node dist/test/progress.test.js && node dist/test/merge.test.js && node dist/test/display.test.js && node dist/test/integration.test.js"
27
+ "test": "esbuild test/setup.test.ts test/orchestrator.test.ts test/worktree.test.ts test/progress.test.ts test/merge.test.ts test/display.test.ts test/testcmd.test.ts test/integration.test.ts --format=esm --bundle --packages=external --outdir=dist/test --sourcemap && node dist/test/setup.test.js && node dist/test/orchestrator.test.js && node dist/test/worktree.test.js && node dist/test/progress.test.js && node dist/test/merge.test.js && node dist/test/display.test.js && node dist/test/testcmd.test.js && node dist/test/integration.test.js"
28
28
  },
29
29
  "dependencies": {
30
30
  "@inquirer/prompts": "^8.7.0",