@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.
- package/README.md +56 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/deliver.d.ts +14 -0
- package/dist/commands/deliver.d.ts.map +1 -0
- package/dist/commands/deliver.js +92 -0
- package/dist/commands/deliver.js.map +1 -0
- package/dist/commands/generate.d.ts +14 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +168 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/init.d.ts +15 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +83 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/profile.d.ts +11 -0
- package/dist/commands/profile.d.ts.map +1 -0
- package/dist/commands/profile.js +35 -0
- package/dist/commands/profile.js.map +1 -0
- package/dist/commands/status.d.ts +14 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +104 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/template.d.ts +11 -0
- package/dist/commands/template.d.ts.map +1 -0
- package/dist/commands/template.js +25 -0
- package/dist/commands/template.js.map +1 -0
- package/dist/commands/verify.d.ts +15 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +167 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/error-handler.d.ts +16 -0
- package/dist/error-handler.d.ts.map +1 -0
- package/dist/error-handler.js +43 -0
- package/dist/error-handler.js.map +1 -0
- package/dist/formatters/agent-mode-formatter.d.ts +167 -0
- package/dist/formatters/agent-mode-formatter.d.ts.map +1 -0
- package/dist/formatters/agent-mode-formatter.js +271 -0
- package/dist/formatters/agent-mode-formatter.js.map +1 -0
- package/dist/formatters/run-status-formatter.d.ts +53 -0
- package/dist/formatters/run-status-formatter.d.ts.map +1 -0
- package/dist/formatters/run-status-formatter.js +267 -0
- package/dist/formatters/run-status-formatter.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +60 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +78 -0
- package/dist/output.js.map +1 -0
- package/dist/program.d.ts +14 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +64 -0
- package/dist/program.js.map +1 -0
- package/dist/progress-bar.d.ts +18 -0
- package/dist/progress-bar.d.ts.map +1 -0
- package/dist/progress-bar.js +28 -0
- package/dist/progress-bar.js.map +1 -0
- package/dist/progress-reporter.d.ts +35 -0
- package/dist/progress-reporter.d.ts.map +1 -0
- package/dist/progress-reporter.js +236 -0
- package/dist/progress-reporter.js.map +1 -0
- package/dist/prompts/init-prompts.d.ts +22 -0
- package/dist/prompts/init-prompts.d.ts.map +1 -0
- package/dist/prompts/init-prompts.js +78 -0
- package/dist/prompts/init-prompts.js.map +1 -0
- package/dist/prompts/layout-prompts.d.ts +15 -0
- package/dist/prompts/layout-prompts.d.ts.map +1 -0
- package/dist/prompts/layout-prompts.js +26 -0
- package/dist/prompts/layout-prompts.js.map +1 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @hstm-labs/forge-cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for Forge — built with Commander.js, providing interactive workspace initialization, pipeline execution, compliance verification, output delivery, and run status reporting.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @hstm-labs/forge-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Commands
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
forge init [name] # Initialize a new Forge workspace
|
|
15
|
+
forge generate # Run the generation pipeline
|
|
16
|
+
forge verify # Verify compliance against specification
|
|
17
|
+
forge deliver # Package and deliver output
|
|
18
|
+
forge status [runId] # Show run status and benchmarks
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Global Options
|
|
22
|
+
|
|
23
|
+
- `--json` — machine-readable JSON output
|
|
24
|
+
- `--quiet` — suppress non-essential output
|
|
25
|
+
- `--verbose` — enable debug logging
|
|
26
|
+
- `--no-color` — disable terminal colors
|
|
27
|
+
- `--no-input` — disable interactive prompts (CI mode)
|
|
28
|
+
|
|
29
|
+
### Generate Options
|
|
30
|
+
|
|
31
|
+
- `--mode=api|agent` — execution mode
|
|
32
|
+
- `--stage=<name>` — run a specific stage only
|
|
33
|
+
- `--continue` — resume an AWAITING_AGENT run
|
|
34
|
+
- `--resume` — resume a failed run
|
|
35
|
+
- `--benchmark` — enable performance benchmarking
|
|
36
|
+
|
|
37
|
+
## Public API
|
|
38
|
+
|
|
39
|
+
- `createProgram()` — create the Commander.js program instance
|
|
40
|
+
- `formatSuccess()`, `formatError()`, `formatWarning()`, `formatInfo()` — styled output helpers
|
|
41
|
+
- `printJson()` — JSON output for `--json` mode
|
|
42
|
+
- `handleError()` — structured error handler
|
|
43
|
+
- `GlobalOptions` — global option types
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { createProgram } from '@hstm-labs/forge-cli';
|
|
49
|
+
|
|
50
|
+
const program = createProgram();
|
|
51
|
+
await program.parseAsync(process.argv);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
[MIT](../../LICENSE)
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Forge CLI entry point.
|
|
4
|
+
*
|
|
5
|
+
* This file is the `bin` target — it creates the program and parses
|
|
6
|
+
* `process.argv`. Import `createProgram` from `./program.js` for testing.
|
|
7
|
+
*/
|
|
8
|
+
import { createProgram } from './program.js';
|
|
9
|
+
import { handleError } from './error-handler.js';
|
|
10
|
+
const program = createProgram();
|
|
11
|
+
program.parseAsync(process.argv).catch((error) => {
|
|
12
|
+
handleError(error);
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;AAEhC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxD,WAAW,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `forge deliver` command — package and deliver generated output.
|
|
3
|
+
*
|
|
4
|
+
* Discovers the workspace, loads config, finds the target run,
|
|
5
|
+
* and executes the delivery pipeline (merge, validate, archive, deliver).
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
/**
|
|
9
|
+
* Create and return the `deliver` command.
|
|
10
|
+
*
|
|
11
|
+
* @returns Commander command for `forge deliver`
|
|
12
|
+
*/
|
|
13
|
+
export declare function createDeliverCommand(): Command;
|
|
14
|
+
//# sourceMappingURL=deliver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliver.d.ts","sourceRoot":"","sources":["../../src/commands/deliver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0BpC;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAmG9C"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `forge deliver` command — package and deliver generated output.
|
|
3
|
+
*
|
|
4
|
+
* Discovers the workspace, loads config, finds the target run,
|
|
5
|
+
* and executes the delivery pipeline (merge, validate, archive, deliver).
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
import { discoverWorkspace, loadConfig, SqliteRunStore, ForgeError, ErrorCodes, } from '@hstm-labs/forge-common';
|
|
9
|
+
import { DeliverStage, formatDeliveryResult, deliveryResultToJson, } from '@hstm-labs/forge-deliverer';
|
|
10
|
+
import { formatInfo, globalOptions, printJson, } from '../output.js';
|
|
11
|
+
import { handleError } from '../error-handler.js';
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Command
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
/**
|
|
16
|
+
* Create and return the `deliver` command.
|
|
17
|
+
*
|
|
18
|
+
* @returns Commander command for `forge deliver`
|
|
19
|
+
*/
|
|
20
|
+
export function createDeliverCommand() {
|
|
21
|
+
return new Command('deliver')
|
|
22
|
+
.description('Package and deliver generated output')
|
|
23
|
+
.option('--run <runId>', 'Run ID to deliver (defaults to latest verified run)')
|
|
24
|
+
.option('--target <path>', 'Target delivery directory')
|
|
25
|
+
.option('--skip-verify', 'Skip verification check', false)
|
|
26
|
+
.option('--no-archive', 'Skip archive creation')
|
|
27
|
+
.option('--format <format>', 'Archive format: tgz or zip', 'tgz')
|
|
28
|
+
.action(async (opts) => {
|
|
29
|
+
try {
|
|
30
|
+
// 1. Discover workspace and load config
|
|
31
|
+
const workspace = discoverWorkspace();
|
|
32
|
+
const config = loadConfig(workspace.configPath);
|
|
33
|
+
// 2. Initialize RunStore
|
|
34
|
+
const store = new SqliteRunStore(workspace.dbPath);
|
|
35
|
+
store.initialize();
|
|
36
|
+
try {
|
|
37
|
+
// 3. Find the target run
|
|
38
|
+
const run = opts.run !== undefined
|
|
39
|
+
? store.getRun(opts.run)
|
|
40
|
+
: store.getLatestRun();
|
|
41
|
+
if (run === undefined) {
|
|
42
|
+
throw new ForgeError(ErrorCodes.PIPE.STAGE_FAILURE, opts.run !== undefined
|
|
43
|
+
? `Run '${opts.run}' not found. Verify the run ID is correct.`
|
|
44
|
+
: 'No completed runs found. Run `forge generate` first.');
|
|
45
|
+
}
|
|
46
|
+
// 4. Verify run status
|
|
47
|
+
const validStatuses = opts.skipVerify
|
|
48
|
+
? ['GENERATED', 'VERIFIED', 'DELIVERED']
|
|
49
|
+
: ['VERIFIED', 'DELIVERED'];
|
|
50
|
+
if (!validStatuses.includes(run.status)) {
|
|
51
|
+
throw new ForgeError(ErrorCodes.PIPE.STAGE_FAILURE, `Run '${run.id}' has status '${run.status}'. ` +
|
|
52
|
+
(opts.skipVerify
|
|
53
|
+
? "Expected at least 'GENERATED'. Run `forge generate` first."
|
|
54
|
+
: "Expected 'VERIFIED'. Run `forge generate` with verification or use --skip-verify."));
|
|
55
|
+
}
|
|
56
|
+
if (!globalOptions.quiet && !globalOptions.json) {
|
|
57
|
+
process.stdout.write(formatInfo(`Delivering run ${run.id}...`) + '\n');
|
|
58
|
+
}
|
|
59
|
+
// 5. Build config with optional target override
|
|
60
|
+
const deliveryConfig = opts.target !== undefined
|
|
61
|
+
? { ...config, deliveryTarget: opts.target }
|
|
62
|
+
: config;
|
|
63
|
+
// 6. Execute DeliverStage
|
|
64
|
+
const deliverStage = new DeliverStage();
|
|
65
|
+
const context = {
|
|
66
|
+
runId: run.id,
|
|
67
|
+
workspace,
|
|
68
|
+
config: deliveryConfig,
|
|
69
|
+
mode: 'api',
|
|
70
|
+
benchmark: false,
|
|
71
|
+
store,
|
|
72
|
+
};
|
|
73
|
+
const output = await deliverStage.execute({}, context);
|
|
74
|
+
const result = output.data?.['delivery'];
|
|
75
|
+
// 7. Display result
|
|
76
|
+
if (globalOptions.json) {
|
|
77
|
+
printJson(deliveryResultToJson(result));
|
|
78
|
+
}
|
|
79
|
+
else if (!globalOptions.quiet) {
|
|
80
|
+
process.stdout.write(formatDeliveryResult(result) + '\n');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
store.close();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
handleError(error);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=deliver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliver.js","sourceRoot":"","sources":["../../src/commands/deliver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,UAAU,EACV,UAAU,GACX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,UAAU,EACV,aAAa,EACb,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC;SAC1B,WAAW,CAAC,sCAAsC,CAAC;SACnD,MAAM,CAAC,eAAe,EAAE,qDAAqD,CAAC;SAC9E,MAAM,CAAC,iBAAiB,EAAE,2BAA2B,CAAC;SACtD,MAAM,CAAC,eAAe,EAAE,yBAAyB,EAAE,KAAK,CAAC;SACzD,MAAM,CAAC,cAAc,EAAE,uBAAuB,CAAC;SAC/C,MAAM,CAAC,mBAA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,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `forge generate` command — run the Forge generation pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Discovers the workspace, loads config, initializes the pipeline runner
|
|
5
|
+
* with registered stages, and executes the pipeline with the given options.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
/**
|
|
9
|
+
* Create and return the `generate` command.
|
|
10
|
+
*
|
|
11
|
+
* @returns Commander command for `forge generate`
|
|
12
|
+
*/
|
|
13
|
+
export declare function createGenerateCommand(): Command;
|
|
14
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwCpC;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CA4L/C"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `forge generate` command — run the Forge generation pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Discovers the workspace, loads config, initializes the pipeline runner
|
|
5
|
+
* with registered stages, and executes the pipeline with the given options.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
import { writeFileSync } from 'node:fs';
|
|
9
|
+
import { discoverWorkspace, loadConfig, SqliteRunStore, } from '@hstm-labs/forge-common';
|
|
10
|
+
import { PipelineRunner, ValidateStage, LayoutStage, } from '@hstm-labs/forge-core';
|
|
11
|
+
import { ScaffoldStage } from '@hstm-labs/forge-scaffold';
|
|
12
|
+
import { promptForLayout } from '../prompts/layout-prompts.js';
|
|
13
|
+
import { ArchitectStage } from '@hstm-labs/forge-architect';
|
|
14
|
+
import { ServicesGenerateStage } from '@hstm-labs/forge-services-generator';
|
|
15
|
+
import { AppsGenerateStage } from '@hstm-labs/forge-apps-generator';
|
|
16
|
+
import { InfraGenerateStage } from '@hstm-labs/forge-infra-generator';
|
|
17
|
+
import { SecurityGenerateStage } from '@hstm-labs/forge-security-generator';
|
|
18
|
+
import { SeedDataStage } from '@hstm-labs/forge-seed-data';
|
|
19
|
+
import { ReviewStage } from '@hstm-labs/forge-reviewer';
|
|
20
|
+
import { VerifyStage, TestGenerateStage } from '@hstm-labs/forge-verifier';
|
|
21
|
+
import { DeliverStage } from '@hstm-labs/forge-deliverer';
|
|
22
|
+
import { RunVerifyStage } from '@hstm-labs/forge-run';
|
|
23
|
+
import { formatInfo, globalOptions, printJson, } from '../output.js';
|
|
24
|
+
import { handleError } from '../error-handler.js';
|
|
25
|
+
import { createProgressListener } from '../progress-reporter.js';
|
|
26
|
+
import { formatAgentContinueSuccess, formatAgentContinueFailure, agentContinueSuccessToJson, agentContinueFailureToJson, } from '../formatters/agent-mode-formatter.js';
|
|
27
|
+
/**
|
|
28
|
+
* Create and return the `generate` command.
|
|
29
|
+
*
|
|
30
|
+
* @returns Commander command for `forge generate`
|
|
31
|
+
*/
|
|
32
|
+
export function createGenerateCommand() {
|
|
33
|
+
return new Command('generate')
|
|
34
|
+
.description('Run the generation pipeline')
|
|
35
|
+
.option('-m, --mode <mode>', 'execution mode: api or agent')
|
|
36
|
+
.option('--benchmark', 'enable benchmark timing', false)
|
|
37
|
+
.option('-s, --stage <name>', 'run up to and including this stage')
|
|
38
|
+
.option('--continue', 'continue an AWAITING_AGENT run', false)
|
|
39
|
+
.option('--resume [runId]', 'resume a failed run (optionally by run ID)')
|
|
40
|
+
.action(async (opts) => {
|
|
41
|
+
try {
|
|
42
|
+
// 1. Discover workspace and load config
|
|
43
|
+
const workspace = discoverWorkspace();
|
|
44
|
+
const config = loadConfig(workspace.configPath);
|
|
45
|
+
// 2. Initialize RunStore
|
|
46
|
+
const store = new SqliteRunStore(workspace.dbPath);
|
|
47
|
+
store.initialize();
|
|
48
|
+
try {
|
|
49
|
+
// 3. Register pipeline stages
|
|
50
|
+
const stages = [
|
|
51
|
+
new ValidateStage(),
|
|
52
|
+
new LayoutStage(),
|
|
53
|
+
new ArchitectStage(),
|
|
54
|
+
new ScaffoldStage(),
|
|
55
|
+
new ServicesGenerateStage(),
|
|
56
|
+
new AppsGenerateStage(),
|
|
57
|
+
new InfraGenerateStage(),
|
|
58
|
+
new SecurityGenerateStage(),
|
|
59
|
+
new SeedDataStage(),
|
|
60
|
+
new ReviewStage(),
|
|
61
|
+
new TestGenerateStage(),
|
|
62
|
+
new VerifyStage(),
|
|
63
|
+
new DeliverStage(),
|
|
64
|
+
new RunVerifyStage(),
|
|
65
|
+
];
|
|
66
|
+
// 4. Resolve execution mode
|
|
67
|
+
const mode = (opts.mode ?? 'api');
|
|
68
|
+
// 5. In API mode, resolve LLM adapter from config
|
|
69
|
+
// TODO: Wire LLM adapter resolution when generation stages are added (Task 5.x).
|
|
70
|
+
// For now, only ValidateStage is registered, which does not require an LLM.
|
|
71
|
+
let adapter;
|
|
72
|
+
// 6. Create progress listener
|
|
73
|
+
const progressListener = createProgressListener({
|
|
74
|
+
benchmark: opts.benchmark,
|
|
75
|
+
store,
|
|
76
|
+
});
|
|
77
|
+
// 7. Layout callbacks: prompt when interactive, persist selection to config
|
|
78
|
+
const promptLayout = globalOptions.noInput
|
|
79
|
+
? undefined
|
|
80
|
+
: async (layouts) => promptForLayout(layouts);
|
|
81
|
+
const onConfigUpdate = (updates) => {
|
|
82
|
+
const current = loadConfig(workspace.configPath);
|
|
83
|
+
const next = { ...current, ...updates };
|
|
84
|
+
writeFileSync(workspace.configPath, JSON.stringify(next, null, 2), 'utf-8');
|
|
85
|
+
};
|
|
86
|
+
// 8. Create pipeline runner
|
|
87
|
+
const runner = new PipelineRunner({
|
|
88
|
+
store,
|
|
89
|
+
workspace,
|
|
90
|
+
config,
|
|
91
|
+
stages,
|
|
92
|
+
adapter,
|
|
93
|
+
progressListener,
|
|
94
|
+
promptLayout,
|
|
95
|
+
onConfigUpdate,
|
|
96
|
+
});
|
|
97
|
+
// 9. Build runner options
|
|
98
|
+
const runnerOptions = {
|
|
99
|
+
mode,
|
|
100
|
+
benchmark: opts.benchmark,
|
|
101
|
+
stage: opts.stage,
|
|
102
|
+
continueRun: opts.continue,
|
|
103
|
+
resumeRunId: opts.resume === true ? undefined : opts.resume,
|
|
104
|
+
};
|
|
105
|
+
// 10. Print resume pre-flight message
|
|
106
|
+
if (opts.resume !== undefined && !globalOptions.quiet && !globalOptions.json) {
|
|
107
|
+
const completedStages = store.getStages(typeof opts.resume === 'string' ? opts.resume : '').filter((s) => s.status === 'COMPLETED');
|
|
108
|
+
process.stdout.write(formatInfo(`Verifying artifact integrity for ${String(completedStages.length)} completed stage(s)...`) + '\n');
|
|
109
|
+
}
|
|
110
|
+
// 11. Run the pipeline (progress listener handles stage output)
|
|
111
|
+
const run = await runner.run(runnerOptions);
|
|
112
|
+
// 12. Display --continue result feedback
|
|
113
|
+
if (opts.continue) {
|
|
114
|
+
const continueResult = runner.getLastContinueResult();
|
|
115
|
+
if (continueResult !== undefined) {
|
|
116
|
+
if (globalOptions.json) {
|
|
117
|
+
if (continueResult.validationPassed) {
|
|
118
|
+
printJson(agentContinueSuccessToJson({
|
|
119
|
+
stageName: continueResult.validatedStageName,
|
|
120
|
+
runId: run.id,
|
|
121
|
+
artifactCount: continueResult.artifactCount,
|
|
122
|
+
nextStageName: continueResult.nextStageName,
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
printJson(agentContinueFailureToJson({
|
|
127
|
+
stageName: continueResult.validatedStageName,
|
|
128
|
+
runId: run.id,
|
|
129
|
+
errors: continueResult.validationErrors ?? [],
|
|
130
|
+
followUpPromptPath: continueResult.followUpPromptPath,
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else if (!globalOptions.quiet) {
|
|
135
|
+
if (continueResult.validationPassed) {
|
|
136
|
+
process.stdout.write(formatAgentContinueSuccess({
|
|
137
|
+
stageName: continueResult.validatedStageName,
|
|
138
|
+
runId: run.id,
|
|
139
|
+
artifactCount: continueResult.artifactCount,
|
|
140
|
+
nextStageName: continueResult.nextStageName,
|
|
141
|
+
}) + '\n');
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
process.stdout.write(formatAgentContinueFailure({
|
|
145
|
+
stageName: continueResult.validatedStageName,
|
|
146
|
+
runId: run.id,
|
|
147
|
+
errors: continueResult.validationErrors ?? [],
|
|
148
|
+
followUpPromptPath: continueResult.followUpPromptPath,
|
|
149
|
+
}) + '\n');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// 13. Print resume success message
|
|
155
|
+
if (opts.resume !== undefined && !globalOptions.quiet && !globalOptions.json) {
|
|
156
|
+
process.stdout.write(formatInfo(`Artifact integrity verified. Resumed run ${run.id}.`) + '\n');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
finally {
|
|
160
|
+
store.close();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
handleError(error);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,cAAc,EACd,aAAa,EACb,WAAW,GACZ,MAAM,uBAAuB,CAAC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aAAa;oCAC3C,aAAa,EAAE,cAAc,CAAC,aAAa;iCAC5C,CAAC,GAAG,IAAI,CACV,CAAC;4BACJ,CAAC;iCAAM,CAAC;gCACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,0BAA0B,CAAC;oCACzB,SAAS,EAAE,cAAc,CAAC,kBAAkB;oCAC5C,KAAK,EAAE,GAAG,CAAC,EAAE;oCACb,MAAM,EAAE,cAAc,CAAC,gBAAgB,IAAI,EAAE;oCAC7C,kBAAkB,EAAE,cAAc,CAAC,kBAAkB;iCACtD,CAAC,GAAG,IAAI,CACV,CAAC;4BACJ,CAAC;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC;gBAED,mCAAmC;gBACnC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;oBAC7E,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,UAAU,CACR,4CAA4C,GAAG,CAAC,EAAE,GAAG,CACtD,GAAG,IAAI,CACT,CAAC;gBACJ,CAAC;YACH,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,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `forge init [path]` command — initialize a Forge workspace.
|
|
3
|
+
*
|
|
4
|
+
* Delegates to `initWorkspace()` from `@hstm-labs/forge-core` and
|
|
5
|
+
* formats the result for terminal or JSON output. Supports interactive
|
|
6
|
+
* prompts when required parameters are missing (unless `--no-input`).
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
/**
|
|
10
|
+
* Create and return the `init` command.
|
|
11
|
+
*
|
|
12
|
+
* @returns Commander command for `forge init`
|
|
13
|
+
*/
|
|
14
|
+
export declare function createInitCommand(): Command;
|
|
15
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAgF3C"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `forge init [path]` command — initialize a Forge workspace.
|
|
3
|
+
*
|
|
4
|
+
* Delegates to `initWorkspace()` from `@hstm-labs/forge-core` and
|
|
5
|
+
* formats the result for terminal or JSON output. Supports interactive
|
|
6
|
+
* prompts when required parameters are missing (unless `--no-input`).
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
import { initWorkspace } from '@hstm-labs/forge-core';
|
|
10
|
+
import { listProfiles } from '@hstm-labs/forge-profiles';
|
|
11
|
+
import { formatSuccess, globalOptions, printJson, } from '../output.js';
|
|
12
|
+
import { handleError } from '../error-handler.js';
|
|
13
|
+
import { promptForInit } from '../prompts/init-prompts.js';
|
|
14
|
+
/**
|
|
15
|
+
* Create and return the `init` command.
|
|
16
|
+
*
|
|
17
|
+
* @returns Commander command for `forge init`
|
|
18
|
+
*/
|
|
19
|
+
export function createInitCommand() {
|
|
20
|
+
return new Command('init')
|
|
21
|
+
.description('Initialize a new Forge workspace')
|
|
22
|
+
.argument('[path]', 'target directory (defaults to current directory)')
|
|
23
|
+
.option('-n, --name <name>', 'project name')
|
|
24
|
+
.option('-f, --force', 'overwrite existing workspace', false)
|
|
25
|
+
.option('-p, --profile <name>', 'technology profile name', 'node-react-postgres')
|
|
26
|
+
.action(async (path, opts) => {
|
|
27
|
+
try {
|
|
28
|
+
let resolvedPath = path;
|
|
29
|
+
let resolvedProfile = opts.profile;
|
|
30
|
+
// Interactive prompts when --name is not provided (gating parameter)
|
|
31
|
+
const needsPrompt = opts.name === undefined;
|
|
32
|
+
if (needsPrompt && !globalOptions.noInput) {
|
|
33
|
+
const availableProfiles = listProfiles();
|
|
34
|
+
const defaults = {
|
|
35
|
+
profile: opts.profile,
|
|
36
|
+
};
|
|
37
|
+
if (path !== undefined)
|
|
38
|
+
defaults.outputPath = path;
|
|
39
|
+
const answers = await promptForInit(availableProfiles, defaults);
|
|
40
|
+
resolvedPath = path ?? answers.outputPath;
|
|
41
|
+
resolvedProfile = answers.profile;
|
|
42
|
+
}
|
|
43
|
+
const options = {
|
|
44
|
+
path: resolvedPath,
|
|
45
|
+
force: opts.force,
|
|
46
|
+
profile: resolvedProfile,
|
|
47
|
+
};
|
|
48
|
+
const workspace = initWorkspace(options);
|
|
49
|
+
if (globalOptions.json) {
|
|
50
|
+
printJson({
|
|
51
|
+
workspace: {
|
|
52
|
+
rootDir: workspace.rootDir,
|
|
53
|
+
configPath: workspace.configPath,
|
|
54
|
+
dbPath: workspace.dbPath,
|
|
55
|
+
},
|
|
56
|
+
status: 'success',
|
|
57
|
+
});
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!globalOptions.quiet) {
|
|
61
|
+
process.stdout.write(formatSuccess(`Workspace initialized at ${workspace.rootDir}`) +
|
|
62
|
+
'\n\n' +
|
|
63
|
+
'Created:\n' +
|
|
64
|
+
' .forge/ Forge internal state\n' +
|
|
65
|
+
' specs/ Specification files\n' +
|
|
66
|
+
' profiles/ Custom profiles\n' +
|
|
67
|
+
' templates/ Custom templates\n' +
|
|
68
|
+
' output/ Generated output\n' +
|
|
69
|
+
'\n' +
|
|
70
|
+
`Configuration: ${workspace.configPath}\n` +
|
|
71
|
+
`Database: ${workspace.dbPath}\n` +
|
|
72
|
+
'\n' +
|
|
73
|
+
'Next steps:\n' +
|
|
74
|
+
' 1. Place your specification in specs/\n' +
|
|
75
|
+
' 2. Run: forge generate --stage=validate\n');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
handleError(error);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EACL,aAAa,EACb,aAAa,EACb,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D;;;;GAIG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;SACvB,WAAW,CAAC,kCAAkC,CAAC;SAC/C,QAAQ,CAAC,QAAQ,EAAE,kDAAkD,CAAC;SACtE,MAAM,CAAC,mBAAmB,EAAE,cAAc,CAAC;SAC3C,MAAM,CAAC,aAAa,EAAE,8BAA8B,EAAE,KAAK,CAAC;SAC5D,MAAM,CACL,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,CACtB;SACA,MAAM,CACL,KAAK,EACH,IAAwB,EACxB,IAAwD,EACxD,EAAE;QACF,IAAI,CAAC;YACH,IAAI,YAAY,GAAG,IAAI,CAAC;YACxB,IAAI,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC;YAEnC,qEAAqE;YACrE,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;YAE5C,IAAI,WAAW,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;gBAC1C,MAAM,iBAAiB,GAAG,Y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,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 profile <subcommand>` placeholder command with subcommands.
|
|
3
|
+
*/
|
|
4
|
+
import { Command } from 'commander';
|
|
5
|
+
/**
|
|
6
|
+
* Create and return the `profile` command with `list` and `show` subcommands.
|
|
7
|
+
*
|
|
8
|
+
* @returns Commander command for `forge profile`
|
|
9
|
+
*/
|
|
10
|
+
export declare function createProfileCommand(): Command;
|
|
11
|
+
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/commands/profile.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAgC9C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `forge profile <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 `profile` command with `list` and `show` subcommands.
|
|
8
|
+
*
|
|
9
|
+
* @returns Commander command for `forge profile`
|
|
10
|
+
*/
|
|
11
|
+
export function createProfileCommand() {
|
|
12
|
+
const profile = new Command('profile').description('Manage technology profiles');
|
|
13
|
+
profile
|
|
14
|
+
.command('list')
|
|
15
|
+
.description('List available profiles')
|
|
16
|
+
.action(() => {
|
|
17
|
+
if (globalOptions.json) {
|
|
18
|
+
printJson({ message: 'Not yet implemented', status: 'pending' });
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
process.stdout.write(formatInfo('profile list: Not yet implemented') + '\n');
|
|
22
|
+
});
|
|
23
|
+
profile
|
|
24
|
+
.command('show <name>')
|
|
25
|
+
.description('Show details of a profile')
|
|
26
|
+
.action(() => {
|
|
27
|
+
if (globalOptions.json) {
|
|
28
|
+
printJson({ message: 'Not yet implemented', status: 'pending' });
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
process.stdout.write(formatInfo('profile show: Not yet implemented') + '\n');
|
|
32
|
+
});
|
|
33
|
+
return profile;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/commands/profile.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,oBAAoB;IAClC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAChD,4BAA4B,CAC7B,CAAC;IAEF,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,yBAAyB,CAAC;SACtC,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,mCAAmC,CAAC,GAAG,IAAI,CACvD,CAAC;IACJ,CAAC,CAAC,CAAC;IAEL,OAAO;SACJ,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,2BAA2B,CAAC;SACxC,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,mCAAmC,CAAC,GAAG,IAAI,CACvD,CAAC;IACJ,CAAC,CAAC,CAAC;IAEL,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* Create and return the `status` command.
|
|
10
|
+
*
|
|
11
|
+
* @returns Commander command for `forge status`
|
|
12
|
+
*/
|
|
13
|
+
export declare function createStatusCommand(): Command;
|
|
14
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBpC;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CA2H7C"}
|