@gate-forge/cli 0.9.1 → 0.10.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +343 -0
  2. package/README.md +3 -0
  3. package/dist/cache-exclusions.d.ts +20 -13
  4. package/dist/cache-exclusions.d.ts.map +1 -1
  5. package/dist/cache-exclusions.js +47 -33
  6. package/dist/cache-exclusions.js.map +1 -1
  7. package/dist/cli.d.ts +1 -1
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +11 -0
  10. package/dist/cli.js.map +1 -1
  11. package/dist/commands/check.d.ts.map +1 -1
  12. package/dist/commands/check.js +14 -14
  13. package/dist/commands/check.js.map +1 -1
  14. package/dist/commands/classify.d.ts +1 -0
  15. package/dist/commands/classify.d.ts.map +1 -1
  16. package/dist/commands/classify.js +230 -14
  17. package/dist/commands/classify.js.map +1 -1
  18. package/dist/commands/common.d.ts +6 -1
  19. package/dist/commands/common.d.ts.map +1 -1
  20. package/dist/commands/common.js +8 -1
  21. package/dist/commands/common.js.map +1 -1
  22. package/dist/commands/enforcement.d.ts +9 -1
  23. package/dist/commands/enforcement.d.ts.map +1 -1
  24. package/dist/commands/enforcement.js +306 -38
  25. package/dist/commands/enforcement.js.map +1 -1
  26. package/dist/commands/init.d.ts +20 -0
  27. package/dist/commands/init.d.ts.map +1 -1
  28. package/dist/commands/init.js +88 -56
  29. package/dist/commands/init.js.map +1 -1
  30. package/dist/commands/migrate.d.ts +14 -0
  31. package/dist/commands/migrate.d.ts.map +1 -0
  32. package/dist/commands/migrate.js +177 -0
  33. package/dist/commands/migrate.js.map +1 -0
  34. package/dist/commands/pre-commit.d.ts.map +1 -1
  35. package/dist/commands/pre-commit.js +8 -1
  36. package/dist/commands/pre-commit.js.map +1 -1
  37. package/dist/commands/tests.d.ts.map +1 -1
  38. package/dist/commands/tests.js +120 -40
  39. package/dist/commands/tests.js.map +1 -1
  40. package/dist/docs-exclusions.d.ts +32 -5
  41. package/dist/docs-exclusions.d.ts.map +1 -1
  42. package/dist/docs-exclusions.js +60 -26
  43. package/dist/docs-exclusions.js.map +1 -1
  44. package/dist/evidence-config-text.d.ts +57 -0
  45. package/dist/evidence-config-text.d.ts.map +1 -0
  46. package/dist/evidence-config-text.js +263 -0
  47. package/dist/evidence-config-text.js.map +1 -0
  48. package/dist/execution.d.ts +51 -8
  49. package/dist/execution.d.ts.map +1 -1
  50. package/dist/execution.js +61 -29
  51. package/dist/execution.js.map +1 -1
  52. package/dist/gateforge-owned.d.ts +1 -1
  53. package/dist/gateforge-owned.d.ts.map +1 -1
  54. package/dist/gateforge-owned.js +6 -9
  55. package/dist/gateforge-owned.js.map +1 -1
  56. package/dist/input-snapshot.d.ts.map +1 -1
  57. package/dist/input-snapshot.js +2 -6
  58. package/dist/input-snapshot.js.map +1 -1
  59. package/dist/legacy-exclusion-paths.d.ts +28 -0
  60. package/dist/legacy-exclusion-paths.d.ts.map +1 -0
  61. package/dist/legacy-exclusion-paths.js +48 -0
  62. package/dist/legacy-exclusion-paths.js.map +1 -0
  63. package/dist/pipeline.d.ts +8 -2
  64. package/dist/pipeline.d.ts.map +1 -1
  65. package/dist/pipeline.js +9 -8
  66. package/dist/pipeline.js.map +1 -1
  67. package/dist/repo-path.d.ts +3 -0
  68. package/dist/repo-path.d.ts.map +1 -0
  69. package/dist/repo-path.js +24 -0
  70. package/dist/repo-path.js.map +1 -0
  71. package/dist/staged-candidate.d.ts +36 -1
  72. package/dist/staged-candidate.d.ts.map +1 -1
  73. package/dist/staged-candidate.js +47 -0
  74. package/dist/staged-candidate.js.map +1 -1
  75. package/guides/CONNECT-YOUR-PROJECT.md +50 -1
  76. package/guides/QUICKSTART.md +43 -10
  77. package/guides/REFERENCE.md +206 -30
  78. package/guides/TEST-ENVIRONMENT.md +36 -0
  79. package/guides/UPGRADE-0.9-to-0.10.md +137 -0
  80. package/package.json +12 -10
