specdrive-cli 0.1.9 → 0.1.12
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 +955 -506
- package/agents/00-onboarding.md +261 -0
- package/agents/01-constitution.md +214 -201
- package/agents/02-specification.md +249 -226
- package/agents/03-uiux.md +156 -144
- package/agents/04-cascade.md +151 -122
- package/agents/05-discover-skills.md +136 -136
- package/agents/06-documentation.md +158 -145
- package/agents/07-implementation.md +201 -169
- package/agents/08-performance.md +179 -165
- package/agents/09-review-complete.md +239 -168
- package/agents/10-security.md +180 -167
- package/agents/11-test.md +195 -0
- package/commands/gates.js +73 -73
- package/commands/manifest.json +113 -95
- package/commands/permissions.json +39 -0
- package/commands/router.js +151 -127
- package/commands/tools.json +19 -19
- package/dashboard/app.js +394 -0
- package/dashboard/index.html +74 -0
- package/dashboard/server.js +166 -0
- package/dashboard/style.css +157 -0
- package/mcp/mcp.json +31 -0
- package/mcp/server.js +108 -0
- package/package.json +35 -32
- package/schemas/config.schema.json +20 -0
- package/schemas/workflow-state.schema.json +152 -35
- package/scripts/anti-redundancy.js +176 -176
- package/scripts/audit-log.js +46 -46
- package/scripts/check-permission.js +87 -0
- package/scripts/diff-spec.js +51 -0
- package/scripts/diff-version.js +96 -0
- package/scripts/generate-adapters.js +80 -80
- package/scripts/generate-from-template.js +97 -70
- package/scripts/generate-openapi.js +76 -0
- package/scripts/github-team-sync.js +81 -0
- package/scripts/install-hooks.js +21 -0
- package/scripts/load-plugins.js +65 -65
- package/scripts/migrate-openspec.js +318 -0
- package/scripts/migrate-speckit.js +322 -0
- package/scripts/migrate.js +12 -0
- package/scripts/onboard.js +312 -0
- package/scripts/pre-commit.js +56 -20
- package/scripts/team.js +113 -113
- package/scripts/test-adapters.js +118 -118
- package/scripts/test-create.js +13 -13
- package/scripts/test-end-to-end.js +137 -137
- package/scripts/test-router.js +110 -110
- package/scripts/test-state-transitions.js +146 -146
- package/scripts/test-validator.js +152 -152
- package/scripts/validate-config.js +36 -0
- package/scripts/validate-governance.js +150 -130
- package/scripts/verify.js +525 -0
- package/scripts/version-new.js +202 -0
- package/src/index.js +1010 -400
- package/templates/expo/plan.json +12 -0
- package/templates/expo/spec.json +12 -0
- package/templates/expo/tasks.json +5 -0
- package/templates/fastapi/plan.json +12 -0
- package/templates/fastapi/spec.json +12 -0
- package/templates/fastapi/tasks.json +5 -0
- package/templates/generic/plan.json +12 -0
- package/templates/generic/spec.json +11 -0
- package/templates/generic/tasks.json +5 -0
- package/templates/nextjs/plan.json +23 -0
- package/templates/nextjs/spec.json +12 -0
- package/templates/nextjs/tasks.json +5 -0
- package/templates/react-node/plan.json +15 -0
- package/templates/react-node/spec.json +12 -0
- package/templates/react-node/tasks.json +5 -0
- package/templates/registry.json +30 -0
- package/templates/turborepo/plan.json +12 -0
- package/templates/turborepo/spec.json +12 -0
- package/templates/turborepo/tasks.json +5 -0
package/commands/gates.js
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
const projectRoot = process.cwd();
|
|
5
|
-
|
|
6
|
-
function getWorkflowState() {
|
|
7
|
-
const workflowStatePath = path.join(projectRoot, ".sdrive", "workflow-state.json");
|
|
8
|
-
|
|
9
|
-
if (!fs.existsSync(workflowStatePath)) {
|
|
10
|
-
console.error("❌ workflow-state.json not found. Run `sdrive init` first.");
|
|
11
|
-
process.exit(1);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return JSON.parse(fs.readFileSync(workflowStatePath, "utf8"));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function saveWorkflowState(state) {
|
|
18
|
-
const workflowStatePath = path.join(projectRoot, ".sdrive", "workflow-state.json");
|
|
19
|
-
fs.writeFileSync(workflowStatePath, JSON.stringify(state, null, 2));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function getFeature(featureName) {
|
|
23
|
-
const state = getWorkflowState();
|
|
24
|
-
return state.features?.find((f) => f.name === featureName);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function gateStatus(featureName, gate) {
|
|
28
|
-
const feature = getFeature(featureName);
|
|
29
|
-
|
|
30
|
-
if (!feature) {
|
|
31
|
-
return "unknown";
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return feature.gates?.[gate] || "pending";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function approveGate(featureName, gate) {
|
|
38
|
-
const state = getWorkflowState();
|
|
39
|
-
const feature = getFeature(featureName);
|
|
40
|
-
|
|
41
|
-
if (!feature) {
|
|
42
|
-
console.error(`❌ Feature "${featureName}" not found.`);
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (!feature.gates) {
|
|
47
|
-
feature.gates = {};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
feature.gates[gate] = "approved";
|
|
51
|
-
|
|
52
|
-
feature.history = feature.history || [];
|
|
53
|
-
feature.history.push({
|
|
54
|
-
event: `${gate}_approved`,
|
|
55
|
-
timestamp: new Date().toISOString()
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
saveWorkflowState(state);
|
|
59
|
-
console.log(`✅ Gate "${gate}" approved for feature "${featureName}".`);
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function isGateApproved(featureName, gate) {
|
|
64
|
-
return gateStatus(featureName, gate) === "approved";
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
module.exports = {
|
|
68
|
-
getWorkflowState,
|
|
69
|
-
saveWorkflowState,
|
|
70
|
-
getFeature,
|
|
71
|
-
gateStatus,
|
|
72
|
-
approveGate,
|
|
73
|
-
isGateApproved
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const projectRoot = process.cwd();
|
|
5
|
+
|
|
6
|
+
function getWorkflowState() {
|
|
7
|
+
const workflowStatePath = path.join(projectRoot, ".sdrive", "workflow-state.json");
|
|
8
|
+
|
|
9
|
+
if (!fs.existsSync(workflowStatePath)) {
|
|
10
|
+
console.error("❌ workflow-state.json not found. Run `sdrive init` first.");
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return JSON.parse(fs.readFileSync(workflowStatePath, "utf8"));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function saveWorkflowState(state) {
|
|
18
|
+
const workflowStatePath = path.join(projectRoot, ".sdrive", "workflow-state.json");
|
|
19
|
+
fs.writeFileSync(workflowStatePath, JSON.stringify(state, null, 2));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getFeature(featureName) {
|
|
23
|
+
const state = getWorkflowState();
|
|
24
|
+
return state.features?.find((f) => f.name === featureName);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function gateStatus(featureName, gate) {
|
|
28
|
+
const feature = getFeature(featureName);
|
|
29
|
+
|
|
30
|
+
if (!feature) {
|
|
31
|
+
return "unknown";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return feature.gates?.[gate] || "pending";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function approveGate(featureName, gate) {
|
|
38
|
+
const state = getWorkflowState();
|
|
39
|
+
const feature = getFeature(featureName);
|
|
40
|
+
|
|
41
|
+
if (!feature) {
|
|
42
|
+
console.error(`❌ Feature "${featureName}" not found.`);
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!feature.gates) {
|
|
47
|
+
feature.gates = {};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
feature.gates[gate] = "approved";
|
|
51
|
+
|
|
52
|
+
feature.history = feature.history || [];
|
|
53
|
+
feature.history.push({
|
|
54
|
+
event: `${gate}_approved`,
|
|
55
|
+
timestamp: new Date().toISOString()
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
saveWorkflowState(state);
|
|
59
|
+
console.log(`✅ Gate "${gate}" approved for feature "${featureName}".`);
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function isGateApproved(featureName, gate) {
|
|
64
|
+
return gateStatus(featureName, gate) === "approved";
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = {
|
|
68
|
+
getWorkflowState,
|
|
69
|
+
saveWorkflowState,
|
|
70
|
+
getFeature,
|
|
71
|
+
gateStatus,
|
|
72
|
+
approveGate,
|
|
73
|
+
isGateApproved
|
|
74
74
|
};
|
package/commands/manifest.json
CHANGED
|
@@ -1,96 +1,114 @@
|
|
|
1
|
-
{
|
|
2
|
-
"prefix": "/sdrive:",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"commands": [
|
|
5
|
-
{
|
|
6
|
-
"command": "/sdrive:constitution",
|
|
7
|
-
"agent": "constitution",
|
|
8
|
-
"agentFile": ".sdrive/agents/01-constitution.md",
|
|
9
|
-
"description": "Initialize or update the project constitution",
|
|
10
|
-
"acceptsFeature": false,
|
|
11
|
-
"gates": ["constitution"],
|
|
12
|
-
"validators": ["governance"]
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"command": "/sdrive:propose",
|
|
16
|
-
"agent": "specification",
|
|
17
|
-
"agentFile": ".sdrive/agents/02-specification.md",
|
|
18
|
-
"description": "Create feature specification, traceability, technical plan, and tasks",
|
|
19
|
-
"acceptsFeature": true,
|
|
20
|
-
"gates": ["specification", "planning"],
|
|
21
|
-
"validators": ["governance"]
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"command": "/sdrive:design",
|
|
25
|
-
"agent": "uiux",
|
|
26
|
-
"agentFile": ".sdrive/agents/03-uiux.md",
|
|
27
|
-
"description": "Build UI/UX prototype and design system",
|
|
28
|
-
"acceptsFeature": true,
|
|
29
|
-
"gates": [],
|
|
30
|
-
"validators": ["governance"]
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"command": "/sdrive:sync",
|
|
34
|
-
"agent": "cascade",
|
|
35
|
-
"agentFile": ".sdrive/agents/04-cascade.md",
|
|
36
|
-
"description": "Sync spec, plan, tasks, and traceability",
|
|
37
|
-
"acceptsFeature": true,
|
|
38
|
-
"gates": [],
|
|
39
|
-
"validators": ["governance"]
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"command": "/sdrive:skills",
|
|
43
|
-
"agent": "discover-skills",
|
|
44
|
-
"agentFile": ".sdrive/agents/05-discover-skills.md",
|
|
45
|
-
"description": "Audit and manage AI skills",
|
|
46
|
-
"acceptsFeature": false,
|
|
47
|
-
"gates": [],
|
|
48
|
-
"validators": []
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"command": "/sdrive:docs",
|
|
52
|
-
"agent": "documentation",
|
|
53
|
-
"agentFile": ".sdrive/agents/06-documentation.md",
|
|
54
|
-
"description": "Generate documentation and detect drift",
|
|
55
|
-
"acceptsFeature": true,
|
|
56
|
-
"gates": [],
|
|
57
|
-
"validators": ["governance"]
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"command": "/sdrive:apply",
|
|
61
|
-
"agent": "implementation",
|
|
62
|
-
"agentFile": ".sdrive/agents/07-implementation.md",
|
|
63
|
-
"description": "Write production code from approved tasks",
|
|
64
|
-
"acceptsFeature": true,
|
|
65
|
-
"gates": ["implementation"],
|
|
66
|
-
"validators": ["governance"]
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"command": "/sdrive:performance",
|
|
70
|
-
"agent": "performance",
|
|
71
|
-
"agentFile": ".sdrive/agents/08-performance.md",
|
|
72
|
-
"description": "Benchmark and optimize performance",
|
|
73
|
-
"acceptsFeature": true,
|
|
74
|
-
"gates": [],
|
|
75
|
-
"validators": ["governance"]
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"command": "/sdrive:review",
|
|
79
|
-
"agent": "review-complete",
|
|
80
|
-
"agentFile": ".sdrive/agents/09-review-complete.md",
|
|
81
|
-
"description": "Final audit, merge, and archive",
|
|
82
|
-
"acceptsFeature": true,
|
|
83
|
-
"gates": ["review"],
|
|
84
|
-
"validators": ["governance"]
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"command": "/sdrive:secure",
|
|
88
|
-
"agent": "security",
|
|
89
|
-
"agentFile": ".sdrive/agents/10-security.md",
|
|
90
|
-
"description": "Security audit, threat modeling, and fixes",
|
|
91
|
-
"acceptsFeature": true,
|
|
92
|
-
"gates": [],
|
|
93
|
-
"validators": ["governance"]
|
|
94
|
-
}
|
|
95
|
-
|
|
1
|
+
{
|
|
2
|
+
"prefix": "/sdrive:",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"commands": [
|
|
5
|
+
{
|
|
6
|
+
"command": "/sdrive:constitution",
|
|
7
|
+
"agent": "constitution",
|
|
8
|
+
"agentFile": ".sdrive/agents/01-constitution.md",
|
|
9
|
+
"description": "Initialize or update the project constitution",
|
|
10
|
+
"acceptsFeature": false,
|
|
11
|
+
"gates": ["constitution"],
|
|
12
|
+
"validators": ["governance"]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"command": "/sdrive:propose",
|
|
16
|
+
"agent": "specification",
|
|
17
|
+
"agentFile": ".sdrive/agents/02-specification.md",
|
|
18
|
+
"description": "Create feature specification, traceability, technical plan, and tasks",
|
|
19
|
+
"acceptsFeature": true,
|
|
20
|
+
"gates": ["specification", "planning"],
|
|
21
|
+
"validators": ["governance"]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"command": "/sdrive:design",
|
|
25
|
+
"agent": "uiux",
|
|
26
|
+
"agentFile": ".sdrive/agents/03-uiux.md",
|
|
27
|
+
"description": "Build UI/UX prototype and design system",
|
|
28
|
+
"acceptsFeature": true,
|
|
29
|
+
"gates": [],
|
|
30
|
+
"validators": ["governance"]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"command": "/sdrive:sync",
|
|
34
|
+
"agent": "cascade",
|
|
35
|
+
"agentFile": ".sdrive/agents/04-cascade.md",
|
|
36
|
+
"description": "Sync spec, plan, tasks, and traceability",
|
|
37
|
+
"acceptsFeature": true,
|
|
38
|
+
"gates": [],
|
|
39
|
+
"validators": ["governance"]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"command": "/sdrive:skills",
|
|
43
|
+
"agent": "discover-skills",
|
|
44
|
+
"agentFile": ".sdrive/agents/05-discover-skills.md",
|
|
45
|
+
"description": "Audit and manage AI skills",
|
|
46
|
+
"acceptsFeature": false,
|
|
47
|
+
"gates": [],
|
|
48
|
+
"validators": []
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"command": "/sdrive:docs",
|
|
52
|
+
"agent": "documentation",
|
|
53
|
+
"agentFile": ".sdrive/agents/06-documentation.md",
|
|
54
|
+
"description": "Generate documentation and detect drift",
|
|
55
|
+
"acceptsFeature": true,
|
|
56
|
+
"gates": [],
|
|
57
|
+
"validators": ["governance"]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"command": "/sdrive:apply",
|
|
61
|
+
"agent": "implementation",
|
|
62
|
+
"agentFile": ".sdrive/agents/07-implementation.md",
|
|
63
|
+
"description": "Write production code from approved tasks",
|
|
64
|
+
"acceptsFeature": true,
|
|
65
|
+
"gates": ["implementation"],
|
|
66
|
+
"validators": ["governance"]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"command": "/sdrive:performance",
|
|
70
|
+
"agent": "performance",
|
|
71
|
+
"agentFile": ".sdrive/agents/08-performance.md",
|
|
72
|
+
"description": "Benchmark and optimize performance",
|
|
73
|
+
"acceptsFeature": true,
|
|
74
|
+
"gates": [],
|
|
75
|
+
"validators": ["governance"]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"command": "/sdrive:review",
|
|
79
|
+
"agent": "review-complete",
|
|
80
|
+
"agentFile": ".sdrive/agents/09-review-complete.md",
|
|
81
|
+
"description": "Final audit, merge, and archive",
|
|
82
|
+
"acceptsFeature": true,
|
|
83
|
+
"gates": ["review"],
|
|
84
|
+
"validators": ["governance"]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"command": "/sdrive:secure",
|
|
88
|
+
"agent": "security",
|
|
89
|
+
"agentFile": ".sdrive/agents/10-security.md",
|
|
90
|
+
"description": "Security audit, threat modeling, and fixes",
|
|
91
|
+
"acceptsFeature": true,
|
|
92
|
+
"gates": [],
|
|
93
|
+
"validators": ["governance"]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"command": "/sdrive:test",
|
|
97
|
+
"agent": "test",
|
|
98
|
+
"agentFile": ".sdrive/agents/11-test.md",
|
|
99
|
+
"description": "Write tests for acceptance criteria, run them, and report coverage",
|
|
100
|
+
"acceptsFeature": true,
|
|
101
|
+
"gates": [],
|
|
102
|
+
"validators": ["governance"]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"command": "/sdrive:onboard",
|
|
106
|
+
"agent": "onboarding",
|
|
107
|
+
"agentFile": ".sdrive/agents/00-onboarding.md",
|
|
108
|
+
"description": "Onboard an existing project into SpecDrive",
|
|
109
|
+
"acceptsFeature": false,
|
|
110
|
+
"gates": [],
|
|
111
|
+
"validators": ["governance"]
|
|
112
|
+
}
|
|
113
|
+
]
|
|
96
114
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"rules": {
|
|
4
|
+
"/sdrive:constitution": ["admin"],
|
|
5
|
+
"/sdrive:propose": ["admin", "reviewer"],
|
|
6
|
+
"/sdrive:design": ["admin", "reviewer", "developer"],
|
|
7
|
+
"/sdrive:sync": ["admin", "reviewer", "developer"],
|
|
8
|
+
"/sdrive:skills": ["admin"],
|
|
9
|
+
"/sdrive:docs": ["admin", "reviewer", "developer"],
|
|
10
|
+
"/sdrive:apply": ["admin", "developer"],
|
|
11
|
+
"/sdrive:test": ["admin", "developer"],
|
|
12
|
+
"/sdrive:performance": ["admin", "developer"],
|
|
13
|
+
"/sdrive:review": ["admin", "reviewer"],
|
|
14
|
+
"/sdrive:secure": ["admin", "developer"],
|
|
15
|
+
"/sdrive:onboard": ["admin"]
|
|
16
|
+
},
|
|
17
|
+
"cli": {
|
|
18
|
+
"init": ["admin"],
|
|
19
|
+
"create": ["admin", "reviewer", "developer"],
|
|
20
|
+
"approve": ["admin", "reviewer"],
|
|
21
|
+
"team:add": ["admin"],
|
|
22
|
+
"team:remove": ["admin"],
|
|
23
|
+
"team:update": ["admin"],
|
|
24
|
+
"team:sync": ["admin"],
|
|
25
|
+
"template:set": ["admin"],
|
|
26
|
+
"hooks:install": ["admin"],
|
|
27
|
+
"migrate": ["admin"],
|
|
28
|
+
"reopen": ["admin", "reviewer"],
|
|
29
|
+
"verify": ["admin", "reviewer", "developer"],
|
|
30
|
+
"validate": ["admin", "reviewer", "developer"],
|
|
31
|
+
"config:validate": ["admin"],
|
|
32
|
+
"dashboard": ["admin", "reviewer", "developer"],
|
|
33
|
+
"diff": ["admin", "reviewer", "developer"],
|
|
34
|
+
"openapi:generate": ["admin", "reviewer", "developer"],
|
|
35
|
+
"version:new": ["admin", "reviewer"],
|
|
36
|
+
"diff:version": ["admin", "reviewer", "developer"],
|
|
37
|
+
"onboard": ["admin"]
|
|
38
|
+
}
|
|
39
|
+
}
|