@hstm-labs/forge-cli 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +56 -0
  2. package/dist/cli.d.ts +9 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +14 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/deliver.d.ts +14 -0
  7. package/dist/commands/deliver.d.ts.map +1 -0
  8. package/dist/commands/deliver.js +92 -0
  9. package/dist/commands/deliver.js.map +1 -0
  10. package/dist/commands/generate.d.ts +14 -0
  11. package/dist/commands/generate.d.ts.map +1 -0
  12. package/dist/commands/generate.js +168 -0
  13. package/dist/commands/generate.js.map +1 -0
  14. package/dist/commands/init.d.ts +15 -0
  15. package/dist/commands/init.d.ts.map +1 -0
  16. package/dist/commands/init.js +83 -0
  17. package/dist/commands/init.js.map +1 -0
  18. package/dist/commands/profile.d.ts +11 -0
  19. package/dist/commands/profile.d.ts.map +1 -0
  20. package/dist/commands/profile.js +35 -0
  21. package/dist/commands/profile.js.map +1 -0
  22. package/dist/commands/status.d.ts +14 -0
  23. package/dist/commands/status.d.ts.map +1 -0
  24. package/dist/commands/status.js +104 -0
  25. package/dist/commands/status.js.map +1 -0
  26. package/dist/commands/template.d.ts +11 -0
  27. package/dist/commands/template.d.ts.map +1 -0
  28. package/dist/commands/template.js +25 -0
  29. package/dist/commands/template.js.map +1 -0
  30. package/dist/commands/verify.d.ts +15 -0
  31. package/dist/commands/verify.d.ts.map +1 -0
  32. package/dist/commands/verify.js +167 -0
  33. package/dist/commands/verify.js.map +1 -0
  34. package/dist/error-handler.d.ts +16 -0
  35. package/dist/error-handler.d.ts.map +1 -0
  36. package/dist/error-handler.js +43 -0
  37. package/dist/error-handler.js.map +1 -0
  38. package/dist/formatters/agent-mode-formatter.d.ts +167 -0
  39. package/dist/formatters/agent-mode-formatter.d.ts.map +1 -0
  40. package/dist/formatters/agent-mode-formatter.js +271 -0
  41. package/dist/formatters/agent-mode-formatter.js.map +1 -0
  42. package/dist/formatters/run-status-formatter.d.ts +53 -0
  43. package/dist/formatters/run-status-formatter.d.ts.map +1 -0
  44. package/dist/formatters/run-status-formatter.js +267 -0
  45. package/dist/formatters/run-status-formatter.js.map +1 -0
  46. package/dist/index.d.ts +5 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +5 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/output.d.ts +60 -0
  51. package/dist/output.d.ts.map +1 -0
  52. package/dist/output.js +78 -0
  53. package/dist/output.js.map +1 -0
  54. package/dist/program.d.ts +14 -0
  55. package/dist/program.d.ts.map +1 -0
  56. package/dist/program.js +64 -0
  57. package/dist/program.js.map +1 -0
  58. package/dist/progress-bar.d.ts +18 -0
  59. package/dist/progress-bar.d.ts.map +1 -0
  60. package/dist/progress-bar.js +28 -0
  61. package/dist/progress-bar.js.map +1 -0
  62. package/dist/progress-reporter.d.ts +35 -0
  63. package/dist/progress-reporter.d.ts.map +1 -0
  64. package/dist/progress-reporter.js +236 -0
  65. package/dist/progress-reporter.js.map +1 -0
  66. package/dist/prompts/init-prompts.d.ts +22 -0
  67. package/dist/prompts/init-prompts.d.ts.map +1 -0
  68. package/dist/prompts/init-prompts.js +78 -0
  69. package/dist/prompts/init-prompts.js.map +1 -0
  70. package/dist/prompts/layout-prompts.d.ts +15 -0
  71. package/dist/prompts/layout-prompts.d.ts.map +1 -0
  72. package/dist/prompts/layout-prompts.js +26 -0
  73. package/dist/prompts/layout-prompts.js.map +1 -0
  74. package/package.json +46 -0
