@x0rium/devkit-cli 0.4.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/advance.d.ts +9 -0
- package/dist/advance.d.ts.map +1 -0
- package/dist/advance.js +47 -0
- package/dist/advance.js.map +1 -0
- package/dist/constitution.d.ts +16 -0
- package/dist/constitution.d.ts.map +1 -0
- package/dist/constitution.js +186 -0
- package/dist/constitution.js.map +1 -0
- package/dist/coverage.d.ts +18 -0
- package/dist/coverage.d.ts.map +1 -0
- package/dist/coverage.js +167 -0
- package/dist/coverage.js.map +1 -0
- package/dist/dashboard.d.ts +2 -0
- package/dist/dashboard.d.ts.map +1 -0
- package/dist/dashboard.js +380 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/detector.d.ts +3 -0
- package/dist/detector.d.ts.map +1 -0
- package/dist/detector.js +45 -0
- package/dist/detector.js.map +1 -0
- package/dist/escalate.d.ts +11 -0
- package/dist/escalate.d.ts.map +1 -0
- package/dist/escalate.js +133 -0
- package/dist/escalate.js.map +1 -0
- package/dist/gate.d.ts +15 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +244 -0
- package/dist/gate.js.map +1 -0
- package/dist/impact.d.ts +17 -0
- package/dist/impact.d.ts.map +1 -0
- package/dist/impact.js +192 -0
- package/dist/impact.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +494 -0
- package/dist/index.js.map +1 -0
- package/dist/investigate.d.ts +21 -0
- package/dist/investigate.d.ts.map +1 -0
- package/dist/investigate.js +200 -0
- package/dist/investigate.js.map +1 -0
- package/dist/rfc.d.ts +21 -0
- package/dist/rfc.d.ts.map +1 -0
- package/dist/rfc.js +152 -0
- package/dist/rfc.js.map +1 -0
- package/dist/scaffold.d.ts +7 -0
- package/dist/scaffold.d.ts.map +1 -0
- package/dist/scaffold.js +54 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/schemas.d.ts +11 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +103 -0
- package/dist/schemas.js.map +1 -0
- package/dist/status.d.ts +13 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +112 -0
- package/dist/status.js.map +1 -0
- package/dist/validator.d.ts +16 -0
- package/dist/validator.d.ts.map +1 -0
- package/dist/validator.js +185 -0
- package/dist/validator.js.map +1 -0
- package/dist/watch.d.ts +2 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +48 -0
- package/dist/watch.js.map +1 -0
- package/package.json +47 -0
package/dist/status.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
const PHASE_ORDER = ['research', 'product', 'arch', 'spec', 'qa'];
|
|
4
|
+
const PHASE_LABELS = {
|
|
5
|
+
research: 'ResearchKit',
|
|
6
|
+
product: 'ProductKit',
|
|
7
|
+
arch: 'ArchKit',
|
|
8
|
+
spec: 'SpecKit',
|
|
9
|
+
qa: 'QAKit',
|
|
10
|
+
};
|
|
11
|
+
const PHASE_NEXT_STEP = {
|
|
12
|
+
research: 'Define your idea. Run /research-kit or create artifacts in .devkit/research/',
|
|
13
|
+
product: 'Define users and UX invariants. Run /product-kit or create artifacts in .devkit/product/',
|
|
14
|
+
arch: 'Design architecture variants and invariants. Run /arch-kit or create artifacts in .devkit/arch/',
|
|
15
|
+
spec: 'Write specs and implement. Run /spec-kit with github/spec-kit workflow',
|
|
16
|
+
qa: 'Generate test contracts from invariants. Run /qa-kit',
|
|
17
|
+
};
|
|
18
|
+
function parseCheckboxStatus(line) {
|
|
19
|
+
if (line.includes('[x]'))
|
|
20
|
+
return 'done';
|
|
21
|
+
if (line.includes('[/]'))
|
|
22
|
+
return 'in_progress';
|
|
23
|
+
return 'pending';
|
|
24
|
+
}
|
|
25
|
+
function countFiles(dir) {
|
|
26
|
+
try {
|
|
27
|
+
const { readdirSync } = require('node:fs');
|
|
28
|
+
return readdirSync(dir).filter((f) => f.endsWith('.md')).length;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function getStatus(cwd) {
|
|
35
|
+
const statusPath = join(cwd, '.devkit', 'STATUS.md');
|
|
36
|
+
if (!existsSync(statusPath))
|
|
37
|
+
return null;
|
|
38
|
+
const content = readFileSync(statusPath, 'utf-8');
|
|
39
|
+
const lines = content.split('\n');
|
|
40
|
+
// Parse header fields
|
|
41
|
+
let mode = 'unknown';
|
|
42
|
+
let initialized = 'unknown';
|
|
43
|
+
let currentPhase = 'research';
|
|
44
|
+
for (const line of lines) {
|
|
45
|
+
const modeMatch = line.match(/^MODE:\s*(.+)/);
|
|
46
|
+
if (modeMatch)
|
|
47
|
+
mode = modeMatch[1].trim();
|
|
48
|
+
const initMatch = line.match(/^INITIALIZED:\s*(.+)/);
|
|
49
|
+
if (initMatch)
|
|
50
|
+
initialized = initMatch[1].trim();
|
|
51
|
+
const phaseMatch = line.match(/^CURRENT_PHASE:\s*(.+)/);
|
|
52
|
+
if (phaseMatch)
|
|
53
|
+
currentPhase = phaseMatch[1].trim();
|
|
54
|
+
}
|
|
55
|
+
// Parse phase checkboxes
|
|
56
|
+
const phaseProgress = {
|
|
57
|
+
research: 'pending',
|
|
58
|
+
product: 'pending',
|
|
59
|
+
arch: 'pending',
|
|
60
|
+
spec: 'pending',
|
|
61
|
+
qa: 'pending',
|
|
62
|
+
};
|
|
63
|
+
for (const line of lines) {
|
|
64
|
+
for (const phase of PHASE_ORDER) {
|
|
65
|
+
if (line.includes(PHASE_LABELS[phase])) {
|
|
66
|
+
phaseProgress[phase] = parseCheckboxStatus(line);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Count artifacts
|
|
71
|
+
const artifactCounts = {
|
|
72
|
+
research: countFiles(join(cwd, '.devkit', 'research')),
|
|
73
|
+
product: countFiles(join(cwd, '.devkit', 'product')),
|
|
74
|
+
arch: countFiles(join(cwd, '.devkit', 'arch')),
|
|
75
|
+
decisions: countFiles(join(cwd, '.devkit', 'arch', 'decisions')),
|
|
76
|
+
qa: countFiles(join(cwd, '.devkit', 'qa')),
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
phase: currentPhase,
|
|
80
|
+
mode,
|
|
81
|
+
initialized,
|
|
82
|
+
phaseProgress,
|
|
83
|
+
nextStep: PHASE_NEXT_STEP[currentPhase] ?? 'Unknown phase',
|
|
84
|
+
artifactCounts,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export function formatStatus(status) {
|
|
88
|
+
const lines = [];
|
|
89
|
+
lines.push('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
90
|
+
lines.push('ā DevKit Status ā');
|
|
91
|
+
lines.push('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
92
|
+
lines.push('');
|
|
93
|
+
lines.push(` Mode: ${status.mode}`);
|
|
94
|
+
lines.push(` Initialized: ${status.initialized}`);
|
|
95
|
+
lines.push(` Phase: ${status.phase.toUpperCase()}`);
|
|
96
|
+
lines.push('');
|
|
97
|
+
lines.push(' Progress:');
|
|
98
|
+
for (const phase of PHASE_ORDER) {
|
|
99
|
+
const s = status.phaseProgress[phase];
|
|
100
|
+
const icon = s === 'done' ? 'ā
' : s === 'in_progress' ? 'š' : 'ā¬';
|
|
101
|
+
const count = status.artifactCounts[phase] ?? 0;
|
|
102
|
+
const artifacts = count > 0 ? ` (${count} artifacts)` : '';
|
|
103
|
+
const label = PHASE_LABELS[phase];
|
|
104
|
+
const pointer = phase === status.phase ? ' ā current' : '';
|
|
105
|
+
lines.push(` ${icon} ${label}${artifacts}${pointer}`);
|
|
106
|
+
}
|
|
107
|
+
lines.push('');
|
|
108
|
+
lines.push(` Next: ${status.nextStep}`);
|
|
109
|
+
lines.push('');
|
|
110
|
+
return lines.join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2
|
+
file: string;
|
|
3
|
+
line: number;
|
|
4
|
+
field: string;
|
|
5
|
+
message: string;
|
|
6
|
+
fix: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ValidationResult {
|
|
9
|
+
errors: ValidationError[];
|
|
10
|
+
warnings: ValidationError[];
|
|
11
|
+
filesChecked: number;
|
|
12
|
+
filesValid: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function validateArtifacts(cwd: string): ValidationResult;
|
|
15
|
+
export declare function formatValidation(result: ValidationResult): string;
|
|
16
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACtB;AA4GD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAyD/D;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAsCjE"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { readFileSync, existsSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { join, relative, basename } from 'node:path';
|
|
3
|
+
import { SCHEMAS, STRUCTURED_FIELDS } from './schemas.js';
|
|
4
|
+
function findSections(content) {
|
|
5
|
+
const sections = new Map();
|
|
6
|
+
const lines = content.split('\n');
|
|
7
|
+
for (let i = 0; i < lines.length; i++) {
|
|
8
|
+
const match = lines[i].match(/^##\s+(.+)/);
|
|
9
|
+
if (match) {
|
|
10
|
+
sections.set(match[1].trim(), i + 1);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return sections;
|
|
14
|
+
}
|
|
15
|
+
function findStructuredFields(content, sectionStart, nextSectionStart) {
|
|
16
|
+
const fields = new Map();
|
|
17
|
+
const lines = content.split('\n');
|
|
18
|
+
const end = nextSectionStart ? nextSectionStart - 1 : lines.length;
|
|
19
|
+
for (let i = sectionStart; i < end; i++) {
|
|
20
|
+
const match = lines[i].match(/^([A-Z_]+):\s*(.*)/);
|
|
21
|
+
if (match) {
|
|
22
|
+
fields.set(match[1], { line: i + 1, value: match[2].trim() });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return fields;
|
|
26
|
+
}
|
|
27
|
+
function detectSectionType(sectionName) {
|
|
28
|
+
const lower = sectionName.toLowerCase();
|
|
29
|
+
if (lower.startsWith('unknown:') || lower.startsWith('unknown '))
|
|
30
|
+
return 'unknown';
|
|
31
|
+
if (lower.startsWith('assumption:') || lower.startsWith('assumption '))
|
|
32
|
+
return 'assumption';
|
|
33
|
+
if (lower.startsWith('i') && /^i\d+:/.test(lower))
|
|
34
|
+
return 'invariant';
|
|
35
|
+
if (lower.startsWith('u') && /^u\d+:/.test(lower))
|
|
36
|
+
return 'ux_invariant';
|
|
37
|
+
if (lower.startsWith('tc-i'))
|
|
38
|
+
return 'test_contract';
|
|
39
|
+
if (lower.startsWith('adr-'))
|
|
40
|
+
return 'adr';
|
|
41
|
+
if (lower.startsWith('rfc-'))
|
|
42
|
+
return 'rfc';
|
|
43
|
+
if (lower.startsWith('inv-') || lower.startsWith('investigation-'))
|
|
44
|
+
return 'investigation';
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
function validateFile(filePath, schema, devkitDir) {
|
|
48
|
+
const errors = [];
|
|
49
|
+
const relPath = relative(devkitDir, filePath);
|
|
50
|
+
if (!existsSync(filePath))
|
|
51
|
+
return [];
|
|
52
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
53
|
+
const sections = findSections(content);
|
|
54
|
+
// Check required sections
|
|
55
|
+
for (const required of schema.requiredSections) {
|
|
56
|
+
// Case-insensitive check
|
|
57
|
+
const found = [...sections.keys()].some(s => s.toLowerCase().includes(required.toLowerCase()));
|
|
58
|
+
if (!found) {
|
|
59
|
+
errors.push({
|
|
60
|
+
file: relPath,
|
|
61
|
+
line: 1,
|
|
62
|
+
field: required,
|
|
63
|
+
message: `Missing required section: ## ${required}`,
|
|
64
|
+
fix: `Add "## ${required}" section to ${basename(filePath)}`,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Check structured fields in dynamic sections
|
|
69
|
+
const sectionEntries = [...sections.entries()];
|
|
70
|
+
for (let i = 0; i < sectionEntries.length; i++) {
|
|
71
|
+
const [name, startLine] = sectionEntries[i];
|
|
72
|
+
const nextLine = sectionEntries[i + 1]?.[1] ?? null;
|
|
73
|
+
const sectionType = detectSectionType(name);
|
|
74
|
+
if (sectionType && STRUCTURED_FIELDS[sectionType]) {
|
|
75
|
+
const fields = findStructuredFields(content, startLine, nextLine);
|
|
76
|
+
const requiredFields = STRUCTURED_FIELDS[sectionType];
|
|
77
|
+
for (const fieldName of requiredFields) {
|
|
78
|
+
if (!fields.has(fieldName)) {
|
|
79
|
+
errors.push({
|
|
80
|
+
file: relPath,
|
|
81
|
+
line: startLine,
|
|
82
|
+
field: fieldName,
|
|
83
|
+
message: `Missing field ${fieldName} in section "${name}"`,
|
|
84
|
+
fix: `Add "${fieldName}: <value>" under "## ${name}" in ${basename(filePath)}`,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const field = fields.get(fieldName);
|
|
89
|
+
if (!field.value || field.value === '[fill when validated]') {
|
|
90
|
+
// Warning, not error ā field exists but empty
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return errors;
|
|
97
|
+
}
|
|
98
|
+
export function validateArtifacts(cwd) {
|
|
99
|
+
const devkitDir = join(cwd, '.devkit');
|
|
100
|
+
const errors = [];
|
|
101
|
+
const warnings = [];
|
|
102
|
+
let filesChecked = 0;
|
|
103
|
+
let filesValid = 0;
|
|
104
|
+
if (!existsSync(devkitDir)) {
|
|
105
|
+
errors.push({
|
|
106
|
+
file: '.devkit/',
|
|
107
|
+
line: 0,
|
|
108
|
+
field: 'directory',
|
|
109
|
+
message: '.devkit/ directory not found',
|
|
110
|
+
fix: 'Run "devkit init" to create .devkit/ structure',
|
|
111
|
+
});
|
|
112
|
+
return { errors, warnings, filesChecked: 0, filesValid: 0 };
|
|
113
|
+
}
|
|
114
|
+
// Check each known artifact
|
|
115
|
+
for (const schema of SCHEMAS) {
|
|
116
|
+
const filePath = join(devkitDir, schema.directory, schema.file);
|
|
117
|
+
if (!existsSync(filePath))
|
|
118
|
+
continue;
|
|
119
|
+
filesChecked++;
|
|
120
|
+
const fileErrors = validateFile(filePath, schema, devkitDir);
|
|
121
|
+
if (fileErrors.length === 0) {
|
|
122
|
+
filesValid++;
|
|
123
|
+
}
|
|
124
|
+
errors.push(...fileErrors);
|
|
125
|
+
}
|
|
126
|
+
// Also check decision files (ADR, RFC, INV)
|
|
127
|
+
const decisionsDir = join(devkitDir, 'arch', 'decisions');
|
|
128
|
+
if (existsSync(decisionsDir)) {
|
|
129
|
+
const files = readdirSync(decisionsDir).filter(f => f.endsWith('.md'));
|
|
130
|
+
for (const file of files) {
|
|
131
|
+
const filePath = join(decisionsDir, file);
|
|
132
|
+
filesChecked++;
|
|
133
|
+
let schemaType;
|
|
134
|
+
if (file.startsWith('ADR-')) {
|
|
135
|
+
schemaType = { id: 'arch.adr', file, directory: 'arch/decisions', requiredSections: [] };
|
|
136
|
+
}
|
|
137
|
+
else if (file.startsWith('RFC-')) {
|
|
138
|
+
schemaType = { id: 'arch.rfc', file, directory: 'arch/decisions', requiredSections: [] };
|
|
139
|
+
}
|
|
140
|
+
else if (file.startsWith('INV-')) {
|
|
141
|
+
schemaType = { id: 'arch.inv', file, directory: 'arch/decisions', requiredSections: [] };
|
|
142
|
+
}
|
|
143
|
+
if (schemaType) {
|
|
144
|
+
const fileErrors = validateFile(filePath, schemaType, devkitDir);
|
|
145
|
+
if (fileErrors.length === 0)
|
|
146
|
+
filesValid++;
|
|
147
|
+
errors.push(...fileErrors);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return { errors, warnings, filesChecked, filesValid };
|
|
152
|
+
}
|
|
153
|
+
export function formatValidation(result) {
|
|
154
|
+
const lines = [];
|
|
155
|
+
if (result.filesChecked === 0) {
|
|
156
|
+
lines.push('ā ļø No artifacts found to validate.');
|
|
157
|
+
lines.push(' Run "devkit init" and create artifacts in .devkit/');
|
|
158
|
+
return lines.join('\n');
|
|
159
|
+
}
|
|
160
|
+
lines.push(`Checked ${result.filesChecked} artifact(s)\n`);
|
|
161
|
+
if (result.errors.length === 0) {
|
|
162
|
+
lines.push(`ā
All ${result.filesValid} artifact(s) valid!`);
|
|
163
|
+
return lines.join('\n');
|
|
164
|
+
}
|
|
165
|
+
lines.push(`ā Found ${result.errors.length} error(s):\n`);
|
|
166
|
+
// Group by file
|
|
167
|
+
const byFile = new Map();
|
|
168
|
+
for (const err of result.errors) {
|
|
169
|
+
const list = byFile.get(err.file) ?? [];
|
|
170
|
+
list.push(err);
|
|
171
|
+
byFile.set(err.file, list);
|
|
172
|
+
}
|
|
173
|
+
for (const [file, errs] of byFile) {
|
|
174
|
+
lines.push(` š ${file}`);
|
|
175
|
+
for (const err of errs) {
|
|
176
|
+
const loc = err.line > 0 ? `:${err.line}` : '';
|
|
177
|
+
lines.push(` ā ${err.message}`);
|
|
178
|
+
lines.push(` ā Fix: ${err.fix}`);
|
|
179
|
+
}
|
|
180
|
+
lines.push('');
|
|
181
|
+
}
|
|
182
|
+
lines.push(`${result.filesValid}/${result.filesChecked} valid`);
|
|
183
|
+
return lines.join('\n');
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAW,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAuB,MAAM,cAAc,CAAC;AAiB/E,SAAS,YAAY,CAAC,OAAe;IACjC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5C,IAAI,KAAK,EAAE,CAAC;YACR,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1C,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,oBAAoB,CACzB,OAAe,EACf,YAAoB,EACpB,gBAA+B;IAE/B,MAAM,MAAM,GAAG,IAAI,GAAG,EAA2C,CAAC;IAClE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;IAEnE,KAAK,IAAI,CAAC,GAAG,YAAY,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U,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,iBAAiB,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;QAC3C,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,YAAY,QAAQ,CAAC,CAAC;IAChE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
package/dist/watch.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":"AAKA,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAoC/C"}
|
package/dist/watch.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { watch } from 'chokidar';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { validateArtifacts, formatValidation } from './validator.js';
|
|
5
|
+
export function watchValidate(cwd) {
|
|
6
|
+
const devkitDir = join(cwd, '.devkit');
|
|
7
|
+
console.log(chalk.bold('\nšļø Watch Mode ā Validating on file changes\n'));
|
|
8
|
+
console.log(chalk.dim(` Watching: ${devkitDir}/**/*.md`));
|
|
9
|
+
console.log(chalk.dim(' Press Ctrl+C to stop.\n'));
|
|
10
|
+
// Run initial validation
|
|
11
|
+
runValidation(cwd);
|
|
12
|
+
// Watch .devkit/ for changes
|
|
13
|
+
const watcher = watch(join(devkitDir, '**/*.md'), {
|
|
14
|
+
ignoreInitial: true,
|
|
15
|
+
awaitWriteFinish: {
|
|
16
|
+
stabilityThreshold: 300,
|
|
17
|
+
pollInterval: 100,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
watcher.on('change', (path) => {
|
|
21
|
+
const relative = path.replace(cwd + '/', '');
|
|
22
|
+
console.log(chalk.cyan(`\n š Changed: ${relative}`));
|
|
23
|
+
runValidation(cwd);
|
|
24
|
+
});
|
|
25
|
+
watcher.on('add', (path) => {
|
|
26
|
+
const relative = path.replace(cwd + '/', '');
|
|
27
|
+
console.log(chalk.green(`\n ā Added: ${relative}`));
|
|
28
|
+
runValidation(cwd);
|
|
29
|
+
});
|
|
30
|
+
watcher.on('unlink', (path) => {
|
|
31
|
+
const relative = path.replace(cwd + '/', '');
|
|
32
|
+
console.log(chalk.red(`\n ā Removed: ${relative}`));
|
|
33
|
+
runValidation(cwd);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function runValidation(cwd) {
|
|
37
|
+
const time = new Date().toLocaleTimeString();
|
|
38
|
+
console.log(chalk.dim(` āāā ${time} āāā`));
|
|
39
|
+
const result = validateArtifacts(cwd);
|
|
40
|
+
console.log(formatValidation(result));
|
|
41
|
+
if (result.errors.length === 0) {
|
|
42
|
+
console.log(chalk.green(' ā
All clear!'));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
console.log(chalk.red(` ā ${result.errors.length} error(s)`));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../src/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAErE,MAAM,UAAU,aAAa,CAAC,GAAW;IACrC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAEvC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,kDAAkD,C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CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,QAAQ,EAAE,CAAC,CAAC,CAAC;QACrD,aAAa,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,aAAa,CAAC,GAAW;IAC9B,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,kBAAkB,EAAE,CAAC;IAC7C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM,CAAC,CAAC,CAAC;IAE5C,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IAEtC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,WAAW,CAAC,CAAC,CAAC;IACnE,CAAC;AACL,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@x0rium/devkit-cli",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "CLI for DevKit ā AI-Native Development Methodology",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/x0rium/DevKit"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/x0rium/DevKit#readme",
|
|
14
|
+
"bin": {
|
|
15
|
+
"devkit": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "tsc --watch",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"devkit",
|
|
25
|
+
"ai",
|
|
26
|
+
"methodology",
|
|
27
|
+
"agent-skills",
|
|
28
|
+
"spec-driven"
|
|
29
|
+
],
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"ajv": "^8.17.1",
|
|
36
|
+
"chalk": "^5.4.1",
|
|
37
|
+
"chokidar": "^5.0.0",
|
|
38
|
+
"commander": "^13.1.0",
|
|
39
|
+
"glob": "^11.0.1",
|
|
40
|
+
"gray-matter": "^4.0.3"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^22.0.0",
|
|
44
|
+
"typescript": "^5.7.0",
|
|
45
|
+
"vitest": "^3.0.0"
|
|
46
|
+
}
|
|
47
|
+
}
|