altimate-receipts 0.8.0 → 0.9.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 +158 -175
- package/dist/{chunk-6QULLAVH.js → chunk-4S2ABMUN.js} +2 -2
- package/dist/{chunk-SGVU3CGP.js → chunk-TUWJRD7H.js} +8 -17
- package/dist/{chunk-SGVU3CGP.js.map → chunk-TUWJRD7H.js.map} +1 -1
- package/dist/{chunk-NPYC3NGR.js → chunk-WNGBYBM3.js} +2 -2
- package/dist/cli.js +28 -9
- package/dist/cli.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/mcp/server.js +2 -2
- package/package.json +1 -1
- /package/dist/{chunk-6QULLAVH.js.map → chunk-4S2ABMUN.js.map} +0 -0
- /package/dist/{chunk-NPYC3NGR.js.map → chunk-WNGBYBM3.js.map} +0 -0
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
redactReceipt,
|
|
19
19
|
renderLedger,
|
|
20
20
|
windowedEffort
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-TUWJRD7H.js";
|
|
22
22
|
|
|
23
23
|
// src/receipt/canonical.ts
|
|
24
24
|
function canonicalize(value) {
|
|
@@ -856,4 +856,4 @@ export {
|
|
|
856
856
|
rederiveFromTranscript,
|
|
857
857
|
compareToTranscript
|
|
858
858
|
};
|
|
859
|
-
//# sourceMappingURL=chunk-
|
|
859
|
+
//# sourceMappingURL=chunk-WNGBYBM3.js.map
|
package/dist/cli.js
CHANGED
|
@@ -15,13 +15,13 @@ import {
|
|
|
15
15
|
sliceByBranch,
|
|
16
16
|
toDsseEnvelope,
|
|
17
17
|
visibleMergeFindings
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WNGBYBM3.js";
|
|
19
19
|
import {
|
|
20
20
|
computeTrends,
|
|
21
21
|
deriveTargets,
|
|
22
22
|
renderTrends,
|
|
23
23
|
upsertTrendsSection
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-4S2ABMUN.js";
|
|
25
25
|
import {
|
|
26
26
|
agentIds,
|
|
27
27
|
anyDetected,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
upsertGuardrailsSection,
|
|
52
52
|
verifyBundle,
|
|
53
53
|
windowedEffort
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-TUWJRD7H.js";
|
|
55
55
|
|
|
56
56
|
// src/cli.ts
|
|
57
57
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
@@ -254,7 +254,7 @@ function settingsStore(root) {
|
|
|
254
254
|
return void 0;
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
|
-
function mergeHookIntoSettings(path, command = HOOK_COMMAND) {
|
|
257
|
+
function mergeHookIntoSettings(path, command = HOOK_COMMAND, opts = {}) {
|
|
258
258
|
let settings = {};
|
|
259
259
|
if (existsSync2(path)) {
|
|
260
260
|
let parsed;
|
|
@@ -283,10 +283,26 @@ function mergeHookIntoSettings(path, command = HOOK_COMMAND) {
|
|
|
283
283
|
return { ok: false, reason: `${path} has a non-array hooks.PreToolUse \u2014 leaving it untouched` };
|
|
284
284
|
}
|
|
285
285
|
const present = pre.some((e) => e?.hooks?.some((h) => h?.command === command));
|
|
286
|
-
|
|
286
|
+
let envChanged = false;
|
|
287
|
+
if (opts.defaultStoreRef) {
|
|
288
|
+
if (settings.env === void 0) {
|
|
289
|
+
settings.env = {};
|
|
290
|
+
}
|
|
291
|
+
const env = settings.env;
|
|
292
|
+
if (typeof env !== "object" || env === null || Array.isArray(env)) {
|
|
293
|
+
return { ok: false, reason: `${path} has a non-object "env" key \u2014 leaving it untouched` };
|
|
294
|
+
}
|
|
295
|
+
if (env.RECEIPTS_STORE === void 0) {
|
|
296
|
+
env.RECEIPTS_STORE = "ref";
|
|
297
|
+
envChanged = true;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (present && !envChanged) {
|
|
287
301
|
return { ok: true, changed: false };
|
|
288
302
|
}
|
|
289
|
-
|
|
303
|
+
if (!present) {
|
|
304
|
+
pre.push({ matcher: "Bash", hooks: [{ type: "command", command }] });
|
|
305
|
+
}
|
|
290
306
|
mkdirSync2(dirname(path), { recursive: true });
|
|
291
307
|
writeFileSync2(path, `${JSON.stringify(settings, null, 2)}
|
|
292
308
|
`);
|
|
@@ -2116,12 +2132,14 @@ function runInit(opts = {}) {
|
|
|
2116
2132
|
lines.push(`receipts init: wrote ${path} (tracking ${tag}, quiet + non-blocking).`);
|
|
2117
2133
|
}
|
|
2118
2134
|
const settingsPath = join7(".claude", "settings.json");
|
|
2119
|
-
const merged = mergeHookIntoSettings(settingsPath);
|
|
2135
|
+
const merged = mergeHookIntoSettings(settingsPath, void 0, { defaultStoreRef: true });
|
|
2120
2136
|
if (!merged.ok) {
|
|
2121
2137
|
lines.push(`receipts init: ${merged.reason}.`);
|
|
2122
2138
|
} else if (merged.changed) {
|
|
2123
2139
|
written.push(settingsPath);
|
|
2124
|
-
lines.push(
|
|
2140
|
+
lines.push(
|
|
2141
|
+
`receipts init: added the receipts pre-push hook to ${settingsPath} (store=ref \u2014 receipts live at refs/receipts/<branch>, no files in the tree).`
|
|
2142
|
+
);
|
|
2125
2143
|
} else {
|
|
2126
2144
|
lines.push(`receipts init: ${settingsPath} already has the receipts hook.`);
|
|
2127
2145
|
}
|
|
@@ -2135,7 +2153,8 @@ function runInit(opts = {}) {
|
|
|
2135
2153
|
const codexPath = join7(".codex", "hooks.json");
|
|
2136
2154
|
const m = mergeHookIntoSettings(
|
|
2137
2155
|
codexPath,
|
|
2138
|
-
"npx -y altimate-receipts@latest hook pre-push --agent codex"
|
|
2156
|
+
"npx -y altimate-receipts@latest hook pre-push --agent codex",
|
|
2157
|
+
{ defaultStoreRef: true }
|
|
2139
2158
|
);
|
|
2140
2159
|
if (!m.ok) {
|
|
2141
2160
|
lines.push(`receipts init: ${m.reason}.`);
|