@afokapu/atdd-bun 0.10.63 → 0.10.65
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/integrity.json +3 -3
- package/package.json +1 -1
- package/src/cli.ts +4 -3
- package/src/ratchet.ts +5 -3
package/integrity.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.10.
|
|
2
|
+
"version": "0.10.65",
|
|
3
3
|
"files": {
|
|
4
4
|
"HOOK_AUDIT.md": "5329d840db37671b1918f688ead26865473b87db73dbc75f7c8b2a8bbe8d6d43",
|
|
5
5
|
"PLANNER_PORT.md": "fb5935bac8b7ac18994de21e43ace3a5ef8cd55f85b0e3349fca261280054f11",
|
|
@@ -1258,7 +1258,7 @@
|
|
|
1258
1258
|
"relationships.yaml": "5860a308ebc3ee7fa8172fc2c6633984000ab3003f0ae4b6fa28db48879eda22",
|
|
1259
1259
|
"src/agent.ts": "6d6c6e75908af8fbab13432f0001b0374bb25cf3dee46ba218dfd67e0090cb56",
|
|
1260
1260
|
"src/ci.ts": "646e72ff576d3921d85ecdd1d8c7821693832735be8949f5da254f3c345be032",
|
|
1261
|
-
"src/cli.ts": "
|
|
1261
|
+
"src/cli.ts": "fc8a78b31d6630671bb2ebd51363741cb4cf786801a95b8da8c879144683a049",
|
|
1262
1262
|
"src/docs-capability.ts": "bdeeb414649049b1cd4fa8008cada3a576318be51c43bec91bfa46a8e250c270",
|
|
1263
1263
|
"src/enforce.ts": "7e6b3a1fc7c90f8e1836ab3e4655778fb569a63be5e7c199de44024fc003e6be",
|
|
1264
1264
|
"src/hooks.ts": "6b579c030bb4772f08806e802f4f814444b1878bbac0d6c62bc10b4ee184e449",
|
|
@@ -1269,7 +1269,7 @@
|
|
|
1269
1269
|
"src/planner-schema-validator.ts": "ce529c0936171075e93c7539b3655fe895a98dd2973ebda5775958e6ebc316d9",
|
|
1270
1270
|
"src/planner-validators.ts": "99adeb65f579af923c11f21a8f55cfb9993b007fd8df59c5f764696b55379cfc",
|
|
1271
1271
|
"src/profile-registry.ts": "5a7761d324181ae27deb51f198d63648a4c99e858b4de98b54d35e6cf8a39fe7",
|
|
1272
|
-
"src/ratchet.ts": "
|
|
1272
|
+
"src/ratchet.ts": "909b47124863287cbf6b02237b70fd50d82522d5029b2ae900c371d2ea2287a2",
|
|
1273
1273
|
"src/register.ts": "6a2f1c6b8df0dc9c8f45df8ec9fac2be29044e048b08c8ffe423410e94dadedd",
|
|
1274
1274
|
"src/release.ts": "7b0fe444ee81f476f53b9c21b6c347ef588ee616c60211419cf984132be768ba",
|
|
1275
1275
|
"src/setup.ts": "c6804f699808c01a849ea46489b0e9feab7991da4cb62a29edd439423e0a88c0",
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { enforce, enabledProfiles, flowCompatibilityDiagnostic, normalizeProfileName, profileNames, type Profile } from "./enforce";
|
|
2
|
+
import { concreteProfiles, enforce, enabledProfiles, flowCompatibilityDiagnostic, normalizeProfileName, profileNames, type Profile } from "./enforce";
|
|
3
3
|
import { activationContextDigest, canonicalFindingPath, compareFindings, contextDigest, isStrictProfileExpansion, parseRatchetPolicy } from "./ratchet";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { mkdtemp, readFile, rm } from "node:fs/promises";
|
|
@@ -154,7 +154,8 @@ if (!args.includes("--ratchet")) {
|
|
|
154
154
|
if (!policy) fail("--ratchet requires an explicit atdd-bun.yaml ratchet policy");
|
|
155
155
|
const candidateProfiles = normalizedRequested.includes("all") ? await enabledProfiles(candidateRoot) : normalizedRequested;
|
|
156
156
|
if (stable(policy.profiles).join(",") !== stable(candidateProfiles).join(",")) fail("ratchet.profiles must exactly equal the selected profiles");
|
|
157
|
-
|
|
157
|
+
const explicitCandidateProfiles = Array.isArray(candidateConfig.profiles) && candidateConfig.profiles.every(profile => concreteProfiles.includes(profile as typeof concreteProfiles[number])) && new Set(candidateConfig.profiles).size === candidateConfig.profiles.length;
|
|
158
|
+
if (profileActivation && (!explicitCandidateProfiles || stable(await enabledProfiles(candidateRoot)).join(",") !== stable(candidateProfiles).join(","))) fail("profile activation requires the explicitly configured candidate profile set to be selected");
|
|
158
159
|
if ((await git(candidateRoot, ["status", "--porcelain"])).out) fail("--ratchet requires a porcelain-clean candidate worktree");
|
|
159
160
|
const resolved = await git(candidateRoot, ["rev-parse", "--verify", `${base}^{commit}`]);
|
|
160
161
|
if (resolved.code || resolved.out.toLowerCase() !== base.toLowerCase()) fail(`ratchet base ${base} is unavailable or not a full exact commit`);
|
|
@@ -169,7 +170,7 @@ if (!args.includes("--ratchet")) {
|
|
|
169
170
|
else {
|
|
170
171
|
const baseConfig = await configAt(scratch), baseProfiles = profileActivation ? await enabledProfiles(scratch) : normalizedRequested.includes("all") ? await enabledProfiles(scratch) : normalizedRequested;
|
|
171
172
|
const ordinaryContextMatches = stable(baseProfiles).join(",") === stable(candidateProfiles).join(",") && contextDigest(baseConfig, baseProfiles) === contextDigest(candidateConfig, candidateProfiles);
|
|
172
|
-
const activationIsValid =
|
|
173
|
+
const activationIsValid = isStrictProfileExpansion(baseProfiles, candidateProfiles) && activationContextDigest(baseConfig) === activationContextDigest(candidateConfig);
|
|
173
174
|
if (!(profileActivation ? activationIsValid : ordinaryContextMatches)) { console.error(profileActivation ? "ratchet profile activation requires an explicit monotonic profile expansion and identical non-profile context" : "ratchet base and candidate profile/context differ; use a separately governed adoption path"); process.exitCode = 1; }
|
|
174
175
|
else {
|
|
175
176
|
const [baseFindings, candidateFindings] = await Promise.all([enforce({ root: scratch, profiles: candidateProfiles as Profile[] }), enforce({ root: candidateRoot, profiles: candidateProfiles as Profile[] })]);
|
package/src/ratchet.ts
CHANGED
|
@@ -41,15 +41,17 @@ export function findingFingerprint(finding: FindingIdentity): string {
|
|
|
41
41
|
return sha256({ format: "atdd-bun.finding-fingerprint/v1", rule_id: finding.rule_id, path, subject });
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
/** The selected profiles and every policy key except ratchet itself must agree across exact base and candidate.
|
|
44
|
+
/** The selected profiles and every policy key except ratchet itself must agree across exact base and candidate.
|
|
45
|
+
* `worktrees` is finding-inert (read only by the hook worktree gate and worktree commands) and is omitted; configs
|
|
46
|
+
* without it keep byte-identical v1 digests. Integrity still reports its loosening. */
|
|
45
47
|
export function contextDigest(config: Record<string, unknown>, profiles: string[]): string {
|
|
46
|
-
const { ratchet: _ratchet, ...policy } = config;
|
|
48
|
+
const { ratchet: _ratchet, worktrees: _worktrees, ...policy } = config;
|
|
47
49
|
return sha256({ format: "atdd-bun.ratchet-context/v1", profiles: [...profiles].sort(), policy });
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
/** Activation is a one-time, explicitly requested profile-list expansion; every other policy input remains identical. */
|
|
51
53
|
export function activationContextDigest(config: Record<string, unknown>): string {
|
|
52
|
-
const { ratchet: _ratchet, profiles: _profiles, ...policy } = config;
|
|
54
|
+
const { ratchet: _ratchet, profiles: _profiles, worktrees: _worktrees, ...policy } = config;
|
|
53
55
|
return sha256({ format: "atdd-bun.ratchet-activation-context/v1", policy });
|
|
54
56
|
}
|
|
55
57
|
|