@context-forge/cli 0.8.5 → 0.9.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/dist/commands/arch.d.ts +7 -0
- package/dist/commands/arch.d.ts.map +1 -0
- package/dist/commands/arch.js +169 -0
- package/dist/commands/arch.js.map +1 -0
- package/dist/commands/backup.d.ts +3 -0
- package/dist/commands/backup.d.ts.map +1 -0
- package/dist/commands/backup.js +27 -0
- package/dist/commands/backup.js.map +1 -0
- package/dist/commands/build.d.ts +24 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +146 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/check.d.ts +3 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +250 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/commandInstaller.d.ts +28 -0
- package/dist/commands/commandInstaller.d.ts.map +1 -0
- package/dist/commands/commandInstaller.js +136 -0
- package/dist/commands/commandInstaller.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +116 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/future.d.ts +3 -0
- package/dist/commands/future.d.ts.map +1 -0
- package/dist/commands/future.js +96 -0
- package/dist/commands/future.js.map +1 -0
- package/dist/commands/guides.d.ts +9 -0
- package/dist/commands/guides.d.ts.map +1 -0
- package/dist/commands/guides.js +156 -0
- package/dist/commands/guides.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +124 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +97 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/next.d.ts +3 -0
- package/dist/commands/next.d.ts.map +1 -0
- package/dist/commands/next.js +52 -0
- package/dist/commands/next.js.map +1 -0
- package/dist/commands/plan.d.ts +7 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +102 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/project.d.ts +25 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +550 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/prompt.d.ts +3 -0
- package/dist/commands/prompt.d.ts.map +1 -0
- package/dist/commands/prompt.js +112 -0
- package/dist/commands/prompt.js.map +1 -0
- package/dist/commands/setup-ide.d.ts +15 -0
- package/dist/commands/setup-ide.d.ts.map +1 -0
- package/dist/commands/setup-ide.js +250 -0
- package/dist/commands/setup-ide.js.map +1 -0
- package/dist/commands/slice.d.ts +7 -0
- package/dist/commands/slice.d.ts.map +1 -0
- package/dist/commands/slice.js +151 -0
- package/dist/commands/slice.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +210 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/task.d.ts +13 -0
- package/dist/commands/task.d.ts.map +1 -0
- package/dist/commands/task.js +207 -0
- package/dist/commands/task.js.map +1 -0
- package/dist/commands/update.d.ts +27 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +172 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/workflow.d.ts +3 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +204 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/commands/worktree.d.ts +3 -0
- package/dist/commands/worktree.d.ts.map +1 -0
- package/dist/commands/worktree.js +371 -0
- package/dist/commands/worktree.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +167 -0
- package/dist/index.js.map +1 -0
- package/dist/options.d.ts +16 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +29 -0
- package/dist/options.js.map +1 -0
- package/dist/output/entryStatusDisplay.d.ts +12 -0
- package/dist/output/entryStatusDisplay.d.ts.map +1 -0
- package/dist/output/entryStatusDisplay.js +24 -0
- package/dist/output/entryStatusDisplay.js.map +1 -0
- package/dist/output/formatter.d.ts +6 -0
- package/dist/output/formatter.d.ts.map +1 -0
- package/dist/output/formatter.js +9 -0
- package/dist/output/formatter.js.map +1 -0
- package/dist/output/styles.d.ts +15 -0
- package/dist/output/styles.d.ts.map +1 -0
- package/dist/output/styles.js +16 -0
- package/dist/output/styles.js.map +1 -0
- package/dist/output/tables.d.ts +6 -0
- package/dist/output/tables.d.ts.map +1 -0
- package/dist/output/tables.js +45 -0
- package/dist/output/tables.js.map +1 -0
- package/dist/utils/archIndex.d.ts +7 -0
- package/dist/utils/archIndex.d.ts.map +1 -0
- package/dist/utils/archIndex.js +14 -0
- package/dist/utils/archIndex.js.map +1 -0
- package/dist/utils/breaking-changes.d.ts +14 -0
- package/dist/utils/breaking-changes.d.ts.map +1 -0
- package/dist/utils/breaking-changes.js +11 -0
- package/dist/utils/breaking-changes.js.map +1 -0
- package/dist/utils/commandCatalog.d.ts +25 -0
- package/dist/utils/commandCatalog.d.ts.map +1 -0
- package/dist/utils/commandCatalog.js +32 -0
- package/dist/utils/commandCatalog.js.map +1 -0
- package/dist/utils/confirm.d.ts +3 -0
- package/dist/utils/confirm.d.ts.map +1 -0
- package/dist/utils/confirm.js +12 -0
- package/dist/utils/confirm.js.map +1 -0
- package/dist/utils/errors.d.ts +22 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +63 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/phaseShorthand.d.ts +23 -0
- package/dist/utils/phaseShorthand.d.ts.map +1 -0
- package/dist/utils/phaseShorthand.js +68 -0
- package/dist/utils/phaseShorthand.js.map +1 -0
- package/dist/utils/project.d.ts +60 -0
- package/dist/utils/project.d.ts.map +1 -0
- package/dist/utils/project.js +140 -0
- package/dist/utils/project.js.map +1 -0
- package/dist/utils/worktree-overlay.d.ts +31 -0
- package/dist/utils/worktree-overlay.d.ts.map +1 -0
- package/dist/utils/worktree-overlay.js +63 -0
- package/dist/utils/worktree-overlay.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NormalizedStatus } from '@context-forge/core';
|
|
2
|
+
/** A derived status, or the TD-2a degraded case for a signal that failed to resolve. */
|
|
3
|
+
export type DisplayStatus = NormalizedStatus | 'degraded';
|
|
4
|
+
/**
|
|
5
|
+
* Render a plan/arch entry's derived status for table display.
|
|
6
|
+
* Distinguishes a signed-off complete entry (checkbox ticked) from a
|
|
7
|
+
* derived-complete-but-unchecked one (tasks done, awaiting sign-off) — this
|
|
8
|
+
* is presentation only; callers must branch on the underlying NormalizedStatus,
|
|
9
|
+
* never on this rendered label (CLAUDE.md: labels are not logical structure).
|
|
10
|
+
*/
|
|
11
|
+
export declare function renderEntryStatus(status: DisplayStatus, isChecked: boolean): string;
|
|
12
|
+
//# sourceMappingURL=entryStatusDisplay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entryStatusDisplay.d.ts","sourceRoot":"","sources":["../../src/output/entryStatusDisplay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,wFAAwF;AACxF,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,UAAU,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAYnF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { STATUS } from '@context-forge/core';
|
|
2
|
+
import { success, dim, warn } from './styles.js';
|
|
3
|
+
/**
|
|
4
|
+
* Render a plan/arch entry's derived status for table display.
|
|
5
|
+
* Distinguishes a signed-off complete entry (checkbox ticked) from a
|
|
6
|
+
* derived-complete-but-unchecked one (tasks done, awaiting sign-off) — this
|
|
7
|
+
* is presentation only; callers must branch on the underlying NormalizedStatus,
|
|
8
|
+
* never on this rendered label (CLAUDE.md: labels are not logical structure).
|
|
9
|
+
*/
|
|
10
|
+
export function renderEntryStatus(status, isChecked) {
|
|
11
|
+
if (status === 'degraded')
|
|
12
|
+
return warn('⚠ unreadable');
|
|
13
|
+
switch (status) {
|
|
14
|
+
case STATUS.Deprecated:
|
|
15
|
+
return dim('⊘ deprecated');
|
|
16
|
+
case STATUS.Complete:
|
|
17
|
+
return isChecked ? success('✓ complete') : success('● tasks done');
|
|
18
|
+
case STATUS.InProgress:
|
|
19
|
+
return warn('◐ in progress');
|
|
20
|
+
case STATUS.NotStarted:
|
|
21
|
+
return dim('○ not started');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=entryStatusDisplay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entryStatusDisplay.js","sourceRoot":"","sources":["../../src/output/entryStatusDisplay.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAKjD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAqB,EAAE,SAAkB;IACzE,IAAI,MAAM,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC;IACvD,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM,CAAC,UAAU;YACpB,OAAO,GAAG,CAAC,cAAc,CAAC,CAAC;QAC7B,KAAK,MAAM,CAAC,QAAQ;YAClB,OAAO,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACrE,KAAK,MAAM,CAAC,UAAU;YACpB,OAAO,IAAI,CAAC,eAAe,CAAC,CAAC;QAC/B,KAAK,MAAM,CAAC,UAAU;YACpB,OAAO,GAAG,CAAC,eAAe,CAAC,CAAC;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type OutputMode = 'terminal' | 'json';
|
|
2
|
+
/** Print structured data as formatted JSON to stdout. */
|
|
3
|
+
export declare function printJson(data: unknown): void;
|
|
4
|
+
/** Print raw text to stdout (no formatting, no trailing newline unless in text). */
|
|
5
|
+
export declare function printRaw(text: string): void;
|
|
6
|
+
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;AAE7C,yDAAyD;AACzD,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED,oFAAoF;AACpF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE3C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Print structured data as formatted JSON to stdout. */
|
|
2
|
+
export function printJson(data) {
|
|
3
|
+
process.stdout.write(JSON.stringify(data, null, 2) + '\n');
|
|
4
|
+
}
|
|
5
|
+
/** Print raw text to stdout (no formatting, no trailing newline unless in text). */
|
|
6
|
+
export function printRaw(text) {
|
|
7
|
+
process.stdout.write(text);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"AAEA,yDAAyD;AACzD,MAAM,UAAU,SAAS,CAAC,IAAa;IACrC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAC7D,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Style for field labels (e.g. "Project:", "Phase:") */
|
|
2
|
+
export declare const label: import("chalk").ChalkInstance;
|
|
3
|
+
/** Style for field values */
|
|
4
|
+
export declare const value: import("chalk").ChalkInstance;
|
|
5
|
+
/** Style for section headings */
|
|
6
|
+
export declare const heading: import("chalk").ChalkInstance;
|
|
7
|
+
/** Style for secondary/subdued text */
|
|
8
|
+
export declare const dim: import("chalk").ChalkInstance;
|
|
9
|
+
/** Style for error messages */
|
|
10
|
+
export declare const error: import("chalk").ChalkInstance;
|
|
11
|
+
/** Style for success messages */
|
|
12
|
+
export declare const success: import("chalk").ChalkInstance;
|
|
13
|
+
/** Style for warning messages */
|
|
14
|
+
export declare const warn: import("chalk").ChalkInstance;
|
|
15
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/output/styles.ts"],"names":[],"mappings":"AAEA,yDAAyD;AACzD,eAAO,MAAM,KAAK,+BAAa,CAAC;AAEhC,6BAA6B;AAC7B,eAAO,MAAM,KAAK,+BAAa,CAAC;AAEhC,iCAAiC;AACjC,eAAO,MAAM,OAAO,+BAAuB,CAAC;AAE5C,uCAAuC;AACvC,eAAO,MAAM,GAAG,+BAAY,CAAC;AAE7B,+BAA+B;AAC/B,eAAO,MAAM,KAAK,+BAAY,CAAC;AAE/B,iCAAiC;AACjC,eAAO,MAAM,OAAO,+BAAc,CAAC;AAEnC,iCAAiC;AACjC,eAAO,MAAM,IAAI,+BAAe,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/** Style for field labels (e.g. "Project:", "Phase:") */
|
|
3
|
+
export const label = chalk.bold;
|
|
4
|
+
/** Style for field values */
|
|
5
|
+
export const value = chalk.cyan;
|
|
6
|
+
/** Style for section headings */
|
|
7
|
+
export const heading = chalk.bold.underline;
|
|
8
|
+
/** Style for secondary/subdued text */
|
|
9
|
+
export const dim = chalk.dim;
|
|
10
|
+
/** Style for error messages */
|
|
11
|
+
export const error = chalk.red;
|
|
12
|
+
/** Style for success messages */
|
|
13
|
+
export const success = chalk.green;
|
|
14
|
+
/** Style for warning messages */
|
|
15
|
+
export const warn = chalk.yellow;
|
|
16
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/output/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,yDAAyD;AACzD,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;AAEhC,6BAA6B;AAC7B,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC;AAEhC,iCAAiC;AACjC,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;AAE5C,uCAAuC;AACvC,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;AAE7B,+BAA+B;AAC/B,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC;AAE/B,iCAAiC;AACjC,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC;AAEnC,iCAAiC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render a borderless table with bold/cyan headers and an underline separator.
|
|
3
|
+
* Matches orchestration CLI style: no cell borders, column-aligned with padding.
|
|
4
|
+
*/
|
|
5
|
+
export declare function renderTable(headers: string[], rows: string[][], rowPrefixes?: string[]): string;
|
|
6
|
+
//# sourceMappingURL=tables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../src/output/tables.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,MAAM,EAAE,EAAE,EAChB,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,MAAM,CAsCR"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Render a borderless table with bold/cyan headers and an underline separator.
|
|
4
|
+
* Matches orchestration CLI style: no cell borders, column-aligned with padding.
|
|
5
|
+
*/
|
|
6
|
+
export function renderTable(headers, rows, rowPrefixes) {
|
|
7
|
+
// Calculate column widths from headers and data
|
|
8
|
+
const colWidths = headers.map((h, i) => {
|
|
9
|
+
const dataMax = rows.reduce((max, row) => Math.max(max, stripAnsi(row[i] ?? '').length), 0);
|
|
10
|
+
return Math.max(stripAnsi(h).length, dataMax);
|
|
11
|
+
});
|
|
12
|
+
const pad = 2; // spacing between columns
|
|
13
|
+
const indent = ' ';
|
|
14
|
+
const lines = [];
|
|
15
|
+
// Header row — bold cyan
|
|
16
|
+
const headerLine = headers
|
|
17
|
+
.map((h, i) => chalk.bold.cyan(h.padEnd(colWidths[i])))
|
|
18
|
+
.join(' '.repeat(pad));
|
|
19
|
+
lines.push(indent + headerLine);
|
|
20
|
+
// Underline — thin dash under each column
|
|
21
|
+
const underline = colWidths
|
|
22
|
+
.map((w) => '─'.repeat(w))
|
|
23
|
+
.join(' '.repeat(pad));
|
|
24
|
+
lines.push(indent + chalk.dim(underline));
|
|
25
|
+
// Data rows
|
|
26
|
+
for (let r = 0; r < rows.length; r++) {
|
|
27
|
+
const row = rows[r];
|
|
28
|
+
const prefix = rowPrefixes ? rowPrefixes[r] : indent;
|
|
29
|
+
const rowLine = row
|
|
30
|
+
.map((cell, i) => {
|
|
31
|
+
const visible = stripAnsi(cell ?? '');
|
|
32
|
+
const padding = colWidths[i] - visible.length;
|
|
33
|
+
return (cell ?? '') + ' '.repeat(Math.max(0, padding));
|
|
34
|
+
})
|
|
35
|
+
.join(' '.repeat(pad));
|
|
36
|
+
lines.push(prefix + rowLine);
|
|
37
|
+
}
|
|
38
|
+
return lines.join('\n');
|
|
39
|
+
}
|
|
40
|
+
/** Strip ANSI escape codes to get visible character length. */
|
|
41
|
+
function stripAnsi(str) {
|
|
42
|
+
// eslint-disable-next-line no-control-regex
|
|
43
|
+
return str.replace(/\x1B\[[0-9;]*m/g, '');
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../../src/output/tables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;GAGG;AACH,MAAM,UAAU,WAAW,CACzB,OAAiB,EACjB,IAAgB,EAChB,WAAsB;IAEtB,gDAAgD;IAChD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5F,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,0BAA0B;IACzC,MAAM,MAAM,GAAG,IAAI,CAAC;IACpB,MA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I,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,+DAA+D;AAC/D,SAAS,SAAS,CAAC,GAAW;IAC5B,4CAA4C;IAC5C,OAAO,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse and validate an `[archIndex]` positional argument shared by
|
|
3
|
+
* `cf list slices` / `cf list tasks`. Throws UserError on non-numeric or
|
|
4
|
+
* negative input; returns the parsed integer otherwise.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseArchIndex(raw: string): number;
|
|
7
|
+
//# sourceMappingURL=archIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archIndex.d.ts","sourceRoot":"","sources":["../../src/utils/archIndex.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMlD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UserError } from './errors.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parse and validate an `[archIndex]` positional argument shared by
|
|
4
|
+
* `cf list slices` / `cf list tasks`. Throws UserError on non-numeric or
|
|
5
|
+
* negative input; returns the parsed integer otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export function parseArchIndex(raw) {
|
|
8
|
+
const archIndex = Number(raw);
|
|
9
|
+
if (!Number.isInteger(archIndex) || archIndex < 0) {
|
|
10
|
+
throw new UserError(`Invalid archIndex '${raw}' — must be a non-negative integer.`);
|
|
11
|
+
}
|
|
12
|
+
return archIndex;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=archIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archIndex.js","sourceRoot":"","sources":["../../src/utils/archIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,SAAS,CAAC,sBAAsB,GAAG,qCAAqC,CAAC,CAAC;IACtF,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** A breaking CLI change that agents should be aware of. */
|
|
2
|
+
export interface BreakingChange {
|
|
3
|
+
/** Version that introduced the breaking change. */
|
|
4
|
+
since: string;
|
|
5
|
+
/** Human-readable description of what changed. */
|
|
6
|
+
change: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Breaking changes since the last minor version bump.
|
|
10
|
+
* Manually maintained — add entries when making breaking CLI changes.
|
|
11
|
+
* Clear this array when bumping the minor version.
|
|
12
|
+
*/
|
|
13
|
+
export declare const BREAKING_CHANGES: BreakingChange[];
|
|
14
|
+
//# sourceMappingURL=breaking-changes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breaking-changes.d.ts","sourceRoot":"","sources":["../../src/utils/breaking-changes.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,MAAM,WAAW,cAAc;IAC7B,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,cAAc,EAI5C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breaking changes since the last minor version bump.
|
|
3
|
+
* Manually maintained — add entries when making breaking CLI changes.
|
|
4
|
+
* Clear this array when bumping the minor version.
|
|
5
|
+
*/
|
|
6
|
+
export const BREAKING_CHANGES = [
|
|
7
|
+
{ since: '0.6.20', change: 'cf slice list → cf list slices (and other artifact list commands)' },
|
|
8
|
+
{ since: '0.6.23', change: 'Bare cf build no longer outputs raw prompt — use cf build --json or /cf:build slash command' },
|
|
9
|
+
{ since: '0.6.26', change: 'Compound commands (cf concept, cf arch, cf slice, cf tasks, cf implement, cf plan, cf initiatives) removed — use cf set + cf build, or Squadron (sq) equivalents' },
|
|
10
|
+
];
|
|
11
|
+
//# sourceMappingURL=breaking-changes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breaking-changes.js","sourceRoot":"","sources":["../../src/utils/breaking-changes.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAqB;IAChD,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,mEAAmE,EAAE;IAChG,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,6FAA6F,EAAE;IAC1H,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,kKAAkK,EAAE;CAChM,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
interface CatalogArg {
|
|
3
|
+
name: string;
|
|
4
|
+
required: boolean;
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
interface CatalogOption {
|
|
8
|
+
flag: string;
|
|
9
|
+
description: string;
|
|
10
|
+
}
|
|
11
|
+
interface CatalogCommand {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
args: CatalogArg[];
|
|
15
|
+
options: CatalogOption[];
|
|
16
|
+
subcommands: CatalogCommand[];
|
|
17
|
+
}
|
|
18
|
+
export interface CommandCatalog {
|
|
19
|
+
version: string;
|
|
20
|
+
commands: CatalogCommand[];
|
|
21
|
+
}
|
|
22
|
+
/** Walk the Commander tree and produce a machine-readable command catalog. */
|
|
23
|
+
export declare function buildCommandCatalog(program: Command, version: string): CommandCatalog;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=commandCatalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandCatalog.d.ts","sourceRoot":"","sources":["../../src/utils/commandCatalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,WAAW,EAAE,cAAc,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAgCD,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAMrF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function buildCommandEntry(cmd) {
|
|
2
|
+
// Filter out default help option and version option
|
|
3
|
+
const options = cmd.options
|
|
4
|
+
.filter((o) => !o.flags.includes('--help') && !o.flags.includes('--version'))
|
|
5
|
+
.map((o) => ({
|
|
6
|
+
flag: o.flags,
|
|
7
|
+
description: o.description,
|
|
8
|
+
}));
|
|
9
|
+
const args = (cmd.registeredArguments ?? []).map((a) => ({
|
|
10
|
+
name: a.name(),
|
|
11
|
+
required: a.required,
|
|
12
|
+
description: a.description,
|
|
13
|
+
}));
|
|
14
|
+
const subcommands = cmd.commands
|
|
15
|
+
.filter((sub) => sub.name() !== 'help')
|
|
16
|
+
.map((sub) => buildCommandEntry(sub));
|
|
17
|
+
return {
|
|
18
|
+
name: cmd.name(),
|
|
19
|
+
description: cmd.description(),
|
|
20
|
+
args,
|
|
21
|
+
options,
|
|
22
|
+
subcommands,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Walk the Commander tree and produce a machine-readable command catalog. */
|
|
26
|
+
export function buildCommandCatalog(program, version) {
|
|
27
|
+
const commands = program.commands
|
|
28
|
+
.filter((cmd) => cmd.name() !== 'help')
|
|
29
|
+
.map((cmd) => buildCommandEntry(cmd));
|
|
30
|
+
return { version, commands };
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=commandCatalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandCatalog.js","sourceRoot":"","sources":["../../src/utils/commandCatalog.ts"],"names":[],"mappings":"AA0BA,SAAS,iBAAiB,CAAC,GAAY;IACrC,oDAAoD;IACpD,MAAM,OAAO,GAAoB,GAAG,CAAC,OAAO;SACzC,MAAM,CAAC,CAAC,CAAoB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;SAC/F,GAAG,CAAC,CAAC,CAAyC,EAAE,EAAE,CAAC,CAAC;QACnD,IAAI,EAAE,CAAC,CAAC,KAAK;QACb,WAAW,EAAE,CAAC,CAAC,WAAW;KAC3B,CAAC,CAAC,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12 @@
|
|
|
1
|
+
import * as readline from 'node:readline';
|
|
2
|
+
/** Prompt user for y/N confirmation via stdin. Returns true if confirmed. */
|
|
3
|
+
export function askConfirmation(prompt) {
|
|
4
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
5
|
+
return new Promise((resolve) => {
|
|
6
|
+
rl.question(prompt, (answer) => {
|
|
7
|
+
rl.close();
|
|
8
|
+
resolve(answer.trim().toLowerCase() === 'y');
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=confirm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm.js","sourceRoot":"","sources":["../../src/utils/confirm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,6EAA6E;AAC7E,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;YAC7B,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Standard error codes for machine-readable error responses. */
|
|
2
|
+
export type ErrorCode = 'PROJECT_NOT_FOUND' | 'FIELD_NOT_FOUND' | 'INVALID_ARGUMENT' | 'INVALID_VALUE' | 'MISSING_CONFIG' | 'ARTIFACT_NOT_FOUND' | 'READ_ONLY' | 'ALREADY_EXISTS';
|
|
3
|
+
/**
|
|
4
|
+
* User-facing error — printed without stack trace.
|
|
5
|
+
* Use for expected failure conditions (missing config, invalid arguments, etc).
|
|
6
|
+
*/
|
|
7
|
+
export declare class UserError extends Error {
|
|
8
|
+
code?: ErrorCode;
|
|
9
|
+
suggestion?: string;
|
|
10
|
+
constructor(message: string, code?: ErrorCode, suggestion?: string);
|
|
11
|
+
}
|
|
12
|
+
/** Enable JSON-structured error output. Called when --json is parsed. */
|
|
13
|
+
export declare function setJsonMode(): void;
|
|
14
|
+
/** Check if JSON mode is active (flag or CF_JSON env var). */
|
|
15
|
+
export declare function isJsonMode(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Top-level error handler. Prints the message and exits with code 1.
|
|
18
|
+
* In JSON mode, outputs structured JSON to stderr.
|
|
19
|
+
* Otherwise, UserErrors get a clean message; unexpected errors get a brief summary.
|
|
20
|
+
*/
|
|
21
|
+
export declare function handleError(err: unknown): never;
|
|
22
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,MAAM,MAAM,SAAS,GACjB,mBAAmB,GACnB,iBAAiB,GACjB,kBAAkB,GAClB,eAAe,GACf,gBAAgB,GAChB,oBAAoB,GACpB,WAAW,GACX,gBAAgB,CAAC;AAErB;;;GAGG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAClC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAER,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,MAAM;CAMnE;AAKD,yEAAyE;AACzE,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED,8DAA8D;AAC9D,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CA0B/C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User-facing error — printed without stack trace.
|
|
3
|
+
* Use for expected failure conditions (missing config, invalid arguments, etc).
|
|
4
|
+
*/
|
|
5
|
+
export class UserError extends Error {
|
|
6
|
+
code;
|
|
7
|
+
suggestion;
|
|
8
|
+
constructor(message, code, suggestion) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'UserError';
|
|
11
|
+
this.code = code;
|
|
12
|
+
this.suggestion = suggestion;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Module-level JSON mode flag — set during option parsing. */
|
|
16
|
+
let jsonMode = false;
|
|
17
|
+
/** Enable JSON-structured error output. Called when --json is parsed. */
|
|
18
|
+
export function setJsonMode() {
|
|
19
|
+
jsonMode = true;
|
|
20
|
+
}
|
|
21
|
+
/** Check if JSON mode is active (flag or CF_JSON env var). */
|
|
22
|
+
export function isJsonMode() {
|
|
23
|
+
return jsonMode || process.env.CF_JSON === '1';
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Top-level error handler. Prints the message and exits with code 1.
|
|
27
|
+
* In JSON mode, outputs structured JSON to stderr.
|
|
28
|
+
* Otherwise, UserErrors get a clean message; unexpected errors get a brief summary.
|
|
29
|
+
*/
|
|
30
|
+
export function handleError(err) {
|
|
31
|
+
if (isJsonMode()) {
|
|
32
|
+
const jsonError = { error: true };
|
|
33
|
+
if (err instanceof UserError) {
|
|
34
|
+
jsonError.code = err.code ?? 'UNKNOWN';
|
|
35
|
+
jsonError.message = err.message;
|
|
36
|
+
if (err.suggestion)
|
|
37
|
+
jsonError.suggestion = err.suggestion;
|
|
38
|
+
}
|
|
39
|
+
else if (err instanceof Error) {
|
|
40
|
+
jsonError.code = 'UNKNOWN';
|
|
41
|
+
jsonError.message = err.message;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
jsonError.code = 'UNKNOWN';
|
|
45
|
+
jsonError.message = String(err);
|
|
46
|
+
}
|
|
47
|
+
process.stderr.write(JSON.stringify(jsonError) + '\n');
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
if (err instanceof UserError) {
|
|
51
|
+
const msg = err.suggestion ? `${err.message}\n ${err.suggestion}` : err.message;
|
|
52
|
+
console.error(msg);
|
|
53
|
+
}
|
|
54
|
+
else if (err instanceof Error) {
|
|
55
|
+
console.error(`Error: ${err.message}`);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
console.error(`Error: ${String(err)}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAClC,IAAI,CAAa;IACjB,UAAU,CAAU;IAEpB,YAAY,OAAe,EAAE,IAAgB,EAAE,UAAmB;QAChE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAED,+DAA+D;AAC/D,IAAI,QAAQ,GAAG,KAAK,CAAC;AAErB,yEAAyE;AACzE,MAAM,UAAU,WAAW;IACzB,QAAQ,GAAG,IAAI,CAAC;AAClB,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,UAAU;IACxB,OAAO,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,GAAG,CAAC;AACjD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,IAAI,UAAU,EAAE,EAAE,CAAC;QACjB,MA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,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse phase shorthands from the system prompt file.
|
|
3
|
+
*
|
|
4
|
+
* Extracts headings matching `(Phase n)` or `(Phase n.m)` and builds
|
|
5
|
+
* a map: { P1: 'Concept', P2: 'Architecture', ... }
|
|
6
|
+
*
|
|
7
|
+
* The prompt file is resolved from the project path.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getPhaseShorthands(projectPath: string): Promise<Map<string, string>>;
|
|
10
|
+
/** Clear the cached shorthands (for testing). */
|
|
11
|
+
export declare function clearPhaseShorthandCache(): void;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve a phase input (name, shorthand, or key) to a prompt key suitable
|
|
14
|
+
* for SystemPromptParser.getPromptForInstruction().
|
|
15
|
+
*
|
|
16
|
+
* Resolution order:
|
|
17
|
+
* 1. Phase shorthand (P1–P7) → resolved name
|
|
18
|
+
* 2. Otherwise: return as-is (case-insensitive matching handled by parser)
|
|
19
|
+
*
|
|
20
|
+
* Hyphens and spaces are interchangeable.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolvePhaseInput(input: string, projectPath: string): Promise<string>;
|
|
23
|
+
//# sourceMappingURL=phaseShorthand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phaseShorthand.d.ts","sourceRoot":"","sources":["../../src/utils/phaseShorthand.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAyB1F;AAED,iDAAiD;AACjD,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAajB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { PROMPT_FILE_RELATIVE_PATH } from '@context-forge/core';
|
|
4
|
+
/**
|
|
5
|
+
* Phase shorthand map: P1 → phase name, derived at runtime from the prompt asset.
|
|
6
|
+
* Cached after first parse.
|
|
7
|
+
*/
|
|
8
|
+
let cachedShorthands = null;
|
|
9
|
+
/**
|
|
10
|
+
* Parse phase shorthands from the system prompt file.
|
|
11
|
+
*
|
|
12
|
+
* Extracts headings matching `(Phase n)` or `(Phase n.m)` and builds
|
|
13
|
+
* a map: { P1: 'Concept', P2: 'Architecture', ... }
|
|
14
|
+
*
|
|
15
|
+
* The prompt file is resolved from the project path.
|
|
16
|
+
*/
|
|
17
|
+
export async function getPhaseShorthands(projectPath) {
|
|
18
|
+
if (cachedShorthands)
|
|
19
|
+
return cachedShorthands;
|
|
20
|
+
const promptFilePath = path.join(projectPath, PROMPT_FILE_RELATIVE_PATH);
|
|
21
|
+
const content = await fs.readFile(promptFilePath, 'utf-8');
|
|
22
|
+
const map = new Map();
|
|
23
|
+
// Match headings like "##### Concept (Phase 1)" or "##### Implementation (Phase 6)"
|
|
24
|
+
const pattern = /^#{1,6}\s+(.+?)\s+\(Phase\s+(\d+(?:\.\d+)?)\)\s*$/gm;
|
|
25
|
+
let match;
|
|
26
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
27
|
+
const name = match[1].trim();
|
|
28
|
+
const number = match[2];
|
|
29
|
+
// Only use the integer part for shorthand (P1, P2, etc.)
|
|
30
|
+
const intPart = number.split('.')[0];
|
|
31
|
+
const shorthand = `P${intPart}`;
|
|
32
|
+
// First match for each integer wins (e.g. P2 = Architecture, not P2.1)
|
|
33
|
+
if (!map.has(shorthand)) {
|
|
34
|
+
map.set(shorthand, name);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
cachedShorthands = map;
|
|
38
|
+
return map;
|
|
39
|
+
}
|
|
40
|
+
/** Clear the cached shorthands (for testing). */
|
|
41
|
+
export function clearPhaseShorthandCache() {
|
|
42
|
+
cachedShorthands = null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Resolve a phase input (name, shorthand, or key) to a prompt key suitable
|
|
46
|
+
* for SystemPromptParser.getPromptForInstruction().
|
|
47
|
+
*
|
|
48
|
+
* Resolution order:
|
|
49
|
+
* 1. Phase shorthand (P1–P7) → resolved name
|
|
50
|
+
* 2. Otherwise: return as-is (case-insensitive matching handled by parser)
|
|
51
|
+
*
|
|
52
|
+
* Hyphens and spaces are interchangeable.
|
|
53
|
+
*/
|
|
54
|
+
export async function resolvePhaseInput(input, projectPath) {
|
|
55
|
+
// Check if input is a shorthand like P1, p5, etc.
|
|
56
|
+
const shorthandMatch = input.match(/^[Pp](\d+)$/);
|
|
57
|
+
if (shorthandMatch) {
|
|
58
|
+
const shorthands = await getPhaseShorthands(projectPath);
|
|
59
|
+
const key = `P${shorthandMatch[1]}`;
|
|
60
|
+
const name = shorthands.get(key);
|
|
61
|
+
if (name)
|
|
62
|
+
return name;
|
|
63
|
+
// Fall through — return as-is and let the parser handle it
|
|
64
|
+
}
|
|
65
|
+
// Normalize: hyphens ↔ spaces
|
|
66
|
+
return input.replace(/-/g, ' ');
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=phaseShorthand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phaseShorthand.js","sourceRoot":"","sources":["../../src/utils/phaseShorthand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;;GAGG;AACH,IAAI,gBAAgB,GAA+B,IAAI,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC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ACnB,MAAM,UAAU,GAAG,MAAM,kBAAkB,CAAC,WAAW,CAAC,CAAC;QACzD,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC;QACtB,2DAA2D;IAC7D,CAAC;IAED,8BAA8B;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { FileProjectStore } from '@context-forge/core/node';
|
|
2
|
+
import type { ProjectData } from '@context-forge/core';
|
|
3
|
+
/**
|
|
4
|
+
* Find a project by exact ID or case-insensitive name.
|
|
5
|
+
* ID match takes priority over name match.
|
|
6
|
+
*/
|
|
7
|
+
export declare function findByNameOrId(nameOrId: string, store: FileProjectStore): Promise<ProjectData | null>;
|
|
8
|
+
/** Result of a CWD-based project match, including optional worktree context. */
|
|
9
|
+
export interface CwdMatch {
|
|
10
|
+
project: ProjectData;
|
|
11
|
+
/** Set when the match was via a worktree's worktreePath rather than projectPath. */
|
|
12
|
+
worktreeId?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Find the project whose projectPath or worktreePath best matches the current
|
|
16
|
+
* working directory. When multiple paths match (nested paths), the longest wins.
|
|
17
|
+
* Projects without a projectPath are skipped; worktrees without a worktreePath
|
|
18
|
+
* are also skipped.
|
|
19
|
+
*/
|
|
20
|
+
export declare function findProjectByCwd(store: FileProjectStore): Promise<CwdMatch | null>;
|
|
21
|
+
export type ResolutionSource = 'flag' | 'cwd' | 'worktree' | 'default' | 'none';
|
|
22
|
+
export interface ResolvedProject {
|
|
23
|
+
id: string;
|
|
24
|
+
source: ResolutionSource;
|
|
25
|
+
}
|
|
26
|
+
export interface ResolvedProjectWorktree {
|
|
27
|
+
id: string;
|
|
28
|
+
source: ResolutionSource;
|
|
29
|
+
/** Set when CWD matched a worktree's worktreePath. */
|
|
30
|
+
worktreeId?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Options for resolveProjectWorktree. */
|
|
33
|
+
export interface ResolveProjectWorktreeOptions {
|
|
34
|
+
/** Explicit --project flag value (name or id). */
|
|
35
|
+
project?: string;
|
|
36
|
+
/** Explicit --worktree flag value (name or id) — overrides CWD-derived worktreeId. */
|
|
37
|
+
worktree?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Resolves which project and (optionally) worktree to use via a three-step chain:
|
|
41
|
+
*
|
|
42
|
+
* 1. explicit --project flag → findByNameOrId
|
|
43
|
+
* 2. CWD detection → findProjectByCwd (worktree-aware)
|
|
44
|
+
* 3. Throw UserError with guidance
|
|
45
|
+
*
|
|
46
|
+
* When opts.worktree is provided and a project was resolved, also resolves the
|
|
47
|
+
* worktreeId via findWorktreeByNameOrId.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveProjectWorktree(opts: ResolveProjectWorktreeOptions, store: FileProjectStore): Promise<ResolvedProjectWorktree>;
|
|
50
|
+
/**
|
|
51
|
+
* Resolves which project to use via a three-step chain.
|
|
52
|
+
* Backwards-compatible wrapper around resolveProjectWorktree — drops worktreeId.
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveProjectId(explicit: string | undefined, store: FileProjectStore): Promise<ResolvedProject>;
|
|
55
|
+
/**
|
|
56
|
+
* Find a worktree within a project by exact ID or case-insensitive name.
|
|
57
|
+
* ID match takes priority over name match. Returns undefined if not found.
|
|
58
|
+
*/
|
|
59
|
+
export declare function findWorktreeByNameOrId(projectId: string, nameOrId: string, store: FileProjectStore): Promise<import('@context-forge/core').WorktreeContext | undefined>;
|
|
60
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/utils/project.ts"],"names":[],"mappings":"AAAA,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