@@ -0,0 +1,104 @@
1
+ /**
2
+ * `forge status [runId]` command — show run status and details.
3
+ *
4
+ * Discovers the workspace, opens the RunStore, and queries for run data.
5
+ * Supports listing recent runs, showing run detail, and benchmark views.
6
+ */
7
+ import { Command } from 'commander';
8
+ import { discoverWorkspace, SqliteRunStore, } from '@hstm-labs/forge-common';
9
+ import { globalOptions, printJson } from '../output.js';
10
+ import { handleError } from '../error-handler.js';
11
+ import { formatRunSummaryTable, formatRunDetail, formatBenchmarkSummary, formatBenchmarkDetail, } from '../formatters/run-status-formatter.js';
12
+ import { formatAgentStatusDetail, agentStatusDetailToJson, buildAgentStatusOptions, } from '../formatters/agent-mode-formatter.js';
13
+ /**
14
+ * Create and return the `status` command.
15
+ *
16
+ * @returns Commander command for `forge status`
17
+ */
18
+ export function createStatusCommand() {
19
+ return new Command('status')
20
+ .description('Show run status')
21
+ .argument('[runId]', 'run identifier')
22
+ .option('--benchmark', 'list benchmark runs', false)
23
+ .action(async (runId, opts) => {
24
+ try {
25
+ const workspace = discoverWorkspace();
26
+ const store = new SqliteRunStore(workspace.dbPath);
27
+ store.initialize();
28
+ try {
29
+ // `forge status --benchmark` — list benchmark runs
30
+ if (opts.benchmark) {
31
+ const benchmarkRuns = store.listBenchmarkRuns();
32
+ if (globalOptions.json) {
33
+ printJson({ benchmarkRuns });
34
+ return;
35
+ }
36
+ process.stdout.write(formatBenchmarkSummary(benchmarkRuns) + '\n');
37
+ return;
38
+ }
39
+ // `forge status <runId>` — show run detail
40
+ if (runId !== undefined) {
41
+ const run = store.getRun(runId);
42
+ if (run === undefined) {
43
+ handleError(new Error(`Run '${runId}' not found. Verify the run ID is correct.`));
44
+ }
45
+ const stages = store.getStages(run.id);
46
+ const artifacts = store.getArtifacts(run.id);
47
+ // AWAITING_AGENT — use agent-specific detail format
48
+ if (run.status === 'AWAITING_AGENT') {
49
+ const awaitingStage = stages.find((s) => s.status === 'AWAITING_AGENT');
50
+ if (awaitingStage !== undefined) {
51
+ const totalPipelineStages = 10;
52
+ const agentOptions = buildAgentStatusOptions(run.id, awaitingStage, stages, totalPipelineStages, run.startedAt, workspace.forgeDir);
53
+ if (globalOptions.json) {
54
+ printJson(agentStatusDetailToJson(agentOptions));
55
+ return;
56
+ }
57
+ process.stdout.write(formatAgentStatusDetail(agentOptions) + '\n');
58
+ return;
59
+ }
60
+ }
61
+ if (globalOptions.json) {
62
+ // Include benchmark data if this is a benchmark run
63
+ const benchmarkReport = run.benchmark
64
+ ? store.getBenchmarkReport(run.id)
65
+ : undefined;
66
+ printJson({
67
+ run,
68
+ stages,
69
+ artifacts,
70
+ benchmark: benchmarkReport,
71
+ });
72
+ return;
73
+ }
74
+ // Human-readable detail
75
+ let output = formatRunDetail(run, stages, artifacts);
76
+ // Append benchmark detail if applicable
77
+ if (run.benchmark) {
78
+ const report = store.getBenchmarkReport(run.id);
79
+ if (report !== undefined) {
80
+ output += '\n\n' + formatBenchmarkDetail(report);
81
+ }
82
+ }
83
+ process.stdout.write(output + '\n');
84
+ return;
85
+ }
86
+ // `forge status` — list recent runs
87
+ const runs = store.listRuns();
88
+ const recentRuns = runs.slice(0, 10);
89
+ if (globalOptions.json) {
90
+ printJson({ runs: recentRuns });
91
+ return;
92
+ }
93
+ process.stdout.write(formatRunSummaryTable(recentRuns) + '\n');
94
+ }
95
+ finally {
96
+ store.close();
97
+ }
98
+ }
99
+ catch (error) {
100
+ handleError(error);
101
+ }
102
+ });
103
+ }
104
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,OAAO,C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CAAC;4BACzB,MAAM,IAAI,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;wBACnD,CAAC;oBACH,CAAC;oBAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;oBACpC,OAAO;gBACT,CAAC;gBAED,oCAAoC;gBACpC,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;gBAC9B,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAErC,IAAI,aAAa,CAAC,IAAI,EAAE,CAAC;oBACvB,SAAS,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;oBAChC,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,qBAAqB,CAAC,UAAU,CAAC,GAAG,IAAI,CACzC,CAAC;YACJ,CAAC;oBAAS,CAAC;gBACT,KAAK,CAAC,KAAK,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `forge template <subcommand>` placeholder command with subcommands.
3
+ */
4
+ import { Command } from 'commander';
5
+ /**
6
+ * Create and return the `template` command with `list` subcommand.
7
+ *
8
+ * @returns Commander command for `forge template`
9
+ */
10
+ export declare function createTemplateCommand(): Command;
11
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/commands/template.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAmB/C"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * `forge template <subcommand>` placeholder command with subcommands.
3
+ */
4
+ import { Command } from 'commander';
5
+ import { formatInfo, globalOptions, printJson } from '../output.js';
6
+ /**
7
+ * Create and return the `template` command with `list` subcommand.
8
+ *
9
+ * @returns Commander command for `forge template`
10
+ */
11
+ export function createTemplateCommand() {
12
+ const template = new Command('template').description('Manage code templates');
13
+ template
14
+ .command('list')
15
+ .description('List available templates')
16
+ .action(() => {
17
+ if (globalOptions.json) {
18
+ printJson({ message: 'Not yet implemented', status: 'pending' });
19
+ return;
20
+ }
21
+ process.stdout.write(formatInfo('template list: Not yet implemented') + '\n');
22
+ });
23
+ return template;
24
+ }
25
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/commands/template.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,QAAQ,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,WAAW,CAClD,uBAAuB,CACxB,CAAC;IAEF,QAAQ;SACL,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,0BAA0B,CAAC;SACvC,MAAM,CAAC,GAAG,EAAE;QACX,IAAI,aAAa,CAAC,IAAI,EAAE,CAAC;YACvB,SAAS,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;YACjE,OAAO;QACT,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,UAAU,CAAC,oCAAoC,CAAC,GAAG,IAAI,CACxD,CAAC;IACJ,CAAC,CAAC,CAAC;IAEL,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `forge verify` command — verify compliance of generated output against specification.
3
+ *
4
+ * Runs the compliance verification stage independently on a completed run,
5
+ * or as part of the full pipeline. Produces a compliance report with
6
+ * requirement coverage, gap analysis, and review finding incorporation.
7
+ */
8
+ import { Command } from 'commander';
9
+ /**
10
+ * Create and return the `verify` command.
11
+ *
12
+ * @returns Commander command for `forge verify`
13
+ */
14
+ export declare function createVerifyCommand(): Command;
15
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/commands/verify.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoHpC;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CA+G7C"}
@@ -0,0 +1,167 @@
1
+ /**
2
+ * `forge verify` command — verify compliance of generated output against specification.
3
+ *
4
+ * Runs the compliance verification stage independently on a completed run,
5
+ * or as part of the full pipeline. Produces a compliance report with
6
+ * requirement coverage, gap analysis, and review finding incorporation.
7
+ */
8
+ import { resolve, join } from 'node:path';
9
+ import { readFileSync } from 'node:fs';
10
+ import { Command } from 'commander';
11
+ import { discoverWorkspace, loadConfig, SqliteRunStore, ForgeError, ErrorCodes, } from '@hstm-labs/forge-common';
12
+ import { parseSpec, createDefaultRegistry } from '@hstm-labs/forge-spec-parser';
13
+ import { VerifyStage, formatComplianceReport, complianceReportToJson, } from '@hstm-labs/forge-verifier';
14
+ import { formatInfo, formatSuccess, formatWarning, globalOptions, printJson, } from '../output.js';
15
+ import { handleError } from '../error-handler.js';
16
+ // ---------------------------------------------------------------------------
17
+ // Stage-to-data-key mapping
18
+ // ---------------------------------------------------------------------------
19
+ /** Maps stage names to their `data` sub-key in PipelineStageOutput. */
20
+ const STAGE_DATA_KEYS = {
21
+ architect: 'architecture',
22
+ 'api-generate': 'api',
23
+ 'ui-generate': 'ui',
24
+ 'infra-generate': 'infra',
25
+ 'security-generate': 'security',
26
+ 'seed-data': 'seedData',
27
+ review: 'review',
28
+ };
29
+ // ---------------------------------------------------------------------------
30
+ // Helpers
31
+ // ---------------------------------------------------------------------------
32
+ /**
33
+ * Load stage outputs from disk for a completed run.
34
+ *
35
+ * Reads JSON artifact files from each stage's artifacts directory and
36
+ * reconstructs PipelineStageInput for the verify stage.
37
+ *
38
+ * @param forgeDir - Path to the .forge directory
39
+ * @param store - RunStore for artifact metadata
40
+ * @param runId - Run ID
41
+ * @returns Reconstructed PipelineStageInput
42
+ */
43
+ function loadStageOutputsFromDisk(forgeDir, store, runId) {
44
+ const input = {};
45
+ const allArtifacts = store.getArtifacts(runId);
46
+ // Group artifacts by stage
47
+ const byStage = new Map();
48
+ for (const artifact of allArtifacts) {
49
+ const existing = byStage.get(artifact.stageName);
50
+ if (existing !== undefined) {
51
+ existing.push(artifact.filePath);
52
+ }
53
+ else {
54
+ byStage.set(artifact.stageName, [artifact.filePath]);
55
+ }
56
+ }
57
+ // For each stage with a known data key, try to read the primary JSON artifact
58
+ for (const [stageName, dataKey] of Object.entries(STAGE_DATA_KEYS)) {
59
+ const files = byStage.get(stageName);
60
+ if (files === undefined)
61
+ continue;
62
+ // Find the primary JSON file
63
+ const jsonFile = files.find((f) => f.endsWith('.json'));
64
+ if (jsonFile === undefined)
65
+ continue;
66
+ const fullPath = join(forgeDir, 'runs', runId, 'stages', stageName, 'artifacts', jsonFile);
67
+ try {
68
+ const content = readFileSync(fullPath, 'utf-8');
69
+ const parsed = JSON.parse(content);
70
+ input[stageName] = {
71
+ artifacts: [],
72
+ data: { [dataKey]: parsed },
73
+ };
74
+ }
75
+ catch {
76
+ // If the file can't be read or parsed, skip this stage
77
+ }
78
+ }
79
+ return input;
80
+ }
81
+ // ---------------------------------------------------------------------------
82
+ // Command
83
+ // ---------------------------------------------------------------------------
84
+ /** Default compliance score threshold for pass/fail determination. */
85
+ const DEFAULT_THRESHOLD = 80;
86
+ /**
87
+ * Create and return the `verify` command.
88
+ *
89
+ * @returns Commander command for `forge verify`
90
+ */
91
+ export function createVerifyCommand() {
92
+ return new Command('verify')
93
+ .description('Verify compliance of generated output against specification')
94
+ .option('--run <runId>', 'Run ID to verify (defaults to latest completed run)')
95
+ .action(async (opts) => {
96
+ try {
97
+ // 1. Discover workspace and load config
98
+ const workspace = discoverWorkspace();
99
+ const config = loadConfig(workspace.configPath);
100
+ // 2. Initialize RunStore
101
+ const store = new SqliteRunStore(workspace.dbPath);
102
+ store.initialize();
103
+ try {
104
+ // 3. Find the target run
105
+ const run = opts.run !== undefined
106
+ ? store.getRun(opts.run)
107
+ : store.getLatestRun();
108
+ if (run === undefined) {
109
+ throw new ForgeError(ErrorCodes.PIPE.STAGE_FAILURE, opts.run !== undefined
110
+ ? `Run '${opts.run}' not found. Verify the run ID is correct.`
111
+ : 'No completed runs found. Run `forge generate` first.');
112
+ }
113
+ if (!globalOptions.quiet && !globalOptions.json) {
114
+ process.stdout.write(formatInfo(`Verifying compliance for run ${run.id}...`) + '\n');
115
+ }
116
+ // 4. Load stage outputs from disk
117
+ const stageInput = loadStageOutputsFromDisk(workspace.forgeDir, store, run.id);
118
+ // 5. Parse the specification
119
+ const specPath = resolve(workspace.rootDir, config.specPath);
120
+ const registry = createDefaultRegistry();
121
+ const parsedSpec = parseSpec(specPath, registry);
122
+ // Set validate stage data with parsedSpec
123
+ stageInput['validate'] = {
124
+ artifacts: [],
125
+ data: { parsedSpec },
126
+ };
127
+ // 6. Execute VerifyStage
128
+ const verifyStage = new VerifyStage();
129
+ const context = {
130
+ runId: run.id,
131
+ workspace,
132
+ config,
133
+ mode: 'api',
134
+ benchmark: false,
135
+ store,
136
+ };
137
+ const output = await verifyStage.execute(stageInput, context);
138
+ const report = output.data?.['compliance'];
139
+ // 7. Display the compliance report
140
+ if (globalOptions.json) {
141
+ printJson(complianceReportToJson(report));
142
+ }
143
+ else if (!globalOptions.quiet) {
144
+ process.stdout.write(formatComplianceReport(report) + '\n');
145
+ // Score status line
146
+ if (report.score >= DEFAULT_THRESHOLD) {
147
+ process.stdout.write(formatSuccess(`Compliance score ${String(report.score)}% meets threshold (${String(DEFAULT_THRESHOLD)}%)`) + '\n');
148
+ }
149
+ else {
150
+ process.stdout.write(formatWarning(`Compliance score ${String(report.score)}% is below threshold (${String(DEFAULT_THRESHOLD)}%)`) + '\n');
151
+ }
152
+ }
153
+ // 8. Exit code: 0 if score >= threshold, 1 if below
154
+ if (report.score < DEFAULT_THRESHOLD) {
155
+ process.exit(1);
156
+ }
157
+ }
158
+ finally {
159
+ store.close();
160
+ }
161
+ }
162
+ catch (error) {
163
+ handleError(error);
164
+ }
165
+ });
166
+ }
167
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/commands/verify.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,UAAU,EACV,UAAU,GACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,UAAU,EACV,aAAa,EACb,aAAa,EACb,aAAa,EACb,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,8EAA8E;AAC9E,4BAA4B;AAC5B,8EAA8E;AAE9E,uEAAuE;AACvE,MAAM,eAAe,GAA2B;IAC9C,SAAS,EAAE,cAAc;IACzB,cAAc,EAAE,KAAK;IACrB,aAAa,EAAE,IAAI;IACnB,gBAAgB,EAAE,OAAO;IACzB,mB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and formats them
5
+ * appropriately based on error type and output mode.
6
+ */
7
+ /**
8
+ * Handle a CLI command error.
9
+ *
10
+ * - `ForgeError`: prints code + message (includes remediation), exits 1
11
+ * - Unknown error: prints generic message, suggests `--verbose`, exits 2
12
+ *
13
+ * @param error - The error to handle
14
+ */
15
+ export declare function handleError(error: unknown): never;
16
+ //# sourceMappingURL=error-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../src/error-handler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAyBjD"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Global error handler for the Forge CLI.
3
+ *
4
+ * Catches unhandled errors from commands and formats them
5
+ * appropriately based on error type and output mode.
6
+ */
7
+ import { ForgeError } from '@hstm-labs/forge-common';
8
+ import { formatError, globalOptions, printJson } from './output.js';
9
+ /**
10
+ * Handle a CLI command error.
11
+ *
12
+ * - `ForgeError`: prints code + message (includes remediation), exits 1
13
+ * - Unknown error: prints generic message, suggests `--verbose`, exits 2
14
+ *
15
+ * @param error - The error to handle
16
+ */
17
+ export function handleError(error) {
18
+ if (error instanceof ForgeError) {
19
+ if (globalOptions.json) {
20
+ printJson({ error: { code: error.code, message: error.message } });
21
+ }
22
+ else {
23
+ process.stderr.write(formatError(`[${error.code}] ${error.message}`) + '\n');
24
+ }
25
+ process.exit(1);
26
+ }
27
+ // Unknown error
28
+ const message = error instanceof Error ? error.message : 'An unexpected error occurred';
29
+ if (globalOptions.json) {
30
+ printJson({ error: { code: 'UNKNOWN', message } });
31
+ }
32
+ else {
33
+ process.stderr.write(formatError(message) + '\n');
34
+ if (!globalOptions.verbose) {
35
+ process.stderr.write('Run with --verbose for more details.\n');
36
+ }
37
+ else if (error instanceof Error && error.stack) {
38
+ process.stderr.write(error.stack + '\n');
39
+ }
40
+ }
41
+ process.exit(2);
42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wCAAwC,CAAC,CAAC;QACjE,CAAC;aAAM,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YACjD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Agent mode formatting helpers for the Forge CLI.
3
+ *
4
+ * Provides box-style and line-style formatters for agent mode workflow steps:
5
+ * prompt export, continue success, continue failure, and status detail.
6
+ * Each formatter has a human-readable and a JSON-serializable variant.
7
+ */
8
+ import type { StageName, PipelineStageRecord } from '@hstm-labs/forge-common';
9
+ /** Options for the agent prompt export formatter. */
10
+ export interface AgentPromptExportOptions {
11
+ /** Stage name that was exported. */
12
+ stageName: StageName;
13
+ /** Run identifier. */
14
+ runId: string;
15
+ /** Path to the exported prompt file. */
16
+ promptPath: string;
17
+ }
18
+ /** Options for the agent continue success formatter. */
19
+ export interface AgentContinueSuccessOptions {
20
+ /** Stage that was validated. */
21
+ stageName: StageName;
22
+ /** Number of artifacts found. */
23
+ artifactCount: number;
24
+ /** Next stage name (undefined if pipeline is complete). */
25
+ nextStageName?: StageName | undefined;
26
+ /** Run identifier. */
27
+ runId: string;
28
+ }
29
+ /** Options for the agent continue failure formatter. */
30
+ export interface AgentContinueFailureOptions {
31
+ /** Stage that failed validation. */
32
+ stageName: StageName;
33
+ /** Validation error messages. */
34
+ errors: string[];
35
+ /** Follow-up prompt path. */
36
+ followUpPromptPath?: string | undefined;
37
+ /** Run identifier. */
38
+ runId: string;
39
+ }
40
+ /** Options for the agent status detail formatter. */
41
+ export interface AgentStatusDetailOptions {
42
+ /** Run identifier. */
43
+ runId: string;
44
+ /** Stage that is awaiting agent. */
45
+ awaitingStageName: StageName;
46
+ /** 1-based index of the awaiting stage. */
47
+ stageIndex: number;
48
+ /** Total number of stages in the pipeline. */
49
+ totalStages: number;
50
+ /** Prompt path for the awaiting stage. */
51
+ promptPath: string;
52
+ /** When the run started. */
53
+ startedAt: string;
54
+ /** Completed stages with name and duration. */
55
+ completedStages: Array<{
56
+ name: StageName;
57
+ durationMs?: number | undefined;
58
+ }>;
59
+ }
60
+ /**
61
+ * Format the agent prompt export box shown after initial prompt export.
62
+ *
63
+ * @param options - Export details
64
+ * @returns Formatted box string
65
+ */
66
+ export declare function formatAgentPromptExport(options: AgentPromptExportOptions): string;
67
+ /**
68
+ * Format the successful continue validation message.
69
+ *
70
+ * @param options - Continue success details
71
+ * @returns Formatted string
72
+ */
73
+ export declare function formatAgentContinueSuccess(options: AgentContinueSuccessOptions): string;
74
+ /**
75
+ * Format the failed continue validation message.
76
+ *
77
+ * @param options - Continue failure details
78
+ * @returns Formatted string
79
+ */
80
+ export declare function formatAgentContinueFailure(options: AgentContinueFailureOptions): string;
81
+ /**
82
+ * Format the AWAITING_AGENT status detail for `forge status`.
83
+ *
84
+ * @param options - Status detail options
85
+ * @returns Formatted string
86
+ */
87
+ export declare function formatAgentStatusDetail(options: AgentStatusDetailOptions): string;
88
+ /** JSON structure for agent prompt export. */
89
+ export interface AgentPromptExportJson {
90
+ type: 'agent-prompt-export';
91
+ stageName: StageName;
92
+ runId: string;
93
+ promptPath: string;
94
+ }
95
+ /** JSON structure for agent continue success. */
96
+ export interface AgentContinueSuccessJson {
97
+ type: 'agent-continue-success';
98
+ stageName: StageName;
99
+ runId: string;
100
+ artifactCount: number;
101
+ nextStageName?: StageName | undefined;
102
+ pipelineComplete: boolean;
103
+ }
104
+ /** JSON structure for agent continue failure. */
105
+ export interface AgentContinueFailureJson {
106
+ type: 'agent-continue-failure';
107
+ stageName: StageName;
108
+ runId: string;
109
+ errors: string[];
110
+ followUpPromptPath?: string | undefined;
111
+ }
112
+ /** JSON structure for agent status detail. */
113
+ export interface AgentStatusDetailJson {
114
+ type: 'agent-status-detail';
115
+ runId: string;
116
+ status: 'AWAITING_AGENT';
117
+ awaitingStageName: StageName;
118
+ stageIndex: number;
119
+ totalStages: number;
120
+ promptPath: string;
121
+ startedAt: string;
122
+ completedStages: Array<{
123
+ name: StageName;
124
+ durationMs?: number | undefined;
125
+ }>;
126
+ }
127
+ /**
128
+ * Build a JSON-serializable object for the agent prompt export.
129
+ *
130
+ * @param options - Export details
131
+ * @returns JSON-serializable object
132
+ */
133
+ export declare function agentPromptExportToJson(options: AgentPromptExportOptions): AgentPromptExportJson;
134
+ /**
135
+ * Build a JSON-serializable object for agent continue success.
136
+ *
137
+ * @param options - Continue success details
138
+ * @returns JSON-serializable object
139
+ */
140
+ export declare function agentContinueSuccessToJson(options: AgentContinueSuccessOptions): AgentContinueSuccessJson;
141
+ /**
142
+ * Build a JSON-serializable object for agent continue failure.
143
+ *
144
+ * @param options - Continue failure details
145
+ * @returns JSON-serializable object
146
+ */
147
+ export declare function agentContinueFailureToJson(options: AgentContinueFailureOptions): AgentContinueFailureJson;
148
+ /**
149
+ * Build a JSON-serializable object for agent status detail.
150
+ *
151
+ * @param options - Status detail options
152
+ * @returns JSON-serializable object
153
+ */
154
+ export declare function agentStatusDetailToJson(options: AgentStatusDetailOptions): AgentStatusDetailJson;
155
+ /**
156
+ * Build {@link AgentStatusDetailOptions} from run store data.
157
+ *
158
+ * @param runId - Run identifier
159
+ * @param awaitingStage - The stage record that is AWAITING_AGENT
160
+ * @param allStages - All stage records for the run
161
+ * @param totalPipelineStages - Total stages in the pipeline
162
+ * @param startedAt - Run start time
163
+ * @param forgeDir - Path to .forge directory (for prompt path construction)
164
+ * @returns Options for formatAgentStatusDetail
165
+ */
166
+ export declare function buildAgentStatusOptions(runId: string, awaitingStage: PipelineStageRecord, allStages: PipelineStageRecord[], totalPipelineStages: number, startedAt: string, forgeDir: string): AgentStatusDetailOptions;
167
+ //# sourceMappingURL=agent-mode-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-mode-formatter.d.ts","sourceRoot":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