@@ -0,0 +1,137 @@
1
+ # Upgrade from 0.9 to 0.10
2
+
3
+ 0.10.0 has one configuration change: the two evidence-exclusion declarations
4
+ `.gateforge/docs-exclusions.yml` and `.gateforge/cache-exclusions.yml` are gone,
5
+ and their lists now live in `.gateforge.yml` under `evidence.exclude.docs` and
6
+ `evidence.exclude.cache`. One owner file instead of three, and no other
7
+ behavior moves.
8
+
9
+ **Nothing is read twice.** While either old file is present, every command
10
+ refuses with a message naming the file and `gateforge migrate`. Reading past it
11
+ would silently drop your exclusions, and a silently dropped exclusion changes
12
+ what evidence identity means — so the cutover is loud.
13
+
14
+ ## Upgrade steps
15
+
16
+ 1. Set every direct `@gate-forge/*` dependency to `0.10.0` (and every
17
+ `overrides`/`resolutions` entry and `npm:@gate-forge/…` alias), then
18
+ `npm install`.
19
+
20
+ 2. Migrate the declarations, if you have any:
21
+
22
+ ```sh
23
+ gateforge migrate
24
+ ```
25
+
26
+ This is a preview: it prints the exact diff of `.gateforge.yml` and the
27
+ files it would delete, writes nothing, and exits 0. Read it. Then write it:
28
+
29
+ ```sh
30
+ gateforge migrate --confirm
31
+ ```
32
+
33
+ The command validates both old files with the same rules the loaders used,
34
+ splices one `evidence.exclude` block into your `.gateforge.yml` **as text**
35
+ (your comments, key order and quoting stay byte for byte), deletes the old
36
+ files, and prints the re-pin reminder. It is idempotent: a repository with
37
+ nothing to migrate prints `nothing to migrate` and exits 0, so re-running
38
+ after a partial adoption is free.
39
+
40
+ A repository that declares no exclusions needs no migration at all — leave
41
+ `.gateforge.yml` alone.
42
+
43
+ If your `.gateforge.yml` already declares `evidence:` in a form the command
44
+ cannot extend safely (an inline `evidence: {...}`, a `docs:` list written in
45
+ flow style), it refuses by name and changes nothing. Add the block by hand:
46
+
47
+ ```yaml
48
+ evidence:
49
+ exclude:
50
+ docs:
51
+ - docs
52
+ cache:
53
+ - backend/__pycache__/account.cpython-312.pyc
54
+ ```
55
+
56
+ ...or delete your hand-written `evidence:` block and re-run `migrate
57
+ --confirm`, which will write it for you.
58
+
59
+ 3. Re-approve the policy digest. Migration changed `.gateforge.yml`, which is
60
+ a trusted policy input:
61
+
62
+ ```sh
63
+ git add -A .gateforge .gateforge.yml
64
+ gateforge enforcement pin --pin-file ~/.config/<repo>.gateforge.env --confirm
65
+ ```
66
+
67
+ The command digests the STAGED bytes — the ones the commit gate digests —
68
+ and writes exactly the `GATEFORGE_APPROVED_POLICY_DIGEST=<hex>` line into
69
+ that env file, mode `0600`, leaving every other line alone. Without
70
+ `--confirm` it only prints the line. The env file must stay OUTSIDE the
71
+ repository, exactly like the protected variable it replaces; a path inside
72
+ the repository is refused, and so is a policy input that is not fully
73
+ staged (it names the file). Export the file for your shell or CI as before —
74
+ `GATEFORGE_TRUSTED_CONFIG`, a protected CI variable, or the file itself.
75
+ **Without a matching pin, a repository that uses exclusions still refuses to
76
+ use them** — the guarantee did not weaken.
77
+
78
+ To see WHAT moved instead of reading a digest: `gateforge enforcement doctor`
79
+ lists the inputs whose staged bytes differ from HEAD (`policy-inputs-vs-HEAD`)
80
+ and whether your provisioned pin still matches them (`approved-digest`).
81
+
82
+ 4. Commit the setup change on its own:
83
+
84
+ ```sh
85
+ git add .gateforge .gateforge.yml && git commit -m "chore: evidence exclusions in .gateforge.yml"
86
+ ```
87
+
88
+ 5. Check the same bytes you did before:
89
+
90
+ ```sh
91
+ gateforge check --changed
92
+ gateforge test-gates --changed # seal one receipt under the new engine
93
+ ```
94
+
95
+ ## What can appear or disappear, and why
96
+
97
+ - **The exclusion lists themselves do not change.** `loadDocsExclusions` and
98
+ `loadCacheExclusions` return exactly the lists you had before the migration.
99
+ Every refusal is unchanged too: an excluded folder still may not contain a
100
+ configured input, source, manifest, lockfile, `*.config.*` file, CI config or
101
+ symlink, and still may only hold the documented, data and static-raster
102
+ formats; a bytecode exclusion still must be an exact `.pyc`/`.pyo` directly
103
+ under `__pycache__`.
104
+ - **The policy digest changes once.** The declarations are no longer separate
105
+ digest entries; their bytes are inside `.gateforge.yml`, which the digest
106
+ already hashed. The bytes your approval pins are the same bytes, so nothing
107
+ is newly unprotected — the value just has to be re-approved once because the
108
+ file that carries it changed.
109
+ - **The input snapshot changes once, in the same way.** The two files are no
110
+ longer extra explicit inputs, for the same reason.
111
+ - **`init` writes into `.gateforge.yml`.** `--docs-exclude` / `--cache-exclude`
112
+ (and the `--confirm-…` flags) now splice into your config instead of writing
113
+ a separate document, so a second `init` on the same repository is still a
114
+ no-op and an owner-confirmed change still prints `updated:`.
115
+
116
+ ## Owner decisions this release asks for
117
+
118
+ - **One file to review.** When you review a policy change, the exclusions are
119
+ now in the file you were reading anyway. `evidence.exclude` is deliberately
120
+ not named after `project.paths.exclude`: that key is scan scope (what the
121
+ detector reads), this one is evidence identity (what the gate stops
122
+ binding). Both are yours; they mean different things.
123
+ - **The declaration is still an assertion, not proof.** Nothing here proves
124
+ that an excluded file cannot affect application or test behavior. Reports
125
+ keep printing the exact folders/files, the pin status, and the reduced
126
+ guarantee.
127
+
128
+ ## If something breaks
129
+
130
+ | If you see | Do this |
131
+ |---|---|
132
+ | `found .gateforge/docs-exclusions.yml: since 0.10 evidence exclusions live in .gateforge.yml under evidence.exclude — run \`gateforge migrate\`` | You have not migrated yet. Run `gateforge migrate`, read the preview, then `gateforge migrate --confirm`. |
133
+ | `found .gateforge/cache-exclusions.yml: …` | Same, for the bytecode list. |
134
+ | `.gateforge.yml declares docs inline as \`docs: […]\` — this command only writes docs as a list` | Your config writes that list in flow style. Reformat it as a block list (`docs:` then ` - path`), or edit the block by hand. |
135
+ | `.gateforge.yml declares evidence inline; this command only appends to an \`evidence:\` block` | Same for an inline `evidence:` or `exclude:` mapping. Make them block mappings, or add the block by hand. |
136
+ | `ENFORCEMENT_UNTRUSTED` / `approvalStatus: mismatch` after migrating | Expected once: `.gateforge.yml` is a policy input. Re-approve the digest (step 3). |
137
+ | `invalid gateforge config … Unrecognized key: "evidence"` | The CLI is older than the `.gateforge.yml` you migrated. Upgrade every `@gate-forge/*` package to `0.10.0` together. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gate-forge/cli",
3
- "version": "0.9.1",
3
+ "version": "0.10.1",
4
4
  "gateforgeCompatibility": {
5
5
  "supervisedFixtureProtocol": "gateforge.supervised-playwright.v1"
6
6
  },
