@gurulu/cli 0.1.0 → 0.1.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 +7 -3
- package/scripts/.gitkeep +0 -0
- package/scripts/README-gurulu-agentic-install.md +114 -0
- package/scripts/README-gurulu-scan.md +98 -0
- package/scripts/audit-cli-scopes.mjs +204 -0
- package/scripts/backfill-tenant-id.mjs +172 -0
- package/scripts/backfill-tenant-links.ts +252 -0
- package/scripts/backup-clickhouse.sh +27 -0
- package/scripts/backup-postgres.sh +19 -0
- package/scripts/bootstrap-runtime-schema.mjs +105 -0
- package/scripts/bootstrap-stripe.mjs +158 -0
- package/scripts/gurulu-agentic-install.lib.cjs +734 -0
- package/scripts/gurulu-agentic-install.mjs +343 -0
- package/scripts/gurulu-scan.lib.cjs +989 -0
- package/scripts/gurulu-scan.mjs +91 -0
- package/scripts/gurulu-verify-install.lib.cjs +334 -0
- package/scripts/gurulu-verify-install.mjs +59 -0
- package/scripts/init-ssl.sh +26 -0
- package/scripts/migrate-flow-graph-enums.sh +86 -0
- package/scripts/monitor-disk.sh +24 -0
- package/scripts/patches/astro.patch.cjs +73 -0
- package/scripts/patches/auto-instrument/ast-helper.cjs +332 -0
- package/scripts/patches/auto-instrument/astro.cjs +267 -0
- package/scripts/patches/auto-instrument/express.cjs +368 -0
- package/scripts/patches/auto-instrument/fastify.cjs +258 -0
- package/scripts/patches/auto-instrument/index.cjs +78 -0
- package/scripts/patches/auto-instrument/nestjs.cjs +282 -0
- package/scripts/patches/auto-instrument/nextjs-app-router.cjs +318 -0
- package/scripts/patches/auto-instrument/nextjs-pages.cjs +348 -0
- package/scripts/patches/auto-instrument/remix.cjs +164 -0
- package/scripts/patches/auto-instrument/singleton-helper.cjs +193 -0
- package/scripts/patches/auto-instrument/sveltekit.cjs +157 -0
- package/scripts/patches/auto-instrument/vite-react.cjs +37 -0
- package/scripts/patches/auto-instrument/vue.cjs +192 -0
- package/scripts/patches/express.patch.cjs +99 -0
- package/scripts/patches/fastify.patch.cjs +107 -0
- package/scripts/patches/index.cjs +294 -0
- package/scripts/patches/nestjs.patch.cjs +111 -0
- package/scripts/patches/nextjs-app-router.patch.cjs +95 -0
- package/scripts/patches/nextjs-pages.patch.cjs +96 -0
- package/scripts/patches/remix.patch.cjs +74 -0
- package/scripts/patches/sveltekit.patch.cjs +71 -0
- package/scripts/patches/vite-react.patch.cjs +72 -0
- package/scripts/patches/vue.patch.cjs +81 -0
- package/scripts/renew-ssl.sh +14 -0
- package/scripts/resolve-migration.sh +23 -0
- package/scripts/seed-cli-dev-keys.mjs +130 -0
- package/scripts/seed-test-data.mjs +391 -0
- package/scripts/spike-browserless.ts +65 -0
- package/scripts/tenant-pivot-consistency-check.mjs +205 -0
- package/scripts/tenant-pivot-phase-3-cleanup.lib.cjs +258 -0
- package/scripts/tenant-pivot-phase-3-cleanup.mjs +98 -0
- package/scripts/test-identity-resolution.ts +804 -0
- package/scripts/validate-gurulu-schemas.mjs +79 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Validates every example file in examples/gurulu/ against its matching
|
|
3
|
+
// schema in schemas/gurulu/. Pure contract check for the W4.1 spike —
|
|
4
|
+
// this script is NOT wired into the app runtime.
|
|
5
|
+
|
|
6
|
+
import { readFileSync, readdirSync } from "node:fs";
|
|
7
|
+
import { resolve, dirname, join } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import AjvModule from "ajv";
|
|
10
|
+
|
|
11
|
+
const Ajv = AjvModule.default || AjvModule;
|
|
12
|
+
|
|
13
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const repoRoot = resolve(here, "..");
|
|
15
|
+
const schemaDir = join(repoRoot, "schemas", "gurulu");
|
|
16
|
+
const exampleDir = join(repoRoot, "examples", "gurulu");
|
|
17
|
+
|
|
18
|
+
const ajv = new Ajv({ allErrors: true, strict: false });
|
|
19
|
+
// ajv 6.x doesn't understand draft-07 $id registration for "format: uri" by default,
|
|
20
|
+
// but it ships with basic formats. Keep validation permissive on unknown formats.
|
|
21
|
+
if (typeof ajv.addFormat === "function") {
|
|
22
|
+
for (const f of ["hostname", "uri", "date-time"]) {
|
|
23
|
+
if (!ajv.getFormat || !ajv.getFormat(f)) {
|
|
24
|
+
try { ajv.addFormat(f, { validate: () => true }); } catch {}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const schemaFiles = readdirSync(schemaDir).filter((f) => f.endsWith(".schema.json"));
|
|
30
|
+
|
|
31
|
+
let failures = 0;
|
|
32
|
+
for (const schemaFile of schemaFiles.sort()) {
|
|
33
|
+
const base = schemaFile.replace(".schema.json", "");
|
|
34
|
+
const schemaPath = join(schemaDir, schemaFile);
|
|
35
|
+
const examplePath = join(exampleDir, `${base}.json`);
|
|
36
|
+
|
|
37
|
+
let schema, example;
|
|
38
|
+
try {
|
|
39
|
+
schema = JSON.parse(readFileSync(schemaPath, "utf8"));
|
|
40
|
+
} catch (e) {
|
|
41
|
+
console.error(`SCHEMA PARSE FAIL ${schemaFile}: ${e.message}`);
|
|
42
|
+
failures++;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
example = JSON.parse(readFileSync(examplePath, "utf8"));
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.error(`EXAMPLE MISSING/INVALID ${base}.json: ${e.message}`);
|
|
49
|
+
failures++;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let validate;
|
|
54
|
+
try {
|
|
55
|
+
validate = ajv.compile(schema);
|
|
56
|
+
} catch (e) {
|
|
57
|
+
console.error(`COMPILE FAIL ${schemaFile}: ${e.message}`);
|
|
58
|
+
failures++;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const ok = validate(example);
|
|
63
|
+
if (ok) {
|
|
64
|
+
console.log(`OK ${base}`);
|
|
65
|
+
} else {
|
|
66
|
+
failures++;
|
|
67
|
+
console.error(`FAIL ${base}:`);
|
|
68
|
+
for (const err of validate.errors || []) {
|
|
69
|
+
console.error(` - ${err.instancePath || "(root)"} ${err.message}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (failures > 0) {
|
|
75
|
+
console.error(`\n${failures} validation failure(s).`);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
} else {
|
|
78
|
+
console.log(`\nAll ${schemaFiles.length} schema/example pairs valid.`);
|
|
79
|
+
}
|