@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,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installer UI — banner and success message.
|
|
3
|
+
*/
|
|
4
|
+
import { blue, bold, cyan, dim, green } from '../../shared/ansi/index.js';
|
|
5
|
+
// Keep in sync with the slash command registry once it exists (see docs/decisions/architecture/package-evolution.md).
|
|
6
|
+
const COMMAND_GROUPS = [
|
|
7
|
+
{
|
|
8
|
+
name: 'Strategist',
|
|
9
|
+
roleKey: 'strategist',
|
|
10
|
+
commands: [
|
|
11
|
+
['/clancy:brief', 'Generate a strategic brief for a feature'],
|
|
12
|
+
['/clancy:approve-brief', 'Convert brief into board tickets'],
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'Planner',
|
|
17
|
+
roleKey: 'planner',
|
|
18
|
+
commands: [
|
|
19
|
+
['/clancy:plan', 'Refine backlog tickets into plans'],
|
|
20
|
+
['/clancy:approve-plan', 'Promote plan to ticket description'],
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'Implementer',
|
|
25
|
+
roleKey: null,
|
|
26
|
+
commands: [
|
|
27
|
+
['/clancy:implement', 'Pick up one ticket and stop'],
|
|
28
|
+
['/clancy:autopilot', 'Run Clancy in loop mode'],
|
|
29
|
+
['/clancy:dry-run', 'Preview next ticket without changes'],
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'Reviewer',
|
|
34
|
+
roleKey: null,
|
|
35
|
+
commands: [
|
|
36
|
+
['/clancy:review', 'Score next ticket and get recommendations'],
|
|
37
|
+
['/clancy:status', 'Show next tickets without running'],
|
|
38
|
+
['/clancy:logs', 'Display progress log'],
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Setup & Maintenance',
|
|
43
|
+
roleKey: null,
|
|
44
|
+
commands: [
|
|
45
|
+
['/clancy:init', 'Set up Clancy in your project'],
|
|
46
|
+
['/clancy:map-codebase', 'Scan codebase with 5 parallel agents'],
|
|
47
|
+
['/clancy:settings', 'View and change configuration'],
|
|
48
|
+
['/clancy:doctor', 'Diagnose your setup'],
|
|
49
|
+
['/clancy:update-docs', 'Refresh codebase documentation'],
|
|
50
|
+
['/clancy:update', 'Update Clancy to latest version'],
|
|
51
|
+
['/clancy:uninstall', 'Remove Clancy from your project'],
|
|
52
|
+
['/clancy:help', 'Show all commands'],
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
const BANNER_LINES = [
|
|
57
|
+
' ██████╗██╗ █████╗ ███╗ ██╗ ██████╗██╗ ██╗',
|
|
58
|
+
' ██╔════╝██║ ██╔══██╗████╗ ██║██╔════╝╚██╗ ██╔╝',
|
|
59
|
+
' ██║ ██║ ███████║██╔██╗ ██║██║ ╚████╔╝ ',
|
|
60
|
+
' ██║ ██║ ██╔══██║██║╚██╗██║██║ ╚██╔╝ ',
|
|
61
|
+
' ╚██████╗███████╗██║ ██║██║ ╚████║╚██████╗ ██║ ',
|
|
62
|
+
' ╚═════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ',
|
|
63
|
+
];
|
|
64
|
+
/**
|
|
65
|
+
* Print the Clancy ASCII banner and version info.
|
|
66
|
+
*
|
|
67
|
+
* @param version - The package version string to display.
|
|
68
|
+
* @returns Nothing — output is written to stdout.
|
|
69
|
+
*/
|
|
70
|
+
export function printBanner(version) {
|
|
71
|
+
console.log('');
|
|
72
|
+
BANNER_LINES.forEach((line) => console.log(blue(line)));
|
|
73
|
+
console.log('');
|
|
74
|
+
console.log(` ${bold(`v${version}`)}${dim(' Autonomous, board-driven development for Claude Code.')}`);
|
|
75
|
+
console.log(dim(' Named after Chief Clancy Wiggum. Built on the Ralph technique by Geoffrey Huntley.'));
|
|
76
|
+
}
|
|
77
|
+
/** Check whether a group should be shown for the given enabled roles. */
|
|
78
|
+
function isGroupVisible(group, enabledRoles) {
|
|
79
|
+
if (group.roleKey === null)
|
|
80
|
+
return true;
|
|
81
|
+
if (enabledRoles === null)
|
|
82
|
+
return true;
|
|
83
|
+
return enabledRoles.has(group.roleKey);
|
|
84
|
+
}
|
|
85
|
+
/** Column width for command names — keeps descriptions aligned. */
|
|
86
|
+
const CMD_COL_WIDTH = 22;
|
|
87
|
+
/** Format a single command line for display. */
|
|
88
|
+
function formatCommand([cmd, desc]) {
|
|
89
|
+
return ` ${cyan(cmd.padEnd(CMD_COL_WIDTH))} ${dim(desc)}`;
|
|
90
|
+
}
|
|
91
|
+
/** Print a single command group header and its commands. */
|
|
92
|
+
function printGroup(group) {
|
|
93
|
+
console.log('');
|
|
94
|
+
console.log(` ${bold(group.name)}`);
|
|
95
|
+
group.commands.forEach((cmd) => console.log(formatCommand(cmd)));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Print the post-install success message with available commands.
|
|
99
|
+
*
|
|
100
|
+
* Command groups with a non-null `roleKey` are role-gated: they are shown only
|
|
101
|
+
* when their role key is present in `enabledRoles`. Groups with `roleKey === null`
|
|
102
|
+
* are always shown. Pass `null` for `enabledRoles` to disable role gating and show
|
|
103
|
+
* all groups.
|
|
104
|
+
*
|
|
105
|
+
* @param enabledRoles - Role keys matching `CommandGroup.roleKey` (e.g. `"strategist"`), or `null` to show all groups.
|
|
106
|
+
* @returns Nothing — output is written to stdout.
|
|
107
|
+
*/
|
|
108
|
+
export function printSuccess(enabledRoles) {
|
|
109
|
+
console.log('');
|
|
110
|
+
console.log(green(' ✓ Clancy installed successfully.'));
|
|
111
|
+
console.log('');
|
|
112
|
+
console.log(' Next steps:');
|
|
113
|
+
console.log(dim(' 1. Open a project in Claude Code'));
|
|
114
|
+
console.log(` 2. Run: ${cyan('/clancy:init')}`);
|
|
115
|
+
console.log('');
|
|
116
|
+
console.log(' Commands available:');
|
|
117
|
+
const visibleGroups = COMMAND_GROUPS.filter((g) => isGroupVisible(g, enabledRoles));
|
|
118
|
+
visibleGroups.forEach(printGroup);
|
|
119
|
+
console.log('');
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/installer/ui/ui.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAYxE,sHAAsH;AACtH,MAAM,cAAc,GAA4B;IAC9C;QACE,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,YAAY;QACrB,QAAQ,EAAE;YACR,CAAC,eAAe,EAAE,0CAA0C,C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nE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,YAAwC;IACnE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC,CAAC;IACzD,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IAErC,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAChD,cAAc,CAAC,CAAC,EAAE,YAAY,CAAC,CAChC,CAAC;IACF,aAAa,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAElC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Autopilot runner — loop orchestration for unattended ticket processing.
|
|
3
|
+
*
|
|
4
|
+
* Runs the implement pipeline repeatedly, checking for quiet hours and
|
|
5
|
+
* stop conditions between iterations. Generates a session report and
|
|
6
|
+
* optionally sends a webhook notification when the loop ends.
|
|
7
|
+
*/
|
|
8
|
+
import type { ConsoleLike } from '../shared/types.js';
|
|
9
|
+
import type { PipelineResult } from '@chief-clancy/core';
|
|
10
|
+
type StopCondition = {
|
|
11
|
+
readonly stop: false;
|
|
12
|
+
} | {
|
|
13
|
+
readonly stop: true;
|
|
14
|
+
readonly reason: string;
|
|
15
|
+
};
|
|
16
|
+
/** Options for the autopilot runner. */
|
|
17
|
+
type AutopilotOpts = {
|
|
18
|
+
readonly maxIterations: number;
|
|
19
|
+
readonly runIteration: () => Promise<PipelineResult>;
|
|
20
|
+
readonly buildReport: (loopStartTime: number, loopEndTime: number) => string;
|
|
21
|
+
readonly sendNotification: (url: string, message: string) => Promise<void>;
|
|
22
|
+
readonly sleep: (ms: number) => Promise<void>;
|
|
23
|
+
readonly console: ConsoleLike;
|
|
24
|
+
readonly clock: () => number;
|
|
25
|
+
readonly now?: () => Date;
|
|
26
|
+
readonly quietStart?: string;
|
|
27
|
+
readonly quietEnd?: string;
|
|
28
|
+
readonly webhookUrl?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Parse a time string in HH:MM format.
|
|
32
|
+
*
|
|
33
|
+
* @param value - Time string like `"22:00"` or `"6:00"`.
|
|
34
|
+
* @returns Parsed hours and minutes, or `undefined` if invalid.
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseTime(value: string): {
|
|
37
|
+
readonly hours: number;
|
|
38
|
+
readonly minutes: number;
|
|
39
|
+
} | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Check if the current time falls within a quiet hours window.
|
|
42
|
+
*
|
|
43
|
+
* Handles overnight windows (e.g. 22:00–06:00). Returns the number
|
|
44
|
+
* of milliseconds to sleep, or 0 if not in quiet hours.
|
|
45
|
+
*
|
|
46
|
+
* @param startStr - Start time in HH:MM format.
|
|
47
|
+
* @param endStr - End time in HH:MM format.
|
|
48
|
+
* @param now - Current date for testing.
|
|
49
|
+
* @returns Milliseconds to sleep, or 0 if outside quiet hours.
|
|
50
|
+
*/
|
|
51
|
+
export declare function getQuietSleepMs(startStr: string, endStr: string, now: Date): number;
|
|
52
|
+
/**
|
|
53
|
+
* Check whether a pipeline result should stop the autopilot loop.
|
|
54
|
+
*
|
|
55
|
+
* Completed and resumed results continue. Errors and dry-runs stop.
|
|
56
|
+
* Aborts stop only for fatal phases (preflight, ticket-fetch, etc.);
|
|
57
|
+
* non-fatal aborts (feasibility, invoke) allow the next ticket.
|
|
58
|
+
*
|
|
59
|
+
* @param result - The pipeline result to check.
|
|
60
|
+
* @returns Stop flag and optional reason.
|
|
61
|
+
*/
|
|
62
|
+
export declare function checkStopCondition(result: PipelineResult): StopCondition;
|
|
63
|
+
/**
|
|
64
|
+
* Run the autopilot loop — iterate implement, check stop conditions.
|
|
65
|
+
*
|
|
66
|
+
* @param opts - Injected I/O resources and configuration.
|
|
67
|
+
* @returns Resolves when the loop ends.
|
|
68
|
+
*/
|
|
69
|
+
export declare function runAutopilot(opts: AutopilotOpts): Promise<void>;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=autopilot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autopilot.d.ts","sourceRoot":"","sources":["../../../src/runner/autopilot/autopilot.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAQzD,KAAK,aAAa,GACd;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,wCAAwC;AACxC,KAAK,aAAa,GAAG;IACnB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,CAAC;IACrD,QAAQ,CAAC,WAAW,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7E,QAAQ,CAAC,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,CAAC;IAC7B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAIF;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,GACZ;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAUlE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,IAAI,GACR,MAAM,CAgBR;AAqCD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,aAAa,CAwBxE;AAID;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CASrE"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { formatDuration } from '@chief-clancy/core';
|
|
2
|
+
import { bold, dim, green, yellow } from '../../shared/ansi/index.js';
|
|
3
|
+
// ─── Pure helpers ────────────────────────────────────────────────────────────
|
|
4
|
+
/**
|
|
5
|
+
* Parse a time string in HH:MM format.
|
|
6
|
+
*
|
|
7
|
+
* @param value - Time string like `"22:00"` or `"6:00"`.
|
|
8
|
+
* @returns Parsed hours and minutes, or `undefined` if invalid.
|
|
9
|
+
*/
|
|
10
|
+
export function parseTime(value) {
|
|
11
|
+
const match = value.trim().match(/^(\d{1,2}):(\d{2})$/);
|
|
12
|
+
if (!match)
|
|
13
|
+
return undefined;
|
|
14
|
+
const hours = parseInt(match[1], 10);
|
|
15
|
+
const minutes = parseInt(match[2], 10);
|
|
16
|
+
const isValidHour = hours >= 0 && hours <= 23;
|
|
17
|
+
const isValidMinute = minutes >= 0 && minutes <= 59;
|
|
18
|
+
return isValidHour && isValidMinute ? { hours, minutes } : undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Check if the current time falls within a quiet hours window.
|
|
22
|
+
*
|
|
23
|
+
* Handles overnight windows (e.g. 22:00–06:00). Returns the number
|
|
24
|
+
* of milliseconds to sleep, or 0 if not in quiet hours.
|
|
25
|
+
*
|
|
26
|
+
* @param startStr - Start time in HH:MM format.
|
|
27
|
+
* @param endStr - End time in HH:MM format.
|
|
28
|
+
* @param now - Current date for testing.
|
|
29
|
+
* @returns Milliseconds to sleep, or 0 if outside quiet hours.
|
|
30
|
+
*/
|
|
31
|
+
export function getQuietSleepMs(startStr, endStr, now) {
|
|
32
|
+
const start = parseTime(startStr);
|
|
33
|
+
const end = parseTime(endStr);
|
|
34
|
+
if (!start || !end)
|
|
35
|
+
return 0;
|
|
36
|
+
const nowMin = now.getHours() * 60 + now.getMinutes();
|
|
37
|
+
const startMin = start.hours * 60 + start.minutes;
|
|
38
|
+
const endMin = end.hours * 60 + end.minutes;
|
|
39
|
+
const isInQuiet = computeQuietStatus(nowMin, startMin, endMin);
|
|
40
|
+
if (!isInQuiet)
|
|
41
|
+
return 0;
|
|
42
|
+
const minutesUntilEnd = computeMinutesUntilEnd(nowMin, endMin);
|
|
43
|
+
const msIntoMinute = now.getSeconds() * 1000 + now.getMilliseconds();
|
|
44
|
+
return Math.max(0, minutesUntilEnd * 60_000 - msIntoMinute);
|
|
45
|
+
}
|
|
46
|
+
/** Check if current minute falls inside the quiet window. */
|
|
47
|
+
function computeQuietStatus(nowMin, startMin, endMin) {
|
|
48
|
+
if (startMin === endMin)
|
|
49
|
+
return false;
|
|
50
|
+
const isSameDayWindow = startMin < endMin;
|
|
51
|
+
const isAfterStart = nowMin >= startMin;
|
|
52
|
+
const isBeforeEnd = nowMin < endMin;
|
|
53
|
+
// Same-day window (e.g. 09:00–17:00): must be between start and end
|
|
54
|
+
if (isSameDayWindow)
|
|
55
|
+
return isAfterStart && isBeforeEnd;
|
|
56
|
+
// Overnight window (e.g. 22:00–06:00): after start OR before end
|
|
57
|
+
return isAfterStart || isBeforeEnd;
|
|
58
|
+
}
|
|
59
|
+
/** Calculate minutes remaining until end of quiet window. */
|
|
60
|
+
function computeMinutesUntilEnd(nowMin, endMin) {
|
|
61
|
+
const diff = endMin - nowMin;
|
|
62
|
+
const wrappedToNextDay = diff + 24 * 60;
|
|
63
|
+
return diff <= 0 ? wrappedToNextDay : diff;
|
|
64
|
+
}
|
|
65
|
+
/** Phases where an abort should stop the entire autopilot loop. */
|
|
66
|
+
const FATAL_ABORT_PHASES = new Set([
|
|
67
|
+
'lock-check',
|
|
68
|
+
'preflight',
|
|
69
|
+
'ticket-fetch',
|
|
70
|
+
'branch-setup',
|
|
71
|
+
]);
|
|
72
|
+
/**
|
|
73
|
+
* Check whether a pipeline result should stop the autopilot loop.
|
|
74
|
+
*
|
|
75
|
+
* Completed and resumed results continue. Errors and dry-runs stop.
|
|
76
|
+
* Aborts stop only for fatal phases (preflight, ticket-fetch, etc.);
|
|
77
|
+
* non-fatal aborts (feasibility, invoke) allow the next ticket.
|
|
78
|
+
*
|
|
79
|
+
* @param result - The pipeline result to check.
|
|
80
|
+
* @returns Stop flag and optional reason.
|
|
81
|
+
*/
|
|
82
|
+
export function checkStopCondition(result) {
|
|
83
|
+
switch (result.status) {
|
|
84
|
+
case 'completed':
|
|
85
|
+
case 'resumed':
|
|
86
|
+
return { stop: false };
|
|
87
|
+
case 'error':
|
|
88
|
+
return { stop: true, reason: result.error ?? 'Unknown error' };
|
|
89
|
+
case 'dry-run':
|
|
90
|
+
return { stop: true, reason: 'Dry run — loop not applicable' };
|
|
91
|
+
case 'aborted': {
|
|
92
|
+
const isFatal = FATAL_ABORT_PHASES.has(result.phase ?? '');
|
|
93
|
+
return isFatal
|
|
94
|
+
? { stop: true, reason: `Aborted at ${result.phase}` }
|
|
95
|
+
: { stop: false };
|
|
96
|
+
}
|
|
97
|
+
default: {
|
|
98
|
+
const _exhaustive = result.status;
|
|
99
|
+
return _exhaustive;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// ─── Loop orchestrator ───────────────────────────────────────────────────────
|
|
104
|
+
/**
|
|
105
|
+
* Run the autopilot loop — iterate implement, check stop conditions.
|
|
106
|
+
*
|
|
107
|
+
* @param opts - Injected I/O resources and configuration.
|
|
108
|
+
* @returns Resolves when the loop ends.
|
|
109
|
+
*/
|
|
110
|
+
export async function runAutopilot(opts) {
|
|
111
|
+
const { console: out, clock } = opts;
|
|
112
|
+
const loopStart = clock();
|
|
113
|
+
printBanner(out);
|
|
114
|
+
const iterationCount = await runIterations(opts, loopStart);
|
|
115
|
+
await finalize(opts, loopStart, iterationCount);
|
|
116
|
+
}
|
|
117
|
+
function printBanner(out) {
|
|
118
|
+
out.log(dim('┌──────────────────────────────────────────────────────────┐'));
|
|
119
|
+
out.log(dim('│') +
|
|
120
|
+
bold(' 🤖 Clancy — autopilot mode ') +
|
|
121
|
+
dim('│'));
|
|
122
|
+
out.log(dim('│') +
|
|
123
|
+
dim(' "I\'m on it. Proceed to the abandoned warehouse." ') +
|
|
124
|
+
dim('│'));
|
|
125
|
+
out.log(dim('└──────────────────────────────────────────────────────────┘'));
|
|
126
|
+
}
|
|
127
|
+
async function runIterations(opts, loopStart) {
|
|
128
|
+
const { console: out, clock } = opts;
|
|
129
|
+
const iterIndices = iterations(opts.maxIterations);
|
|
130
|
+
const totalIterations = iterIndices.length;
|
|
131
|
+
// eslint-disable-next-line functional/no-loop-statements -- sequential async loop with early return on stop conditions; map/flatMap can't express this
|
|
132
|
+
for (const i of iterIndices) {
|
|
133
|
+
await handleQuietHours(opts);
|
|
134
|
+
const iterStart = clock();
|
|
135
|
+
out.log('');
|
|
136
|
+
out.log(bold(`🔁 Iteration ${i}/${totalIterations}`));
|
|
137
|
+
const result = await opts.runIteration();
|
|
138
|
+
const iterElapsed = formatDuration(clock() - iterStart);
|
|
139
|
+
out.log(dim(` Iteration ${i} took ${iterElapsed}`));
|
|
140
|
+
const condition = checkStopCondition(result);
|
|
141
|
+
if (condition.stop) {
|
|
142
|
+
const totalElapsed = formatDuration(clock() - loopStart);
|
|
143
|
+
out.log('');
|
|
144
|
+
out.log(`${condition.reason}`);
|
|
145
|
+
out.log(dim(` Total: ${i} iteration${i > 1 ? 's' : ''} in ${totalElapsed}`));
|
|
146
|
+
return i;
|
|
147
|
+
}
|
|
148
|
+
const isLastIteration = i === totalIterations;
|
|
149
|
+
if (!isLastIteration)
|
|
150
|
+
await opts.sleep(2000);
|
|
151
|
+
}
|
|
152
|
+
return totalIterations;
|
|
153
|
+
}
|
|
154
|
+
const MAX_ITERATIONS_CAP = 100;
|
|
155
|
+
/** Generate 1-based iteration indices, capped at {@link MAX_ITERATIONS_CAP}. */
|
|
156
|
+
function iterations(max) {
|
|
157
|
+
const capped = Math.min(Math.max(0, max), MAX_ITERATIONS_CAP);
|
|
158
|
+
return Array.from({ length: capped }, (_, idx) => idx + 1);
|
|
159
|
+
}
|
|
160
|
+
async function handleQuietHours(opts) {
|
|
161
|
+
const { quietStart, quietEnd, console: out } = opts;
|
|
162
|
+
if (!quietStart || !quietEnd)
|
|
163
|
+
return;
|
|
164
|
+
const now = opts.now ? opts.now() : new Date();
|
|
165
|
+
const sleepMs = getQuietSleepMs(quietStart, quietEnd, now);
|
|
166
|
+
if (sleepMs <= 0)
|
|
167
|
+
return;
|
|
168
|
+
const sleepMin = Math.ceil(sleepMs / 60_000);
|
|
169
|
+
out.log('');
|
|
170
|
+
out.log(yellow(`⏸ Quiet hours active (${quietStart}–${quietEnd}). Sleeping ${sleepMin} minutes.`));
|
|
171
|
+
await opts.sleep(sleepMs);
|
|
172
|
+
out.log(dim(' Quiet hours ended. Resuming.'));
|
|
173
|
+
}
|
|
174
|
+
async function finalize(opts, loopStart, iterationCount) {
|
|
175
|
+
const { console: out, clock } = opts;
|
|
176
|
+
const loopEnd = clock();
|
|
177
|
+
const totalElapsed = formatDuration(loopEnd - loopStart);
|
|
178
|
+
out.log('');
|
|
179
|
+
out.log(green(`🏁 Completed ${iterationCount} iterations`) +
|
|
180
|
+
dim(` (${totalElapsed})`));
|
|
181
|
+
// Generate session report
|
|
182
|
+
const report = opts.buildReport(loopStart, loopEnd);
|
|
183
|
+
out.log('');
|
|
184
|
+
out.log(dim('─── Session Report ───'));
|
|
185
|
+
out.log(report);
|
|
186
|
+
// Send webhook notification (best-effort)
|
|
187
|
+
if (opts.webhookUrl) {
|
|
188
|
+
const summary = extractSummaryForWebhook(report);
|
|
189
|
+
try {
|
|
190
|
+
await opts.sendNotification(opts.webhookUrl, summary);
|
|
191
|
+
}
|
|
192
|
+
catch (err) {
|
|
193
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
194
|
+
out.error(`Webhook notification failed: ${message}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
/** Extract summary lines from report for webhook message. */
|
|
199
|
+
function extractSummaryForWebhook(report) {
|
|
200
|
+
const summaryLines = report
|
|
201
|
+
.split(/\r?\n/)
|
|
202
|
+
.filter((l) => l.startsWith('- Tickets') || l.startsWith('- Total'));
|
|
203
|
+
const detail = summaryLines.length > 0 ? summaryLines.join('. ') : 'session complete';
|
|
204
|
+
return `Clancy autopilot: ${detail}`;
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=autopilot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autopilot.js","sourceRoot":"","sources":["../../../src/runner/autopilot/autopilot.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,o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,CAAC;IAEhB,0CAA0C;IAC1C,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,MAAM,OAAO,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,GAAG,CAAC,KAAK,CAAC,gCAAgC,OAAO,EAAE,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;AACH,CAAC;AAED,6DAA6D;AAC7D,SAAS,wBAAwB,CAAC,MAAc;IAC9C,MAAM,YAAY,GAAG,MAAM;SACxB,KAAK,CAAC,OAAO,CAAC;SACd,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;IAEvE,MAAM,MAAM,GACV,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC;IAEzE,OAAO,qBAAqB,MAAM,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runner/autopilot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runner/autopilot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { SpawnSyncFn } from '../shared/types.js';
|
|
2
|
+
/** Options for both print and session invocations. */
|
|
3
|
+
type ClaudeInvokeOptions = {
|
|
4
|
+
readonly prompt: string;
|
|
5
|
+
readonly model?: string;
|
|
6
|
+
readonly spawn: SpawnSyncFn;
|
|
7
|
+
};
|
|
8
|
+
type ClaudePrintResult = {
|
|
9
|
+
readonly stdout: string;
|
|
10
|
+
readonly ok: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Invoke Claude in print mode and capture the response.
|
|
14
|
+
*
|
|
15
|
+
* Uses `claude -p` for a single-prompt, non-interactive invocation.
|
|
16
|
+
* Stdout is captured (not streamed) so the caller can parse it.
|
|
17
|
+
*
|
|
18
|
+
* @param options - The print invocation options.
|
|
19
|
+
* @returns The captured stdout and whether the process succeeded.
|
|
20
|
+
*/
|
|
21
|
+
export declare function invokeClaudePrint(options: ClaudeInvokeOptions): ClaudePrintResult;
|
|
22
|
+
/**
|
|
23
|
+
* Invoke a Claude Code session with the given prompt.
|
|
24
|
+
*
|
|
25
|
+
* Pipes the prompt to stdin and streams stdout/stderr live to the
|
|
26
|
+
* terminal. Uses `--dangerously-skip-permissions` for autonomous
|
|
27
|
+
* operation.
|
|
28
|
+
*
|
|
29
|
+
* @param options - The session invocation options.
|
|
30
|
+
* @returns `true` if Claude exited successfully (code 0), `false` otherwise.
|
|
31
|
+
*/
|
|
32
|
+
export declare function invokeClaudeSession(options: ClaudeInvokeOptions): boolean;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=cli-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-bridge.d.ts","sourceRoot":"","sources":["../../../src/runner/cli-bridge/cli-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,sDAAsD;AACtD,KAAK,mBAAmB,GAAG;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;CACtB,CAAC;AAUF;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,mBAAmB,GAC3B,iBAAiB,CAgBnB;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAazE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
function buildArgs(base, model) {
|
|
2
|
+
return model ? [...base, '--model', model] : base;
|
|
3
|
+
}
|
|
4
|
+
function isSuccess(result) {
|
|
5
|
+
return result.status === 0 && !result.error;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Invoke Claude in print mode and capture the response.
|
|
9
|
+
*
|
|
10
|
+
* Uses `claude -p` for a single-prompt, non-interactive invocation.
|
|
11
|
+
* Stdout is captured (not streamed) so the caller can parse it.
|
|
12
|
+
*
|
|
13
|
+
* @param options - The print invocation options.
|
|
14
|
+
* @returns The captured stdout and whether the process succeeded.
|
|
15
|
+
*/
|
|
16
|
+
export function invokeClaudePrint(options) {
|
|
17
|
+
const { prompt, model, spawn } = options;
|
|
18
|
+
// Clancy runs autonomously — skip the interactive permission prompt
|
|
19
|
+
const base = ['-p', '--dangerously-skip-permissions'];
|
|
20
|
+
const args = buildArgs(base, model);
|
|
21
|
+
const result = spawn('claude', args, {
|
|
22
|
+
input: prompt,
|
|
23
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
24
|
+
encoding: 'utf8',
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
stdout: result.stdout ?? '',
|
|
28
|
+
ok: isSuccess(result),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Invoke a Claude Code session with the given prompt.
|
|
33
|
+
*
|
|
34
|
+
* Pipes the prompt to stdin and streams stdout/stderr live to the
|
|
35
|
+
* terminal. Uses `--dangerously-skip-permissions` for autonomous
|
|
36
|
+
* operation.
|
|
37
|
+
*
|
|
38
|
+
* @param options - The session invocation options.
|
|
39
|
+
* @returns `true` if Claude exited successfully (code 0), `false` otherwise.
|
|
40
|
+
*/
|
|
41
|
+
export function invokeClaudeSession(options) {
|
|
42
|
+
const { prompt, model, spawn } = options;
|
|
43
|
+
// Clancy runs autonomously — skip the interactive permission prompt
|
|
44
|
+
const base = ['--dangerously-skip-permissions'];
|
|
45
|
+
const args = buildArgs(base, model);
|
|
46
|
+
const result = spawn('claude', args, {
|
|
47
|
+
input: prompt,
|
|
48
|
+
stdio: ['pipe', 'inherit', 'inherit'],
|
|
49
|
+
encoding: 'utf8',
|
|
50
|
+
});
|
|
51
|
+
return isSuccess(result);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=cli-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-bridge.js","sourceRoot":"","sources":["../../../src/runner/cli-bridge/cli-bridge.ts"],"names":[],"mappings":"AAeA,SAAS,SAAS,CAAC,IAAuB,EAAE,KAAc;IACxD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC;AAED,SAAS,SAAS,CAAC,MAAgC;IACjD,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;AAC9C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAC/B,OAA4B;IAE5B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,K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sourceRoot":"","sources":["../../../src/runner/cli-bridge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deliver phase wiring — push, PR creation, rework actions.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from the dep factory to stay within file-length limits.
|
|
5
|
+
*/
|
|
6
|
+
import type { AppendFn } from '../shared/types.js';
|
|
7
|
+
import type { ExecGit, FetchFn, PipelineDeps, ProgressFs, QualityFs } from '@chief-clancy/core';
|
|
8
|
+
type DeliverOpts = {
|
|
9
|
+
readonly projectRoot: string;
|
|
10
|
+
readonly exec: ExecGit;
|
|
11
|
+
readonly progressFs: ProgressFs;
|
|
12
|
+
readonly qualityFs: QualityFs;
|
|
13
|
+
readonly fetch: FetchFn;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Wire the deliver phase with shared I/O resources.
|
|
17
|
+
*
|
|
18
|
+
* @param opts - Shared I/O resources for delivery.
|
|
19
|
+
* @param progress - Pre-wired progress append function.
|
|
20
|
+
* @returns The deliver field for PipelineDeps.
|
|
21
|
+
*/
|
|
22
|
+
export declare function wireDeliver(opts: DeliverOpts, progress: AppendFn): Pick<PipelineDeps, 'deliver'>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=deliver-phase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliver-phase.d.ts","sourceRoot":"","sources":["../../../src/runner/dep-factory/deliver-phase.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EACV,OAAO,EACP,OAAO,EACP,YAAY,EACZ,UAAU,EACV,SAAS,EAEV,MAAM,oBAAoB,CAAC;AAc5B,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,WAAW,EACjB,QAAQ,EAAE,QAAQ,GACjB,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAgD/B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { deliverPhase, deliverViaPullRequest, detectRemote, postReworkActions, recordDelivery, recordRework, resolvePlatformHandlers, } from '@chief-clancy/core';
|
|
2
|
+
import { resolveBuildLabel } from './dep-factory.js';
|
|
3
|
+
/**
|
|
4
|
+
* Wire the deliver phase with shared I/O resources.
|
|
5
|
+
*
|
|
6
|
+
* @param opts - Shared I/O resources for delivery.
|
|
7
|
+
* @param progress - Pre-wired progress append function.
|
|
8
|
+
* @returns The deliver field for PipelineDeps.
|
|
9
|
+
*/
|
|
10
|
+
export function wireDeliver(opts, progress) {
|
|
11
|
+
const { projectRoot, exec, fetch: fetchFn, qualityFs } = opts;
|
|
12
|
+
return {
|
|
13
|
+
deliver: (ctx) => deliverPhase(ctx, {
|
|
14
|
+
deliverViaPullRequest: (callOpts) => deliverViaPullRequest({
|
|
15
|
+
...callOpts,
|
|
16
|
+
exec,
|
|
17
|
+
fetchFn,
|
|
18
|
+
progressFs: opts.progressFs,
|
|
19
|
+
deliverFs: { readFile: (p) => qualityFs.readFile(p) },
|
|
20
|
+
projectRoot,
|
|
21
|
+
// Safe: deliver runs after preflight (config) and ticketFetch (ticket)
|
|
22
|
+
config: ctx.config,
|
|
23
|
+
ticket: ctx.ticket,
|
|
24
|
+
}),
|
|
25
|
+
appendProgress: progress,
|
|
26
|
+
recordDelivery: () => {
|
|
27
|
+
const now = Date.now();
|
|
28
|
+
recordDelivery(qualityFs, projectRoot, {
|
|
29
|
+
// Safe: recordDelivery runs after ticketFetch, which sets ticket
|
|
30
|
+
ticketKey: ctx.ticket.key,
|
|
31
|
+
duration: now - ctx.startTime,
|
|
32
|
+
now,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
recordRework: () =>
|
|
36
|
+
// Safe: recordRework runs after ticketFetch, which sets ticket
|
|
37
|
+
recordRework(qualityFs, projectRoot, ctx.ticket.key),
|
|
38
|
+
removeBuildLabel: async (ticketKey) => {
|
|
39
|
+
// Safe: deliver runs after preflight (config + board populated)
|
|
40
|
+
await ctx.board.removeLabel(ticketKey, resolveBuildLabel(ctx));
|
|
41
|
+
},
|
|
42
|
+
postReworkActions: async (reworkCallOpts) => {
|
|
43
|
+
const remote = detectRemote(exec);
|
|
44
|
+
const handlers = resolvePlatformHandlers({
|
|
45
|
+
fetchFn,
|
|
46
|
+
// Safe: postReworkActions runs after preflight, which sets config
|
|
47
|
+
env: ctx.config.env,
|
|
48
|
+
remote,
|
|
49
|
+
});
|
|
50
|
+
if (!handlers)
|
|
51
|
+
return;
|
|
52
|
+
await postReworkActions({ ...reworkCallOpts, handlers });
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=deliver-phase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliver-phase.js","sourceRoot":"","sources":["../../../src/runner/dep-factory/deliver-phase.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAUrD;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,IAAiB,EACjB,QAAkB;IAElB,MAAM,EAAE,WAAW,EAAE,IAAI,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