cliguard 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/bin.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -252,6 +252,8 @@ npx cliguard check ./bin/cli.js --strict
|
|
|
252
252
|
|
|
253
253
|
Off by default so it never changes behavior for an existing CI config - opt in per project.
|
|
254
254
|
|
|
255
|
+
A `--strict`-only change is real BREAKING output, so `cliguard accept` needs the same flag to find it - `cliguard accept ./bin/cli.js "root -> copy" --strict --reason "..."` - without it, `accept` compares in default (non-strict) mode and won't see the change at all.
|
|
256
|
+
|
|
255
257
|
## Programmatic API
|
|
256
258
|
|
|
257
259
|
Everything above is the CLI. The same extraction and diff logic is also available as a library, for a custom build script, monorepo tool, or bot that wants to embed a contract check without spawning `npx cliguard` as a subprocess:
|
|
@@ -324,6 +326,7 @@ jobs:
|
|
|
324
326
|
entry: ./bin/cli.js
|
|
325
327
|
# adapter: yargs # default: commander
|
|
326
328
|
# comment-on-pr: false # default: true
|
|
329
|
+
# strict: true # default: false
|
|
327
330
|
```
|
|
328
331
|
|
|
329
332
|
Set `comment-on-pr: false` to keep the exit-code gate without the comment, or use the raw CLI directly for a non-GitHub CI provider:
|
package/dist/bin.js
CHANGED
|
@@ -113,6 +113,7 @@ program
|
|
|
113
113
|
.argument("<changePath>", 'the exact DiffResult path to accept, e.g. "root -> build -> option[--target]"')
|
|
114
114
|
.requiredOption("-r, --reason <text>", "why this break is intentional - shown in check output")
|
|
115
115
|
.option(...adapterOption)
|
|
116
|
+
.option("--strict", "match against the same --strict rules used to find this change (e.g. a positional argument reorder) - required to accept one, since it's otherwise invisible to the default comparison", false)
|
|
116
117
|
.action(async (entry, changePath, options) => {
|
|
117
118
|
const exitCode = await withSuppressedExit(async () => {
|
|
118
119
|
const reason = options.reason.trim();
|
|
@@ -122,7 +123,7 @@ program
|
|
|
122
123
|
}
|
|
123
124
|
const oldContract = (0, storage_1.readContract)();
|
|
124
125
|
const newContract = await (0, registry_1.resolveAdapter)(options.adapter).extract(entry);
|
|
125
|
-
const diff = applyDeprecations(diffEngine.applyUnstableMarkers((0, config_1.applyConfig)(diffEngine.compare(oldContract, newContract), (0, config_1.loadConfig)()), oldContract, newContract), indexDeprecations((0, storage_1.readDeprecations)()));
|
|
126
|
+
const diff = applyDeprecations(diffEngine.applyUnstableMarkers((0, config_1.applyConfig)(diffEngine.compare(oldContract, newContract, { strict: options.strict }), (0, config_1.loadConfig)()), oldContract, newContract), indexDeprecations((0, storage_1.readDeprecations)()));
|
|
126
127
|
const match = diff.find((change) => change.type === types_1.ChangeType.BREAKING && change.path === changePath);
|
|
127
128
|
if (!match) {
|
|
128
129
|
const breaking = diff.filter((change) => change.type === types_1.ChangeType.BREAKING);
|