@speclife/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +105 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* SpecLife CLI
|
|
4
|
+
*
|
|
5
|
+
* Thin CLI wrapper for CI/scripting.
|
|
6
|
+
* Primary interface is the MCP server.
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
import { loadConfig, createGitAdapter, createOpenSpecAdapter, initWorkflow, statusWorkflow, } from '@speclife/core';
|
|
10
|
+
const program = new Command();
|
|
11
|
+
program
|
|
12
|
+
.name('speclife')
|
|
13
|
+
.description('Bring specifications to life - automated spec-driven development')
|
|
14
|
+
.version('0.1.0');
|
|
15
|
+
program
|
|
16
|
+
.command('init <change-id>')
|
|
17
|
+
.description('Initialize a new change: create worktree (default) and scaffold proposal')
|
|
18
|
+
.option('-m, --message <description>', 'Brief description for the proposal')
|
|
19
|
+
.option('--no-worktree', 'Create branch in current directory instead of worktree')
|
|
20
|
+
.option('--dry-run', 'Preview changes without applying')
|
|
21
|
+
.action(async (changeId, options) => {
|
|
22
|
+
try {
|
|
23
|
+
const cwd = process.cwd();
|
|
24
|
+
const config = await loadConfig(cwd);
|
|
25
|
+
const git = createGitAdapter(cwd);
|
|
26
|
+
const openspec = createOpenSpecAdapter({ projectRoot: cwd, specDir: config.specDir });
|
|
27
|
+
const result = await initWorkflow({
|
|
28
|
+
changeId,
|
|
29
|
+
description: options.message,
|
|
30
|
+
noWorktree: !options.worktree,
|
|
31
|
+
dryRun: options.dryRun,
|
|
32
|
+
}, { git, openspec, config }, (event) => console.log(` ${event.message}`));
|
|
33
|
+
if (result.worktreePath) {
|
|
34
|
+
console.log(`✓ Created worktree: ${result.worktreePath}`);
|
|
35
|
+
}
|
|
36
|
+
console.log(`✓ Created branch: ${result.branch}`);
|
|
37
|
+
console.log(`✓ Scaffolded: ${result.proposalPath}`);
|
|
38
|
+
console.log(`✓ Scaffolded: ${result.tasksPath}`);
|
|
39
|
+
if (result.worktreePath) {
|
|
40
|
+
console.log(`\nNext: cd ${result.worktreePath}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.error(`Error: ${error instanceof Error ? error.message : error}`);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
program
|
|
49
|
+
.command('status [change-id]')
|
|
50
|
+
.description('Show status of a change')
|
|
51
|
+
.action(async (changeId) => {
|
|
52
|
+
try {
|
|
53
|
+
const cwd = process.cwd();
|
|
54
|
+
const config = await loadConfig(cwd);
|
|
55
|
+
const git = createGitAdapter(cwd);
|
|
56
|
+
const openspec = createOpenSpecAdapter({ projectRoot: cwd, specDir: config.specDir });
|
|
57
|
+
const result = await statusWorkflow({ changeId }, { git, openspec });
|
|
58
|
+
if (!result) {
|
|
59
|
+
console.log(changeId
|
|
60
|
+
? `Change '${changeId}' not found`
|
|
61
|
+
: 'No active change on current branch');
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const { change, onBranch, taskSummary } = result;
|
|
65
|
+
console.log(`Change: ${change.id}`);
|
|
66
|
+
console.log(`State: ${change.state}`);
|
|
67
|
+
console.log(`Branch: ${change.branch}${onBranch ? ' (current)' : ''}`);
|
|
68
|
+
console.log(`Tasks: ${taskSummary.completed}/${taskSummary.total} (${taskSummary.percentage}%)`);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
console.error(`Error: ${error instanceof Error ? error.message : error}`);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
program
|
|
76
|
+
.command('list')
|
|
77
|
+
.description('List all active changes')
|
|
78
|
+
.action(async () => {
|
|
79
|
+
try {
|
|
80
|
+
const cwd = process.cwd();
|
|
81
|
+
const config = await loadConfig(cwd);
|
|
82
|
+
const git = createGitAdapter(cwd);
|
|
83
|
+
const openspec = createOpenSpecAdapter({ projectRoot: cwd, specDir: config.specDir });
|
|
84
|
+
const changeIds = await openspec.listChanges();
|
|
85
|
+
if (changeIds.length === 0) {
|
|
86
|
+
console.log('No active changes');
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
console.log('Active changes:');
|
|
90
|
+
for (const id of changeIds) {
|
|
91
|
+
const result = await statusWorkflow({ changeId: id }, { git, openspec });
|
|
92
|
+
if (result) {
|
|
93
|
+
const marker = result.onBranch ? '→ ' : ' ';
|
|
94
|
+
console.log(`${marker}${id} (${result.change.state}, ${result.taskSummary.completed}/${result.taskSummary.total} tasks)`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
console.error(`Error: ${error instanceof Error ? error.message : error}`);
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
// TODO: Add submit, merge, implement, test commands in future phases
|
|
104
|
+
program.parse();
|
|
105
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EACZ,cAAc,GAEf,MAAM,gBAAgB,CAAC;AAExB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B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E/C,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;YACjC,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC/B,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;YACzE,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC7C,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,EAAE,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,WAAW,CAAC,SAAS,IAAI,MAAM,CAAC,WAAW,CAAC,KAAK,SAAS,CAAC,CAAC;YAC5H,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,qEAAqE;AAErE,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@speclife/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI for SpecLife - for CI/scripts",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"speclife": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"start": "node dist/index.js",
|
|
14
|
+
"dev": "tsc --watch",
|
|
15
|
+
"test": "vitest run --passWithNoTests",
|
|
16
|
+
"typecheck": "tsc --noEmit"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@speclife/core": "*",
|
|
20
|
+
"commander": "^12.0.0",
|
|
21
|
+
"inquirer": "^10.0.0",
|
|
22
|
+
"chalk": "^5.3.0",
|
|
23
|
+
"ora": "^8.0.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/inquirer": "^9.0.7",
|
|
27
|
+
"@types/node": "^22.0.0",
|
|
28
|
+
"typescript": "^5.6.0",
|
|
29
|
+
"vitest": "^2.0.0"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|