jekyll-component-mcp 0.0.0-stage → 1.0.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/CHANGELOG.md +18 -0
- package/LICENSE +21 -0
- package/README.md +153 -2
- package/dist/config/constants.d.ts +46 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +75 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/environment.d.ts +51 -0
- package/dist/config/environment.d.ts.map +1 -0
- package/dist/config/environment.js +102 -0
- package/dist/config/environment.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +86 -0
- package/dist/index.js.map +1 -0
- package/dist/parsers/frontmatter-parser.d.ts +19 -0
- package/dist/parsers/frontmatter-parser.d.ts.map +1 -0
- package/dist/parsers/frontmatter-parser.js +71 -0
- package/dist/parsers/frontmatter-parser.js.map +1 -0
- package/dist/parsers/liquid-parser.d.ts +33 -0
- package/dist/parsers/liquid-parser.d.ts.map +1 -0
- package/dist/parsers/liquid-parser.js +98 -0
- package/dist/parsers/liquid-parser.js.map +1 -0
- package/dist/parsers/project-scanner.d.ts +29 -0
- package/dist/parsers/project-scanner.d.ts.map +1 -0
- package/dist/parsers/project-scanner.js +194 -0
- package/dist/parsers/project-scanner.js.map +1 -0
- package/dist/parsers/scss-parser.d.ts +26 -0
- package/dist/parsers/scss-parser.d.ts.map +1 -0
- package/dist/parsers/scss-parser.js +90 -0
- package/dist/parsers/scss-parser.js.map +1 -0
- package/dist/security/command-policy.d.ts +21 -0
- package/dist/security/command-policy.d.ts.map +1 -0
- package/dist/security/command-policy.js +48 -0
- package/dist/security/command-policy.js.map +1 -0
- package/dist/security/path-policy.d.ts +31 -0
- package/dist/security/path-policy.d.ts.map +1 -0
- package/dist/security/path-policy.js +127 -0
- package/dist/security/path-policy.js.map +1 -0
- package/dist/security/validation.d.ts +18 -0
- package/dist/security/validation.d.ts.map +1 -0
- package/dist/security/validation.js +59 -0
- package/dist/security/validation.js.map +1 -0
- package/dist/server/context.d.ts +18 -0
- package/dist/server/context.d.ts.map +1 -0
- package/dist/server/context.js +34 -0
- package/dist/server/context.js.map +1 -0
- package/dist/server/create-server.d.ts +8 -0
- package/dist/server/create-server.d.ts.map +1 -0
- package/dist/server/create-server.js +546 -0
- package/dist/server/create-server.js.map +1 -0
- package/dist/services/build-service.d.ts +27 -0
- package/dist/services/build-service.d.ts.map +1 -0
- package/dist/services/build-service.js +85 -0
- package/dist/services/build-service.js.map +1 -0
- package/dist/services/component-service.d.ts +74 -0
- package/dist/services/component-service.d.ts.map +1 -0
- package/dist/services/component-service.js +422 -0
- package/dist/services/component-service.js.map +1 -0
- package/dist/services/documentation-service.d.ts +64 -0
- package/dist/services/documentation-service.d.ts.map +1 -0
- package/dist/services/documentation-service.js +186 -0
- package/dist/services/documentation-service.js.map +1 -0
- package/dist/services/liquid-service.d.ts +31 -0
- package/dist/services/liquid-service.d.ts.map +1 -0
- package/dist/services/liquid-service.js +103 -0
- package/dist/services/liquid-service.js.map +1 -0
- package/dist/services/project-service.d.ts +30 -0
- package/dist/services/project-service.d.ts.map +1 -0
- package/dist/services/project-service.js +102 -0
- package/dist/services/project-service.js.map +1 -0
- package/dist/services/scss-service.d.ts +37 -0
- package/dist/services/scss-service.d.ts.map +1 -0
- package/dist/services/scss-service.js +82 -0
- package/dist/services/scss-service.js.map +1 -0
- package/dist/services/token-service.d.ts +29 -0
- package/dist/services/token-service.d.ts.map +1 -0
- package/dist/services/token-service.js +97 -0
- package/dist/services/token-service.js.map +1 -0
- package/dist/services/validation-service.d.ts +33 -0
- package/dist/services/validation-service.d.ts.map +1 -0
- package/dist/services/validation-service.js +101 -0
- package/dist/services/validation-service.js.map +1 -0
- package/dist/utils/filesystem.d.ts +38 -0
- package/dist/utils/filesystem.d.ts.map +1 -0
- package/dist/utils/filesystem.js +131 -0
- package/dist/utils/filesystem.js.map +1 -0
- package/dist/utils/json.d.ts +6 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +20 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +58 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/shell.d.ts +23 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +96 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/yaml.d.ts +15 -0
- package/dist/utils/yaml.d.ts.map +1 -0
- package/dist/utils/yaml.js +34 -0
- package/dist/utils/yaml.js.map +1 -0
- package/package.json +51 -4
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Front matter validation and parsing for Jekyll documents.
|
|
3
|
+
*/
|
|
4
|
+
import { extractFrontMatter } from "../utils/yaml.js";
|
|
5
|
+
const KNOWN_FIELDS = new Set([
|
|
6
|
+
"title",
|
|
7
|
+
"description",
|
|
8
|
+
"layout",
|
|
9
|
+
"permalink",
|
|
10
|
+
"date",
|
|
11
|
+
"categories",
|
|
12
|
+
"tags",
|
|
13
|
+
"author",
|
|
14
|
+
"image",
|
|
15
|
+
"published",
|
|
16
|
+
"sitemap",
|
|
17
|
+
"robots",
|
|
18
|
+
"excerpt",
|
|
19
|
+
"slug",
|
|
20
|
+
"name",
|
|
21
|
+
"variant",
|
|
22
|
+
"component",
|
|
23
|
+
]);
|
|
24
|
+
/**
|
|
25
|
+
* Validate front matter. Prefer warnings over hard errors for optional fields.
|
|
26
|
+
*/
|
|
27
|
+
export function validateFrontMatter(source) {
|
|
28
|
+
const { data, content } = extractFrontMatter(source);
|
|
29
|
+
const issues = [];
|
|
30
|
+
if (Object.keys(data).length === 0 && source.trimStart().startsWith("---")) {
|
|
31
|
+
issues.push({
|
|
32
|
+
field: "_root",
|
|
33
|
+
level: "warning",
|
|
34
|
+
message: "Front matter block appears present but could not be parsed",
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
// Soft checks
|
|
38
|
+
if (data.title !== undefined && typeof data.title !== "string") {
|
|
39
|
+
issues.push({ field: "title", level: "warning", message: "title should be a string" });
|
|
40
|
+
}
|
|
41
|
+
if (data.layout !== undefined && typeof data.layout !== "string") {
|
|
42
|
+
issues.push({ field: "layout", level: "warning", message: "layout should be a string" });
|
|
43
|
+
}
|
|
44
|
+
if (data.date !== undefined) {
|
|
45
|
+
const d = data.date;
|
|
46
|
+
if (!(d instanceof Date) && typeof d !== "string") {
|
|
47
|
+
issues.push({ field: "date", level: "warning", message: "date should be a string or date" });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (data.permalink !== undefined && typeof data.permalink !== "string") {
|
|
51
|
+
issues.push({
|
|
52
|
+
field: "permalink",
|
|
53
|
+
level: "warning",
|
|
54
|
+
message: "permalink should be a string",
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
// Unknown fields are fine in Jekyll; just note very unusual ones at debug level only
|
|
58
|
+
for (const key of Object.keys(data)) {
|
|
59
|
+
if (!KNOWN_FIELDS.has(key) && key.startsWith("_")) {
|
|
60
|
+
// ignore private
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const hasErrors = issues.some((i) => i.level === "error");
|
|
64
|
+
return {
|
|
65
|
+
data,
|
|
66
|
+
content,
|
|
67
|
+
issues,
|
|
68
|
+
valid: !hasErrors,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=frontmatter-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter-parser.js","sourceRoot":"","sources":["../../src/parsers/frontmatter-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAetD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,OAAO;IACP,aAAa;IACb,QAAQ;IACR,WAAW;IACX,MAAM;IACN,YAAY;IACZ,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QAAQ,EAAE,CAAC;YAClD,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC,CAAC;QAC/F,CAAC;IACH,CAAC;IACD,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;QACvE,MAAM,CAAC,IAAI,CAAC;YACV,KAAK,EAAE,WAAW;YAClB,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,8BAA8B;SACxC,CAAC,CAAC;IACL,CAAC;IAED,qFAAqF;IACrF,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACpC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAClD,iBAAiB;QACnB,CAAC;IACH,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC;IAC1D,OAAO;QACL,IAAI;QACJ,OAAO;QACP,MAAM;QACN,KAAK,EAAE,CAAC,SAAS;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Liquid source analysis (never executes Liquid).
|
|
3
|
+
* Detects include parameters, variants, and basic structural patterns.
|
|
4
|
+
*/
|
|
5
|
+
export interface LiquidParameter {
|
|
6
|
+
name: string;
|
|
7
|
+
usageCount: number;
|
|
8
|
+
examples: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface LiquidAnalysis {
|
|
11
|
+
parameters: LiquidParameter[];
|
|
12
|
+
hasCapture: boolean;
|
|
13
|
+
hasIf: boolean;
|
|
14
|
+
hasFor: boolean;
|
|
15
|
+
hasInclude: boolean;
|
|
16
|
+
hasAssign: boolean;
|
|
17
|
+
classNames: string[];
|
|
18
|
+
idAttributes: string[];
|
|
19
|
+
interactiveElements: string[];
|
|
20
|
+
accessibilityHints: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Analyze Liquid component source for metadata useful to agents.
|
|
24
|
+
*/
|
|
25
|
+
export declare function analyzeLiquid(source: string): LiquidAnalysis;
|
|
26
|
+
/**
|
|
27
|
+
* Basic Liquid syntax pattern checks (not a full parser).
|
|
28
|
+
*/
|
|
29
|
+
export declare function checkLiquidSyntax(source: string): {
|
|
30
|
+
errors: string[];
|
|
31
|
+
warnings: string[];
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=liquid-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquid-parser.d.ts","sourceRoot":"","sources":["../../src/parsers/liquid-parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B;AASD;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAoE5D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAsB1F"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Liquid source analysis (never executes Liquid).
|
|
3
|
+
* Detects include parameters, variants, and basic structural patterns.
|
|
4
|
+
*/
|
|
5
|
+
const INCLUDE_PARAM_RE = /include\.([a-zA-Z_][a-zA-Z0-9_]*)/g;
|
|
6
|
+
const CLASS_RE = /class\s*=\s*["']([^"']+)["']/gi;
|
|
7
|
+
const ID_RE = /\bid\s*=\s*["']([^"']+)["']/gi;
|
|
8
|
+
const INTERACTIVE_RE = /<(button|a|input|select|textarea|details|summary)\b/gi;
|
|
9
|
+
const ARIA_RE = /\baria-[a-z-]+\s*=/gi;
|
|
10
|
+
const ROLE_RE = /\brole\s*=\s*["']([^"']+)["']/gi;
|
|
11
|
+
/**
|
|
12
|
+
* Analyze Liquid component source for metadata useful to agents.
|
|
13
|
+
*/
|
|
14
|
+
export function analyzeLiquid(source) {
|
|
15
|
+
const paramMap = new Map();
|
|
16
|
+
let m;
|
|
17
|
+
const paramRe = new RegExp(INCLUDE_PARAM_RE.source, "g");
|
|
18
|
+
while ((m = paramRe.exec(source)) !== null) {
|
|
19
|
+
const name = m[1];
|
|
20
|
+
const entry = paramMap.get(name) ?? { count: 0, examples: [] };
|
|
21
|
+
entry.count += 1;
|
|
22
|
+
if (entry.examples.length < 3) {
|
|
23
|
+
const start = Math.max(0, m.index - 20);
|
|
24
|
+
const end = Math.min(source.length, m.index + m[0].length + 20);
|
|
25
|
+
entry.examples.push(source.slice(start, end).replace(/\s+/g, " ").trim());
|
|
26
|
+
}
|
|
27
|
+
paramMap.set(name, entry);
|
|
28
|
+
}
|
|
29
|
+
const parameters = [...paramMap.entries()]
|
|
30
|
+
.map(([name, v]) => ({ name, usageCount: v.count, examples: v.examples }))
|
|
31
|
+
.sort((a, b) => b.usageCount - a.usageCount);
|
|
32
|
+
const classNames = new Set();
|
|
33
|
+
const classRe = new RegExp(CLASS_RE.source, "gi");
|
|
34
|
+
while ((m = classRe.exec(source)) !== null) {
|
|
35
|
+
for (const c of m[1].split(/\s+/)) {
|
|
36
|
+
if (c)
|
|
37
|
+
classNames.add(c);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const idAttributes = new Set();
|
|
41
|
+
const idRe = new RegExp(ID_RE.source, "gi");
|
|
42
|
+
while ((m = idRe.exec(source)) !== null) {
|
|
43
|
+
if (m[1])
|
|
44
|
+
idAttributes.add(m[1]);
|
|
45
|
+
}
|
|
46
|
+
const interactiveElements = new Set();
|
|
47
|
+
const intRe = new RegExp(INTERACTIVE_RE.source, "gi");
|
|
48
|
+
while ((m = intRe.exec(source)) !== null) {
|
|
49
|
+
interactiveElements.add(m[1].toLowerCase());
|
|
50
|
+
}
|
|
51
|
+
const accessibilityHints = [];
|
|
52
|
+
if (interactiveElements.size > 0) {
|
|
53
|
+
const hasAria = ARIA_RE.test(source) || ROLE_RE.test(source);
|
|
54
|
+
if (!hasAria) {
|
|
55
|
+
accessibilityHints.push("Interactive elements present; consider ARIA attributes and keyboard support");
|
|
56
|
+
}
|
|
57
|
+
if (interactiveElements.has("button") || interactiveElements.has("a")) {
|
|
58
|
+
if (!/tabindex|@keydown|onkeydown|keyboard/i.test(source)) {
|
|
59
|
+
accessibilityHints.push("Interactive component may lack explicit keyboard behavior");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
parameters,
|
|
65
|
+
hasCapture: /\{\%\s*capture\b/.test(source),
|
|
66
|
+
hasIf: /\{\%\s*if\b/.test(source),
|
|
67
|
+
hasFor: /\{\%\s*for\b/.test(source),
|
|
68
|
+
hasInclude: /\{\%\s*include\b/.test(source),
|
|
69
|
+
hasAssign: /\{\%\s*assign\b/.test(source),
|
|
70
|
+
classNames: [...classNames],
|
|
71
|
+
idAttributes: [...idAttributes],
|
|
72
|
+
interactiveElements: [...interactiveElements],
|
|
73
|
+
accessibilityHints,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Basic Liquid syntax pattern checks (not a full parser).
|
|
78
|
+
*/
|
|
79
|
+
export function checkLiquidSyntax(source) {
|
|
80
|
+
const errors = [];
|
|
81
|
+
const warnings = [];
|
|
82
|
+
const openTags = (source.match(/\{\%/g) ?? []).length;
|
|
83
|
+
const closeTags = (source.match(/\%\}/g) ?? []).length;
|
|
84
|
+
if (openTags !== closeTags) {
|
|
85
|
+
errors.push(`Unbalanced Liquid tags: ${openTags} opening vs ${closeTags} closing`);
|
|
86
|
+
}
|
|
87
|
+
const openOutput = (source.match(/\{\{/g) ?? []).length;
|
|
88
|
+
const closeOutput = (source.match(/\}\}/g) ?? []).length;
|
|
89
|
+
if (openOutput !== closeOutput) {
|
|
90
|
+
errors.push(`Unbalanced Liquid output: ${openOutput} opening vs ${closeOutput} closing`);
|
|
91
|
+
}
|
|
92
|
+
// Detect common mistakes
|
|
93
|
+
if (/\{\%\s*end(?!if|for|capture|unless|case|comment|raw|tablerow|paginate)\w*/.test(source)) {
|
|
94
|
+
warnings.push("Possible misspelled end tag");
|
|
95
|
+
}
|
|
96
|
+
return { errors, warnings };
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=liquid-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liquid-parser.js","sourceRoot":"","sources":["../../src/parsers/liquid-parser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH,MAAM,gBAAgB,GAAG,oCAAoC,CAAC;AAC9D,MAAM,QAAQ,GAAG,gCAAgC,CAAC;AAClD,MAAM,KAAK,GAAG,+BAA+B,CAAC;AAC9C,MAAM,cAAc,GAAG,uDAAuD,CAAC;AAC/E,MAAM,OAAO,GAAG,sBAAsB,CAAC;AACvC,MAAM,OAAO,GAAG,iCAAiC,CAAC;AAElD;;GAEG;AACH,MAAM,UAAU,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AAa,EAAE,CAAC;IAE9B,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IACtD,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IACvD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC,2BAA2B,QAAQ,eAAe,SAAS,UAAU,CAAC,CAAC;IACrF,CAAC;IAED,MAAM,UAAU,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IACxD,MAAM,WAAW,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IACzD,IAAI,UAAU,KAAK,WAAW,EAAE,CAAC;QAC/B,MAAM,CAAC,IAAI,CAAC,6BAA6B,UAAU,eAAe,WAAW,UAAU,CAAC,CAAC;IAC3F,CAAC;IAED,yBAAyB;IACzB,IAAI,2EAA2E,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7F,QAAQ,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured project architecture scan for Jekyll + component framework.
|
|
3
|
+
*/
|
|
4
|
+
import type { McpConfig } from "../config/environment.js";
|
|
5
|
+
export interface ProjectScanResult {
|
|
6
|
+
root: string;
|
|
7
|
+
jekyll: boolean;
|
|
8
|
+
configFiles: string[];
|
|
9
|
+
directories: Record<string, boolean>;
|
|
10
|
+
layouts: string[];
|
|
11
|
+
includes: string[];
|
|
12
|
+
components: Array<{
|
|
13
|
+
name: string;
|
|
14
|
+
liquid?: string;
|
|
15
|
+
scss?: string;
|
|
16
|
+
javascript?: string;
|
|
17
|
+
documentation?: string;
|
|
18
|
+
example?: string;
|
|
19
|
+
}>;
|
|
20
|
+
sections: string[];
|
|
21
|
+
scssFiles: string[];
|
|
22
|
+
jsFiles: string[];
|
|
23
|
+
docsFiles: string[];
|
|
24
|
+
hasBundler: boolean;
|
|
25
|
+
hasPackageJson: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function scanProject(config: McpConfig): ProjectScanResult;
|
|
28
|
+
export declare function detectScssArchitecture(root: string, scssRoot: string): string[];
|
|
29
|
+
//# sourceMappingURL=project-scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-scanner.d.ts","sourceRoot":"","sources":["../../src/parsers/project-scanner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAI1D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;CACzB;AAyBD,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,iBAAiB,CAiJhE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAmC/E"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured project architecture scan for Jekyll + component framework.
|
|
3
|
+
*/
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { safeExists, safeReadDir, safeWalk } from "../utils/filesystem.js";
|
|
6
|
+
import { resolveSafePath, toRelative } from "../security/path-policy.js";
|
|
7
|
+
function listHtmlIn(root, relDir, maxDepth = 4) {
|
|
8
|
+
if (!safeExists(root, relDir))
|
|
9
|
+
return [];
|
|
10
|
+
const out = [];
|
|
11
|
+
for (const entry of safeWalk(root, relDir, { maxDepth, extensions: [".html", ".liquid"] })) {
|
|
12
|
+
if (!entry.isDirectory)
|
|
13
|
+
out.push(entry.relativePath);
|
|
14
|
+
}
|
|
15
|
+
return out;
|
|
16
|
+
}
|
|
17
|
+
function listScss(root, relDir, maxDepth = 6) {
|
|
18
|
+
if (!safeExists(root, relDir))
|
|
19
|
+
return [];
|
|
20
|
+
const out = [];
|
|
21
|
+
for (const entry of safeWalk(root, relDir, { maxDepth, extensions: [".scss", ".sass", ".css"] })) {
|
|
22
|
+
if (!entry.isDirectory)
|
|
23
|
+
out.push(entry.relativePath);
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
function componentNameFromPath(filePath) {
|
|
28
|
+
const base = path.basename(filePath, path.extname(filePath));
|
|
29
|
+
return base.replace(/^_/, "").toLowerCase();
|
|
30
|
+
}
|
|
31
|
+
export function scanProject(config) {
|
|
32
|
+
const { root, paths } = config;
|
|
33
|
+
const configFiles = [];
|
|
34
|
+
for (const name of ["_config.yml", "_config.yaml", "_config.toml", "config.yml"]) {
|
|
35
|
+
if (safeExists(root, name))
|
|
36
|
+
configFiles.push(name);
|
|
37
|
+
}
|
|
38
|
+
const directories = {
|
|
39
|
+
_layouts: safeExists(root, paths.layouts),
|
|
40
|
+
_includes: safeExists(root, paths.includes),
|
|
41
|
+
_data: safeExists(root, paths.data),
|
|
42
|
+
_posts: safeExists(root, paths.posts),
|
|
43
|
+
_sass: safeExists(root, paths.sass),
|
|
44
|
+
assets: safeExists(root, paths.assets),
|
|
45
|
+
docs: safeExists(root, paths.docs),
|
|
46
|
+
examples: safeExists(root, paths.examples),
|
|
47
|
+
_site: safeExists(root, paths.site),
|
|
48
|
+
components: safeExists(root, paths.components),
|
|
49
|
+
sections: safeExists(root, paths.sections),
|
|
50
|
+
scss: safeExists(root, paths.scss),
|
|
51
|
+
};
|
|
52
|
+
const layouts = listHtmlIn(root, paths.layouts);
|
|
53
|
+
const includes = listHtmlIn(root, paths.includes, 5);
|
|
54
|
+
// Components under _includes/components or configured path
|
|
55
|
+
const componentLiquid = listHtmlIn(root, paths.components, 3);
|
|
56
|
+
const componentMap = new Map();
|
|
57
|
+
for (const f of componentLiquid) {
|
|
58
|
+
const name = componentNameFromPath(f);
|
|
59
|
+
componentMap.set(name, { name, liquid: f });
|
|
60
|
+
}
|
|
61
|
+
// SCSS components
|
|
62
|
+
const scssComponents = listScss(root, paths.scssComponents ?? path.join(paths.scss, "components"), 3);
|
|
63
|
+
for (const f of scssComponents) {
|
|
64
|
+
const name = componentNameFromPath(f);
|
|
65
|
+
const existing = componentMap.get(name) ?? { name };
|
|
66
|
+
existing.scss = f;
|
|
67
|
+
componentMap.set(name, existing);
|
|
68
|
+
}
|
|
69
|
+
// Also scan main scss for component-like files
|
|
70
|
+
const allScss = listScss(root, paths.scss, 5);
|
|
71
|
+
for (const f of allScss) {
|
|
72
|
+
if (f.includes("components/") || f.includes("component")) {
|
|
73
|
+
const name = componentNameFromPath(f);
|
|
74
|
+
if (!componentMap.has(name)) {
|
|
75
|
+
componentMap.set(name, { name, scss: f });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// JS components
|
|
80
|
+
if (safeExists(root, paths.jsComponents)) {
|
|
81
|
+
for (const entry of safeWalk(root, paths.jsComponents, {
|
|
82
|
+
maxDepth: 3,
|
|
83
|
+
extensions: [".js", ".ts", ".mjs"],
|
|
84
|
+
})) {
|
|
85
|
+
if (entry.isDirectory)
|
|
86
|
+
continue;
|
|
87
|
+
const name = componentNameFromPath(entry.relativePath);
|
|
88
|
+
const existing = componentMap.get(name) ?? { name };
|
|
89
|
+
existing.javascript = entry.relativePath;
|
|
90
|
+
componentMap.set(name, existing);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// Docs
|
|
94
|
+
if (safeExists(root, paths.docsComponents)) {
|
|
95
|
+
for (const entry of safeWalk(root, paths.docsComponents, {
|
|
96
|
+
maxDepth: 3,
|
|
97
|
+
extensions: [".md", ".markdown", ".html"],
|
|
98
|
+
})) {
|
|
99
|
+
if (entry.isDirectory)
|
|
100
|
+
continue;
|
|
101
|
+
const name = componentNameFromPath(entry.relativePath);
|
|
102
|
+
const existing = componentMap.get(name) ?? { name };
|
|
103
|
+
existing.documentation = entry.relativePath;
|
|
104
|
+
componentMap.set(name, existing);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Examples
|
|
108
|
+
if (safeExists(root, paths.examplesComponents)) {
|
|
109
|
+
for (const entry of safeWalk(root, paths.examplesComponents, {
|
|
110
|
+
maxDepth: 3,
|
|
111
|
+
extensions: [".html", ".md"],
|
|
112
|
+
})) {
|
|
113
|
+
if (entry.isDirectory)
|
|
114
|
+
continue;
|
|
115
|
+
const name = componentNameFromPath(entry.relativePath);
|
|
116
|
+
const existing = componentMap.get(name) ?? { name };
|
|
117
|
+
existing.example = entry.relativePath;
|
|
118
|
+
componentMap.set(name, existing);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const sections = listHtmlIn(root, paths.sections, 3).map(componentNameFromPath);
|
|
122
|
+
const jsFiles = [];
|
|
123
|
+
if (safeExists(root, paths.js)) {
|
|
124
|
+
for (const entry of safeWalk(root, paths.js, { maxDepth: 5, extensions: [".js", ".ts", ".mjs"] })) {
|
|
125
|
+
if (!entry.isDirectory)
|
|
126
|
+
jsFiles.push(entry.relativePath);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const docsFiles = [];
|
|
130
|
+
if (safeExists(root, paths.docs)) {
|
|
131
|
+
for (const entry of safeWalk(root, paths.docs, {
|
|
132
|
+
maxDepth: 5,
|
|
133
|
+
extensions: [".md", ".markdown", ".html"],
|
|
134
|
+
})) {
|
|
135
|
+
if (!entry.isDirectory)
|
|
136
|
+
docsFiles.push(entry.relativePath);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const hasBundler = safeExists(root, "Gemfile") || safeExists(root, "Gemfile.lock");
|
|
140
|
+
const hasPackageJson = safeExists(root, "package.json");
|
|
141
|
+
return {
|
|
142
|
+
root,
|
|
143
|
+
jekyll: configFiles.length > 0 || directories._layouts || directories._includes,
|
|
144
|
+
configFiles,
|
|
145
|
+
directories,
|
|
146
|
+
layouts: layouts.map((f) => toRelative(root, resolveSafePath(root, f))),
|
|
147
|
+
includes: includes.map((f) => toRelative(root, resolveSafePath(root, f))),
|
|
148
|
+
components: [...componentMap.values()].sort((a, b) => a.name.localeCompare(b.name)),
|
|
149
|
+
sections,
|
|
150
|
+
scssFiles: allScss,
|
|
151
|
+
jsFiles,
|
|
152
|
+
docsFiles,
|
|
153
|
+
hasBundler,
|
|
154
|
+
hasPackageJson,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
export function detectScssArchitecture(root, scssRoot) {
|
|
158
|
+
const layers = [];
|
|
159
|
+
const candidates = [
|
|
160
|
+
"tokens",
|
|
161
|
+
"abstracts",
|
|
162
|
+
"variables",
|
|
163
|
+
"mixins",
|
|
164
|
+
"functions",
|
|
165
|
+
"base",
|
|
166
|
+
"vendors",
|
|
167
|
+
"utilities",
|
|
168
|
+
"components",
|
|
169
|
+
"sections",
|
|
170
|
+
"layout",
|
|
171
|
+
"pages",
|
|
172
|
+
"themes",
|
|
173
|
+
];
|
|
174
|
+
for (const c of candidates) {
|
|
175
|
+
if (safeExists(root, path.join(scssRoot, c)) || safeExists(root, path.join(scssRoot, `_${c}`))) {
|
|
176
|
+
layers.push(c);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// Also check for files
|
|
180
|
+
try {
|
|
181
|
+
const entries = safeReadDir(root, scssRoot);
|
|
182
|
+
for (const e of entries) {
|
|
183
|
+
const name = e.replace(/^_/, "").replace(/\.(scss|sass)$/, "");
|
|
184
|
+
if (candidates.includes(name) && !layers.includes(name)) {
|
|
185
|
+
layers.push(name);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
/* ignore */
|
|
191
|
+
}
|
|
192
|
+
return layers;
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=project-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-scanner.js","sourceRoot":"","sources":["../../src/parsers/project-scanner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAyBzE,SAAS,UAAU,CAAC,IAAY,EAAE,MAAc,EAAE,QAAQ,GAAG,CAAC;IAC5D,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC;QAAE,OAAO,EAAE,CAAC;IACzC,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,IAAI,EAAE,MAA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/
|
|
4
|
+
export interface ScssToken {
|
|
5
|
+
name: string;
|
|
6
|
+
value: string;
|
|
7
|
+
category: string;
|
|
8
|
+
line?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ScssAnalysis {
|
|
11
|
+
imports: string[];
|
|
12
|
+
variables: ScssToken[];
|
|
13
|
+
cssCustomProperties: ScssToken[];
|
|
14
|
+
mixins: string[];
|
|
15
|
+
selectors: string[];
|
|
16
|
+
usesForward: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function analyzeScss(source: string): ScssAnalysis;
|
|
19
|
+
/**
|
|
20
|
+
* Detect whether a component SCSS file is already imported in an entry point.
|
|
21
|
+
*/
|
|
22
|
+
export declare function findImportForComponent(entrySource: string, componentName: string): {
|
|
23
|
+
present: boolean;
|
|
24
|
+
line?: string;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=scss-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scss-parser.d.ts","sourceRoot":"","sources":["../../src/parsers/scss-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,mBAAmB,EAAE,SAAS,EAAE,CAAC;IACjC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB;AAqBD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAgDxD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAarC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SCSS source analysis for design tokens, imports, and architecture.
|
|
3
|
+
*/
|
|
4
|
+
const IMPORT_RE = /@(?:import|use|forward)\s+["']([^"']+)["']/g;
|
|
5
|
+
const VAR_RE = /(\$[\w-]+)\s*:\s*([^;]+);/g;
|
|
6
|
+
const CSS_VAR_RE = /(--[\w-]+)\s*:\s*([^;]+);/g;
|
|
7
|
+
const MIXIN_RE = /@mixin\s+([\w-]+)/g;
|
|
8
|
+
const SELECTOR_RE = /^\s*([.#][\w-]+(?:\s*[.#][\w-]+)*)\s*\{/gm;
|
|
9
|
+
function categorizeToken(name) {
|
|
10
|
+
const n = name.toLowerCase();
|
|
11
|
+
if (/color|colour|bg|background|fill|stroke|text-/.test(n))
|
|
12
|
+
return "color";
|
|
13
|
+
if (/space|spacing|gap|margin|padding|inset/.test(n))
|
|
14
|
+
return "spacing";
|
|
15
|
+
if (/radius|rounded|corner/.test(n))
|
|
16
|
+
return "radius";
|
|
17
|
+
if (/shadow|elevation/.test(n))
|
|
18
|
+
return "shadow";
|
|
19
|
+
if (/font|type|text-|line-height|letter/.test(n))
|
|
20
|
+
return "typography";
|
|
21
|
+
if (/break|media|screen|container|viewport/.test(n))
|
|
22
|
+
return "breakpoints";
|
|
23
|
+
if (/motion|transition|duration|easing|animation/.test(n))
|
|
24
|
+
return "motion";
|
|
25
|
+
if (/z-index|layer/.test(n))
|
|
26
|
+
return "z-index";
|
|
27
|
+
return "other";
|
|
28
|
+
}
|
|
29
|
+
export function analyzeScss(source) {
|
|
30
|
+
const imports = [];
|
|
31
|
+
let m;
|
|
32
|
+
const importRe = new RegExp(IMPORT_RE.source, "g");
|
|
33
|
+
while ((m = importRe.exec(source)) !== null) {
|
|
34
|
+
imports.push(m[1]);
|
|
35
|
+
}
|
|
36
|
+
const variables = [];
|
|
37
|
+
const varRe = new RegExp(VAR_RE.source, "g");
|
|
38
|
+
while ((m = varRe.exec(source)) !== null) {
|
|
39
|
+
variables.push({
|
|
40
|
+
name: m[1],
|
|
41
|
+
value: m[2].trim(),
|
|
42
|
+
category: categorizeToken(m[1]),
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const cssCustomProperties = [];
|
|
46
|
+
const cssRe = new RegExp(CSS_VAR_RE.source, "g");
|
|
47
|
+
while ((m = cssRe.exec(source)) !== null) {
|
|
48
|
+
cssCustomProperties.push({
|
|
49
|
+
name: m[1],
|
|
50
|
+
value: m[2].trim(),
|
|
51
|
+
category: categorizeToken(m[1]),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const mixins = [];
|
|
55
|
+
const mixinRe = new RegExp(MIXIN_RE.source, "g");
|
|
56
|
+
while ((m = mixinRe.exec(source)) !== null) {
|
|
57
|
+
mixins.push(m[1]);
|
|
58
|
+
}
|
|
59
|
+
const selectors = [];
|
|
60
|
+
const selRe = new RegExp(SELECTOR_RE.source, "gm");
|
|
61
|
+
while ((m = selRe.exec(source)) !== null) {
|
|
62
|
+
selectors.push(m[1].trim());
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
imports,
|
|
66
|
+
variables,
|
|
67
|
+
cssCustomProperties,
|
|
68
|
+
mixins,
|
|
69
|
+
selectors,
|
|
70
|
+
usesForward: /@forward\b/.test(source),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Detect whether a component SCSS file is already imported in an entry point.
|
|
75
|
+
*/
|
|
76
|
+
export function findImportForComponent(entrySource, componentName) {
|
|
77
|
+
const patterns = [
|
|
78
|
+
new RegExp(`["']components[/._]?${componentName}["']`),
|
|
79
|
+
new RegExp(`["'][^"']*${componentName}["']`),
|
|
80
|
+
new RegExp(`@import\\s+["'].*${componentName}`),
|
|
81
|
+
new RegExp(`@use\\s+["'].*${componentName}`),
|
|
82
|
+
];
|
|
83
|
+
for (const re of patterns) {
|
|
84
|
+
if (re.test(entrySource)) {
|
|
85
|
+
return { present: true };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return { present: false };
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=scss-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scss-parser.js","sourceRoot":"","sources":["../../src/parsers/scss-parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AAkBH,MAAM,SAAS,GAAG,6CAA6C,CAAC;AAChE,MAAM,MAAM,GAAG,4BAA4B,CAAC;AAC5C,MAAM,UAAU,GAAG,4BAA4B,CAAC;AAChD,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AACtC,MAAM,WAAW,GAAG,2CAA2C,CAAC;AAEhE,SAAS,eAAe,CAAC,IAAY;IACnC,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC7B,IAAI,8CAA8C,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC;IAC3E,IAAI,wCAAwC,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACvE,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,QAAQ,CAAC;IACrD,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,QAAQ,CAAC;IAChD,IAAI,oCAAoC,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,YAAY,CAAC;IACtE,IAAI,uCAAuC,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,aAAa,CAAC;IAC1E,IAAI,6CAA6C,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,QAAQ,CAAC;IAC3E,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9C,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAA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CAAC;IACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allowlisted command runner. Never execute arbitrary model-supplied shell.
|
|
3
|
+
*/
|
|
4
|
+
export declare class CommandPolicyError extends Error {
|
|
5
|
+
readonly details: Record<string, unknown>;
|
|
6
|
+
readonly code = "COMMAND_NOT_ALLOWED";
|
|
7
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Validate that a command string is on the allowlist and contains no forbidden tokens.
|
|
11
|
+
*/
|
|
12
|
+
export declare function assertAllowedCommand(command: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Build a safe argv array for the given allowlisted command string.
|
|
15
|
+
* Returns { cmd, args } suitable for child_process.spawn.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseAllowedCommand(command: string): {
|
|
18
|
+
cmd: string;
|
|
19
|
+
args: string[];
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=command-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-policy.d.ts","sourceRoot":"","sources":["../../src/security/command-policy.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,qBAAa,kBAAmB,SAAQ,KAAK;aAIzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAHlD,QAAQ,CAAC,IAAI,yBAAyB;gBAEpC,OAAO,EAAE,MAAM,EACC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;CAKxD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAuB1D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAMpF"}
|