@oddessentials/repo-standards 6.0.0 β 7.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/README.md +56 -15
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/config/standards.csharp-dotnet.azure-devops.json +1 -1
- package/dist/config/standards.csharp-dotnet.github-actions.json +1 -1
- package/dist/config/standards.csharp-dotnet.json +1 -1
- package/dist/config/standards.go.azure-devops.json +1 -1
- package/dist/config/standards.go.github-actions.json +1 -1
- package/dist/config/standards.go.json +1 -1
- package/dist/config/standards.json +1 -1
- package/dist/config/standards.python.azure-devops.json +1 -1
- package/dist/config/standards.python.github-actions.json +1 -1
- package/dist/config/standards.python.json +1 -1
- package/dist/config/standards.rust.azure-devops.json +1 -1
- package/dist/config/standards.rust.github-actions.json +1 -1
- package/dist/config/standards.rust.json +1 -1
- package/dist/config/standards.typescript-js.azure-devops.json +1 -1
- package/dist/config/standards.typescript-js.github-actions.json +1 -1
- package/dist/config/standards.typescript-js.json +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +14 -5
- package/scripts/build.ts +25 -9
- package/scripts/env-guard.ts +84 -0
- package/scripts/generate-instructions.ts +1 -1
- package/scripts/generate-readme-counts.ts +1 -1
- package/scripts/generate-standards.ts +20 -2
- package/scripts/sync-schema-version-pretest.cjs +43 -0
- package/scripts/types.internal.ts +18 -0
- package/scripts/validate-schema.ts +2 -48
package/README.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/@oddessentials/repo-standards)
|
|
2
|
+
[](https://www.npmjs.com/package/@oddessentials/repo-standards)
|
|
2
3
|
[](https://github.com/oddessentials/repo-standards/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/oddessentials/repo-standards/actions/workflows/release.yml)
|
|
5
|
+
[](https://renovatebot.com)
|
|
6
|
+
[](https://github.com/semantic-release/semantic-release)
|
|
7
|
+
[](https://conventionalcommits.org)
|
|
3
8
|
[](LICENSE)
|
|
9
|
+
[](https://nodejs.org)
|
|
10
|
+
[](https://www.typescriptlang.org/)
|
|
11
|
+
[](https://eslint.org/)
|
|
12
|
+
[](https://prettier.io/)
|
|
13
|
+
[](CONTRIBUTING.md)
|
|
14
|
+
[](https://github.com/oddessentials/repo-standards/graphs/commit-activity)
|
|
4
15
|
|
|
5
16
|
# π Repository Standards & CI Checklist
|
|
6
17
|
|
|
@@ -18,7 +29,7 @@ It is designed to be:
|
|
|
18
29
|
|
|
19
30
|
---
|
|
20
31
|
|
|
21
|
-
## Whatβs Included
|
|
32
|
+
## π¦ Whatβs Included
|
|
22
33
|
|
|
23
34
|
- **Master spec (source of truth)**
|
|
24
35
|
`config/standards.json`
|
|
@@ -31,7 +42,7 @@ It is designed to be:
|
|
|
31
42
|
|
|
32
43
|
---
|
|
33
44
|
|
|
34
|
-
## Meta Rules (Global Policy)
|
|
45
|
+
## π§ Meta Rules (Global Policy)
|
|
35
46
|
|
|
36
47
|
The master spec includes a `meta` block that defines system-wide expectations:
|
|
37
48
|
|
|
@@ -66,9 +77,9 @@ The master spec includes a `meta` block that defines system-wide expectations:
|
|
|
66
77
|
|
|
67
78
|
---
|
|
68
79
|
|
|
69
|
-
## Structure of `config/standards.json`
|
|
80
|
+
## π Structure of `config/standards.json`
|
|
70
81
|
|
|
71
|
-
- `version` β schema version (
|
|
82
|
+
- `version` β schema version (matches package.json major version)
|
|
72
83
|
- `meta` β global rules and migration policy
|
|
73
84
|
- `ciSystems` β supported CI platforms
|
|
74
85
|
_(currently `github-actions`, `azure-devops`)_
|
|
@@ -105,17 +116,16 @@ The `version` field indicates schema compatibility:
|
|
|
105
116
|
- `3` β Expands release, build determinism, and provenance/CI automation requirements; adds unified release workflow and template automation guidance.
|
|
106
117
|
- `4` β Stable API contract with `getStandards()`, `getSchema()`, `STANDARDS_VERSION` exports; Node 22 LTS alignment.
|
|
107
118
|
- `5` β Adds automated version-guard guidance for repositories using semantic-release; schema aligned to package major version 5.
|
|
119
|
+
- `6` β Schema version aligned to package major version 6; introduces automated pre-test version sync.
|
|
108
120
|
|
|
109
|
-
To keep `config/standards.json` in sync with semantic-release major bumps,
|
|
110
|
-
`
|
|
111
|
-
and commit the updated files. This updates the schema version and README
|
|
112
|
-
references in one place.
|
|
121
|
+
To keep `config/standards.json` in sync with semantic-release major bumps, the
|
|
122
|
+
`sync:version` script runs automatically before tests.
|
|
113
123
|
|
|
114
124
|
Consumers should ignore unknown fields for forward compatibility.
|
|
115
125
|
|
|
116
126
|
---
|
|
117
127
|
|
|
118
|
-
## Dependency Governance (Recommended Items)
|
|
128
|
+
## π Dependency Governance (Recommended Items)
|
|
119
129
|
|
|
120
130
|
Two recommended checklist items support supply-chain governance:
|
|
121
131
|
|
|
@@ -152,7 +162,7 @@ Required secrets:
|
|
|
152
162
|
|
|
153
163
|
---
|
|
154
164
|
|
|
155
|
-
## Bazel Integration
|
|
165
|
+
## π οΈ Bazel Integration
|
|
156
166
|
|
|
157
167
|
This framework supports Bazel as an **optional build executor** for quality checks.
|
|
158
168
|
|
|
@@ -230,7 +240,7 @@ To disable Bazel hints for a repo that contains Bazel files but uses npm for qua
|
|
|
230
240
|
|
|
231
241
|
---
|
|
232
242
|
|
|
233
|
-
## Generating Stack-Specific JSON
|
|
243
|
+
## π Generating Stack-Specific JSON
|
|
234
244
|
|
|
235
245
|
The generator reads the master spec and produces filtered, deterministic outputs.
|
|
236
246
|
|
|
@@ -275,7 +285,7 @@ config/standards.typescript-js.github-actions.json
|
|
|
275
285
|
|
|
276
286
|
---
|
|
277
287
|
|
|
278
|
-
## Consuming This Package (npm)
|
|
288
|
+
## π₯ Consuming This Package (npm)
|
|
279
289
|
|
|
280
290
|
Install:
|
|
281
291
|
|
|
@@ -295,7 +305,7 @@ This package is intentionally **read-only** and **side-effect free**.
|
|
|
295
305
|
|
|
296
306
|
---
|
|
297
307
|
|
|
298
|
-
## How to Apply to a Repository
|
|
308
|
+
## π How to Apply to a Repository
|
|
299
309
|
|
|
300
310
|
1. Identify the stack (`typescript-js`, `csharp-dotnet`, `python`)
|
|
301
311
|
2. Generate the filtered checklist
|
|
@@ -308,7 +318,7 @@ For existing repositories, follow `meta.migrationGuide` to adopt standards incre
|
|
|
308
318
|
|
|
309
319
|
---
|
|
310
320
|
|
|
311
|
-
## Instruction Generation
|
|
321
|
+
## π Instruction Generation
|
|
312
322
|
|
|
313
323
|
Human-readable βagent instructionsβ can also be generated:
|
|
314
324
|
|
|
@@ -325,7 +335,38 @@ npm run generate:instructions -- standards.csharp-dotnet.azure-devops.json
|
|
|
325
335
|
|
|
326
336
|
---
|
|
327
337
|
|
|
328
|
-
##
|
|
338
|
+
## β
Dogfooding Compliance
|
|
339
|
+
|
|
340
|
+
This repository follows its own standards. See [docs/COMPLIANCE.md](docs/COMPLIANCE.md) for the full audit.
|
|
341
|
+
|
|
342
|
+
| Category | Status | Notes |
|
|
343
|
+
| ------------------------- | ------ | ----------------------------------- |
|
|
344
|
+
| βοΈ Core (29 items) | 28/29 | Secret scanning N/A for public repo |
|
|
345
|
+
| π Recommended (12 items) | 6/12 | AI/E2E items N/A for library |
|
|
346
|
+
| π― Optional (3 items) | 0/3 | Not targeted |
|
|
347
|
+
|
|
348
|
+
<details>
|
|
349
|
+
<summary>π Core Requirements</summary>
|
|
350
|
+
|
|
351
|
+
| Status | Standard |
|
|
352
|
+
| ------ | ------------------------------------------- |
|
|
353
|
+
| β
| Line Endings, CRLF Detection, Ignore Files |
|
|
354
|
+
| β
| Linting (ESLint v9), Formatter (Prettier) |
|
|
355
|
+
| β
| Unit Tests (Vitest), CI Quality Gates |
|
|
356
|
+
| β
| Semantic Versioning, Version Guard |
|
|
357
|
+
| β
| Unified Release, Hook Bypass, Commit Lint |
|
|
358
|
+
| β
| Type Checking (strict), Dependency Security |
|
|
359
|
+
| β
| Deterministic Builds, Provenance |
|
|
360
|
+
| β
| Hooks (Husky), Hook/CI Parity |
|
|
361
|
+
| β
| Runtime Version, Documentation, Governance |
|
|
362
|
+
| β οΈ | Coverage (low thresholds - intentional) |
|
|
363
|
+
| β¬ | Secret Scanning (N/A for public repo) |
|
|
364
|
+
|
|
365
|
+
</details>
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
## π‘ Philosophy
|
|
329
370
|
|
|
330
371
|
π **Small rules. Shared language. Predictable outcomes.**
|
|
331
372
|
|
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../node_modules/tsup/assets/cjs_shims.js","../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * repo-standards CLI\n *\n * Usage:\n * repo-standards --version\n * repo-standards --help\n * repo-standards <stack> [ci-system]\n */\n\nimport { createRequire } from \"node:module\";\nimport {\n loadBaseline,\n listSupportedStacks,\n listSupportedCiSystems,\n} from \"./index.js\";\nimport type { StackId, CiSystem } from \"./types.js\";\n\n// Dynamic version reading from package.json for determinism invariant compliance\nconst require = createRequire(import.meta.url);\nconst pkg = require(\"../package.json\") as { version: string };\n\n/** Package version - dynamically read from package.json for determinism */\nexport const VERSION: string = pkg.version;\n\nfunction printHelp(): void {\n console.log(`repo-standards v${VERSION}\n\nUsage:\n repo-standards --version Print version and exit\n repo-standards --help Print this help message\n repo-standards <stack> [ci] Get standards for a stack (optional CI system)\n\nSupported stacks: ${listSupportedStacks().join(\", \")}\nSupported CI systems: ${listSupportedCiSystems().join(\", \")}\n\nExamples:\n repo-standards typescript-js\n repo-standards python github-actions\n`);\n}\n\nfunction main(): void {\n const args = process.argv.slice(2);\n\n // Handle --version\n if (args.includes(\"--version\") || args.includes(\"-V\")) {\n console.log(VERSION);\n process.exit(0);\n }\n\n // Handle --help or no args\n if (args.includes(\"--help\") || args.includes(\"-h\") || args.length === 0) {\n printHelp();\n process.exit(args.length === 0 ? 1 : 0);\n }\n\n const [stackArg, ciArg] = args;\n const validStacks = listSupportedStacks();\n const validCiSystems = listSupportedCiSystems();\n\n // Validate stack\n if (!validStacks.includes(stackArg as StackId)) {\n console.error(`Error: Unknown stack \"${stackArg}\"`);\n console.error(`Valid stacks: ${validStacks.join(\", \")}`);\n process.exit(1);\n }\n\n // Validate CI system if provided\n if (ciArg && !validCiSystems.includes(ciArg as CiSystem)) {\n console.error(`Error: Unknown CI system \"${ciArg}\"`);\n console.error(`Valid CI systems: ${validCiSystems.join(\", \")}`);\n process.exit(1);\n }\n\n // Load and output standards\n const standards = loadBaseline(\n stackArg as StackId,\n ciArg as CiSystem | undefined,\n );\n console.log(JSON.stringify(standards, null, 2));\n}\n\nmain();\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","import { fileURLToPath } from \"node:url\";\nimport { readFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport type {\n MasterJson,\n StackChecklistJson,\n StackId,\n CiSystem,\n} from \"./types.js\";\nimport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION } from \"./version.js\";\n\n// Re-export types for consumers\nexport type { MasterJson, StackChecklistJson, StackId, CiSystem };\n\n// Re-export version info (stable API contract)\nexport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION };\n\n// ESM equivalent of __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Path to config directory:\n// - When running from src/ (dev/test): use repo root config/\n// - When running from dist/ (installed): use dist/config/\nconst isDevMode = __dirname.includes(\"src\");\nconst configDir = isDevMode\n ? join(__dirname, \"..\", \"config\")\n : join(__dirname, \"config\");\n\n/** Load the master spec JSON from the packaged dist directory */\nexport function loadMasterSpec(): MasterJson {\n const filePath = join(configDir, \"standards.json\");\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** Load a stack-specific checklist (optionally filtered by CI system) */\nexport function loadBaseline(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n const suffix = ci ? `.${ci}` : \"\";\n const file = `standards.${stack}${suffix}.json`;\n const filePath = join(configDir, file);\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** List all supported stacks (derived from the master spec) */\nexport function listSupportedStacks(): readonly StackId[] {\n const spec = loadMasterSpec();\n return Object.keys(spec.stacks) as StackId[];\n}\n\n/** List all supported CI systems (derived from the master spec) */\nexport function listSupportedCiSystems(): readonly CiSystem[] {\n const spec = loadMasterSpec();\n return spec.ciSystems as CiSystem[];\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadBaseline - loads stack-specific standards checklist.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getStandards(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n return loadBaseline(stack, ci);\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadMasterSpec - loads the master standards schema.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getSchema(): MasterJson {\n return loadMasterSpec();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ADF9D,yBAA8B;;;AEV9B,sBAA8B;A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QAAQ,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,WAAW,GAAG;AACvE,cAAU;AACV,YAAQ,KAAK,KAAK,WAAW,IAAI,IAAI,CAAC;AAAA,EACxC;AAEA,QAAM,CAAC,UAAU,KAAK,IAAI;AAC1B,QAAM,cAAc,oBAAoB;AACxC,QAAM,iBAAiB,uBAAuB;AAG9C,MAAI,CAAC,YAAY,SAAS,QAAmB,GAAG;AAC9C,YAAQ,MAAM,yBAAyB,QAAQ,GAAG;AAClD,YAAQ,MAAM,iBAAiB,YAAY,KAAK,IAAI,CAAC,EAAE;AACvD,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,MAAI,SAAS,CAAC,eAAe,SAAS,KAAiB,GAAG;AACxD,YAAQ,MAAM,6BAA6B,KAAK,GAAG;AACnD,YAAQ,MAAM,qBAAqB,eAAe,KAAK,IAAI,CAAC,EAAE;AAC9D,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,EACF;AACA,UAAQ,IAAI,KAAK,UAAU,WAAW,MAAM,CAAC,CAAC;AAChD;AAEA,KAAK;","names":["__filename","require"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../node_modules/tsup/assets/cjs_shims.js","../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * repo-standards CLI\n *\n * Usage:\n * repo-standards --version\n * repo-standards --help\n * repo-standards <stack> [ci-system]\n */\n\nimport { createRequire } from \"node:module\";\nimport {\n loadBaseline,\n listSupportedStacks,\n listSupportedCiSystems,\n} from \"./index.js\";\nimport type { StackId, CiSystem } from \"./types.js\";\n\n// Dynamic version reading from package.json for determinism invariant compliance\nconst require = createRequire(import.meta.url);\nconst pkg = require(\"../package.json\") as { version: string };\n\n/** Package version - dynamically read from package.json for determinism */\nexport const VERSION: string = pkg.version;\n\nfunction printHelp(): void {\n console.log(`repo-standards v${VERSION}\n\nUsage:\n repo-standards --version Print version and exit\n repo-standards --help Print this help message\n repo-standards <stack> [ci] Get standards for a stack (optional CI system)\n\nSupported stacks: ${listSupportedStacks().join(\", \")}\nSupported CI systems: ${listSupportedCiSystems().join(\", \")}\n\nExamples:\n repo-standards typescript-js\n repo-standards python github-actions\n`);\n}\n\nfunction main(): void {\n const args = process.argv.slice(2);\n\n // Handle --version\n if (args.includes(\"--version\") || args.includes(\"-V\")) {\n console.log(VERSION);\n process.exit(0);\n }\n\n // Handle --help or no args\n if (args.includes(\"--help\") || args.includes(\"-h\") || args.length === 0) {\n printHelp();\n process.exit(args.length === 0 ? 1 : 0);\n }\n\n const [stackArg, ciArg] = args;\n const validStacks = listSupportedStacks();\n const validCiSystems = listSupportedCiSystems();\n\n // Validate stack\n if (!validStacks.includes(stackArg as StackId)) {\n console.error(`Error: Unknown stack \"${stackArg}\"`);\n console.error(`Valid stacks: ${validStacks.join(\", \")}`);\n process.exit(1);\n }\n\n // Validate CI system if provided\n if (ciArg && !validCiSystems.includes(ciArg as CiSystem)) {\n console.error(`Error: Unknown CI system \"${ciArg}\"`);\n console.error(`Valid CI systems: ${validCiSystems.join(\", \")}`);\n process.exit(1);\n }\n\n // Load and output standards\n const standards = loadBaseline(\n stackArg as StackId,\n ciArg as CiSystem | undefined,\n );\n console.log(JSON.stringify(standards, null, 2));\n}\n\nmain();\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","import { fileURLToPath } from \"node:url\";\nimport { readFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport type {\n MasterJson,\n StackChecklistJson,\n StackId,\n CiSystem,\n} from \"./types.js\";\nimport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION } from \"./version.js\";\n\n// Re-export types for consumers\nexport type { MasterJson, StackChecklistJson, StackId, CiSystem };\n\n// Re-export version info (stable API contract)\nexport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION };\n\n// ESM equivalent of __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Path to config directory:\n// - When running from src/ (dev/test): use repo root config/\n// - When running from dist/ (installed): use dist/config/\nconst isDevMode = __dirname.includes(\"src\");\nconst configDir = isDevMode\n ? join(__dirname, \"..\", \"config\")\n : join(__dirname, \"config\");\n\n/** Load the master spec JSON from the packaged dist directory */\nexport function loadMasterSpec(): MasterJson {\n const filePath = join(configDir, \"standards.json\");\n return JSON.parse(readFileSync(filePath, \"utf8\")) as MasterJson;\n}\n\n/** Load a stack-specific checklist (optionally filtered by CI system) */\nexport function loadBaseline(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n const suffix = ci ? `.${ci}` : \"\";\n const file = `standards.${stack}${suffix}.json`;\n const filePath = join(configDir, file);\n return JSON.parse(readFileSync(filePath, \"utf8\")) as StackChecklistJson;\n}\n\n/** List all supported stacks (derived from the master spec) */\nexport function listSupportedStacks(): readonly StackId[] {\n const spec = loadMasterSpec();\n return Object.keys(spec.stacks) as StackId[];\n}\n\n/** List all supported CI systems (derived from the master spec) */\nexport function listSupportedCiSystems(): readonly CiSystem[] {\n const spec = loadMasterSpec();\n return spec.ciSystems as CiSystem[];\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadBaseline - loads stack-specific standards checklist.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getStandards(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n return loadBaseline(stack, ci);\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadMasterSpec - loads the master standards schema.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getSchema(): MasterJson {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AAA;AAAA,oBAOpB,oBAAoB,EAAE,KAAK,IAAI,CAAC;AAAA,wBAC5B,uBAAuB,EAAE,KAAK,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,CAK1D;AACD;AAEA,SAAS,OAAa;AACpB,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAGjC,MAAI,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,IAAI,GAAG;AACrD,YAAQ,IAAI,OAAO;AACnB,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,MAAI,KAAK,SAAS,QAAQ,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,WAAW,GAAG;AACvE,cAAU;AACV,YAAQ,KAAK,KAAK,WAAW,IAAI,IAAI,CAAC;AAAA,EACxC;AAEA,QAAM,CAAC,UAAU,KAAK,IAAI;AAC1B,QAAM,cAAc,oBAAoB;AACxC,QAAM,iBAAiB,uBAAuB;AAG9C,MAAI,CAAC,YAAY,SAAS,QAAmB,GAAG;AAC9C,YAAQ,MAAM,yBAAyB,QAAQ,GAAG;AAClD,YAAQ,MAAM,iBAAiB,YAAY,KAAK,IAAI,CAAC,EAAE;AACvD,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,MAAI,SAAS,CAAC,eAAe,SAAS,KAAiB,GAAG;AACxD,YAAQ,MAAM,6BAA6B,KAAK,GAAG;AACnD,YAAQ,MAAM,qBAAqB,eAAe,KAAK,IAAI,CAAC,EAAE;AAC9D,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,EACF;AACA,UAAQ,IAAI,KAAK,UAAU,WAAW,MAAM,CAAC,CAAC;AAChD;AAEA,KAAK;","names":["__filename","require"]}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * repo-standards CLI\n *\n * Usage:\n * repo-standards --version\n * repo-standards --help\n * repo-standards <stack> [ci-system]\n */\n\nimport { createRequire } from \"node:module\";\nimport {\n loadBaseline,\n listSupportedStacks,\n listSupportedCiSystems,\n} from \"./index.js\";\nimport type { StackId, CiSystem } from \"./types.js\";\n\n// Dynamic version reading from package.json for determinism invariant compliance\nconst require = createRequire(import.meta.url);\nconst pkg = require(\"../package.json\") as { version: string };\n\n/** Package version - dynamically read from package.json for determinism */\nexport const VERSION: string = pkg.version;\n\nfunction printHelp(): void {\n console.log(`repo-standards v${VERSION}\n\nUsage:\n repo-standards --version Print version and exit\n repo-standards --help Print this help message\n repo-standards <stack> [ci] Get standards for a stack (optional CI system)\n\nSupported stacks: ${listSupportedStacks().join(\", \")}\nSupported CI systems: ${listSupportedCiSystems().join(\", \")}\n\nExamples:\n repo-standards typescript-js\n repo-standards python github-actions\n`);\n}\n\nfunction main(): void {\n const args = process.argv.slice(2);\n\n // Handle --version\n if (args.includes(\"--version\") || args.includes(\"-V\")) {\n console.log(VERSION);\n process.exit(0);\n }\n\n // Handle --help or no args\n if (args.includes(\"--help\") || args.includes(\"-h\") || args.length === 0) {\n printHelp();\n process.exit(args.length === 0 ? 1 : 0);\n }\n\n const [stackArg, ciArg] = args;\n const validStacks = listSupportedStacks();\n const validCiSystems = listSupportedCiSystems();\n\n // Validate stack\n if (!validStacks.includes(stackArg as StackId)) {\n console.error(`Error: Unknown stack \"${stackArg}\"`);\n console.error(`Valid stacks: ${validStacks.join(\", \")}`);\n process.exit(1);\n }\n\n // Validate CI system if provided\n if (ciArg && !validCiSystems.includes(ciArg as CiSystem)) {\n console.error(`Error: Unknown CI system \"${ciArg}\"`);\n console.error(`Valid CI systems: ${validCiSystems.join(\", \")}`);\n process.exit(1);\n }\n\n // Load and output standards\n const standards = loadBaseline(\n stackArg as StackId,\n ciArg as CiSystem | undefined,\n );\n console.log(JSON.stringify(standards, null, 2));\n}\n\nmain();\n","import { fileURLToPath } from \"node:url\";\nimport { readFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport type {\n MasterJson,\n StackChecklistJson,\n StackId,\n CiSystem,\n} from \"./types.js\";\nimport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION } from \"./version.js\";\n\n// Re-export types for consumers\nexport type { MasterJson, StackChecklistJson, StackId, CiSystem };\n\n// Re-export version info (stable API contract)\nexport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION };\n\n// ESM equivalent of __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Path to config directory:\n// - When running from src/ (dev/test): use repo root config/\n// - When running from dist/ (installed): use dist/config/\nconst isDevMode = __dirname.includes(\"src\");\nconst configDir = isDevMode\n ? join(__dirname, \"..\", \"config\")\n : join(__dirname, \"config\");\n\n/** Load the master spec JSON from the packaged dist directory */\nexport function loadMasterSpec(): MasterJson {\n const filePath = join(configDir, \"standards.json\");\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** Load a stack-specific checklist (optionally filtered by CI system) */\nexport function loadBaseline(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n const suffix = ci ? `.${ci}` : \"\";\n const file = `standards.${stack}${suffix}.json`;\n const filePath = join(configDir, file);\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** List all supported stacks (derived from the master spec) */\nexport function listSupportedStacks(): readonly StackId[] {\n const spec = loadMasterSpec();\n return Object.keys(spec.stacks) as StackId[];\n}\n\n/** List all supported CI systems (derived from the master spec) */\nexport function listSupportedCiSystems(): readonly CiSystem[] {\n const spec = loadMasterSpec();\n return spec.ciSystems as CiSystem[];\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadBaseline - loads stack-specific standards checklist.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getStandards(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n return loadBaseline(stack, ci);\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadMasterSpec - loads the master standards schema.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getSchema(): MasterJson {\n return loadMasterSpec();\n}\n"],"mappings":";;;AAUA,SAAS,qBAAqB;;;ACV9B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,MAAM,eAAe;AAgB9B,IAAMA,cAAa,cAAc,YAAY,GAAG;AAChD,IAAMC,aAAY,QAAQD,WAAU;AAKpC,IAAM,YAAYC,WAAU,SAAS,KAAK;AAC1C,IAAM,YAAY,YACd,KAAKA,YAAW,MAAM,QAAQ,IAC9B,KAAKA,YAAW,QAAQ;AAGrB,SAAS,iBAA6B;AAC3C,QAAM,WAAW,KAAK,WAAW,gBAAgB;AACjD,SAAO,KAAK,MAAM,aAAa,UAAU,MAAM,CAAC;AAClD;AAGO,SAAS,aACd,OACA,IACoB;AACpB,QAAM,SAAS,KAAK,IAAI,EAAE,KAAK;AAC/B,QAAM,OAAO,aAAa,KAAK,GAAG,MAAM;AACxC,QAAM,WAAW,KAAK,WAAW,IAAI;AACrC,SAAO,KAAK,MAAM,aAAa,UAAU,MAAM,CAAC;AAClD;AAGO,SAAS,sBAA0C;AACxD,QAAM,OAAO,eAAe;AAC5B,SAAO,OAAO,KAAK,KAAK,MAAM;AAChC;AAGO,SAAS,yBAA8C;AAC5D,QAAM,OAAO,eAAe;AAC5B,SAAO,KAAK;AACd;;;ADrCA,IAAMC,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAM,MAAMA,SAAQ,iBAAiB;AAG9B,IAAM,UAAkB,IAAI;AAEnC,SAAS,YAAkB;AACzB,UAAQ,IAAI,mBAAmB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAOpB,oBAAoB,EAAE,KAAK,IAAI,CAAC;AAAA,wBAC5B,uBAAuB,EAAE,KAAK,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,CAK1D;AACD;AAEA,SAAS,OAAa;AACpB,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAGjC,MAAI,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,IAAI,GAAG;AACrD,YAAQ,IAAI,OAAO;AACnB,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,MAAI,KAAK,SAAS,QAAQ,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,WAAW,GAAG;AACvE,cAAU;AACV,YAAQ,KAAK,KAAK,WAAW,IAAI,IAAI,CAAC;AAAA,EACxC;AAEA,QAAM,CAAC,UAAU,KAAK,IAAI;AAC1B,QAAM,cAAc,oBAAoB;AACxC,QAAM,iBAAiB,uBAAuB;AAG9C,MAAI,CAAC,YAAY,SAAS,QAAmB,GAAG;AAC9C,YAAQ,MAAM,yBAAyB,QAAQ,GAAG;AAClD,YAAQ,MAAM,iBAAiB,YAAY,KAAK,IAAI,CAAC,EAAE;AACvD,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,MAAI,SAAS,CAAC,eAAe,SAAS,KAAiB,GAAG;AACxD,YAAQ,MAAM,6BAA6B,KAAK,GAAG;AACnD,YAAQ,MAAM,qBAAqB,eAAe,KAAK,IAAI,CAAC,EAAE;AAC9D,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,EACF;AACA,UAAQ,IAAI,KAAK,UAAU,WAAW,MAAM,CAAC,CAAC;AAChD;AAEA,KAAK;","names":["__filename","__dirname","require"]}
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts","../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * repo-standards CLI\n *\n * Usage:\n * repo-standards --version\n * repo-standards --help\n * repo-standards <stack> [ci-system]\n */\n\nimport { createRequire } from \"node:module\";\nimport {\n loadBaseline,\n listSupportedStacks,\n listSupportedCiSystems,\n} from \"./index.js\";\nimport type { StackId, CiSystem } from \"./types.js\";\n\n// Dynamic version reading from package.json for determinism invariant compliance\nconst require = createRequire(import.meta.url);\nconst pkg = require(\"../package.json\") as { version: string };\n\n/** Package version - dynamically read from package.json for determinism */\nexport const VERSION: string = pkg.version;\n\nfunction printHelp(): void {\n console.log(`repo-standards v${VERSION}\n\nUsage:\n repo-standards --version Print version and exit\n repo-standards --help Print this help message\n repo-standards <stack> [ci] Get standards for a stack (optional CI system)\n\nSupported stacks: ${listSupportedStacks().join(\", \")}\nSupported CI systems: ${listSupportedCiSystems().join(\", \")}\n\nExamples:\n repo-standards typescript-js\n repo-standards python github-actions\n`);\n}\n\nfunction main(): void {\n const args = process.argv.slice(2);\n\n // Handle --version\n if (args.includes(\"--version\") || args.includes(\"-V\")) {\n console.log(VERSION);\n process.exit(0);\n }\n\n // Handle --help or no args\n if (args.includes(\"--help\") || args.includes(\"-h\") || args.length === 0) {\n printHelp();\n process.exit(args.length === 0 ? 1 : 0);\n }\n\n const [stackArg, ciArg] = args;\n const validStacks = listSupportedStacks();\n const validCiSystems = listSupportedCiSystems();\n\n // Validate stack\n if (!validStacks.includes(stackArg as StackId)) {\n console.error(`Error: Unknown stack \"${stackArg}\"`);\n console.error(`Valid stacks: ${validStacks.join(\", \")}`);\n process.exit(1);\n }\n\n // Validate CI system if provided\n if (ciArg && !validCiSystems.includes(ciArg as CiSystem)) {\n console.error(`Error: Unknown CI system \"${ciArg}\"`);\n console.error(`Valid CI systems: ${validCiSystems.join(\", \")}`);\n process.exit(1);\n }\n\n // Load and output standards\n const standards = loadBaseline(\n stackArg as StackId,\n ciArg as CiSystem | undefined,\n );\n console.log(JSON.stringify(standards, null, 2));\n}\n\nmain();\n","import { fileURLToPath } from \"node:url\";\nimport { readFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport type {\n MasterJson,\n StackChecklistJson,\n StackId,\n CiSystem,\n} from \"./types.js\";\nimport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION } from \"./version.js\";\n\n// Re-export types for consumers\nexport type { MasterJson, StackChecklistJson, StackId, CiSystem };\n\n// Re-export version info (stable API contract)\nexport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION };\n\n// ESM equivalent of __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Path to config directory:\n// - When running from src/ (dev/test): use repo root config/\n// - When running from dist/ (installed): use dist/config/\nconst isDevMode = __dirname.includes(\"src\");\nconst configDir = isDevMode\n ? join(__dirname, \"..\", \"config\")\n : join(__dirname, \"config\");\n\n/** Load the master spec JSON from the packaged dist directory */\nexport function loadMasterSpec(): MasterJson {\n const filePath = join(configDir, \"standards.json\");\n return JSON.parse(readFileSync(filePath, \"utf8\")) as MasterJson;\n}\n\n/** Load a stack-specific checklist (optionally filtered by CI system) */\nexport function loadBaseline(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n const suffix = ci ? `.${ci}` : \"\";\n const file = `standards.${stack}${suffix}.json`;\n const filePath = join(configDir, file);\n return JSON.parse(readFileSync(filePath, \"utf8\")) as StackChecklistJson;\n}\n\n/** List all supported stacks (derived from the master spec) */\nexport function listSupportedStacks(): readonly StackId[] {\n const spec = loadMasterSpec();\n return Object.keys(spec.stacks) as StackId[];\n}\n\n/** List all supported CI systems (derived from the master spec) */\nexport function listSupportedCiSystems(): readonly CiSystem[] {\n const spec = loadMasterSpec();\n return spec.ciSystems as CiSystem[];\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadBaseline - loads stack-specific standards checklist.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getStandards(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n return loadBaseline(stack, ci);\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadMasterSpec - loads the master standards schema.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getSchema(): MasterJson {\n return loadMasterSpec();\n}\n"],"mappings":";;;AAUA,SAAS,qBAAqB;;;ACV9B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,MAAM,eAAe;AAgB9B,IAAMA,cAAa,cAAc,YAAY,GAAG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;AACV,YAAQ,KAAK,KAAK,WAAW,IAAI,IAAI,CAAC;AAAA,EACxC;AAEA,QAAM,CAAC,UAAU,KAAK,IAAI;AAC1B,QAAM,cAAc,oBAAoB;AACxC,QAAM,iBAAiB,uBAAuB;AAG9C,MAAI,CAAC,YAAY,SAAS,QAAmB,GAAG;AAC9C,YAAQ,MAAM,yBAAyB,QAAQ,GAAG;AAClD,YAAQ,MAAM,iBAAiB,YAAY,KAAK,IAAI,CAAC,EAAE;AACvD,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,MAAI,SAAS,CAAC,eAAe,SAAS,KAAiB,GAAG;AACxD,YAAQ,MAAM,6BAA6B,KAAK,GAAG;AACnD,YAAQ,MAAM,qBAAqB,eAAe,KAAK,IAAI,CAAC,EAAE;AAC9D,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,QAAM,YAAY;AAAA,IAChB;AAAA,IACA;AAAA,EACF;AACA,UAAQ,IAAI,KAAK,UAAU,WAAW,MAAM,CAAC,CAAC;AAChD;AAEA,KAAK;","names":["__filename","__dirname","require"]}
|
package/dist/index.cjs
CHANGED
|
@@ -41,8 +41,8 @@ var import_node_fs = require("fs");
|
|
|
41
41
|
var import_node_path = require("path");
|
|
42
42
|
|
|
43
43
|
// src/version.ts
|
|
44
|
-
var STANDARDS_VERSION = "
|
|
45
|
-
var STANDARDS_SCHEMA_VERSION =
|
|
44
|
+
var STANDARDS_VERSION = "6.0.1";
|
|
45
|
+
var STANDARDS_SCHEMA_VERSION = 6;
|
|
46
46
|
|
|
47
47
|
// src/index.ts
|
|
48
48
|
var __filename2 = (0, import_node_url.fileURLToPath)(importMetaUrl);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../node_modules/tsup/assets/cjs_shims.js","../src/version.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\nimport { readFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport type {\n MasterJson,\n StackChecklistJson,\n StackId,\n CiSystem,\n} from \"./types.js\";\nimport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION } from \"./version.js\";\n\n// Re-export types for consumers\nexport type { MasterJson, StackChecklistJson, StackId, CiSystem };\n\n// Re-export version info (stable API contract)\nexport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION };\n\n// ESM equivalent of __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Path to config directory:\n// - When running from src/ (dev/test): use repo root config/\n// - When running from dist/ (installed): use dist/config/\nconst isDevMode = __dirname.includes(\"src\");\nconst configDir = isDevMode\n ? join(__dirname, \"..\", \"config\")\n : join(__dirname, \"config\");\n\n/** Load the master spec JSON from the packaged dist directory */\nexport function loadMasterSpec(): MasterJson {\n const filePath = join(configDir, \"standards.json\");\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** Load a stack-specific checklist (optionally filtered by CI system) */\nexport function loadBaseline(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n const suffix = ci ? `.${ci}` : \"\";\n const file = `standards.${stack}${suffix}.json`;\n const filePath = join(configDir, file);\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** List all supported stacks (derived from the master spec) */\nexport function listSupportedStacks(): readonly StackId[] {\n const spec = loadMasterSpec();\n return Object.keys(spec.stacks) as StackId[];\n}\n\n/** List all supported CI systems (derived from the master spec) */\nexport function listSupportedCiSystems(): readonly CiSystem[] {\n const spec = loadMasterSpec();\n return spec.ciSystems as CiSystem[];\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadBaseline - loads stack-specific standards checklist.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getStandards(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n return loadBaseline(stack, ci);\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadMasterSpec - loads the master standards schema.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getSchema(): MasterJson {\n return loadMasterSpec();\n}\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","/**\n * AUTO-GENERATED at build time by scripts/build.ts\n * DO NOT EDIT MANUALLY\n *\n * This module provides version information for the repo-standards package.\n * Consumers should import from here instead of package.json to avoid\n * ESM/CJS interop issues.\n */\n\nexport const STANDARDS_VERSION =
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../node_modules/tsup/assets/cjs_shims.js","../src/version.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\nimport { readFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport type {\n MasterJson,\n StackChecklistJson,\n StackId,\n CiSystem,\n} from \"./types.js\";\nimport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION } from \"./version.js\";\n\n// Re-export types for consumers\nexport type { MasterJson, StackChecklistJson, StackId, CiSystem };\n\n// Re-export version info (stable API contract)\nexport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION };\n\n// ESM equivalent of __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Path to config directory:\n// - When running from src/ (dev/test): use repo root config/\n// - When running from dist/ (installed): use dist/config/\nconst isDevMode = __dirname.includes(\"src\");\nconst configDir = isDevMode\n ? join(__dirname, \"..\", \"config\")\n : join(__dirname, \"config\");\n\n/** Load the master spec JSON from the packaged dist directory */\nexport function loadMasterSpec(): MasterJson {\n const filePath = join(configDir, \"standards.json\");\n return JSON.parse(readFileSync(filePath, \"utf8\")) as MasterJson;\n}\n\n/** Load a stack-specific checklist (optionally filtered by CI system) */\nexport function loadBaseline(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n const suffix = ci ? `.${ci}` : \"\";\n const file = `standards.${stack}${suffix}.json`;\n const filePath = join(configDir, file);\n return JSON.parse(readFileSync(filePath, \"utf8\")) as StackChecklistJson;\n}\n\n/** List all supported stacks (derived from the master spec) */\nexport function listSupportedStacks(): readonly StackId[] {\n const spec = loadMasterSpec();\n return Object.keys(spec.stacks) as StackId[];\n}\n\n/** List all supported CI systems (derived from the master spec) */\nexport function listSupportedCiSystems(): readonly CiSystem[] {\n const spec = loadMasterSpec();\n return spec.ciSystems as CiSystem[];\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadBaseline - loads stack-specific standards checklist.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getStandards(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n return loadBaseline(stack, ci);\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadMasterSpec - loads the master standards schema.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getSchema(): MasterJson {\n return loadMasterSpec();\n}\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","/**\n * AUTO-GENERATED at build time by scripts/build.ts\n * DO NOT EDIT MANUALLY\n *\n * This module provides version information for the repo-standards package.\n * Consumers should import from here instead of package.json to avoid\n * ESM/CJS interop issues.\n */\n\nexport const STANDARDS_VERSION = \"6.0.1\";\nexport const STANDARDS_SCHEMA_VERSION = 6;\n"],"mappings":";;;;;;;;;;;;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 +156,8 @@ interface StackChecklistJson {
|
|
|
156
156
|
* Consumers should import from here instead of package.json to avoid
|
|
157
157
|
* ESM/CJS interop issues.
|
|
158
158
|
*/
|
|
159
|
-
declare const STANDARDS_VERSION = "
|
|
160
|
-
declare const STANDARDS_SCHEMA_VERSION =
|
|
159
|
+
declare const STANDARDS_VERSION = "6.0.1";
|
|
160
|
+
declare const STANDARDS_SCHEMA_VERSION = 6;
|
|
161
161
|
|
|
162
162
|
/** Load the master spec JSON from the packaged dist directory */
|
|
163
163
|
declare function loadMasterSpec(): MasterJson;
|
package/dist/index.d.ts
CHANGED
|
@@ -156,8 +156,8 @@ interface StackChecklistJson {
|
|
|
156
156
|
* Consumers should import from here instead of package.json to avoid
|
|
157
157
|
* ESM/CJS interop issues.
|
|
158
158
|
*/
|
|
159
|
-
declare const STANDARDS_VERSION = "
|
|
160
|
-
declare const STANDARDS_SCHEMA_VERSION =
|
|
159
|
+
declare const STANDARDS_VERSION = "6.0.1";
|
|
160
|
+
declare const STANDARDS_SCHEMA_VERSION = 6;
|
|
161
161
|
|
|
162
162
|
/** Load the master spec JSON from the packaged dist directory */
|
|
163
163
|
declare function loadMasterSpec(): MasterJson;
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,8 @@ import { readFileSync } from "fs";
|
|
|
4
4
|
import { join, dirname } from "path";
|
|
5
5
|
|
|
6
6
|
// src/version.ts
|
|
7
|
-
var STANDARDS_VERSION = "
|
|
8
|
-
var STANDARDS_SCHEMA_VERSION =
|
|
7
|
+
var STANDARDS_VERSION = "6.0.1";
|
|
8
|
+
var STANDARDS_SCHEMA_VERSION = 6;
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
11
|
var __filename2 = fileURLToPath(import.meta.url);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/version.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\nimport { readFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport type {\n MasterJson,\n StackChecklistJson,\n StackId,\n CiSystem,\n} from \"./types.js\";\nimport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION } from \"./version.js\";\n\n// Re-export types for consumers\nexport type { MasterJson, StackChecklistJson, StackId, CiSystem };\n\n// Re-export version info (stable API contract)\nexport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION };\n\n// ESM equivalent of __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Path to config directory:\n// - When running from src/ (dev/test): use repo root config/\n// - When running from dist/ (installed): use dist/config/\nconst isDevMode = __dirname.includes(\"src\");\nconst configDir = isDevMode\n ? join(__dirname, \"..\", \"config\")\n : join(__dirname, \"config\");\n\n/** Load the master spec JSON from the packaged dist directory */\nexport function loadMasterSpec(): MasterJson {\n const filePath = join(configDir, \"standards.json\");\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** Load a stack-specific checklist (optionally filtered by CI system) */\nexport function loadBaseline(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n const suffix = ci ? `.${ci}` : \"\";\n const file = `standards.${stack}${suffix}.json`;\n const filePath = join(configDir, file);\n return JSON.parse(readFileSync(filePath, \"utf8\"));\n}\n\n/** List all supported stacks (derived from the master spec) */\nexport function listSupportedStacks(): readonly StackId[] {\n const spec = loadMasterSpec();\n return Object.keys(spec.stacks) as StackId[];\n}\n\n/** List all supported CI systems (derived from the master spec) */\nexport function listSupportedCiSystems(): readonly CiSystem[] {\n const spec = loadMasterSpec();\n return spec.ciSystems as CiSystem[];\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadBaseline - loads stack-specific standards checklist.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getStandards(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n return loadBaseline(stack, ci);\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadMasterSpec - loads the master standards schema.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getSchema(): MasterJson {\n return loadMasterSpec();\n}\n","/**\n * AUTO-GENERATED at build time by scripts/build.ts\n * DO NOT EDIT MANUALLY\n *\n * This module provides version information for the repo-standards package.\n * Consumers should import from here instead of package.json to avoid\n * ESM/CJS interop issues.\n */\n\nexport const STANDARDS_VERSION =
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/version.ts"],"sourcesContent":["import { fileURLToPath } from \"node:url\";\nimport { readFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport type {\n MasterJson,\n StackChecklistJson,\n StackId,\n CiSystem,\n} from \"./types.js\";\nimport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION } from \"./version.js\";\n\n// Re-export types for consumers\nexport type { MasterJson, StackChecklistJson, StackId, CiSystem };\n\n// Re-export version info (stable API contract)\nexport { STANDARDS_VERSION, STANDARDS_SCHEMA_VERSION };\n\n// ESM equivalent of __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n// Path to config directory:\n// - When running from src/ (dev/test): use repo root config/\n// - When running from dist/ (installed): use dist/config/\nconst isDevMode = __dirname.includes(\"src\");\nconst configDir = isDevMode\n ? join(__dirname, \"..\", \"config\")\n : join(__dirname, \"config\");\n\n/** Load the master spec JSON from the packaged dist directory */\nexport function loadMasterSpec(): MasterJson {\n const filePath = join(configDir, \"standards.json\");\n return JSON.parse(readFileSync(filePath, \"utf8\")) as MasterJson;\n}\n\n/** Load a stack-specific checklist (optionally filtered by CI system) */\nexport function loadBaseline(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n const suffix = ci ? `.${ci}` : \"\";\n const file = `standards.${stack}${suffix}.json`;\n const filePath = join(configDir, file);\n return JSON.parse(readFileSync(filePath, \"utf8\")) as StackChecklistJson;\n}\n\n/** List all supported stacks (derived from the master spec) */\nexport function listSupportedStacks(): readonly StackId[] {\n const spec = loadMasterSpec();\n return Object.keys(spec.stacks) as StackId[];\n}\n\n/** List all supported CI systems (derived from the master spec) */\nexport function listSupportedCiSystems(): readonly CiSystem[] {\n const spec = loadMasterSpec();\n return spec.ciSystems as CiSystem[];\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadBaseline - loads stack-specific standards checklist.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getStandards(\n stack: StackId,\n ci?: CiSystem,\n): StackChecklistJson {\n return loadBaseline(stack, ci);\n}\n\n/**\n * PUBLIC API CONTRACT (semver-governed)\n * Alias for loadMasterSpec - loads the master standards schema.\n * Breaking changes to this function signature require a major version bump.\n */\nexport function getSchema(): MasterJson {\n return loadMasterSpec();\n}\n","/**\n * AUTO-GENERATED at build time by scripts/build.ts\n * DO NOT EDIT MANUALLY\n *\n * This module provides version information for the repo-standards package.\n * Consumers should import from here instead of package.json to avoid\n * ESM/CJS interop issues.\n */\n\nexport const STANDARDS_VERSION = \"6.0.1\";\nexport const STANDARDS_SCHEMA_VERSION = 6;\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,MAAM,eAAe;;;ACOvB,IAAM,oBAAoB;AAC1B,IAAM,2BAA2B;;;ADQxC,IAAMA,cAAa,cAAc,YAAY,GAAG;AAChD,IAAMC,aAAY,QAAQD,WAAU;AAKpC,IAAM,YAAYC,WAAU,SAAS,KAAK;AAC1C,IAAM,YAAY,YACd,KAAKA,YAAW,MAAM,QAAQ,IAC9B,KAAKA,YAAW,QAAQ;AAGrB,SAAS,iBAA6B;AAC3C,QAAM,WAAW,KAAK,WAAW,gBAAgB;AACjD,SAAO,KAAK,MAAM,aAAa,UAAU,MAAM,CAAC;AAClD;AAGO,SAAS,aACd,OACA,IACoB;AACpB,QAAM,SAAS,KAAK,IAAI,EAAE,KAAK;AAC/B,QAAM,OAAO,aAAa,KAAK,GAAG,MAAM;AACxC,QAAM,WAAW,KAAK,WAAW,IAAI;AACrC,SAAO,KAAK,MAAM,aAAa,UAAU,MAAM,CAAC;AAClD;AAGO,SAAS,sBAA0C;AACxD,QAAM,OAAO,eAAe;AAC5B,SAAO,OAAO,KAAK,KAAK,MAAM;AAChC;AAGO,SAAS,yBAA8C;AAC5D,QAAM,OAAO,eAAe;AAC5B,SAAO,KAAK;AACd;AAOO,SAAS,aACd,OACA,IACoB;AACpB,SAAO,aAAa,OAAO,EAAE;AAC/B;AAOO,SAAS,YAAwB;AACtC,SAAO,eAAe;AACxB;","names":["__filename","__dirname"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oddessentials/repo-standards",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "7.0.0",
|
|
5
5
|
"description": "Standards and CI filtering utilities for multi-stack repository governance.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -14,14 +14,19 @@
|
|
|
14
14
|
"lint": "eslint .",
|
|
15
15
|
"format": "prettier . --write",
|
|
16
16
|
"format:check": "prettier . --check",
|
|
17
|
+
"check": "npm run lint && npm run format:check && npm run typecheck",
|
|
17
18
|
"test": "vitest run",
|
|
18
19
|
"typecheck": "tsc --noEmit",
|
|
20
|
+
"security": "npm audit --audit-level=high --omit=dev",
|
|
21
|
+
"policy": "npm run deps:check && tsx scripts/env-guard.ts",
|
|
22
|
+
"deps:check": "depcruise src --config .dependency-cruiser.cjs",
|
|
23
|
+
"sync:version": "node scripts/sync-schema-version-pretest.cjs",
|
|
19
24
|
"prepare": "husky",
|
|
20
25
|
"postinstall": "git config core.hooksPath .husky || true",
|
|
21
|
-
"ci": "npm run
|
|
26
|
+
"ci": "npm run check && npm run sync:version && npm run test && npm run build",
|
|
22
27
|
"generate:standards": "tsx scripts/generate-standards.ts",
|
|
23
28
|
"validate:schema": "tsx scripts/validate-schema.ts",
|
|
24
|
-
"verify": "npm run
|
|
29
|
+
"verify": "npm run check && npm run test && npm run security && npm run policy && npm run build"
|
|
25
30
|
},
|
|
26
31
|
"devDependencies": {
|
|
27
32
|
"@commitlint/cli": "^20.2.0",
|
|
@@ -33,10 +38,13 @@
|
|
|
33
38
|
"@types/node": "^24.10.1",
|
|
34
39
|
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
|
35
40
|
"@typescript-eslint/parser": "^8.48.1",
|
|
41
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
36
42
|
"ajv": "^8.17.1",
|
|
37
43
|
"ajv-formats": "^3.0.1",
|
|
38
44
|
"coverage-v8": "^0.0.1-security",
|
|
45
|
+
"dependency-cruiser": "^17.3.7",
|
|
39
46
|
"eslint": "^9.39.1",
|
|
47
|
+
"eslint-plugin-security": "^3.0.1",
|
|
40
48
|
"fast-json-stable-stringify": "^2.1.0",
|
|
41
49
|
"globals": "^16.5.0",
|
|
42
50
|
"happy-dom": "^20.0.11",
|
|
@@ -51,10 +59,11 @@
|
|
|
51
59
|
"vitest": "^4.0.15"
|
|
52
60
|
},
|
|
53
61
|
"engines": {
|
|
54
|
-
"node": ">=22"
|
|
62
|
+
"node": ">=22.0.0",
|
|
63
|
+
"npm": ">=10.0.0"
|
|
55
64
|
},
|
|
56
65
|
"lint-staged": {
|
|
57
|
-
"*.{js,cjs,ts,mjs,json,md}": [
|
|
66
|
+
"*.{js,cjs,ts,mjs,json,md,yml,yaml}": [
|
|
58
67
|
"prettier --write"
|
|
59
68
|
],
|
|
60
69
|
"*.{js,cjs,ts,mjs}": [
|
package/scripts/build.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
} from "node:fs";
|
|
19
19
|
import { resolve, join } from "node:path";
|
|
20
20
|
import { fileURLToPath } from "node:url";
|
|
21
|
+
import type { PackageJson, MasterJson } from "./types.internal.js";
|
|
21
22
|
|
|
22
23
|
const __filename = fileURLToPath(import.meta.url);
|
|
23
24
|
|
|
@@ -44,11 +45,13 @@ function syncSchemaVersion(rootDir: string): void {
|
|
|
44
45
|
const pkgPath = join(rootDir, "package.json");
|
|
45
46
|
const standardsPath = join(rootDir, "config", "standards.json");
|
|
46
47
|
|
|
47
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
48
|
-
const standards = JSON.parse(
|
|
48
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8")) as PackageJson;
|
|
49
|
+
const standards = JSON.parse(
|
|
50
|
+
readFileSync(standardsPath, "utf8"),
|
|
51
|
+
) as MasterJson;
|
|
49
52
|
|
|
50
53
|
// Extract major version from package.json (e.g., "2.1.0" -> 2)
|
|
51
|
-
const pkgMajor = parseInt(pkg.version.split(".")[0], 10);
|
|
54
|
+
const pkgMajor = parseInt(pkg.version.split(".")[0] ?? "0", 10);
|
|
52
55
|
|
|
53
56
|
if (pkgMajor > standards.version) {
|
|
54
57
|
// Auto-upgrade schema version when semantic-release bumps package.json
|
|
@@ -83,15 +86,16 @@ function generateStack(stack: string, ci?: string) {
|
|
|
83
86
|
/**
|
|
84
87
|
* Generate src/version.ts with current package version
|
|
85
88
|
* This runs before TypeScript compilation so the values are baked in
|
|
89
|
+
* Only writes if content has changed to avoid dirty working tree
|
|
86
90
|
*/
|
|
87
91
|
function generateVersionFile(rootDir: string): void {
|
|
88
92
|
const pkgPath = join(rootDir, "package.json");
|
|
89
93
|
const versionPath = join(rootDir, "src", "version.ts");
|
|
90
94
|
|
|
91
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
95
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8")) as PackageJson;
|
|
92
96
|
const standards = JSON.parse(
|
|
93
97
|
readFileSync(join(rootDir, "config", "standards.json"), "utf8"),
|
|
94
|
-
);
|
|
98
|
+
) as MasterJson;
|
|
95
99
|
|
|
96
100
|
const content = `/**
|
|
97
101
|
* AUTO-GENERATED at build time by scripts/build.ts
|
|
@@ -102,12 +106,24 @@ function generateVersionFile(rootDir: string): void {
|
|
|
102
106
|
* ESM/CJS interop issues.
|
|
103
107
|
*/
|
|
104
108
|
|
|
105
|
-
export const STANDARDS_VERSION =
|
|
109
|
+
export const STANDARDS_VERSION = "${pkg.version}";
|
|
106
110
|
export const STANDARDS_SCHEMA_VERSION = ${standards.version};
|
|
107
111
|
`;
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
// Only write if content has changed (prevents dirty working tree)
|
|
114
|
+
let existingContent = "";
|
|
115
|
+
try {
|
|
116
|
+
existingContent = readFileSync(versionPath, "utf8");
|
|
117
|
+
} catch {
|
|
118
|
+
// File doesn't exist, will be created
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (existingContent === content) {
|
|
122
|
+
console.log(`src/version.ts already at version ${pkg.version} (no change)`);
|
|
123
|
+
} else {
|
|
124
|
+
writeFileSync(versionPath, content);
|
|
125
|
+
console.log(`Generated src/version.ts with version ${pkg.version}`);
|
|
126
|
+
}
|
|
111
127
|
}
|
|
112
128
|
|
|
113
129
|
function main() {
|
|
@@ -156,7 +172,7 @@ function main() {
|
|
|
156
172
|
const destPath = join(configDest, file);
|
|
157
173
|
|
|
158
174
|
// Read, sort for determinism, and write
|
|
159
|
-
const data = JSON.parse(readFileSync(srcPath, "utf8"));
|
|
175
|
+
const data: unknown = JSON.parse(readFileSync(srcPath, "utf8"));
|
|
160
176
|
const sorted = sortObject(data);
|
|
161
177
|
writeFileSync(destPath, JSON.stringify(sorted, null, 2) + "\n");
|
|
162
178
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* env-guard.ts
|
|
3
|
+
*
|
|
4
|
+
* Policy script to prevent .env* files from being committed.
|
|
5
|
+
* This script is part of the v7 security policy enforcement.
|
|
6
|
+
*
|
|
7
|
+
* AI agents MUST NEVER read, write, or modify .env* files.
|
|
8
|
+
* This guard ensures compliance with the AI Agent Safety Invariant.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { execSync } from "node:child_process";
|
|
12
|
+
|
|
13
|
+
function checkStagedEnvFiles(): void {
|
|
14
|
+
try {
|
|
15
|
+
// Get list of staged files
|
|
16
|
+
const staged = execSync("git diff --cached --name-only", {
|
|
17
|
+
encoding: "utf8",
|
|
18
|
+
}).trim();
|
|
19
|
+
|
|
20
|
+
if (!staged) {
|
|
21
|
+
console.log("β No staged files to check");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const stagedFiles = staged.split("\n");
|
|
26
|
+
const envFiles = stagedFiles.filter((file) => {
|
|
27
|
+
const basename = file.split("/").pop() ?? "";
|
|
28
|
+
return basename.startsWith(".env");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if (envFiles.length > 0) {
|
|
32
|
+
console.error("\nβ ERROR: .env* files are staged for commit!\n");
|
|
33
|
+
console.error("The following .env files must NOT be committed:");
|
|
34
|
+
envFiles.forEach((file) => console.error(` - ${file}`));
|
|
35
|
+
console.error("\nThis violates the AI Agent Safety Invariant.");
|
|
36
|
+
console.error(
|
|
37
|
+
"Remove these files from staging with: git reset HEAD <file>",
|
|
38
|
+
);
|
|
39
|
+
console.error("");
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
console.log("β No .env* files staged for commit");
|
|
44
|
+
} catch (error) {
|
|
45
|
+
// If git command fails (e.g., not in a git repo), skip the check
|
|
46
|
+
if (
|
|
47
|
+
error instanceof Error &&
|
|
48
|
+
error.message.includes("not a git repository")
|
|
49
|
+
) {
|
|
50
|
+
console.log("β Not in a git repository, skipping env-guard check");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function checkEnvFilesInWorkingTree(): void {
|
|
58
|
+
try {
|
|
59
|
+
// Check if any .env files exist in the working tree (that are tracked or untracked)
|
|
60
|
+
const result = execSync(
|
|
61
|
+
"git ls-files --others --cached -- '.env*' '*/.env*'",
|
|
62
|
+
{
|
|
63
|
+
encoding: "utf8",
|
|
64
|
+
},
|
|
65
|
+
).trim();
|
|
66
|
+
|
|
67
|
+
if (result) {
|
|
68
|
+
const envFiles = result.split("\n").filter(Boolean);
|
|
69
|
+
if (envFiles.length > 0) {
|
|
70
|
+
console.warn("\nβ WARNING: .env* files detected in repository:");
|
|
71
|
+
envFiles.forEach((file) => console.warn(` - ${file}`));
|
|
72
|
+
console.warn("\nEnsure these are in .gitignore and not committed.\n");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch {
|
|
76
|
+
// Silently ignore errors for this check
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Main execution
|
|
81
|
+
console.log("Running env-guard policy check...");
|
|
82
|
+
checkStagedEnvFiles();
|
|
83
|
+
checkEnvFilesInWorkingTree();
|
|
84
|
+
console.log("β env-guard policy check passed\n");
|
|
@@ -24,7 +24,7 @@ function main() {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
const raw = fs.readFileSync(masterPath, "utf8");
|
|
27
|
-
const master
|
|
27
|
+
const master = JSON.parse(raw) as MasterJson;
|
|
28
28
|
|
|
29
29
|
const coreCount = master.checklist.core.length;
|
|
30
30
|
const recommendedCount = master.checklist.recommended.length;
|
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
|
6
|
+
// Helper to sort object keys recursively for deterministic output
|
|
7
|
+
function sortObject(obj: unknown): unknown {
|
|
8
|
+
if (Array.isArray(obj)) return obj.map(sortObject);
|
|
9
|
+
if (obj && typeof obj === "object") {
|
|
10
|
+
const sorted: Record<string, unknown> = {};
|
|
11
|
+
Object.keys(obj as Record<string, unknown>)
|
|
12
|
+
.sort()
|
|
13
|
+
.forEach((key) => {
|
|
14
|
+
sorted[key] = sortObject((obj as Record<string, unknown>)[key]);
|
|
15
|
+
});
|
|
16
|
+
return sorted;
|
|
17
|
+
}
|
|
18
|
+
return obj;
|
|
19
|
+
}
|
|
20
|
+
|
|
6
21
|
type StackId = "typescript-js" | "csharp-dotnet" | "python" | "rust" | "go";
|
|
7
22
|
type CiSystem = "azure-devops" | "github-actions";
|
|
8
23
|
|
|
@@ -202,7 +217,7 @@ const rootDir = path.join(process.cwd());
|
|
|
202
217
|
const masterPath = path.join(rootDir, "config", "standards.json");
|
|
203
218
|
|
|
204
219
|
const raw = fs.readFileSync(masterPath, "utf8");
|
|
205
|
-
const master
|
|
220
|
+
const master = JSON.parse(raw) as MasterJson;
|
|
206
221
|
|
|
207
222
|
// args: stack [ciSystem]
|
|
208
223
|
// args: stack [ciSystem]
|
|
@@ -242,6 +257,9 @@ fs.mkdirSync(outDir, { recursive: true });
|
|
|
242
257
|
const ciSuffix = targetCiSystem ? `.${targetCiSystem}` : "";
|
|
243
258
|
const outPath = path.join(outDir, `standards.${targetStack}${ciSuffix}.json`);
|
|
244
259
|
|
|
245
|
-
fs.writeFileSync(
|
|
260
|
+
fs.writeFileSync(
|
|
261
|
+
outPath,
|
|
262
|
+
JSON.stringify(sortObject(stackJson), null, 2) + "\n",
|
|
263
|
+
);
|
|
246
264
|
|
|
247
265
|
console.log(`Wrote ${outPath}`);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-test schema version sync.
|
|
3
|
+
* Ensures config/standards.json version matches package.json major version
|
|
4
|
+
* before tests run. This prevents CI failures when semantic-release has
|
|
5
|
+
* bumped package.json but tests run before build.
|
|
6
|
+
*
|
|
7
|
+
* Usage: node scripts/sync-schema-version-pretest.cjs
|
|
8
|
+
*/
|
|
9
|
+
const fs = require("fs");
|
|
10
|
+
const path = require("path");
|
|
11
|
+
|
|
12
|
+
const rootDir = process.cwd();
|
|
13
|
+
const pkgPath = path.join(rootDir, "package.json");
|
|
14
|
+
const standardsPath = path.join(rootDir, "config", "standards.json");
|
|
15
|
+
|
|
16
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
17
|
+
const standards = JSON.parse(fs.readFileSync(standardsPath, "utf8"));
|
|
18
|
+
|
|
19
|
+
const pkgMajor = parseInt(pkg.version.split(".")[0], 10);
|
|
20
|
+
|
|
21
|
+
if (Number.isNaN(pkgMajor)) {
|
|
22
|
+
console.error(
|
|
23
|
+
`[sync-schema-version] Unable to parse major version from ${pkg.version}`,
|
|
24
|
+
);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (pkgMajor > standards.version) {
|
|
29
|
+
console.log(
|
|
30
|
+
`[sync-schema-version] Upgrading schema version: ${standards.version} -> ${pkgMajor}`,
|
|
31
|
+
);
|
|
32
|
+
standards.version = pkgMajor;
|
|
33
|
+
fs.writeFileSync(standardsPath, JSON.stringify(standards, null, 2) + "\n");
|
|
34
|
+
} else if (standards.version > pkgMajor) {
|
|
35
|
+
console.error(
|
|
36
|
+
`[sync-schema-version] ERROR: Schema version ${standards.version} is ahead of package.json major ${pkgMajor}`,
|
|
37
|
+
);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
} else {
|
|
40
|
+
console.log(
|
|
41
|
+
`[sync-schema-version] Schema version ${standards.version} already matches package.json major`,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// scripts/types.internal.ts
|
|
2
|
+
// Internal types for build scripts - not exported to consumers
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Minimal package.json shape for version extraction.
|
|
6
|
+
* Only includes fields used by build scripts.
|
|
7
|
+
*/
|
|
8
|
+
export interface PackageJson {
|
|
9
|
+
version: string;
|
|
10
|
+
scripts?: Record<string, string>;
|
|
11
|
+
bin?: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Re-export MasterJson from src/types for use in scripts
|
|
16
|
+
* without circular dependency concerns.
|
|
17
|
+
*/
|
|
18
|
+
export type { MasterJson } from "../src/types.js";
|
|
@@ -10,7 +10,6 @@ import path from "node:path";
|
|
|
10
10
|
const rootDir = process.cwd();
|
|
11
11
|
const configPath = path.join(rootDir, "config", "standards.json");
|
|
12
12
|
const schemaPath = path.join(rootDir, "config", "standards.schema.json");
|
|
13
|
-
const readmePath = path.join(rootDir, "README.md");
|
|
14
13
|
|
|
15
14
|
interface ValidationResult {
|
|
16
15
|
valid: boolean;
|
|
@@ -54,42 +53,6 @@ interface Config {
|
|
|
54
53
|
};
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
/**
|
|
58
|
-
* Validate README schema version references match standards.json version
|
|
59
|
-
*/
|
|
60
|
-
function validateReadmeSchemaVersion(
|
|
61
|
-
config: Config,
|
|
62
|
-
readmeRaw?: string,
|
|
63
|
-
): ValidationResult {
|
|
64
|
-
if (!readmeRaw) {
|
|
65
|
-
return {
|
|
66
|
-
valid: false,
|
|
67
|
-
errors: ["README.md not provided for version consistency check"],
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const errors: string[] = [];
|
|
72
|
-
const actualVersion = config.version;
|
|
73
|
-
|
|
74
|
-
const currentMatch = readmeRaw.match(/version.*\(currently `(\d+)`\)/i);
|
|
75
|
-
if (!currentMatch) {
|
|
76
|
-
errors.push("README.md missing current schema version reference");
|
|
77
|
-
} else if (Number(currentMatch[1]) !== actualVersion) {
|
|
78
|
-
errors.push(
|
|
79
|
-
`README.md current schema version (${currentMatch[1]}) does not match standards.json (${actualVersion})`,
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const listPattern = new RegExp(`-\\s*\`${actualVersion}\`\\s*β`);
|
|
84
|
-
if (!listPattern.test(readmeRaw)) {
|
|
85
|
-
errors.push(
|
|
86
|
-
`README.md schema version list does not include current version ${actualVersion}`,
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return { valid: errors.length === 0, errors };
|
|
91
|
-
}
|
|
92
|
-
|
|
93
56
|
/**
|
|
94
57
|
* Validate config against JSON Schema using Ajv
|
|
95
58
|
*/
|
|
@@ -291,13 +254,12 @@ export function normalizeConfig(config: unknown): string {
|
|
|
291
254
|
export function validateStandardsConfig(
|
|
292
255
|
configRaw: string,
|
|
293
256
|
schemaRaw: string,
|
|
294
|
-
readmeRaw?: string,
|
|
295
257
|
): ValidationResult {
|
|
296
258
|
let config: Config;
|
|
297
259
|
let schema: unknown;
|
|
298
260
|
|
|
299
261
|
try {
|
|
300
|
-
config = JSON.parse(configRaw);
|
|
262
|
+
config = JSON.parse(configRaw) as Config;
|
|
301
263
|
} catch {
|
|
302
264
|
return { valid: false, errors: ["Failed to parse standards.json as JSON"] };
|
|
303
265
|
}
|
|
@@ -319,7 +281,6 @@ export function validateStandardsConfig(
|
|
|
319
281
|
validateCiHintKeys(config),
|
|
320
282
|
validateCoverageThreshold(config),
|
|
321
283
|
validateExecutionStageCoverage(config),
|
|
322
|
-
validateReadmeSchemaVersion(config, readmeRaw),
|
|
323
284
|
];
|
|
324
285
|
|
|
325
286
|
const allErrors = results.flatMap((r) => r.errors);
|
|
@@ -343,16 +304,10 @@ export function validateStandardsSchema(): void {
|
|
|
343
304
|
process.exit(1);
|
|
344
305
|
}
|
|
345
306
|
|
|
346
|
-
if (!fs.existsSync(readmePath)) {
|
|
347
|
-
console.error(`README file not found: ${readmePath}`);
|
|
348
|
-
process.exit(1);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
307
|
const configRaw = fs.readFileSync(configPath, "utf8");
|
|
352
308
|
const schemaRaw = fs.readFileSync(schemaPath, "utf8");
|
|
353
|
-
const readmeRaw = fs.readFileSync(readmePath, "utf8");
|
|
354
309
|
|
|
355
|
-
const result = validateStandardsConfig(configRaw, schemaRaw
|
|
310
|
+
const result = validateStandardsConfig(configRaw, schemaRaw);
|
|
356
311
|
|
|
357
312
|
if (!result.valid) {
|
|
358
313
|
console.error("Schema validation failed:");
|
|
@@ -369,7 +324,6 @@ export function validateStandardsSchema(): void {
|
|
|
369
324
|
console.log("β All ciHints keys are valid ciSystems");
|
|
370
325
|
console.log("β Coverage threshold semantics are valid");
|
|
371
326
|
console.log("β All items have valid executionStage");
|
|
372
|
-
console.log("β README schema version references are aligned");
|
|
373
327
|
}
|
|
374
328
|
|
|
375
329
|
// CLI entry point
|