@millstone/synapse-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/README.md +135 -0
- package/bin/synapse.js +3 -0
- package/dist/commands/eject.d.ts +19 -0
- package/dist/commands/eject.d.ts.map +1 -0
- package/dist/commands/eject.js +146 -0
- package/dist/commands/eject.js.map +1 -0
- package/dist/commands/fetch-reference.d.ts +19 -0
- package/dist/commands/fetch-reference.d.ts.map +1 -0
- package/dist/commands/fetch-reference.js +93 -0
- package/dist/commands/fetch-reference.js.map +1 -0
- package/dist/commands/format.d.ts +26 -0
- package/dist/commands/format.d.ts.map +1 -0
- package/dist/commands/format.js +126 -0
- package/dist/commands/format.js.map +1 -0
- package/dist/commands/generate-pdf.d.ts +19 -0
- package/dist/commands/generate-pdf.d.ts.map +1 -0
- package/dist/commands/generate-pdf.js +140 -0
- package/dist/commands/generate-pdf.js.map +1 -0
- package/dist/commands/index.d.ts +17 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +26 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +58 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +234 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/migrate.d.ts +29 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +297 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/scaffold.d.ts +24 -0
- package/dist/commands/scaffold.d.ts.map +1 -0
- package/dist/commands/scaffold.js +244 -0
- package/dist/commands/scaffold.js.map +1 -0
- package/dist/commands/update.d.ts +25 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +253 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +37 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +526 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +277 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/bodyRules.d.ts +70 -0
- package/dist/lib/bodyRules.d.ts.map +1 -0
- package/dist/lib/bodyRules.js +711 -0
- package/dist/lib/bodyRules.js.map +1 -0
- package/dist/lib/config.d.ts +49 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +91 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/git.d.ts +99 -0
- package/dist/lib/git.d.ts.map +1 -0
- package/dist/lib/git.js +266 -0
- package/dist/lib/git.js.map +1 -0
- package/dist/lib/graph.d.ts +6 -0
- package/dist/lib/graph.d.ts.map +1 -0
- package/dist/lib/graph.js +6 -0
- package/dist/lib/graph.js.map +1 -0
- package/dist/lib/homepage.d.ts +10 -0
- package/dist/lib/homepage.d.ts.map +1 -0
- package/dist/lib/homepage.js +172 -0
- package/dist/lib/homepage.js.map +1 -0
- package/dist/lib/markdown.d.ts +107 -0
- package/dist/lib/markdown.d.ts.map +1 -0
- package/dist/lib/markdown.js +318 -0
- package/dist/lib/markdown.js.map +1 -0
- package/dist/lib/mode-detection.d.ts +10 -0
- package/dist/lib/mode-detection.d.ts.map +1 -0
- package/dist/lib/mode-detection.js +29 -0
- package/dist/lib/mode-detection.js.map +1 -0
- package/dist/lib/naming.d.ts +47 -0
- package/dist/lib/naming.d.ts.map +1 -0
- package/dist/lib/naming.js +403 -0
- package/dist/lib/naming.js.map +1 -0
- package/dist/lib/schemas.d.ts +38 -0
- package/dist/lib/schemas.d.ts.map +1 -0
- package/dist/lib/schemas.js +248 -0
- package/dist/lib/schemas.js.map +1 -0
- package/dist/lib/templateLint.d.ts +21 -0
- package/dist/lib/templateLint.d.ts.map +1 -0
- package/dist/lib/templateLint.js +243 -0
- package/dist/lib/templateLint.js.map +1 -0
- package/dist/lib/templates.d.ts +53 -0
- package/dist/lib/templates.d.ts.map +1 -0
- package/dist/lib/templates.js +128 -0
- package/dist/lib/templates.js.map +1 -0
- package/dist/lib/tracking.d.ts +52 -0
- package/dist/lib/tracking.d.ts.map +1 -0
- package/dist/lib/tracking.js +135 -0
- package/dist/lib/tracking.js.map +1 -0
- package/dist/lib/types.generated.d.ts +54 -0
- package/dist/lib/types.generated.d.ts.map +1 -0
- package/dist/lib/types.generated.js +144 -0
- package/dist/lib/types.generated.js.map +1 -0
- package/dist/lib/validate-plugins.d.ts +22 -0
- package/dist/lib/validate-plugins.d.ts.map +1 -0
- package/dist/lib/validate-plugins.js +851 -0
- package/dist/lib/validate-plugins.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
import fsExtra from "fs-extra";
|
|
2
|
+
const fs = fsExtra;
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
import glob from "fast-glob";
|
|
5
|
+
import { loadSchema, validateFrontmatter } from "../lib/schemas.js";
|
|
6
|
+
import { validateNaming } from "../lib/naming.js";
|
|
7
|
+
import { parseDocument, extractWikilinks, validateWikilinkExists, } from "../lib/markdown.js";
|
|
8
|
+
import { isDocType } from "../lib/types.generated.js";
|
|
9
|
+
import { loadBodyRules, validateBody } from "../lib/bodyRules.js";
|
|
10
|
+
import { validatePluginMarketplace } from "../lib/validate-plugins.js";
|
|
11
|
+
/**
|
|
12
|
+
* Validates that content directories don't have duplicate numeric prefixes
|
|
13
|
+
*/
|
|
14
|
+
async function validateDirectoryPrefixes(contentDir) {
|
|
15
|
+
const issues = [];
|
|
16
|
+
try {
|
|
17
|
+
const entries = await fs.readdir(contentDir, { withFileTypes: true });
|
|
18
|
+
const directories = entries.filter((e) => e.isDirectory());
|
|
19
|
+
// Extract numeric prefixes from directory names
|
|
20
|
+
const prefixMap = new Map();
|
|
21
|
+
for (const dir of directories) {
|
|
22
|
+
const match = dir.name.match(/^(\d+)_/);
|
|
23
|
+
if (match) {
|
|
24
|
+
const prefix = match[1];
|
|
25
|
+
if (!prefixMap.has(prefix)) {
|
|
26
|
+
prefixMap.set(prefix, []);
|
|
27
|
+
}
|
|
28
|
+
prefixMap.get(prefix).push(dir.name);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Check for duplicates
|
|
32
|
+
for (const [prefix, dirs] of prefixMap.entries()) {
|
|
33
|
+
if (dirs.length > 1) {
|
|
34
|
+
issues.push({
|
|
35
|
+
type: "error",
|
|
36
|
+
code: "DUPLICATE_PREFIX",
|
|
37
|
+
message: `Multiple directories with prefix ${prefix}_: ${dirs.join(", ")}. Each directory must have a unique numeric prefix.`,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
// Ignore errors reading directory
|
|
44
|
+
}
|
|
45
|
+
return issues;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Validates cross-link rules for different document types
|
|
49
|
+
*/
|
|
50
|
+
function validateCrossLinks(frontmatter, body, filePath, existingFiles) {
|
|
51
|
+
const issues = [];
|
|
52
|
+
const docType = frontmatter.type;
|
|
53
|
+
if (!docType || !isDocType(docType)) {
|
|
54
|
+
return issues;
|
|
55
|
+
}
|
|
56
|
+
// Extract wikilinks from body
|
|
57
|
+
const wikilinks = extractWikilinks(body);
|
|
58
|
+
// Validate that all wikilinks point to existing documents
|
|
59
|
+
for (const link of wikilinks) {
|
|
60
|
+
if (!validateWikilinkExists(link, existingFiles)) {
|
|
61
|
+
issues.push({
|
|
62
|
+
type: "error",
|
|
63
|
+
code: "BROKEN_LINK",
|
|
64
|
+
message: `Referenced document does not exist: [[${link}]]`,
|
|
65
|
+
file: filePath,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Validate cross-link rules based on document type
|
|
70
|
+
switch (docType) {
|
|
71
|
+
case "process":
|
|
72
|
+
// Process documents must reference at least one standard
|
|
73
|
+
if (!frontmatter.related_standards ||
|
|
74
|
+
!Array.isArray(frontmatter.related_standards) ||
|
|
75
|
+
frontmatter.related_standards.length === 0) {
|
|
76
|
+
issues.push({
|
|
77
|
+
type: "error",
|
|
78
|
+
code: "MISSING_REQUIRED_LINK",
|
|
79
|
+
message: "Process documents must reference at least one standard",
|
|
80
|
+
file: filePath,
|
|
81
|
+
field: "related_standards",
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// Validate that referenced standards exist
|
|
86
|
+
for (const standard of frontmatter.related_standards) {
|
|
87
|
+
const standardLink = extractWikilinks(standard)[0];
|
|
88
|
+
if (standardLink &&
|
|
89
|
+
!validateWikilinkExists(standardLink, existingFiles)) {
|
|
90
|
+
issues.push({
|
|
91
|
+
type: "error",
|
|
92
|
+
code: "BROKEN_LINK",
|
|
93
|
+
message: `Referenced standard does not exist: ${standard}`,
|
|
94
|
+
file: filePath,
|
|
95
|
+
field: "related_standards",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
case "sop":
|
|
102
|
+
// SOP must reference a parent process
|
|
103
|
+
if (!frontmatter.related_process ||
|
|
104
|
+
typeof frontmatter.related_process !== "string" ||
|
|
105
|
+
frontmatter.related_process.trim() === "") {
|
|
106
|
+
issues.push({
|
|
107
|
+
type: "error",
|
|
108
|
+
code: "MISSING_REQUIRED_LINK",
|
|
109
|
+
message: "SOP must reference a parent process",
|
|
110
|
+
file: filePath,
|
|
111
|
+
field: "related_process",
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
// Validate that referenced process exists
|
|
116
|
+
const processLink = extractWikilinks(frontmatter.related_process)[0];
|
|
117
|
+
if (processLink &&
|
|
118
|
+
!validateWikilinkExists(processLink, existingFiles)) {
|
|
119
|
+
issues.push({
|
|
120
|
+
type: "error",
|
|
121
|
+
code: "BROKEN_LINK",
|
|
122
|
+
message: `Referenced process does not exist: ${frontmatter.related_process}`,
|
|
123
|
+
file: filePath,
|
|
124
|
+
field: "related_process",
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
129
|
+
case "runbook":
|
|
130
|
+
// Runbook must reference a system/service (in body under ## Service section)
|
|
131
|
+
const serviceMatch = body.match(/##\s+Service\s*\n+([^\n#]+)/);
|
|
132
|
+
const serviceContent = serviceMatch ? serviceMatch[1].trim() : "";
|
|
133
|
+
const serviceLinks = extractWikilinks(serviceContent);
|
|
134
|
+
if (!serviceContent || serviceLinks.length === 0) {
|
|
135
|
+
issues.push({
|
|
136
|
+
type: "error",
|
|
137
|
+
code: "MISSING_REQUIRED_LINK",
|
|
138
|
+
message: "Runbook must reference a system/service",
|
|
139
|
+
file: filePath,
|
|
140
|
+
field: "service",
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
// Validate that referenced service exists
|
|
145
|
+
for (const serviceLink of serviceLinks) {
|
|
146
|
+
if (!validateWikilinkExists(serviceLink, existingFiles)) {
|
|
147
|
+
issues.push({
|
|
148
|
+
type: "error",
|
|
149
|
+
code: "BROKEN_LINK",
|
|
150
|
+
message: `Referenced service does not exist: [[${serviceLink}]]`,
|
|
151
|
+
file: filePath,
|
|
152
|
+
field: "service",
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
return issues;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Validates a single document
|
|
163
|
+
*/
|
|
164
|
+
async function validateDocument(filePath, contentDir, schemaDir, existingFiles, bodyRules, // BodyRules type from bodyRules.ts
|
|
165
|
+
strict = true) {
|
|
166
|
+
const issues = [];
|
|
167
|
+
try {
|
|
168
|
+
// Read file content
|
|
169
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
170
|
+
const parsed = parseDocument(content);
|
|
171
|
+
// Check for YAML parse errors
|
|
172
|
+
if (parsed.error) {
|
|
173
|
+
issues.push({
|
|
174
|
+
type: "error",
|
|
175
|
+
code: "YAML_PARSE_ERROR",
|
|
176
|
+
message: `Invalid YAML in frontmatter: ${parsed.error}`,
|
|
177
|
+
file: filePath,
|
|
178
|
+
});
|
|
179
|
+
return issues; // Can't continue validation without valid frontmatter
|
|
180
|
+
}
|
|
181
|
+
const { frontmatter, body } = parsed;
|
|
182
|
+
// Get document type
|
|
183
|
+
const docType = frontmatter.type;
|
|
184
|
+
if (!docType || !isDocType(docType)) {
|
|
185
|
+
issues.push({
|
|
186
|
+
type: "error",
|
|
187
|
+
code: "INVALID_DOC_TYPE",
|
|
188
|
+
message: `Invalid or missing document type: ${docType}`,
|
|
189
|
+
file: filePath,
|
|
190
|
+
field: "type",
|
|
191
|
+
});
|
|
192
|
+
return issues;
|
|
193
|
+
}
|
|
194
|
+
// Load and validate against schema
|
|
195
|
+
const schema = await loadSchema(docType, schemaDir);
|
|
196
|
+
const schemaValidation = validateFrontmatter(frontmatter, schema);
|
|
197
|
+
if (!schemaValidation.valid && schemaValidation.errors) {
|
|
198
|
+
for (const error of schemaValidation.errors) {
|
|
199
|
+
issues.push({
|
|
200
|
+
type: "error",
|
|
201
|
+
code: "SCHEMA_VALIDATION_ERROR",
|
|
202
|
+
message: `Schema validation: ${error.path} ${error.message}`,
|
|
203
|
+
file: filePath,
|
|
204
|
+
field: error.path || undefined,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// Validate body structure (AST-based validation)
|
|
209
|
+
if (bodyRules) {
|
|
210
|
+
const relativePath = path.relative(contentDir, filePath);
|
|
211
|
+
const bodyIssues = validateBody(body, bodyRules, docType, relativePath);
|
|
212
|
+
// Map body validation issues to include file path
|
|
213
|
+
issues.push(...bodyIssues.map((issue) => ({
|
|
214
|
+
...issue,
|
|
215
|
+
file: filePath,
|
|
216
|
+
})));
|
|
217
|
+
}
|
|
218
|
+
// Validate naming conventions
|
|
219
|
+
const relativePath = path.relative(contentDir, filePath);
|
|
220
|
+
const projectRoot = path.resolve(contentDir, '..');
|
|
221
|
+
const namingIssues = validateNaming(relativePath, frontmatter, strict, projectRoot);
|
|
222
|
+
issues.push(...namingIssues.map((issue) => ({
|
|
223
|
+
...issue,
|
|
224
|
+
file: filePath,
|
|
225
|
+
})));
|
|
226
|
+
// Validate cross-links
|
|
227
|
+
const crossLinkIssues = validateCrossLinks(frontmatter, body, filePath, existingFiles);
|
|
228
|
+
issues.push(...crossLinkIssues);
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
issues.push({
|
|
232
|
+
type: "error",
|
|
233
|
+
code: "VALIDATION_FAILED",
|
|
234
|
+
message: `Failed to validate file: ${error}`,
|
|
235
|
+
file: filePath,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
return issues;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Main validation function
|
|
242
|
+
*/
|
|
243
|
+
export async function validate(options) {
|
|
244
|
+
// Better directory resolution that works from any location
|
|
245
|
+
let contentDir = options.contentDir;
|
|
246
|
+
if (!contentDir) {
|
|
247
|
+
// Try to find content directory relative to cwd
|
|
248
|
+
const cwdContent = path.resolve(process.cwd(), "content");
|
|
249
|
+
const parentContent = path.resolve(process.cwd(), "../content");
|
|
250
|
+
const grandparentContent = path.resolve(process.cwd(), "../../content");
|
|
251
|
+
if (await fs.pathExists(cwdContent)) {
|
|
252
|
+
contentDir = cwdContent;
|
|
253
|
+
}
|
|
254
|
+
else if (await fs.pathExists(parentContent)) {
|
|
255
|
+
contentDir = parentContent;
|
|
256
|
+
}
|
|
257
|
+
else if (await fs.pathExists(grandparentContent)) {
|
|
258
|
+
contentDir = grandparentContent;
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
// Default fallback
|
|
262
|
+
contentDir = cwdContent;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
// Resolve the provided path
|
|
267
|
+
contentDir = path.resolve(process.cwd(), contentDir);
|
|
268
|
+
}
|
|
269
|
+
// Schema dir should be at project root, not inside content
|
|
270
|
+
const projectRoot = path.resolve(contentDir, '..');
|
|
271
|
+
const schemaDir = options.schemaDir || path.resolve(projectRoot, "schemas/frontmatter");
|
|
272
|
+
const pattern = options.pattern || "**/*.md";
|
|
273
|
+
const strict = options.strict !== undefined ? options.strict : true; // Default to strict mode
|
|
274
|
+
const allIssues = [];
|
|
275
|
+
let filesValidated = 0;
|
|
276
|
+
try {
|
|
277
|
+
// Load body validation rules
|
|
278
|
+
let bodyRules = null;
|
|
279
|
+
try {
|
|
280
|
+
bodyRules = await loadBodyRules();
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
// Body rules are optional - if they don't exist, skip body validation
|
|
284
|
+
console.warn('Warning: Body rules not found, skipping body validation');
|
|
285
|
+
}
|
|
286
|
+
// Validate directory structure first
|
|
287
|
+
const directoryIssues = await validateDirectoryPrefixes(contentDir);
|
|
288
|
+
allIssues.push(...directoryIssues);
|
|
289
|
+
// Get all markdown files to validate
|
|
290
|
+
const files = await glob(pattern, {
|
|
291
|
+
cwd: contentDir,
|
|
292
|
+
absolute: true,
|
|
293
|
+
ignore: [
|
|
294
|
+
"**/node_modules/**",
|
|
295
|
+
"**/.git/**",
|
|
296
|
+
"**/templates/**",
|
|
297
|
+
"index.md",
|
|
298
|
+
],
|
|
299
|
+
});
|
|
300
|
+
// Build set of ALL existing files in the vault for cross-reference validation
|
|
301
|
+
// This needs to include files from the entire content root, not just the validation directory
|
|
302
|
+
const existingFiles = new Set();
|
|
303
|
+
// Find the root content directory (go up from contentDir until we find the base)
|
|
304
|
+
let rootContentDir = contentDir;
|
|
305
|
+
const pathParts = contentDir.split(path.sep);
|
|
306
|
+
for (let i = pathParts.length - 1; i >= 0; i--) {
|
|
307
|
+
if (pathParts[i] === "content") {
|
|
308
|
+
rootContentDir = pathParts.slice(0, i + 1).join(path.sep);
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
// Get ALL markdown files from the root for link validation
|
|
313
|
+
const allVaultFiles = await glob("**/*.md", {
|
|
314
|
+
cwd: rootContentDir,
|
|
315
|
+
absolute: true,
|
|
316
|
+
ignore: [
|
|
317
|
+
"**/node_modules/**",
|
|
318
|
+
"**/.git/**",
|
|
319
|
+
"**/templates/**",
|
|
320
|
+
"index.md",
|
|
321
|
+
],
|
|
322
|
+
});
|
|
323
|
+
// Add all vault files to the set for cross-reference checking
|
|
324
|
+
for (const file of allVaultFiles) {
|
|
325
|
+
const relativePath = path.relative(rootContentDir, file);
|
|
326
|
+
existingFiles.add(relativePath);
|
|
327
|
+
existingFiles.add(path.basename(file));
|
|
328
|
+
existingFiles.add(path.basename(file, ".md"));
|
|
329
|
+
}
|
|
330
|
+
// Validate each file
|
|
331
|
+
for (const file of files) {
|
|
332
|
+
const issues = await validateDocument(file, rootContentDir, // Use root content dir for proper relative paths
|
|
333
|
+
schemaDir, existingFiles, bodyRules, strict);
|
|
334
|
+
allIssues.push(...issues);
|
|
335
|
+
filesValidated++;
|
|
336
|
+
}
|
|
337
|
+
// Check for duplicate titles across all documents
|
|
338
|
+
const titleMap = new Map();
|
|
339
|
+
for (const file of files) {
|
|
340
|
+
try {
|
|
341
|
+
const content = await fs.readFile(file, "utf-8");
|
|
342
|
+
const { frontmatter } = parseDocument(content);
|
|
343
|
+
if (frontmatter.title && frontmatter.type) {
|
|
344
|
+
// Create a normalized key for comparison
|
|
345
|
+
const normalizedTitle = frontmatter.title
|
|
346
|
+
.toLowerCase()
|
|
347
|
+
.replace(/[^\w\s-]/g, "")
|
|
348
|
+
.replace(/\s+/g, "-")
|
|
349
|
+
.replace(/-+/g, "-")
|
|
350
|
+
.trim();
|
|
351
|
+
// Group by type and normalized title
|
|
352
|
+
const key = `${frontmatter.type}:${normalizedTitle}`;
|
|
353
|
+
if (!titleMap.has(key)) {
|
|
354
|
+
titleMap.set(key, []);
|
|
355
|
+
}
|
|
356
|
+
titleMap.get(key).push(path.relative(contentDir, file));
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
catch (error) {
|
|
360
|
+
// Skip files that can't be parsed for duplicate detection
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
// Report duplicates (excluding examples as they're expected to have similar titles)
|
|
364
|
+
for (const [key, paths] of titleMap.entries()) {
|
|
365
|
+
const nonExamplePaths = paths.filter((p) => !p.includes("00_Guides/Examples/"));
|
|
366
|
+
if (nonExamplePaths.length > 1) {
|
|
367
|
+
const [type, title] = key.split(":", 2);
|
|
368
|
+
allIssues.push({
|
|
369
|
+
type: "warning",
|
|
370
|
+
code: "DUPLICATE_TITLE",
|
|
371
|
+
message: `Multiple ${type} documents with similar title may cause confusion: ${nonExamplePaths.join(", ")}`,
|
|
372
|
+
file: "", // No specific file, it's a cross-file issue
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
// Validate plugins if marketplace manifest exists
|
|
377
|
+
const marketplacePath = path.join(projectRoot, '.claude-plugin/marketplace.json');
|
|
378
|
+
if (await fs.pathExists(marketplacePath)) {
|
|
379
|
+
try {
|
|
380
|
+
const pluginSchemaDir = path.join(projectRoot, 'schemas/plugins');
|
|
381
|
+
const pluginResult = await validatePluginMarketplace(projectRoot, pluginSchemaDir);
|
|
382
|
+
// Merge plugin issues into main validation
|
|
383
|
+
allIssues.push(...pluginResult.issues);
|
|
384
|
+
}
|
|
385
|
+
catch (error) {
|
|
386
|
+
allIssues.push({
|
|
387
|
+
type: "error",
|
|
388
|
+
code: "PLUGIN_VALIDATION_FAILED",
|
|
389
|
+
message: `Plugin validation failed: ${error}`,
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return {
|
|
394
|
+
success: allIssues.filter((i) => i.type === "error").length === 0,
|
|
395
|
+
issues: allIssues,
|
|
396
|
+
filesValidated,
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
catch (error) {
|
|
400
|
+
return {
|
|
401
|
+
success: false,
|
|
402
|
+
issues: [
|
|
403
|
+
{
|
|
404
|
+
type: "error",
|
|
405
|
+
code: "VALIDATION_FAILED",
|
|
406
|
+
message: `Validation failed: ${error}`,
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
filesValidated,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* CLI handler for validate command
|
|
415
|
+
*/
|
|
416
|
+
export async function validateCommand(args) {
|
|
417
|
+
// Handle special case where dir is '.' - treat as current directory
|
|
418
|
+
let contentDir = args.dir;
|
|
419
|
+
if (contentDir === ".") {
|
|
420
|
+
contentDir = process.cwd();
|
|
421
|
+
}
|
|
422
|
+
// Determine project root for plugin validation
|
|
423
|
+
let projectRoot = process.cwd();
|
|
424
|
+
if (contentDir) {
|
|
425
|
+
projectRoot = path.resolve(contentDir, '..');
|
|
426
|
+
}
|
|
427
|
+
const result = await validate({
|
|
428
|
+
contentDir: contentDir,
|
|
429
|
+
schemaDir: args.schema, // Updated to use args.schema
|
|
430
|
+
pattern: args.pattern,
|
|
431
|
+
strict: args.strict, // Will default to true if not specified
|
|
432
|
+
});
|
|
433
|
+
// Get plugin validation results if marketplace exists
|
|
434
|
+
let pluginResult = null;
|
|
435
|
+
const marketplacePath = path.join(projectRoot, '.claude-plugin/marketplace.json');
|
|
436
|
+
if (await fs.pathExists(marketplacePath)) {
|
|
437
|
+
try {
|
|
438
|
+
const pluginSchemaDir = path.join(projectRoot, 'schemas/plugins');
|
|
439
|
+
pluginResult = await validatePluginMarketplace(projectRoot, pluginSchemaDir);
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
// Error already captured in main validation
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
const errors = result.issues.filter((i) => i.type === "error");
|
|
446
|
+
const warnings = result.issues.filter((i) => i.type === "warning");
|
|
447
|
+
// Handle different output formats
|
|
448
|
+
if (args.format === "json") {
|
|
449
|
+
// Count files with errors (not total errors)
|
|
450
|
+
const filesWithErrors = new Set(errors.map((e) => e.file).filter((f) => f))
|
|
451
|
+
.size;
|
|
452
|
+
const validFiles = result.filesValidated - filesWithErrors;
|
|
453
|
+
// Output JSON format
|
|
454
|
+
const jsonOutput = {
|
|
455
|
+
errors: errors,
|
|
456
|
+
warnings: warnings,
|
|
457
|
+
summary: {
|
|
458
|
+
total: result.filesValidated,
|
|
459
|
+
valid: validFiles,
|
|
460
|
+
errors: errors.length,
|
|
461
|
+
warnings: warnings.length,
|
|
462
|
+
},
|
|
463
|
+
};
|
|
464
|
+
console.log(JSON.stringify(jsonOutput, null, 2));
|
|
465
|
+
}
|
|
466
|
+
else if (args.format === "compact") {
|
|
467
|
+
// Compact format - one line per issue
|
|
468
|
+
for (const error of errors) {
|
|
469
|
+
console.log(`[E] ${error.file || "global"}: ${error.message}`);
|
|
470
|
+
}
|
|
471
|
+
for (const warning of warnings) {
|
|
472
|
+
console.log(`[W] ${warning.file || "global"}: ${warning.message}`);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
else if (!args.quiet) {
|
|
476
|
+
// Default pretty format
|
|
477
|
+
console.log(`\nValidated ${result.filesValidated} files\n`);
|
|
478
|
+
// Show plugin validation summary if plugins were validated
|
|
479
|
+
if (pluginResult) {
|
|
480
|
+
console.log('Plugin validation:');
|
|
481
|
+
console.log(` Plugins validated: ${pluginResult.pluginsValidated}`);
|
|
482
|
+
const { componentsValidated } = pluginResult;
|
|
483
|
+
if (componentsValidated.commands > 0) {
|
|
484
|
+
console.log(` Commands: ${componentsValidated.commands}`);
|
|
485
|
+
}
|
|
486
|
+
if (componentsValidated.agents > 0) {
|
|
487
|
+
console.log(` Agents: ${componentsValidated.agents}`);
|
|
488
|
+
}
|
|
489
|
+
if (componentsValidated.skills > 0) {
|
|
490
|
+
console.log(` Skills: ${componentsValidated.skills}`);
|
|
491
|
+
}
|
|
492
|
+
if (componentsValidated.hooks > 0) {
|
|
493
|
+
console.log(` Hooks: ${componentsValidated.hooks}`);
|
|
494
|
+
}
|
|
495
|
+
if (componentsValidated.mcpServers > 0) {
|
|
496
|
+
console.log(` MCP servers: ${componentsValidated.mcpServers}`);
|
|
497
|
+
}
|
|
498
|
+
console.log();
|
|
499
|
+
}
|
|
500
|
+
if (errors.length > 0) {
|
|
501
|
+
console.log(`❌ ${errors.length} errors:`);
|
|
502
|
+
for (const error of errors) {
|
|
503
|
+
console.log(` - ${error.file ? path.basename(error.file) + ": " : ""}${error.message}`);
|
|
504
|
+
}
|
|
505
|
+
console.log();
|
|
506
|
+
}
|
|
507
|
+
if (warnings.length > 0) {
|
|
508
|
+
console.log(`⚠️ ${warnings.length} warnings:`);
|
|
509
|
+
for (const warning of warnings) {
|
|
510
|
+
console.log(` - ${warning.file ? path.basename(warning.file) + ": " : ""}${warning.message}`);
|
|
511
|
+
}
|
|
512
|
+
console.log();
|
|
513
|
+
}
|
|
514
|
+
if (result.success) {
|
|
515
|
+
console.log("✅ All validations passed!");
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
console.log("❌ Validation failed");
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
// Exit with error code if validation failed
|
|
522
|
+
if (!result.success) {
|
|
523
|
+
process.exit(1);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,MAAM,EAAE,GAAG,OAAO,CAAC;AACnB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAW,S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