specdrive-cli 0.1.10 → 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 -697
- 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 +149 -38
- 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 +50 -50
- package/scripts/diff-version.js +96 -0
- package/scripts/generate-adapters.js +80 -80
- package/scripts/generate-from-template.js +97 -97
- package/scripts/generate-openapi.js +75 -75
- package/scripts/github-team-sync.js +80 -80
- package/scripts/install-hooks.js +20 -20
- 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 -62
- 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 -807
- 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
|
@@ -1,131 +1,151 @@
|
|
|
1
|
-
const Ajv = require("ajv");
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
|
|
5
|
-
const ajv = new Ajv({ allErrors: true });
|
|
6
|
-
|
|
7
|
-
const projectRoot = path.join(__dirname, "..", "..");
|
|
8
|
-
|
|
9
|
-
const schemaDir = path.join(projectRoot, ".sdrive", "schemas");
|
|
10
|
-
const governanceDir = path.join(projectRoot, ".sdrive", "governance");
|
|
11
|
-
const specsDir = path.join(projectRoot, ".sdrive", "specs");
|
|
12
|
-
const workflowStatePath = path.join(projectRoot, ".sdrive", "workflow-state.json");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
console.log(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
1
|
+
const Ajv = require("ajv");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
const ajv = new Ajv({ allErrors: true });
|
|
6
|
+
|
|
7
|
+
const projectRoot = path.join(__dirname, "..", "..");
|
|
8
|
+
|
|
9
|
+
const schemaDir = path.join(projectRoot, ".sdrive", "schemas");
|
|
10
|
+
const governanceDir = path.join(projectRoot, ".sdrive", "governance");
|
|
11
|
+
const specsDir = path.join(projectRoot, ".sdrive", "specs");
|
|
12
|
+
const workflowStatePath = path.join(projectRoot, ".sdrive", "workflow-state.json");
|
|
13
|
+
|
|
14
|
+
const configPath = path.join(projectRoot, ".sdrive", "config.json");
|
|
15
|
+
const configSchemaPath = path.join(schemaDir, "config.schema.json");
|
|
16
|
+
|
|
17
|
+
function loadJson(filePath) {
|
|
18
|
+
if (!fs.existsSync(filePath)) {
|
|
19
|
+
console.error(`❌ Schema/file not found: ${filePath}`);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function validateData(data, schema, label) {
|
|
26
|
+
const validate = ajv.compile(schema);
|
|
27
|
+
const valid = validate(data);
|
|
28
|
+
|
|
29
|
+
if (valid) {
|
|
30
|
+
console.log(`✅ ${label} is valid.`);
|
|
31
|
+
return true;
|
|
32
|
+
} else {
|
|
33
|
+
console.log(`❌ ${label} is INVALID:`);
|
|
34
|
+
console.log(validate.errors);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function validateConfig() {
|
|
40
|
+
if (!fs.existsSync(configPath)) {
|
|
41
|
+
console.log("⚠️ config.json not found. Skipping.");
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!fs.existsSync(configSchemaPath)) {
|
|
46
|
+
console.log("⚠️ config.schema.json not found. Skipping config validation.");
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const schema = loadJson(configSchemaPath);
|
|
51
|
+
const data = loadJson(configPath);
|
|
52
|
+
return validateData(data, schema, "config.json");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function validateWorkflowState() {
|
|
56
|
+
if (!fs.existsSync(workflowStatePath)) {
|
|
57
|
+
console.log("⚠️ workflow-state.json not found. Skipping.");
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const schema = loadJson(path.join(schemaDir, "workflow-state.schema.json"));
|
|
62
|
+
const data = loadJson(workflowStatePath);
|
|
63
|
+
return validateData(data, schema, "workflow-state.json");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function validateFeature(featureName) {
|
|
67
|
+
const featureDir = path.join(governanceDir, featureName);
|
|
68
|
+
|
|
69
|
+
if (!fs.existsSync(featureDir)) {
|
|
70
|
+
console.log(`⚠️ Feature "${featureName}" has no governance folder. Skipping.`);
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let failed = false;
|
|
75
|
+
|
|
76
|
+
const files = [
|
|
77
|
+
{ file: "spec.json", schema: "spec.schema.json" },
|
|
78
|
+
{ file: "plan.json", schema: "plan.schema.json" },
|
|
79
|
+
{ file: "tasks.json", schema: "tasks.schema.json" },
|
|
80
|
+
{ file: "traceability.json", schema: "traceability.schema.json" }
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
files.forEach(({ file, schema }) => {
|
|
84
|
+
const filePath = path.join(featureDir, file);
|
|
85
|
+
const schemaPath = path.join(schemaDir, schema);
|
|
86
|
+
|
|
87
|
+
if (!fs.existsSync(filePath)) {
|
|
88
|
+
console.log(`⚠️ ${featureName}/${file} not found. Skipping.`);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const data = loadJson(filePath);
|
|
93
|
+
const schemaData = loadJson(schemaPath);
|
|
94
|
+
failed |= !validateData(data, schemaData, `${featureName}/${file}`);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
return !failed;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function discoverFeatures() {
|
|
101
|
+
const features = new Set();
|
|
102
|
+
|
|
103
|
+
if (fs.existsSync(governanceDir)) {
|
|
104
|
+
fs.readdirSync(governanceDir, { withFileTypes: true })
|
|
105
|
+
.filter((d) => d.isDirectory())
|
|
106
|
+
.forEach((d) => features.add(d.name));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
["backlog", "ongoing", "completed"].forEach((lifecycle) => {
|
|
110
|
+
const lifecyclePath = path.join(specsDir, lifecycle);
|
|
111
|
+
if (fs.existsSync(lifecyclePath)) {
|
|
112
|
+
fs.readdirSync(lifecyclePath, { withFileTypes: true })
|
|
113
|
+
.filter((d) => d.isDirectory())
|
|
114
|
+
.forEach((d) => features.add(d.name));
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
return Array.from(features);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function main() {
|
|
122
|
+
console.log("🔍 SpecDrive Governance Validation\n");
|
|
123
|
+
|
|
124
|
+
let failed = false;
|
|
125
|
+
|
|
126
|
+
failed |= !validateConfig();
|
|
127
|
+
failed |= !validateWorkflowState();
|
|
128
|
+
|
|
129
|
+
const features = discoverFeatures();
|
|
130
|
+
|
|
131
|
+
if (features.length === 0) {
|
|
132
|
+
console.log("⚠️ No features found under .sdrive/governance or .sdrive/specs.");
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
features.forEach((feature) => {
|
|
136
|
+
console.log(`\n📁 Validating feature: ${feature}`);
|
|
137
|
+
failed |= !validateFeature(feature);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
console.log("\n----------------------------------------");
|
|
141
|
+
|
|
142
|
+
if (failed) {
|
|
143
|
+
console.log("❌ Validation FAILED. Fix the errors above.");
|
|
144
|
+
process.exit(1);
|
|
145
|
+
} else {
|
|
146
|
+
console.log("✅ Governance validation complete. All files are valid.");
|
|
147
|
+
process.exit(0);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
131
151
|
main();
|