@su-sws/synthetic-web-team 0.2.1 → 0.2.2
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/package.json +2 -2
- package/packages/cli/src/checks.mjs +47 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@su-sws/synthetic-web-team",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Stanford Web Services standards and agent team: policy, patterns, recipes, fragments, prior art, 31 skills, the two-part install wizard, and the advisory compliance CLI.",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"repository": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"sync-skills": "node scripts/sync-skills.mjs",
|
|
12
|
-
"validate": "node scripts/validate-skills.mjs && node scripts/validate-emit.mjs && node scripts/validate-install.mjs && node scripts/validate-criteria.mjs && node scripts/validate-state-classifier.mjs && node scripts/validate-hooks.mjs && node scripts/validate-acknowledged.mjs",
|
|
12
|
+
"validate": "node scripts/validate-skills.mjs && node scripts/validate-emit.mjs && node scripts/validate-install.mjs && node scripts/validate-criteria.mjs && node scripts/validate-state-classifier.mjs && node scripts/validate-hooks.mjs && node scripts/validate-acknowledged.mjs && node scripts/validate-layouts.mjs",
|
|
13
13
|
"check": "npm run validate && npm run sync-skills -- --check",
|
|
14
14
|
"pack:all": "mkdir -p .pack && npm pack --pack-destination ./.pack && npm pack -w @su-sws/synthetic-web-team-mcp --pack-destination ./.pack"
|
|
15
15
|
},
|
|
@@ -61,6 +61,44 @@ function installed(root, name) {
|
|
|
61
61
|
return existsSync(p) ? JSON.parse(read(p)) : null;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
// The project's own source files, relative to root and sorted shallowest first,
|
|
65
|
+
// wherever the project keeps them. Recipes disagree on the layout: Astro puts
|
|
66
|
+
// everything under src/, Next keeps styles/ and app/ at the root or under src/.
|
|
67
|
+
// A check that guesses one folder reports a fail on every project laid out the
|
|
68
|
+
// other way, so source checks search the whole project instead.
|
|
69
|
+
//
|
|
70
|
+
// Through git when it can, tracked files plus untracked ones git would not
|
|
71
|
+
// ignore, so .gitignore decides what is build output and no list of folder
|
|
72
|
+
// names goes stale. node_modules is never source, ignored or not. Outside a
|
|
73
|
+
// repository, walk the tree and skip node_modules, dot-folders and the usual
|
|
74
|
+
// build output.
|
|
75
|
+
const NOT_SOURCE = new Set(['node_modules', 'dist', '_site', 'build', 'out']);
|
|
76
|
+
|
|
77
|
+
export function projectFiles(root) {
|
|
78
|
+
let files;
|
|
79
|
+
try {
|
|
80
|
+
files = execFileSync('git', ['ls-files', '-z', '--cached', '--others', '--exclude-standard'],
|
|
81
|
+
{ cwd: root, encoding: 'utf8', maxBuffer: 256 * 1024 * 1024, stdio: ['ignore', 'pipe', 'ignore'] })
|
|
82
|
+
.split('\0').filter(Boolean)
|
|
83
|
+
.filter((f) => !f.split('/').includes('node_modules'))
|
|
84
|
+
// A file deleted but not yet staged is still listed.
|
|
85
|
+
.filter((f) => existsSync(join(root, f)));
|
|
86
|
+
} catch {
|
|
87
|
+
files = [];
|
|
88
|
+
(function walk(d) {
|
|
89
|
+
if (!existsSync(d)) return;
|
|
90
|
+
for (const n of readdirSync(d)) {
|
|
91
|
+
const p = join(d, n);
|
|
92
|
+
if (statSync(p).isDirectory()) {
|
|
93
|
+
if (!n.startsWith('.') && !NOT_SOURCE.has(n)) walk(p);
|
|
94
|
+
} else files.push(relative(root, p));
|
|
95
|
+
}
|
|
96
|
+
})(root);
|
|
97
|
+
}
|
|
98
|
+
const depth = (f) => f.split('/').length;
|
|
99
|
+
return files.sort((a, b) => depth(a) - depth(b) || a.localeCompare(b));
|
|
100
|
+
}
|
|
101
|
+
|
|
64
102
|
// --------------------------------------------------------------------------
|
|
65
103
|
// footer: reads the contract, never hardcodes the link set
|
|
66
104
|
// --------------------------------------------------------------------------
|
|
@@ -358,17 +396,10 @@ export function decanter({ root }) {
|
|
|
358
396
|
'Dead package: supports neither current Astro nor Tailwind 4. Use @tailwindcss/vite.')
|
|
359
397
|
: ok('decanter.no-dead-integration', '@astrojs/tailwind absent'));
|
|
360
398
|
|
|
361
|
-
// Entry CSS: redundant tailwind import, and the @source myth.
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
for (const n of readdirSync(d)) {
|
|
366
|
-
const p = join(d, n);
|
|
367
|
-
if (statSync(p).isDirectory()) { if (n !== 'node_modules') walk(p); }
|
|
368
|
-
else if (n.endsWith('.css')) cssFiles.push(p);
|
|
369
|
-
}
|
|
370
|
-
})(join(root, 'src'));
|
|
371
|
-
|
|
399
|
+
// Entry CSS: redundant tailwind import, and the @source myth. Searched across
|
|
400
|
+
// the project, because Astro keeps it in src/styles/ and Next in styles/ or
|
|
401
|
+
// app/, at the root or under src/.
|
|
402
|
+
const cssFiles = projectFiles(root).filter((f) => f.endsWith('.css')).map((f) => join(root, f));
|
|
372
403
|
const entry = cssFiles.find((f) => /@import\s+['"]decanter['"]/.test(read(f)));
|
|
373
404
|
if (!entry) {
|
|
374
405
|
out.push(d ? bad('decanter.entry-css', 'no CSS file imports decanter',
|
|
@@ -1418,18 +1449,13 @@ export function next({ root, html }) {
|
|
|
1418
1449
|
: ok('next.no-tailwind-config', 'no tailwind JS config'));
|
|
1419
1450
|
|
|
1420
1451
|
// metadataBase is the Next equivalent of Astro's `site`, and the same miss.
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
const p = join(d, n);
|
|
1426
|
-
if (statSync(p).isDirectory()) { if (n !== 'node_modules') walk(p); }
|
|
1427
|
-
else if (/^layout\.(t|j)sx?$/.test(n)) layouts.push(p);
|
|
1428
|
-
}
|
|
1429
|
-
})(join(root, 'app'));
|
|
1452
|
+
// Next takes the App Router from app/ or, when that is absent, src/app/.
|
|
1453
|
+
const layouts = projectFiles(root)
|
|
1454
|
+
.filter((f) => /^(src\/)?app\/(.+\/)?layout\.(t|j)sx?$/.test(f))
|
|
1455
|
+
.map((f) => join(root, f));
|
|
1430
1456
|
|
|
1431
1457
|
if (!layouts.length) {
|
|
1432
|
-
out.push(dunno('next.metadata-base', 'no
|
|
1458
|
+
out.push(dunno('next.metadata-base', 'no layout file in app/ or src/app/; App Router expected'));
|
|
1433
1459
|
} else {
|
|
1434
1460
|
const hit = layouts.find((f) => /metadataBase/.test(read(f)));
|
|
1435
1461
|
out.push(hit
|