@@ -20,6 +20,7 @@
20
20
  }
21
21
  },
22
22
  "files": [
23
+ "CHANGELOG.md",
23
24
  "bin",
24
25
  "dist",
25
26
  "guides"
@@ -28,18 +29,19 @@
28
29
  "build": "tsc -p tsconfig.build.json",
29
30
  "prebuild": "npm run build -w @gate-forge/core && npm run build -w @gate-forge/plugin-protocol",
30
31
  "typecheck": "tsc -p tsconfig.json --noEmit",
32
+ "prepack": "node ../../scripts/copy-changelog.mjs",
31
33
  "test": "vitest run"
32
34
  },
33
35
  "dependencies": {
34
- "@gate-forge/core": "^0.9.1",
35
- "@gate-forge/http-contract": "^0.9.1",
36
- "@gate-forge/pack-fastapi": "^0.9.1",
37
- "@gate-forge/pack-alembic": "^0.9.1",
38
- "@gate-forge/pack-http": "^0.9.1",
39
- "@gate-forge/pack-playwright": "^0.9.1",
40
- "@gate-forge/pack-sqlalchemy": "^0.9.1",
41
- "@gate-forge/pack-task": "^0.9.1",
42
- "@gate-forge/plugin-protocol": "^0.9.1",
36
+ "@gate-forge/core": "^0.10.1",
37
+ "@gate-forge/http-contract": "^0.10.1",
38
+ "@gate-forge/pack-fastapi": "^0.10.1",
39
+ "@gate-forge/pack-alembic": "^0.10.1",
40
+ "@gate-forge/pack-http": "^0.10.1",
41
+ "@gate-forge/pack-playwright": "^0.10.1",
42
+ "@gate-forge/pack-sqlalchemy": "^0.10.1",
43
+ "@gate-forge/pack-task": "^0.10.1",
44
+ "@gate-forge/plugin-protocol": "^0.10.1",
43
45
  "picomatch": "^4.0.7",
44
46
  "yaml": "^2.8.1"
45
47
  },