@buoy-design/cli 0.1.0 → 0.1.1
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/LICENSE +21 -0
- package/dist/commands/baseline.d.ts +39 -0
- package/dist/commands/baseline.d.ts.map +1 -0
- package/dist/commands/baseline.js +298 -0
- package/dist/commands/baseline.js.map +1 -0
- package/dist/commands/bootstrap.js +1 -1
- package/dist/commands/bootstrap.js.map +1 -1
- package/dist/commands/ci.d.ts +2 -2
- package/dist/commands/ci.d.ts.map +1 -1
- package/dist/commands/ci.js +107 -129
- package/dist/commands/ci.js.map +1 -1
- package/dist/commands/drift.d.ts +1 -1
- package/dist/commands/drift.d.ts.map +1 -1
- package/dist/commands/drift.js +68 -95
- package/dist/commands/drift.js.map +1 -1
- package/dist/commands/index.d.ts +9 -8
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +9 -8
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +61 -86
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +32 -41
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/scan.d.ts +1 -1
- package/dist/commands/scan.d.ts.map +1 -1
- package/dist/commands/scan.js +59 -211
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +79 -116
- package/dist/commands/status.js.map +1 -1
- package/dist/detect/frameworks.d.ts +6 -1
- package/dist/detect/frameworks.d.ts.map +1 -1
- package/dist/detect/frameworks.js +43 -69
- package/dist/detect/frameworks.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/integrations/github-formatter.d.ts +3 -0
- package/dist/integrations/github-formatter.d.ts.map +1 -0
- package/dist/integrations/github-formatter.js +69 -0
- package/dist/integrations/github-formatter.js.map +1 -0
- package/dist/integrations/github.d.ts +20 -0
- package/dist/integrations/github.d.ts.map +1 -0
- package/dist/integrations/github.js +69 -0
- package/dist/integrations/github.js.map +1 -0
- package/dist/integrations/index.d.ts +4 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +4 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/scan/orchestrator.d.ts +76 -0
- package/dist/scan/orchestrator.d.ts.map +1 -0
- package/dist/scan/orchestrator.js +247 -0
- package/dist/scan/orchestrator.js.map +1 -0
- package/package.json +26 -17
- package/dist/plugins/index.d.ts +0 -3
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js +0 -3
- package/dist/plugins/index.js.map +0 -1
- package/dist/plugins/loader.d.ts +0 -11
- package/dist/plugins/loader.d.ts.map +0 -1
- package/dist/plugins/loader.js +0 -77
- package/dist/plugins/loader.js.map +0 -1
- package/dist/plugins/registry.d.ts +0 -15
- package/dist/plugins/registry.d.ts.map +0 -1
- package/dist/plugins/registry.js +0 -32
- package/dist/plugins/registry.js.map +0 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized scanner orchestration for all CLI commands.
|
|
3
|
+
* Eliminates duplicate scanning logic across scan, status, ci, and drift commands.
|
|
4
|
+
*/
|
|
5
|
+
export class ScanOrchestrator {
|
|
6
|
+
config;
|
|
7
|
+
projectRoot;
|
|
8
|
+
constructor(config, projectRoot = process.cwd()) {
|
|
9
|
+
this.config = config;
|
|
10
|
+
this.projectRoot = projectRoot;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get list of enabled sources from config
|
|
14
|
+
*/
|
|
15
|
+
getEnabledSources() {
|
|
16
|
+
const sources = [];
|
|
17
|
+
// JS Frameworks
|
|
18
|
+
if (this.config.sources.react?.enabled)
|
|
19
|
+
sources.push("react");
|
|
20
|
+
if (this.config.sources.vue?.enabled)
|
|
21
|
+
sources.push("vue");
|
|
22
|
+
if (this.config.sources.svelte?.enabled)
|
|
23
|
+
sources.push("svelte");
|
|
24
|
+
if (this.config.sources.angular?.enabled)
|
|
25
|
+
sources.push("angular");
|
|
26
|
+
if (this.config.sources.webcomponent?.enabled)
|
|
27
|
+
sources.push("webcomponent");
|
|
28
|
+
// Templates
|
|
29
|
+
if (this.config.sources.templates?.enabled)
|
|
30
|
+
sources.push("templates");
|
|
31
|
+
// Design tools
|
|
32
|
+
if (this.config.sources.figma?.enabled)
|
|
33
|
+
sources.push("figma");
|
|
34
|
+
if (this.config.sources.storybook?.enabled)
|
|
35
|
+
sources.push("storybook");
|
|
36
|
+
if (this.config.sources.tokens?.enabled)
|
|
37
|
+
sources.push("tokens");
|
|
38
|
+
return sources;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Scan all enabled sources or specific sources
|
|
42
|
+
*/
|
|
43
|
+
async scan(options = {}) {
|
|
44
|
+
const result = {
|
|
45
|
+
components: [],
|
|
46
|
+
tokens: [],
|
|
47
|
+
errors: [],
|
|
48
|
+
};
|
|
49
|
+
// Determine sources to scan
|
|
50
|
+
const sourcesToScan = options.sources && options.sources.length > 0
|
|
51
|
+
? options.sources
|
|
52
|
+
: this.getEnabledSources();
|
|
53
|
+
if (sourcesToScan.length === 0) {
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
// Import scanners dynamically (lazy load)
|
|
57
|
+
const scanners = await this.importScanners();
|
|
58
|
+
// Scan each source
|
|
59
|
+
for (const source of sourcesToScan) {
|
|
60
|
+
options.onProgress?.(`Scanning ${source}...`);
|
|
61
|
+
try {
|
|
62
|
+
const sourceResult = await this.scanSource(source, scanners);
|
|
63
|
+
result.components.push(...sourceResult.components);
|
|
64
|
+
result.tokens.push(...sourceResult.tokens);
|
|
65
|
+
result.errors.push(...sourceResult.errors);
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
69
|
+
result.errors.push({ source, message });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Scan only component sources (no tokens)
|
|
76
|
+
*/
|
|
77
|
+
async scanComponents(options = {}) {
|
|
78
|
+
const result = await this.scan({
|
|
79
|
+
...options,
|
|
80
|
+
sources: options.sources?.filter((s) => s !== "tokens") ||
|
|
81
|
+
this.getEnabledSources().filter((s) => s !== "tokens"),
|
|
82
|
+
});
|
|
83
|
+
return {
|
|
84
|
+
components: result.components,
|
|
85
|
+
errors: result.errors,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Scan only token sources
|
|
90
|
+
*/
|
|
91
|
+
async scanTokens(options = {}) {
|
|
92
|
+
const result = await this.scan({
|
|
93
|
+
...options,
|
|
94
|
+
sources: ["tokens"],
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
tokens: result.tokens,
|
|
98
|
+
errors: result.errors,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Import all scanner classes dynamically
|
|
103
|
+
*/
|
|
104
|
+
async importScanners() {
|
|
105
|
+
const { ReactComponentScanner, VueComponentScanner, SvelteComponentScanner, AngularComponentScanner, WebComponentScanner, TemplateScanner, TokenScanner, } = await import("@buoy-design/scanners/git");
|
|
106
|
+
return {
|
|
107
|
+
ReactComponentScanner,
|
|
108
|
+
VueComponentScanner,
|
|
109
|
+
SvelteComponentScanner,
|
|
110
|
+
AngularComponentScanner,
|
|
111
|
+
WebComponentScanner,
|
|
112
|
+
TemplateScanner,
|
|
113
|
+
TokenScanner,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Scan a specific source and return results
|
|
118
|
+
*/
|
|
119
|
+
async scanSource(source, scanners) {
|
|
120
|
+
const result = {
|
|
121
|
+
components: [],
|
|
122
|
+
tokens: [],
|
|
123
|
+
errors: [],
|
|
124
|
+
};
|
|
125
|
+
switch (source) {
|
|
126
|
+
case "react": {
|
|
127
|
+
const cfg = this.config.sources.react;
|
|
128
|
+
if (!cfg)
|
|
129
|
+
break;
|
|
130
|
+
const scanner = new scanners.ReactComponentScanner({
|
|
131
|
+
projectRoot: this.projectRoot,
|
|
132
|
+
include: cfg.include,
|
|
133
|
+
exclude: cfg.exclude,
|
|
134
|
+
designSystemPackage: cfg.designSystemPackage,
|
|
135
|
+
});
|
|
136
|
+
const scanResult = await scanner.scan();
|
|
137
|
+
result.components.push(...scanResult.items);
|
|
138
|
+
this.collectErrors(result.errors, source, scanResult.errors);
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case "vue": {
|
|
142
|
+
const cfg = this.config.sources.vue;
|
|
143
|
+
if (!cfg)
|
|
144
|
+
break;
|
|
145
|
+
const scanner = new scanners.VueComponentScanner({
|
|
146
|
+
projectRoot: this.projectRoot,
|
|
147
|
+
include: cfg.include,
|
|
148
|
+
exclude: cfg.exclude,
|
|
149
|
+
});
|
|
150
|
+
const scanResult = await scanner.scan();
|
|
151
|
+
result.components.push(...scanResult.items);
|
|
152
|
+
this.collectErrors(result.errors, source, scanResult.errors);
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
case "svelte": {
|
|
156
|
+
const cfg = this.config.sources.svelte;
|
|
157
|
+
if (!cfg)
|
|
158
|
+
break;
|
|
159
|
+
const scanner = new scanners.SvelteComponentScanner({
|
|
160
|
+
projectRoot: this.projectRoot,
|
|
161
|
+
include: cfg.include,
|
|
162
|
+
exclude: cfg.exclude,
|
|
163
|
+
});
|
|
164
|
+
const scanResult = await scanner.scan();
|
|
165
|
+
result.components.push(...scanResult.items);
|
|
166
|
+
this.collectErrors(result.errors, source, scanResult.errors);
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
case "angular": {
|
|
170
|
+
const cfg = this.config.sources.angular;
|
|
171
|
+
if (!cfg)
|
|
172
|
+
break;
|
|
173
|
+
const scanner = new scanners.AngularComponentScanner({
|
|
174
|
+
projectRoot: this.projectRoot,
|
|
175
|
+
include: cfg.include,
|
|
176
|
+
exclude: cfg.exclude,
|
|
177
|
+
});
|
|
178
|
+
const scanResult = await scanner.scan();
|
|
179
|
+
result.components.push(...scanResult.items);
|
|
180
|
+
this.collectErrors(result.errors, source, scanResult.errors);
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
case "webcomponent": {
|
|
184
|
+
const cfg = this.config.sources.webcomponent;
|
|
185
|
+
if (!cfg)
|
|
186
|
+
break;
|
|
187
|
+
const scanner = new scanners.WebComponentScanner({
|
|
188
|
+
projectRoot: this.projectRoot,
|
|
189
|
+
include: cfg.include,
|
|
190
|
+
exclude: cfg.exclude,
|
|
191
|
+
framework: cfg.framework,
|
|
192
|
+
});
|
|
193
|
+
const scanResult = await scanner.scan();
|
|
194
|
+
result.components.push(...scanResult.items);
|
|
195
|
+
this.collectErrors(result.errors, source, scanResult.errors);
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
case "templates": {
|
|
199
|
+
const cfg = this.config.sources.templates;
|
|
200
|
+
if (!cfg)
|
|
201
|
+
break;
|
|
202
|
+
const scanner = new scanners.TemplateScanner({
|
|
203
|
+
projectRoot: this.projectRoot,
|
|
204
|
+
include: cfg.include,
|
|
205
|
+
exclude: cfg.exclude,
|
|
206
|
+
templateType: cfg.type,
|
|
207
|
+
});
|
|
208
|
+
const scanResult = await scanner.scan();
|
|
209
|
+
result.components.push(...scanResult.items);
|
|
210
|
+
this.collectErrors(result.errors, source, scanResult.errors);
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
case "tokens": {
|
|
214
|
+
const cfg = this.config.sources.tokens;
|
|
215
|
+
if (!cfg)
|
|
216
|
+
break;
|
|
217
|
+
const scanner = new scanners.TokenScanner({
|
|
218
|
+
projectRoot: this.projectRoot,
|
|
219
|
+
files: cfg.files,
|
|
220
|
+
cssVariablePrefix: cfg.cssVariablePrefix,
|
|
221
|
+
});
|
|
222
|
+
const scanResult = await scanner.scan();
|
|
223
|
+
result.tokens.push(...scanResult.items);
|
|
224
|
+
this.collectErrors(result.errors, source, scanResult.errors);
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
case "figma":
|
|
228
|
+
case "storybook":
|
|
229
|
+
// TODO: Implement figma and storybook scanners
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
return result;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Collect and format errors from scanner result
|
|
236
|
+
*/
|
|
237
|
+
collectErrors(target, source, errors) {
|
|
238
|
+
for (const err of errors) {
|
|
239
|
+
target.push({
|
|
240
|
+
source,
|
|
241
|
+
message: err.message,
|
|
242
|
+
file: err.file,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../src/scan/orchestrator.ts"],"names":[],"mappings":"AAgDA;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAa;IACnB,WAAW,CAAS;IAE5B,YAAY,MAAkB,EAAE,cAAsB,OAAO,CAAC,GAAG,EAAE;QACjE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,MAAM,OAAO,GAAoB,EAAE,CAAC;QAEpC,gBAAgB;QAChB,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO;YAAE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO;YAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1D,IAAI,IAAI,CAAC,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,EAAE,IAAI,CAAC,WAAW;oBAC7B,KAAK,EAAE,GAAG,CAAC,KAAK;oBAChB,iBAAiB,EAAE,GAAG,CAAC,iBAAiB;iBACzC,CAAC,CAAC;gBAEH,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;gBACxC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;gBACxC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;gBAC7D,MAAM;YACR,CAAC;YAED,KAAK,OAAO,CAAC;YACb,KAAK,WAAW;gBACd,+CAA+C;gBAC/C,MAAM;QACV,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACK,aAAa,CACnB,MAAmB,EACnB,MAAc,EACd,MAAiD;QAEjD,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;YACzB,MAAM,CAAC,IAAI,CAAC;gBACV,MAAM;gBACN,OAAO,EAAE,GAAG,CAAC,OAAO;gBACpB,IAAI,EAAE,GAAG,CAAC,IAAI;aACf,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-design/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Buoy CLI - Design drift detection for the AI era",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,35 +14,44 @@
|
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/dylantarre/buoy-design/issues"
|
|
16
16
|
},
|
|
17
|
-
"keywords": [
|
|
18
|
-
|
|
17
|
+
"keywords": [
|
|
18
|
+
"buoy",
|
|
19
|
+
"design-system",
|
|
20
|
+
"drift-detection",
|
|
21
|
+
"cli",
|
|
22
|
+
"design-tokens"
|
|
23
|
+
],
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
19
28
|
"bin": {
|
|
20
29
|
"buoy": "./dist/bin.js"
|
|
21
30
|
},
|
|
22
31
|
"main": "./dist/index.js",
|
|
23
32
|
"types": "./dist/index.d.ts",
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "tsc",
|
|
26
|
-
"dev": "tsc --watch",
|
|
27
|
-
"typecheck": "tsc --noEmit",
|
|
28
|
-
"clean": "rm -rf dist",
|
|
29
|
-
"start": "node ./dist/bin/buoy.js",
|
|
30
|
-
"test": "vitest run",
|
|
31
|
-
"test:watch": "vitest"
|
|
32
|
-
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@buoy-design/db": "workspace:*",
|
|
36
|
-
"@buoy-design/scanners": "workspace:*",
|
|
34
|
+
"@octokit/rest": "^21.0.0",
|
|
37
35
|
"chalk": "^5.3.0",
|
|
38
36
|
"cli-table3": "^0.6.5",
|
|
39
37
|
"commander": "^12.1.0",
|
|
40
38
|
"glob": "^11.0.0",
|
|
41
39
|
"ora": "^8.1.1",
|
|
42
|
-
"zod": "^3.24.1"
|
|
40
|
+
"zod": "^3.24.1",
|
|
41
|
+
"@buoy-design/core": "0.1.1",
|
|
42
|
+
"@buoy-design/scanners": "0.1.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^22.10.2",
|
|
46
46
|
"typescript": "^5.7.2"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsc",
|
|
50
|
+
"dev": "tsc --watch",
|
|
51
|
+
"typecheck": "tsc --noEmit",
|
|
52
|
+
"clean": "rm -rf dist",
|
|
53
|
+
"start": "node ./dist/bin/buoy.js",
|
|
54
|
+
"test": "vitest run",
|
|
55
|
+
"test:watch": "vitest"
|
|
47
56
|
}
|
|
48
|
-
}
|
|
57
|
+
}
|
package/dist/plugins/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/plugins/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/plugins/loader.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { BuoyPlugin } from '@buoy-design/core';
|
|
2
|
-
import { registry } from './registry.js';
|
|
3
|
-
interface LoaderOptions {
|
|
4
|
-
projectRoot?: string;
|
|
5
|
-
autoDiscover?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function loadPlugin(nameOrPath: string): Promise<BuoyPlugin>;
|
|
8
|
-
export declare function discoverPlugins(options?: LoaderOptions): Promise<string[]>;
|
|
9
|
-
export declare function loadDiscoveredPlugins(options?: LoaderOptions): Promise<BuoyPlugin[]>;
|
|
10
|
-
export { registry };
|
|
11
|
-
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/plugins/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA4BzC,UAAU,aAAa;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CA4BxE;AAED,wBAAsB,eAAe,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAepF;AAED,wBAAsB,qBAAqB,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAc9F;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/plugins/loader.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'node:path';
|
|
2
|
-
import { existsSync } from 'node:fs';
|
|
3
|
-
import { readFile } from 'node:fs/promises';
|
|
4
|
-
import { registry } from './registry.js';
|
|
5
|
-
const PLUGIN_PREFIX = '@buoy-design/plugin-';
|
|
6
|
-
// Security: Only allow safe characters in plugin names to prevent arbitrary package imports
|
|
7
|
-
const VALID_SIMPLE_NAME = /^[a-z0-9-]+$/;
|
|
8
|
-
const VALID_SCOPED_PACKAGE = /^@[a-z0-9-]+\/[a-z0-9-]+$/;
|
|
9
|
-
function validatePluginName(nameOrPath) {
|
|
10
|
-
if (nameOrPath.startsWith('@')) {
|
|
11
|
-
// Scoped package: must match @org/name pattern with safe characters only
|
|
12
|
-
if (!VALID_SCOPED_PACKAGE.test(nameOrPath)) {
|
|
13
|
-
throw new Error(`Invalid plugin name "${nameOrPath}". Scoped packages must match @org/name ` +
|
|
14
|
-
`with only lowercase letters, numbers, and hyphens.`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
// Simple name: only allow lowercase letters, numbers, and hyphens
|
|
19
|
-
if (!VALID_SIMPLE_NAME.test(nameOrPath)) {
|
|
20
|
-
throw new Error(`Invalid plugin name "${nameOrPath}". Plugin names must contain only ` +
|
|
21
|
-
`lowercase letters, numbers, and hyphens.`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export async function loadPlugin(nameOrPath) {
|
|
26
|
-
// Security: Validate plugin name before dynamic import
|
|
27
|
-
validatePluginName(nameOrPath);
|
|
28
|
-
// Handle shorthand: "react" -> "@buoy-design/plugin-react"
|
|
29
|
-
const moduleName = nameOrPath.startsWith('@')
|
|
30
|
-
? nameOrPath
|
|
31
|
-
: `${PLUGIN_PREFIX}${nameOrPath}`;
|
|
32
|
-
try {
|
|
33
|
-
const imported = await import(moduleName);
|
|
34
|
-
const factory = imported.default || imported.plugin || imported;
|
|
35
|
-
if (typeof factory !== 'function') {
|
|
36
|
-
throw new Error(`Plugin ${moduleName} does not export a valid factory function`);
|
|
37
|
-
}
|
|
38
|
-
const plugin = await factory();
|
|
39
|
-
registry.register(plugin);
|
|
40
|
-
return plugin;
|
|
41
|
-
}
|
|
42
|
-
catch (err) {
|
|
43
|
-
if (err.code === 'ERR_MODULE_NOT_FOUND') {
|
|
44
|
-
throw new Error(`Plugin "${moduleName}" not found. Install it with: npm install ${moduleName}`);
|
|
45
|
-
}
|
|
46
|
-
throw err;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
export async function discoverPlugins(options = {}) {
|
|
50
|
-
const projectRoot = options.projectRoot || process.cwd();
|
|
51
|
-
const pkgPath = resolve(projectRoot, 'package.json');
|
|
52
|
-
if (!existsSync(pkgPath)) {
|
|
53
|
-
return [];
|
|
54
|
-
}
|
|
55
|
-
const pkgJson = JSON.parse(await readFile(pkgPath, 'utf-8'));
|
|
56
|
-
const allDeps = {
|
|
57
|
-
...pkgJson.dependencies,
|
|
58
|
-
...pkgJson.devDependencies,
|
|
59
|
-
};
|
|
60
|
-
return Object.keys(allDeps).filter((dep) => dep.startsWith(PLUGIN_PREFIX));
|
|
61
|
-
}
|
|
62
|
-
export async function loadDiscoveredPlugins(options = {}) {
|
|
63
|
-
const pluginNames = await discoverPlugins(options);
|
|
64
|
-
const plugins = [];
|
|
65
|
-
for (const name of pluginNames) {
|
|
66
|
-
try {
|
|
67
|
-
const plugin = await loadPlugin(name);
|
|
68
|
-
plugins.push(plugin);
|
|
69
|
-
}
|
|
70
|
-
catch (err) {
|
|
71
|
-
console.warn(`Warning: Failed to load plugin ${name}:`, err.message);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return plugins;
|
|
75
|
-
}
|
|
76
|
-
export { registry };
|
|
77
|
-
//# sourceMappingURL=loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/plugins/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAE7C,4FAA4F;AAC5F,MAAM,iBAAiB,GAAG,cAAc,CAAC;AACzC,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAEzD,SAAS,kBAAkB,CAAC,UAAkB;IAC5C,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,yEAAyE;QACzE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CACb,wBAAwB,UAAU,0CAA0C;gBAC1E,oDAAoD,CACvD,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,CAAC;QACN,kEAAkE;QAClE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CACb,wBAAwB,UAAU,oCAAoC;gBACpE,0CAA0C,CAC7C,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAOD,MAAM,C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AAM,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG;QACd,GAAG,OAAO,CAAC,YAAY;QACvB,GAAG,OAAO,CAAC,eAAe;KAC3B,CAAC;IAEF,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,UAAyB,EAAE;IACrE,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC;IACnD,MAAM,OAAO,GAAiB,EAAE,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;YACtC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,kCAAkC,IAAI,GAAG,EAAG,GAAa,CAAC,OAAO,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { BuoyPlugin, PluginMetadata } from '@buoy-design/core';
|
|
2
|
-
export declare class PluginRegistry {
|
|
3
|
-
private plugins;
|
|
4
|
-
register(plugin: BuoyPlugin): void;
|
|
5
|
-
get(name: string): BuoyPlugin | undefined;
|
|
6
|
-
getAll(): BuoyPlugin[];
|
|
7
|
-
getScanners(): BuoyPlugin[];
|
|
8
|
-
getReporters(): BuoyPlugin[];
|
|
9
|
-
getByDetection(framework: string): BuoyPlugin | undefined;
|
|
10
|
-
list(): PluginMetadata[];
|
|
11
|
-
unregister(name: string): boolean;
|
|
12
|
-
clear(): void;
|
|
13
|
-
}
|
|
14
|
-
export declare const registry: PluginRegistry;
|
|
15
|
-
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/plugins/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEpE,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAsC;IAErD,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAIlC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIzC,MAAM,IAAI,UAAU,EAAE;IAItB,WAAW,IAAI,UAAU,EAAE;IAI3B,YAAY,IAAI,UAAU,EAAE;IAI5B,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAMzD,IAAI,IAAI,cAAc,EAAE;IAIxB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC,KAAK,IAAI,IAAI;CAGd;AAED,eAAO,MAAM,QAAQ,gBAAuB,CAAC"}
|
package/dist/plugins/registry.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export class PluginRegistry {
|
|
2
|
-
plugins = new Map();
|
|
3
|
-
register(plugin) {
|
|
4
|
-
this.plugins.set(plugin.metadata.name, plugin);
|
|
5
|
-
}
|
|
6
|
-
get(name) {
|
|
7
|
-
return this.plugins.get(name);
|
|
8
|
-
}
|
|
9
|
-
getAll() {
|
|
10
|
-
return Array.from(this.plugins.values());
|
|
11
|
-
}
|
|
12
|
-
getScanners() {
|
|
13
|
-
return this.getAll().filter((p) => typeof p.scan === 'function');
|
|
14
|
-
}
|
|
15
|
-
getReporters() {
|
|
16
|
-
return this.getAll().filter((p) => typeof p.report === 'function');
|
|
17
|
-
}
|
|
18
|
-
getByDetection(framework) {
|
|
19
|
-
return this.getAll().find((p) => p.metadata.detects?.includes(framework.toLowerCase()));
|
|
20
|
-
}
|
|
21
|
-
list() {
|
|
22
|
-
return this.getAll().map((p) => p.metadata);
|
|
23
|
-
}
|
|
24
|
-
unregister(name) {
|
|
25
|
-
return this.plugins.delete(name);
|
|
26
|
-
}
|
|
27
|
-
clear() {
|
|
28
|
-
this.plugins.clear();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
export const registry = new PluginRegistry();
|
|
32
|
-
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/plugins/registry.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAc;IACjB,OAAO,GAA4B,IAAI,GAAG,EAAE,CAAC;IAErD,QAAQ,CAAC,MAAkB;QACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IACnE,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC;IACrE,CAAC;IAED,cAAc,CAAC,SAAiB;QAC9B,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC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