@chief-clancy/terminal 0.1.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.
- package/LICENSE +21 -0
- package/README.md +62 -0
- package/dist/hooks/clancy-branch-guard.js +1 -0
- package/dist/hooks/clancy-check-update.js +2 -0
- package/dist/hooks/clancy-context-monitor.js +9 -0
- package/dist/hooks/clancy-credential-guard.js +2 -0
- package/dist/hooks/clancy-drift-detector.js +1 -0
- package/dist/hooks/clancy-notification.js +1 -0
- package/dist/hooks/clancy-post-compact.js +2 -0
- package/dist/hooks/clancy-statusline.js +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/file-ops/file-ops.d.ts +35 -0
- package/dist/installer/file-ops/file-ops.d.ts.map +1 -0
- package/dist/installer/file-ops/file-ops.js +95 -0
- package/dist/installer/file-ops/file-ops.js.map +1 -0
- package/dist/installer/file-ops/index.d.ts +2 -0
- package/dist/installer/file-ops/index.d.ts.map +1 -0
- package/dist/installer/file-ops/index.js +2 -0
- package/dist/installer/file-ops/index.js.map +1 -0
- package/dist/installer/hook-installer/hook-installer.d.ts +22 -0
- package/dist/installer/hook-installer/hook-installer.d.ts.map +1 -0
- package/dist/installer/hook-installer/hook-installer.js +213 -0
- package/dist/installer/hook-installer/hook-installer.js.map +1 -0
- package/dist/installer/hook-installer/index.d.ts +2 -0
- package/dist/installer/hook-installer/index.d.ts.map +1 -0
- package/dist/installer/hook-installer/index.js +2 -0
- package/dist/installer/hook-installer/index.js.map +1 -0
- package/dist/installer/install/index.d.ts +3 -0
- package/dist/installer/install/index.d.ts.map +1 -0
- package/dist/installer/install/index.js +2 -0
- package/dist/installer/install/index.js.map +1 -0
- package/dist/installer/install/install.d.ts +124 -0
- package/dist/installer/install/install.d.ts.map +1 -0
- package/dist/installer/install/install.js +255 -0
- package/dist/installer/install/install.js.map +1 -0
- package/dist/installer/manifest/index.d.ts +2 -0
- package/dist/installer/manifest/index.d.ts.map +1 -0
- package/dist/installer/manifest/index.js +2 -0
- package/dist/installer/manifest/index.js.map +1 -0
- package/dist/installer/manifest/manifest.d.ts +46 -0
- package/dist/installer/manifest/manifest.d.ts.map +1 -0
- package/dist/installer/manifest/manifest.js +180 -0
- package/dist/installer/manifest/manifest.js.map +1 -0
- package/dist/installer/prompts/index.d.ts +2 -0
- package/dist/installer/prompts/index.d.ts.map +1 -0
- package/dist/installer/prompts/index.js +2 -0
- package/dist/installer/prompts/index.js.map +1 -0
- package/dist/installer/prompts/prompts.d.ts +34 -0
- package/dist/installer/prompts/prompts.d.ts.map +1 -0
- package/dist/installer/prompts/prompts.js +28 -0
- package/dist/installer/prompts/prompts.js.map +1 -0
- package/dist/installer/role-filter/index.d.ts +2 -0
- package/dist/installer/role-filter/index.d.ts.map +1 -0
- package/dist/installer/role-filter/index.js +2 -0
- package/dist/installer/role-filter/index.js.map +1 -0
- package/dist/installer/role-filter/role-filter.d.ts +33 -0
- package/dist/installer/role-filter/role-filter.d.ts.map +1 -0
- package/dist/installer/role-filter/role-filter.js +91 -0
- package/dist/installer/role-filter/role-filter.js.map +1 -0
- package/dist/installer/shared/fs-errors/fs-errors.d.ts +3 -0
- package/dist/installer/shared/fs-errors/fs-errors.d.ts.map +1 -0
- package/dist/installer/shared/fs-errors/fs-errors.js +7 -0
- package/dist/installer/shared/fs-errors/fs-errors.js.map +1 -0
- package/dist/installer/shared/fs-errors/index.d.ts +2 -0
- package/dist/installer/shared/fs-errors/index.d.ts.map +1 -0
- package/dist/installer/shared/fs-errors/index.js +2 -0
- package/dist/installer/shared/fs-errors/index.js.map +1 -0
- package/dist/installer/shared/fs-guards/fs-guards.d.ts +3 -0
- package/dist/installer/shared/fs-guards/fs-guards.d.ts.map +1 -0
- package/dist/installer/shared/fs-guards/fs-guards.js +18 -0
- package/dist/installer/shared/fs-guards/fs-guards.js.map +1 -0
- package/dist/installer/shared/fs-guards/index.d.ts +2 -0
- package/dist/installer/shared/fs-guards/index.d.ts.map +1 -0
- package/dist/installer/shared/fs-guards/index.js +2 -0
- package/dist/installer/shared/fs-guards/index.js.map +1 -0
- package/dist/installer/shared/type-guards/index.d.ts +2 -0
- package/dist/installer/shared/type-guards/index.d.ts.map +1 -0
- package/dist/installer/shared/type-guards/index.js +2 -0
- package/dist/installer/shared/type-guards/index.js.map +1 -0
- package/dist/installer/shared/type-guards/type-guards.d.ts +8 -0
- package/dist/installer/shared/type-guards/type-guards.d.ts.map +1 -0
- package/dist/installer/shared/type-guards/type-guards.js +10 -0
- package/dist/installer/shared/type-guards/type-guards.js.map +1 -0
- package/dist/installer/ui/index.d.ts +2 -0
- package/dist/installer/ui/index.d.ts.map +1 -0
- package/dist/installer/ui/index.js +2 -0
- package/dist/installer/ui/index.js.map +1 -0
- package/dist/installer/ui/ui.d.ts +23 -0
- package/dist/installer/ui/ui.d.ts.map +1 -0
- package/dist/installer/ui/ui.js +121 -0
- package/dist/installer/ui/ui.js.map +1 -0
- package/dist/runner/autopilot/autopilot.d.ts +71 -0
- package/dist/runner/autopilot/autopilot.d.ts.map +1 -0
- package/dist/runner/autopilot/autopilot.js +206 -0
- package/dist/runner/autopilot/autopilot.js.map +1 -0
- package/dist/runner/autopilot/index.d.ts +2 -0
- package/dist/runner/autopilot/index.d.ts.map +1 -0
- package/dist/runner/autopilot/index.js +2 -0
- package/dist/runner/autopilot/index.js.map +1 -0
- package/dist/runner/cli-bridge/cli-bridge.d.ts +34 -0
- package/dist/runner/cli-bridge/cli-bridge.d.ts.map +1 -0
- package/dist/runner/cli-bridge/cli-bridge.js +53 -0
- package/dist/runner/cli-bridge/cli-bridge.js.map +1 -0
- package/dist/runner/cli-bridge/index.d.ts +2 -0
- package/dist/runner/cli-bridge/index.d.ts.map +1 -0
- package/dist/runner/cli-bridge/index.js +2 -0
- package/dist/runner/cli-bridge/index.js.map +1 -0
- package/dist/runner/dep-factory/deliver-phase.d.ts +24 -0
- package/dist/runner/dep-factory/deliver-phase.d.ts.map +1 -0
- package/dist/runner/dep-factory/deliver-phase.js +57 -0
- package/dist/runner/dep-factory/deliver-phase.js.map +1 -0
- package/dist/runner/dep-factory/dep-factory.d.ts +38 -0
- package/dist/runner/dep-factory/dep-factory.d.ts.map +1 -0
- package/dist/runner/dep-factory/dep-factory.js +193 -0
- package/dist/runner/dep-factory/dep-factory.js.map +1 -0
- package/dist/runner/dep-factory/index.d.ts +2 -0
- package/dist/runner/dep-factory/index.d.ts.map +1 -0
- package/dist/runner/dep-factory/index.js +2 -0
- package/dist/runner/dep-factory/index.js.map +1 -0
- package/dist/runner/dep-factory/invoke-phase.d.ts +20 -0
- package/dist/runner/dep-factory/invoke-phase.d.ts.map +1 -0
- package/dist/runner/dep-factory/invoke-phase.js +45 -0
- package/dist/runner/dep-factory/invoke-phase.js.map +1 -0
- package/dist/runner/implement/implement.d.ts +38 -0
- package/dist/runner/implement/implement.d.ts.map +1 -0
- package/dist/runner/implement/implement.js +61 -0
- package/dist/runner/implement/implement.js.map +1 -0
- package/dist/runner/implement/index.d.ts +2 -0
- package/dist/runner/implement/index.d.ts.map +1 -0
- package/dist/runner/implement/index.js +2 -0
- package/dist/runner/implement/index.js.map +1 -0
- package/dist/runner/notify/index.d.ts +2 -0
- package/dist/runner/notify/index.d.ts.map +1 -0
- package/dist/runner/notify/index.js +2 -0
- package/dist/runner/notify/index.js.map +1 -0
- package/dist/runner/notify/notify.d.ts +49 -0
- package/dist/runner/notify/notify.d.ts.map +1 -0
- package/dist/runner/notify/notify.js +90 -0
- package/dist/runner/notify/notify.js.map +1 -0
- package/dist/runner/prompt-builder/index.d.ts +2 -0
- package/dist/runner/prompt-builder/index.d.ts.map +1 -0
- package/dist/runner/prompt-builder/index.js +2 -0
- package/dist/runner/prompt-builder/index.js.map +1 -0
- package/dist/runner/prompt-builder/prompt-builder.d.ts +53 -0
- package/dist/runner/prompt-builder/prompt-builder.d.ts.map +1 -0
- package/dist/runner/prompt-builder/prompt-builder.js +122 -0
- package/dist/runner/prompt-builder/prompt-builder.js.map +1 -0
- package/dist/runner/session-report/index.d.ts +2 -0
- package/dist/runner/session-report/index.d.ts.map +1 -0
- package/dist/runner/session-report/index.js +2 -0
- package/dist/runner/session-report/index.js.map +1 -0
- package/dist/runner/session-report/session-report.d.ts +81 -0
- package/dist/runner/session-report/session-report.d.ts.map +1 -0
- package/dist/runner/session-report/session-report.js +227 -0
- package/dist/runner/session-report/session-report.js.map +1 -0
- package/dist/runner/shared/types.d.ts +30 -0
- package/dist/runner/shared/types.d.ts.map +1 -0
- package/dist/runner/shared/types.js +2 -0
- package/dist/runner/shared/types.js.map +1 -0
- package/dist/shared/ansi/ansi.d.ts +59 -0
- package/dist/shared/ansi/ansi.d.ts.map +1 -0
- package/dist/shared/ansi/ansi.js +59 -0
- package/dist/shared/ansi/ansi.js.map +1 -0
- package/dist/shared/ansi/index.d.ts +2 -0
- package/dist/shared/ansi/index.d.ts.map +1 -0
- package/dist/shared/ansi/index.js +2 -0
- package/dist/shared/ansi/index.js.map +1 -0
- package/package.json +52 -0
- package/src/agents/agents.test.ts +57 -0
- package/src/agents/arch-agent.md +80 -0
- package/src/agents/concerns-agent.md +96 -0
- package/src/agents/design-agent.md +146 -0
- package/src/agents/devils-advocate.md +54 -0
- package/src/agents/quality-agent.md +178 -0
- package/src/agents/tech-agent.md +101 -0
- package/src/agents/verification-gate.md +128 -0
- package/src/roles/implementer/commands/autopilot.md +11 -0
- package/src/roles/implementer/commands/dry-run.md +15 -0
- package/src/roles/implementer/commands/implement.md +19 -0
- package/src/roles/implementer/workflows/autopilot.md +136 -0
- package/src/roles/implementer/workflows/implement.md +161 -0
- package/src/roles/planner/commands/approve-plan.md +11 -0
- package/src/roles/planner/commands/plan.md +22 -0
- package/src/roles/planner/workflows/approve-plan.md +970 -0
- package/src/roles/planner/workflows/plan.md +868 -0
- package/src/roles/reviewer/commands/logs.md +7 -0
- package/src/roles/reviewer/commands/review.md +9 -0
- package/src/roles/reviewer/commands/status.md +9 -0
- package/src/roles/reviewer/workflows/logs.md +109 -0
- package/src/roles/reviewer/workflows/review.md +197 -0
- package/src/roles/reviewer/workflows/status.md +142 -0
- package/src/roles/roles.test.ts +87 -0
- package/src/roles/setup/commands/doctor.md +7 -0
- package/src/roles/setup/commands/help.md +80 -0
- package/src/roles/setup/commands/init.md +7 -0
- package/src/roles/setup/commands/map-codebase.md +17 -0
- package/src/roles/setup/commands/settings.md +7 -0
- package/src/roles/setup/commands/uninstall.md +5 -0
- package/src/roles/setup/commands/update-docs.md +9 -0
- package/src/roles/setup/commands/update.md +13 -0
- package/src/roles/setup/workflows/doctor.md +131 -0
- package/src/roles/setup/workflows/init.md +1096 -0
- package/src/roles/setup/workflows/map-codebase.md +130 -0
- package/src/roles/setup/workflows/scaffold.md +872 -0
- package/src/roles/setup/workflows/settings.md +958 -0
- package/src/roles/setup/workflows/uninstall.md +170 -0
- package/src/roles/setup/workflows/update-docs.md +95 -0
- package/src/roles/setup/workflows/update.md +287 -0
- package/src/roles/strategist/commands/approve-brief.md +23 -0
- package/src/roles/strategist/commands/brief.md +29 -0
- package/src/roles/strategist/workflows/approve-brief.md +1540 -0
- package/src/roles/strategist/workflows/brief.md +1330 -0
- package/src/templates/CLAUDE.md +101 -0
- package/src/templates/templates.test.ts +53 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runner/prompt-builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt builder for ticket implementation.
|
|
3
|
+
*
|
|
4
|
+
* Generates prompt strings piped to the Claude CLI for autonomous
|
|
5
|
+
* ticket implementation and rework cycles.
|
|
6
|
+
*/
|
|
7
|
+
import type { BoardProvider } from '@chief-clancy/core';
|
|
8
|
+
/**
|
|
9
|
+
* Get the board-specific label for the ticket type.
|
|
10
|
+
*
|
|
11
|
+
* @param provider - The board provider.
|
|
12
|
+
* @returns The label used in prompts (e.g., `'Jira ticket'`, `'GitHub Issue'`).
|
|
13
|
+
*/
|
|
14
|
+
export declare function ticketLabel(provider: BoardProvider): string;
|
|
15
|
+
type PromptInput = {
|
|
16
|
+
readonly provider: BoardProvider;
|
|
17
|
+
readonly key: string;
|
|
18
|
+
readonly title: string;
|
|
19
|
+
readonly description: string;
|
|
20
|
+
/** Epic/milestone/parent info string (e.g., `'PROJ-100'`, `'Sprint 3'`). */
|
|
21
|
+
readonly parentInfo: string;
|
|
22
|
+
/** Blocker info string (e.g., `'Blocked by: PROJ-99, PROJ-98'`). */
|
|
23
|
+
readonly blockers?: string;
|
|
24
|
+
/** When true, enforce test-driven development (red-green-refactor). */
|
|
25
|
+
readonly tdd?: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Build the full Claude prompt for implementing a ticket.
|
|
29
|
+
*
|
|
30
|
+
* @param input - The ticket data for the prompt.
|
|
31
|
+
* @returns The complete prompt string.
|
|
32
|
+
*/
|
|
33
|
+
export declare function buildPrompt(input: PromptInput): string;
|
|
34
|
+
type ReworkPromptInput = {
|
|
35
|
+
readonly provider: BoardProvider;
|
|
36
|
+
readonly key: string;
|
|
37
|
+
readonly title: string;
|
|
38
|
+
readonly description: string;
|
|
39
|
+
readonly feedbackComments: readonly string[];
|
|
40
|
+
/** Git diff or git log output from the previous implementation. */
|
|
41
|
+
readonly previousContext?: string;
|
|
42
|
+
/** When true, enforce test-driven development (red-green-refactor). */
|
|
43
|
+
readonly tdd?: boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Build the Claude prompt for reworking a ticket based on reviewer feedback.
|
|
47
|
+
*
|
|
48
|
+
* @param input - The rework ticket data and feedback.
|
|
49
|
+
* @returns The complete rework prompt string.
|
|
50
|
+
*/
|
|
51
|
+
export declare function buildReworkPrompt(input: ReworkPromptInput): string;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=prompt-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-builder.d.ts","sourceRoot":"","sources":["../../../src/runner/prompt-builder/prompt-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAe3D;AAED,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAgCF;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAkCtD;AAED,KAAK,iBAAiB,GAAG;IACvB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C,mEAAmE;IACnE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,uEAAuE;IACvE,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CA4BlE"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the board-specific label for the ticket type.
|
|
3
|
+
*
|
|
4
|
+
* @param provider - The board provider.
|
|
5
|
+
* @returns The label used in prompts (e.g., `'Jira ticket'`, `'GitHub Issue'`).
|
|
6
|
+
*/
|
|
7
|
+
export function ticketLabel(provider) {
|
|
8
|
+
switch (provider) {
|
|
9
|
+
case 'jira':
|
|
10
|
+
return 'Jira ticket';
|
|
11
|
+
case 'github':
|
|
12
|
+
return 'GitHub Issue';
|
|
13
|
+
case 'linear':
|
|
14
|
+
return 'Linear issue';
|
|
15
|
+
case 'shortcut':
|
|
16
|
+
return 'Shortcut story';
|
|
17
|
+
case 'notion':
|
|
18
|
+
return 'Notion page';
|
|
19
|
+
case 'azdo':
|
|
20
|
+
return 'Azure DevOps work item';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const TDD_BLOCK = `
|
|
24
|
+
## Test-Driven Development
|
|
25
|
+
|
|
26
|
+
You MUST follow the red-green-refactor cycle for every behaviour change:
|
|
27
|
+
|
|
28
|
+
1. **Red** — Write a failing test that describes the desired behaviour.
|
|
29
|
+
Run the test suite and confirm the new test fails.
|
|
30
|
+
2. **Green** — Write the minimum code to make the failing test pass.
|
|
31
|
+
Do not add behaviour beyond what the test requires.
|
|
32
|
+
3. **Refactor** — Clean up the implementation while keeping all tests green.
|
|
33
|
+
Look for duplication, unclear names, or unnecessary complexity.
|
|
34
|
+
|
|
35
|
+
Repeat for each behaviour. Do not write implementation code without a failing test first.
|
|
36
|
+
Design interfaces for testability — prefer pure functions and thin boundaries
|
|
37
|
+
so modules are easy to test in isolation.`;
|
|
38
|
+
function parentLabel(provider) {
|
|
39
|
+
switch (provider) {
|
|
40
|
+
case 'github':
|
|
41
|
+
return 'Milestone';
|
|
42
|
+
case 'notion':
|
|
43
|
+
return 'Parent page';
|
|
44
|
+
case 'jira':
|
|
45
|
+
case 'linear':
|
|
46
|
+
case 'shortcut':
|
|
47
|
+
case 'azdo':
|
|
48
|
+
return 'Epic';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build the full Claude prompt for implementing a ticket.
|
|
53
|
+
*
|
|
54
|
+
* @param input - The ticket data for the prompt.
|
|
55
|
+
* @returns The complete prompt string.
|
|
56
|
+
*/
|
|
57
|
+
export function buildPrompt(input) {
|
|
58
|
+
const label = ticketLabel(input.provider);
|
|
59
|
+
const pLabel = parentLabel(input.provider);
|
|
60
|
+
const isGitHub = input.provider === 'github';
|
|
61
|
+
const ticketWord = isGitHub ? 'issue' : 'ticket';
|
|
62
|
+
const blockerLine = input.blockers && !isGitHub ? `\nBlockers: ${input.blockers}` : '';
|
|
63
|
+
return `You are implementing ${label} ${input.key}.
|
|
64
|
+
|
|
65
|
+
${isGitHub ? 'Title' : 'Summary'}: ${input.title}
|
|
66
|
+
${pLabel}: ${input.parentInfo}${blockerLine}
|
|
67
|
+
|
|
68
|
+
Description:
|
|
69
|
+
${input.description}
|
|
70
|
+
|
|
71
|
+
Step 0 — Executability check (do this before any git or file operation):
|
|
72
|
+
Read the ${isGitHub ? 'issue title and description' : 'ticket summary and description'} above. Can this ${ticketWord} be implemented entirely
|
|
73
|
+
as a code change committed to this repo? Consult the 'Executability check' section of
|
|
74
|
+
CLAUDE.md for the full list of skip conditions.
|
|
75
|
+
|
|
76
|
+
If you must SKIP this ${ticketWord}:
|
|
77
|
+
1. Output: ⚠ Skipping [${input.key}]: {one-line reason}
|
|
78
|
+
2. Output: Ticket skipped — update it to be codebase-only work, then re-run.
|
|
79
|
+
3. Append to .clancy/progress.txt: YYYY-MM-DD HH:MM | ${input.key} | {reason} | SKIPPED
|
|
80
|
+
4. Stop — no branches, no file changes, no git operations.
|
|
81
|
+
|
|
82
|
+
If the ${ticketWord} IS implementable, continue:${input.tdd ? TDD_BLOCK : ''}
|
|
83
|
+
1. Read core docs in .clancy/docs/: STACK.md, ARCHITECTURE.md, CONVENTIONS.md, GIT.md, DEFINITION-OF-DONE.md, CONCERNS.md
|
|
84
|
+
Also read if relevant to this ticket: INTEGRATIONS.md (external APIs/services/auth), TESTING.md (tests/specs/coverage), DESIGN-SYSTEM.md (UI/components/styles), ACCESSIBILITY.md (accessibility/ARIA/WCAG)
|
|
85
|
+
2. Follow the conventions in GIT.md exactly
|
|
86
|
+
3. Implement the ${ticketWord} fully
|
|
87
|
+
4. Commit your work following the conventions in GIT.md
|
|
88
|
+
5. When done, confirm you are finished.`;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Build the Claude prompt for reworking a ticket based on reviewer feedback.
|
|
92
|
+
*
|
|
93
|
+
* @param input - The rework ticket data and feedback.
|
|
94
|
+
* @returns The complete rework prompt string.
|
|
95
|
+
*/
|
|
96
|
+
export function buildReworkPrompt(input) {
|
|
97
|
+
const feedbackSection = input.feedbackComments.length > 0
|
|
98
|
+
? input.feedbackComments.map((c, i) => `${i + 1}. ${c}`).join('\n')
|
|
99
|
+
: 'No reviewer comments found. Review the existing implementation and fix any issues.';
|
|
100
|
+
const previousSection = input.previousContext
|
|
101
|
+
? `\n\n## Previous Implementation\n\n\`\`\`\n${input.previousContext}\n\`\`\``
|
|
102
|
+
: '';
|
|
103
|
+
return `You are fixing review feedback on [${input.key}] ${input.title}.
|
|
104
|
+
|
|
105
|
+
Description:
|
|
106
|
+
${input.description}
|
|
107
|
+
|
|
108
|
+
## Reviewer Feedback
|
|
109
|
+
|
|
110
|
+
${feedbackSection}${previousSection}
|
|
111
|
+
|
|
112
|
+
Address the specific feedback above. Don't re-implement unrelated areas. Focus only on what was flagged.${input.tdd ? TDD_BLOCK : ''}
|
|
113
|
+
|
|
114
|
+
Steps:
|
|
115
|
+
1. Read core docs in .clancy/docs/: STACK.md, ARCHITECTURE.md, CONVENTIONS.md, GIT.md, DEFINITION-OF-DONE.md, CONCERNS.md
|
|
116
|
+
Also read if relevant to this ticket: INTEGRATIONS.md (external APIs/services/auth), TESTING.md (tests/specs/coverage), DESIGN-SYSTEM.md (UI/components/styles), ACCESSIBILITY.md (accessibility/ARIA/WCAG)
|
|
117
|
+
2. Follow the conventions in GIT.md exactly
|
|
118
|
+
3. Fix the issues identified in the reviewer feedback
|
|
119
|
+
4. Commit your work following the conventions in GIT.md
|
|
120
|
+
5. When done, confirm you are finished.`;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=prompt-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-builder.js","sourceRoot":"","sources":["../../../src/runner/prompt-builder/prompt-builder.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,QAAuB;IACjD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,aAAa,CAAC;QACvB,KAAK,QAAQ;YACX,OAAO,cAAc,CAAC;QACxB,KAAK,QAAQ;YACX,OAAO,cAAc,CAAC;QACxB,KAAK,UAAU;YACb,OAAO,gBAAgB,CAAC;QAC1B,KAAK,QAAQ;YACX,OAAO,aAAa,CAAC;QACvB,KAAK,MAAM;YACT,OAAO,wBAAwB,CAAC;IACpC,CAAC;AACH,CAAC;AAeD,MAAM,SAAS,GAAG;;;;;;;;;;;;;;0CAcwB,CAAC;AAE3C,SAAS,WAAW,CAAC,QAAuB;IAC1C,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,WAAW,CAAC;QACrB,KAAK,QAAQ;YACX,OAAO,aAAa,CAAC;QACvB,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU,CAAC;QAChB,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAkB;IAC5C,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK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,MAAM,eAAe,GAAG,KAAK,CAAC,eAAe;QAC3C,CAAC,CAAC,6CAA6C,KAAK,CAAC,eAAe,UAAU;QAC9E,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,sCAAsC,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,KAAK;;;EAGtE,KAAK,CAAC,WAAW;;;;EAIjB,eAAe,GAAG,eAAe;;0GAEuE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;;;;;;;;wCAQ5F,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runner/session-report/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runner/session-report/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session report generator — parse costs.log + progress.txt, build markdown.
|
|
3
|
+
*
|
|
4
|
+
* Produces a structured markdown report of all tickets processed during
|
|
5
|
+
* an autopilot session. Pure functions handle parsing and generation;
|
|
6
|
+
* the orchestrator reads FS and writes the report.
|
|
7
|
+
*/
|
|
8
|
+
import type { ConsoleLike } from '../shared/types.js';
|
|
9
|
+
import type { ProgressEntry, ProgressFs, QualityFs } from '@chief-clancy/core';
|
|
10
|
+
/** A parsed cost entry from costs.log. */
|
|
11
|
+
type CostEntry = {
|
|
12
|
+
readonly timestamp: string;
|
|
13
|
+
readonly key: string;
|
|
14
|
+
readonly duration: string;
|
|
15
|
+
readonly tokens: string;
|
|
16
|
+
};
|
|
17
|
+
/** Quality summary fields used in the report. */
|
|
18
|
+
type QualitySummary = {
|
|
19
|
+
readonly avgReworkCycles: number;
|
|
20
|
+
readonly avgVerificationRetries: number;
|
|
21
|
+
readonly avgDuration: number;
|
|
22
|
+
};
|
|
23
|
+
/** Data required to generate a session report. */
|
|
24
|
+
type SessionReportData = {
|
|
25
|
+
readonly entries: readonly ProgressEntry[];
|
|
26
|
+
readonly costs: readonly CostEntry[];
|
|
27
|
+
readonly quality: {
|
|
28
|
+
readonly summary: QualitySummary;
|
|
29
|
+
} | undefined;
|
|
30
|
+
readonly loopStartTime: number;
|
|
31
|
+
readonly loopEndTime: number;
|
|
32
|
+
};
|
|
33
|
+
/** Options for the session report orchestrator. */
|
|
34
|
+
type BuildReportOpts = {
|
|
35
|
+
readonly progressFs: ProgressFs;
|
|
36
|
+
readonly qualityFs: QualityFs;
|
|
37
|
+
readonly readCostsFile: (path: string) => string;
|
|
38
|
+
readonly writeFile: (path: string, content: string) => void;
|
|
39
|
+
readonly mkdir: (path: string) => void;
|
|
40
|
+
readonly console: ConsoleLike;
|
|
41
|
+
readonly projectRoot: string;
|
|
42
|
+
readonly loopStartTime: number;
|
|
43
|
+
readonly loopEndTime: number;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Convert a progress timestamp (`YYYY-MM-DD HH:MM`) to milliseconds.
|
|
47
|
+
*
|
|
48
|
+
* @param timestamp - The progress file timestamp string.
|
|
49
|
+
* @returns Milliseconds since epoch, or `NaN` if invalid.
|
|
50
|
+
*/
|
|
51
|
+
export declare function progressTimestampToMs(timestamp: string): number;
|
|
52
|
+
/**
|
|
53
|
+
* Parse costs.log content and filter entries after a given timestamp.
|
|
54
|
+
*
|
|
55
|
+
* Each line is expected to follow the format:
|
|
56
|
+
* `ISO-timestamp | KEY | Nmin | ~N tokens (estimated)`
|
|
57
|
+
*
|
|
58
|
+
* @param content - Raw costs.log file content.
|
|
59
|
+
* @param sinceMs - Only include entries with timestamp >= this value.
|
|
60
|
+
* @returns Parsed cost entries from this session.
|
|
61
|
+
*/
|
|
62
|
+
export declare function parseCostsLog(content: string, sinceMs: number): readonly CostEntry[];
|
|
63
|
+
/**
|
|
64
|
+
* Generate a session report from pre-parsed data.
|
|
65
|
+
*
|
|
66
|
+
* @param data - Progress entries, cost entries, quality data, and timing.
|
|
67
|
+
* @returns The report as a markdown string.
|
|
68
|
+
*/
|
|
69
|
+
export declare function generateSessionReport(data: SessionReportData): string;
|
|
70
|
+
/**
|
|
71
|
+
* Build a session report from FS data and write to disk.
|
|
72
|
+
*
|
|
73
|
+
* Reads progress.txt and costs.log, filters entries to the session window,
|
|
74
|
+
* generates the markdown report, and writes to `.clancy/session-report.md`.
|
|
75
|
+
*
|
|
76
|
+
* @param opts - Injected I/O resources and timing.
|
|
77
|
+
* @returns The report markdown string.
|
|
78
|
+
*/
|
|
79
|
+
export declare function buildSessionReport(opts: BuildReportOpts): string;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=session-report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-report.d.ts","sourceRoot":"","sources":["../../../src/runner/session-report/session-report.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAc/E,0CAA0C;AAC1C,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAQF,iDAAiD;AACjD,KAAK,cAAc,GAAG;IACpB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,WA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E;AA8GD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAoChE"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { COMPLETED_STATUSES, FAILED_STATUSES, formatDuration, getQualityData, parseProgressFile, } from '@chief-clancy/core';
|
|
3
|
+
// ─── Pure helpers ────────────────────────────────────────────────────────────
|
|
4
|
+
/**
|
|
5
|
+
* Convert a progress timestamp (`YYYY-MM-DD HH:MM`) to milliseconds.
|
|
6
|
+
*
|
|
7
|
+
* @param timestamp - The progress file timestamp string.
|
|
8
|
+
* @returns Milliseconds since epoch, or `NaN` if invalid.
|
|
9
|
+
*/
|
|
10
|
+
export function progressTimestampToMs(timestamp) {
|
|
11
|
+
const isValidFormat = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(timestamp);
|
|
12
|
+
if (!isValidFormat)
|
|
13
|
+
return NaN;
|
|
14
|
+
return new Date(timestamp.replace(' ', 'T') + ':00Z').getTime();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parse costs.log content and filter entries after a given timestamp.
|
|
18
|
+
*
|
|
19
|
+
* Each line is expected to follow the format:
|
|
20
|
+
* `ISO-timestamp | KEY | Nmin | ~N tokens (estimated)`
|
|
21
|
+
*
|
|
22
|
+
* @param content - Raw costs.log file content.
|
|
23
|
+
* @param sinceMs - Only include entries with timestamp >= this value.
|
|
24
|
+
* @returns Parsed cost entries from this session.
|
|
25
|
+
*/
|
|
26
|
+
export function parseCostsLog(content, sinceMs) {
|
|
27
|
+
const lines = content.split(/\r?\n/).map((line) => line.trim());
|
|
28
|
+
const nonEmpty = lines.filter((line) => line.length > 0);
|
|
29
|
+
return nonEmpty
|
|
30
|
+
.map((line) => parseCostLine(line, sinceMs))
|
|
31
|
+
.filter((entry) => entry !== undefined);
|
|
32
|
+
}
|
|
33
|
+
/** Parse a single cost line, or return undefined if invalid/filtered. */
|
|
34
|
+
function parseCostLine(line, sinceMs) {
|
|
35
|
+
const parts = line.split(' | ');
|
|
36
|
+
if (parts.length < 4)
|
|
37
|
+
return undefined;
|
|
38
|
+
const timestamp = parts[0];
|
|
39
|
+
const entryTime = new Date(timestamp).getTime();
|
|
40
|
+
const isRecentAndValid = !Number.isNaN(entryTime) && entryTime >= sinceMs;
|
|
41
|
+
if (!isRecentAndValid)
|
|
42
|
+
return undefined;
|
|
43
|
+
return {
|
|
44
|
+
timestamp,
|
|
45
|
+
key: parts[1],
|
|
46
|
+
duration: parts[2],
|
|
47
|
+
tokens: parts[3],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/** Parse token count from a single cost entry, or 0 if malformed. */
|
|
51
|
+
function parseTokenCount(tokens) {
|
|
52
|
+
const match = tokens.match(/~(\d[\d,]*)/);
|
|
53
|
+
if (!match)
|
|
54
|
+
return 0;
|
|
55
|
+
const parsed = parseInt(match[1].replace(/,/g, ''), 10);
|
|
56
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
57
|
+
}
|
|
58
|
+
/** Sum token counts from cost entries (recursive — safe for bounded session sizes). */
|
|
59
|
+
function sumTokens(costs, i = 0) {
|
|
60
|
+
return i >= costs.length
|
|
61
|
+
? 0
|
|
62
|
+
: parseTokenCount(costs[i].tokens) + sumTokens(costs, i + 1);
|
|
63
|
+
}
|
|
64
|
+
/** Format a UTC date as `YYYY-MM-DD`. */
|
|
65
|
+
function formatDate(ms) {
|
|
66
|
+
const date = new Date(ms);
|
|
67
|
+
const y = date.getUTCFullYear();
|
|
68
|
+
const mo = String(date.getUTCMonth() + 1).padStart(2, '0');
|
|
69
|
+
const d = String(date.getUTCDate()).padStart(2, '0');
|
|
70
|
+
return `${y}-${mo}-${d}`;
|
|
71
|
+
}
|
|
72
|
+
/** Include a line only when the value is present. */
|
|
73
|
+
function optionalLine(value, format) {
|
|
74
|
+
return value != null ? [format(value)] : [];
|
|
75
|
+
}
|
|
76
|
+
// ─── Report generation ───────────────────────────────────────────────────────
|
|
77
|
+
/** Merge a progress entry with its matching cost data. */
|
|
78
|
+
function attachCost(costByKey, entry) {
|
|
79
|
+
const cost = costByKey.get(entry.key);
|
|
80
|
+
return { ...entry, duration: cost?.duration, tokens: cost?.tokens };
|
|
81
|
+
}
|
|
82
|
+
/** Enrich progress entries with cost data, deduplicated by key. */
|
|
83
|
+
function enrichTickets(entries, costs) {
|
|
84
|
+
// Last entry per key wins (handles rework cycles)
|
|
85
|
+
const costByKey = new Map(costs.map((c) => [c.key, c]));
|
|
86
|
+
const latestByKey = new Map(entries.map((e) => [e.key, e]));
|
|
87
|
+
return [...latestByKey.values()].map((entry) => attachCost(costByKey, entry));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Generate a session report from pre-parsed data.
|
|
91
|
+
*
|
|
92
|
+
* @param data - Progress entries, cost entries, quality data, and timing.
|
|
93
|
+
* @returns The report as a markdown string.
|
|
94
|
+
*/
|
|
95
|
+
export function generateSessionReport(data) {
|
|
96
|
+
const { entries, costs, quality, loopStartTime, loopEndTime } = data;
|
|
97
|
+
const tickets = enrichTickets(entries, costs);
|
|
98
|
+
const completed = tickets.filter((t) => COMPLETED_STATUSES.has(t.status));
|
|
99
|
+
const failed = tickets.filter((t) => FAILED_STATUSES.has(t.status));
|
|
100
|
+
return [
|
|
101
|
+
...buildSummary({ completed: completed.length, failed: failed.length }, { start: loopStartTime, end: loopEndTime }, costs),
|
|
102
|
+
...buildTicketSection(tickets),
|
|
103
|
+
...buildNextSteps(tickets, failed),
|
|
104
|
+
...buildQualitySection(quality),
|
|
105
|
+
'',
|
|
106
|
+
].join('\n');
|
|
107
|
+
}
|
|
108
|
+
function buildSummary(counts, timing, costs) {
|
|
109
|
+
const totalDuration = formatDuration(timing.end - timing.start);
|
|
110
|
+
const totalTokens = sumTokens(costs);
|
|
111
|
+
const tokenLine = totalTokens > 0
|
|
112
|
+
? [`- Estimated token usage: ${totalTokens.toLocaleString('en-US')}`]
|
|
113
|
+
: [];
|
|
114
|
+
return [
|
|
115
|
+
`# Autopilot Session Report — ${formatDate(timing.start)}`,
|
|
116
|
+
'',
|
|
117
|
+
'## Summary',
|
|
118
|
+
`- Tickets completed: ${counts.completed}`,
|
|
119
|
+
`- Tickets failed: ${counts.failed}`,
|
|
120
|
+
`- Total duration: ${totalDuration}`,
|
|
121
|
+
...tokenLine,
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
function buildTicketSection(tickets) {
|
|
125
|
+
if (tickets.length === 0) {
|
|
126
|
+
return ['', '## Tickets', '', 'No tickets were processed in this session.'];
|
|
127
|
+
}
|
|
128
|
+
return ['', '## Tickets', ...tickets.flatMap(formatTicket)];
|
|
129
|
+
}
|
|
130
|
+
function formatTicket(ticket) {
|
|
131
|
+
const isCompleted = COMPLETED_STATUSES.has(ticket.status);
|
|
132
|
+
const icon = isCompleted ? '\u2713' : '\u2717';
|
|
133
|
+
return [
|
|
134
|
+
'',
|
|
135
|
+
`### ${icon} ${ticket.key} — ${ticket.summary}`,
|
|
136
|
+
...optionalLine(ticket.duration, (v) => `- Duration: ${v}`),
|
|
137
|
+
...optionalLine(ticket.tokens, (v) => `- Tokens: ${v}`),
|
|
138
|
+
...optionalLine(ticket.prNumber, (v) => `- PR: #${v}`),
|
|
139
|
+
`- Status: ${ticket.status}`,
|
|
140
|
+
];
|
|
141
|
+
}
|
|
142
|
+
function buildNextSteps(tickets, failed) {
|
|
143
|
+
const prNumbers = tickets
|
|
144
|
+
.filter((t) => t.prNumber != null)
|
|
145
|
+
.map((t) => `#${t.prNumber}`);
|
|
146
|
+
const skippedKeys = failed.map((t) => t.key);
|
|
147
|
+
const hasNextSteps = prNumbers.length > 0 || skippedKeys.length > 0;
|
|
148
|
+
if (!hasNextSteps)
|
|
149
|
+
return [];
|
|
150
|
+
return [
|
|
151
|
+
'',
|
|
152
|
+
'## Next Steps',
|
|
153
|
+
...(prNumbers.length > 0 ? [`- Review PRs ${prNumbers.join(', ')}`] : []),
|
|
154
|
+
...skippedKeys.map((key) => `- ${key} needs manual intervention`),
|
|
155
|
+
];
|
|
156
|
+
}
|
|
157
|
+
function buildQualitySection(quality) {
|
|
158
|
+
if (!quality)
|
|
159
|
+
return [];
|
|
160
|
+
const { avgReworkCycles, avgVerificationRetries, avgDuration } = quality.summary;
|
|
161
|
+
const durationLine = avgDuration > 0
|
|
162
|
+
? [`- Avg delivery time: ${formatDuration(avgDuration)}`]
|
|
163
|
+
: [];
|
|
164
|
+
return [
|
|
165
|
+
'',
|
|
166
|
+
'## Quality Metrics',
|
|
167
|
+
`- Avg rework cycles: ${avgReworkCycles}`,
|
|
168
|
+
`- Avg verification retries: ${avgVerificationRetries}`,
|
|
169
|
+
...durationLine,
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
/** Read a file, returning empty string on ENOENT. */
|
|
173
|
+
function safeRead(readFile, path) {
|
|
174
|
+
try {
|
|
175
|
+
return readFile(path);
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
if (err instanceof Error && 'code' in err && err.code === 'ENOENT') {
|
|
179
|
+
return '';
|
|
180
|
+
}
|
|
181
|
+
throw err;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/** Check if a progress entry falls within the session window. */
|
|
185
|
+
function isInSessionWindow(entry, startMinute) {
|
|
186
|
+
const entryMs = progressTimestampToMs(entry.timestamp);
|
|
187
|
+
return !Number.isNaN(entryMs) && entryMs >= startMinute;
|
|
188
|
+
}
|
|
189
|
+
// ─── Orchestrator ────────────────────────────────────────────────────────────
|
|
190
|
+
/**
|
|
191
|
+
* Build a session report from FS data and write to disk.
|
|
192
|
+
*
|
|
193
|
+
* Reads progress.txt and costs.log, filters entries to the session window,
|
|
194
|
+
* generates the markdown report, and writes to `.clancy/session-report.md`.
|
|
195
|
+
*
|
|
196
|
+
* @param opts - Injected I/O resources and timing.
|
|
197
|
+
* @returns The report markdown string.
|
|
198
|
+
*/
|
|
199
|
+
export function buildSessionReport(opts) {
|
|
200
|
+
const { progressFs, qualityFs, projectRoot, loopStartTime, loopEndTime } = opts;
|
|
201
|
+
// Round start down to the minute to match progress file precision
|
|
202
|
+
const startMinute = Math.floor(loopStartTime / 60_000) * 60_000;
|
|
203
|
+
const allProgress = parseProgressFile(progressFs, projectRoot);
|
|
204
|
+
const sessionEntries = allProgress.filter((entry) => isInSessionWindow(entry, startMinute));
|
|
205
|
+
const costsPath = join(projectRoot, '.clancy', 'costs.log');
|
|
206
|
+
const costsContent = safeRead(opts.readCostsFile, costsPath);
|
|
207
|
+
const costs = parseCostsLog(costsContent, loopStartTime);
|
|
208
|
+
const quality = getQualityData(qualityFs, projectRoot);
|
|
209
|
+
const report = generateSessionReport({
|
|
210
|
+
entries: sessionEntries,
|
|
211
|
+
costs,
|
|
212
|
+
quality,
|
|
213
|
+
loopStartTime,
|
|
214
|
+
loopEndTime,
|
|
215
|
+
});
|
|
216
|
+
// Write to disk (best-effort)
|
|
217
|
+
try {
|
|
218
|
+
opts.mkdir(join(projectRoot, '.clancy'));
|
|
219
|
+
opts.writeFile(join(projectRoot, '.clancy', 'session-report.md'), report);
|
|
220
|
+
}
|
|
221
|
+
catch (err) {
|
|
222
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
223
|
+
opts.console.error(`Failed to write session report: ${message}`);
|
|
224
|
+
}
|
|
225
|
+
return report;
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=session-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-report.js","sourceRoot":"","sources":["../../../src/runner/session-report/session-report.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AA+C5B,gFAAgF;AAEhF;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,MAAM,a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MAAM,GAAG,qBAAqB,CAAC;QACnC,OAAO,EAAE,cAAc;QACvB,KAAK;QACL,OAAO;QACP,aAAa;QACb,WAAW;KACZ,CAAC,CAAC;IAEH,8BAA8B;IAC9B,IAAI,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,mBAAmB,CAAC,EAAE,MAAM,CAAC,CAAC;IAC5E,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,mCAAmC,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types used across runner modules.
|
|
3
|
+
*
|
|
4
|
+
* Consolidates types that were previously duplicated in cli-bridge,
|
|
5
|
+
* dep-factory, invoke-phase, implement, autopilot, and deliver-phase.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProgressStatus } from '@chief-clancy/core';
|
|
8
|
+
import type { SpawnSyncReturns } from 'node:child_process';
|
|
9
|
+
export type StdioValue = 'inherit' | 'ignore' | 'pipe' | number;
|
|
10
|
+
/** Synchronous process spawner with narrowed stdio options. */
|
|
11
|
+
export type SpawnSyncFn = (command: string, args: readonly string[], options: {
|
|
12
|
+
readonly input: string;
|
|
13
|
+
readonly stdio: readonly StdioValue[];
|
|
14
|
+
readonly encoding: 'utf8';
|
|
15
|
+
}) => SpawnSyncReturns<string>;
|
|
16
|
+
/** Minimal console interface for injecting log output. */
|
|
17
|
+
export type ConsoleLike = {
|
|
18
|
+
readonly log: (message: string) => void;
|
|
19
|
+
readonly error: (message: string) => void;
|
|
20
|
+
};
|
|
21
|
+
/** Progress append function used by dep-factory and deliver-phase. */
|
|
22
|
+
export type AppendFn = (opts: {
|
|
23
|
+
readonly key: string;
|
|
24
|
+
readonly summary: string;
|
|
25
|
+
readonly status: ProgressStatus;
|
|
26
|
+
readonly prNumber?: number;
|
|
27
|
+
readonly parent?: string;
|
|
28
|
+
readonly ticketType?: string;
|
|
29
|
+
}) => void;
|
|
30
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runner/shared/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAEhE,+DAA+D;AAC/D,MAAM,MAAM,WAAW,GAAG,CACxB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE;IACP,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,KACE,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAE9B,0DAA0D;AAC1D,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,KAAK,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runner/shared/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANSI escape code helpers for terminal output.
|
|
3
|
+
*
|
|
4
|
+
* Wraps strings in ANSI sequences for styling in CLI environments.
|
|
5
|
+
* These helpers do not compose — nesting calls (e.g. `bold(red('x'))`)
|
|
6
|
+
* produces concatenated codes where the inner reset cancels outer styles.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Dim the given string (reduced intensity).
|
|
10
|
+
*
|
|
11
|
+
* @param s - The string to style.
|
|
12
|
+
* @returns The string wrapped in ANSI dim codes.
|
|
13
|
+
*/
|
|
14
|
+
export declare const dim: (s: string) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Bold the given string.
|
|
17
|
+
*
|
|
18
|
+
* @param s - The string to style.
|
|
19
|
+
* @returns The string wrapped in ANSI bold codes.
|
|
20
|
+
*/
|
|
21
|
+
export declare const bold: (s: string) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Colour the given string blue with bold weight.
|
|
24
|
+
*
|
|
25
|
+
* Uses bold+blue (`1;34`) for contrast on dark backgrounds.
|
|
26
|
+
*
|
|
27
|
+
* @param s - The string to style.
|
|
28
|
+
* @returns The string wrapped in ANSI bold-blue codes.
|
|
29
|
+
*/
|
|
30
|
+
export declare const blue: (s: string) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Colour the given string cyan.
|
|
33
|
+
*
|
|
34
|
+
* @param s - The string to style.
|
|
35
|
+
* @returns The string wrapped in ANSI cyan codes.
|
|
36
|
+
*/
|
|
37
|
+
export declare const cyan: (s: string) => string;
|
|
38
|
+
/**
|
|
39
|
+
* Colour the given string green.
|
|
40
|
+
*
|
|
41
|
+
* @param s - The string to style.
|
|
42
|
+
* @returns The string wrapped in ANSI green codes.
|
|
43
|
+
*/
|
|
44
|
+
export declare const green: (s: string) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Colour the given string red.
|
|
47
|
+
*
|
|
48
|
+
* @param s - The string to style.
|
|
49
|
+
* @returns The string wrapped in ANSI red codes.
|
|
50
|
+
*/
|
|
51
|
+
export declare const red: (s: string) => string;
|
|
52
|
+
/**
|
|
53
|
+
* Colour the given string yellow.
|
|
54
|
+
*
|
|
55
|
+
* @param s - The string to style.
|
|
56
|
+
* @returns The string wrapped in ANSI yellow codes.
|
|
57
|
+
*/
|
|
58
|
+
export declare const yellow: (s: string) => string;
|
|
59
|
+
//# sourceMappingURL=ansi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansi.d.ts","sourceRoot":"","sources":["../../../src/shared/ansi/ansi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,KAAG,MAA8B,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,KAAG,MAA8B,CAAC;AAEhE;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,KAAG,MAAiC,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,KAAG,MAA+B,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,KAAG,MAA+B,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,KAAG,MAA+B,CAAC;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,KAAG,MAA+B,CAAC"}
|