altimate-receipts 0.6.0 → 0.6.2
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/dist/{chunk-ASPLZPMQ.js → chunk-5R6W4W4R.js} +32 -6
- package/dist/chunk-5R6W4W4R.js.map +1 -0
- package/dist/{chunk-DBQWQVZZ.js → chunk-72Y2GS7I.js} +13 -3
- package/dist/chunk-72Y2GS7I.js.map +1 -0
- package/dist/{chunk-543NGQTN.js → chunk-OQJHGUIN.js} +2 -2
- package/dist/cli.js +25 -6
- 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-ASPLZPMQ.js.map +0 -1
- package/dist/chunk-DBQWQVZZ.js.map +0 -1
- /package/dist/{chunk-543NGQTN.js.map → chunk-OQJHGUIN.js.map} +0 -0
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
loadSession,
|
|
8
8
|
selectSummary,
|
|
9
9
|
upsertSection
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-72Y2GS7I.js";
|
|
11
11
|
|
|
12
12
|
// src/report/sessions.ts
|
|
13
13
|
async function deriveTargets(opts) {
|
|
@@ -259,4 +259,4 @@ export {
|
|
|
259
259
|
renderTrends,
|
|
260
260
|
upsertTrendsSection
|
|
261
261
|
};
|
|
262
|
-
//# sourceMappingURL=chunk-
|
|
262
|
+
//# sourceMappingURL=chunk-OQJHGUIN.js.map
|
package/dist/cli.js
CHANGED
|
@@ -13,18 +13,19 @@ import {
|
|
|
13
13
|
renderShareMarkdown,
|
|
14
14
|
sliceByBranch,
|
|
15
15
|
toDsseEnvelope
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-5R6W4W4R.js";
|
|
17
17
|
import {
|
|
18
18
|
computeTrends,
|
|
19
19
|
deriveTargets,
|
|
20
20
|
renderTrends,
|
|
21
21
|
upsertTrendsSection
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-OQJHGUIN.js";
|
|
23
23
|
import {
|
|
24
24
|
agentIds,
|
|
25
25
|
anyDetected,
|
|
26
26
|
buildReceipt,
|
|
27
27
|
collectGuardrails,
|
|
28
|
+
cwdAtFirstGit,
|
|
28
29
|
deriveFindings,
|
|
29
30
|
deriveSpans,
|
|
30
31
|
formatCostAlways,
|
|
@@ -43,7 +44,7 @@ import {
|
|
|
43
44
|
selectSummary,
|
|
44
45
|
upsertGuardrailsSection,
|
|
45
46
|
verifyBundle
|
|
46
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-72Y2GS7I.js";
|
|
47
48
|
|
|
48
49
|
// src/cli.ts
|
|
49
50
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
@@ -340,6 +341,14 @@ function isGitPush(command) {
|
|
|
340
341
|
}
|
|
341
342
|
return false;
|
|
342
343
|
}
|
|
344
|
+
function isGitCommit(command) {
|
|
345
|
+
for (const { sub, rest } of gitInvocations(command)) {
|
|
346
|
+
if (sub === "commit" && !rest.includes("--dry-run")) {
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
343
352
|
function gitStdinPushesBranch(stdin) {
|
|
344
353
|
return stdin.split("\n").some((line) => line.trim().startsWith("refs/heads/"));
|
|
345
354
|
}
|
|
@@ -379,6 +388,7 @@ async function readStdin(stream = process.stdin) {
|
|
|
379
388
|
return data;
|
|
380
389
|
}
|
|
381
390
|
async function runHookPrePush(dialect, stdin, generate) {
|
|
391
|
+
let pendingCommit = false;
|
|
382
392
|
try {
|
|
383
393
|
if (process.env.RECEIPTS_HOOK === "0") {
|
|
384
394
|
return { exit: 0 };
|
|
@@ -402,6 +412,11 @@ async function runHookPrePush(dialect, stdin, generate) {
|
|
|
402
412
|
if (!isGitPush(payload.tool_input.command)) {
|
|
403
413
|
return { exit: 0 };
|
|
404
414
|
}
|
|
415
|
+
const locus = cwdAtFirstGit(payload.tool_input.command, process.cwd());
|
|
416
|
+
if (locus.kind === "known" && existsSync3(locus.path)) {
|
|
417
|
+
process.chdir(locus.path);
|
|
418
|
+
}
|
|
419
|
+
pendingCommit = isGitCommit(payload.tool_input.command);
|
|
405
420
|
} else if (!gitStdinPushesBranch(stdin)) {
|
|
406
421
|
return { exit: 0 };
|
|
407
422
|
}
|
|
@@ -425,7 +440,7 @@ async function runHookPrePush(dialect, stdin, generate) {
|
|
|
425
440
|
process.stderr.write = (() => true);
|
|
426
441
|
let generated;
|
|
427
442
|
try {
|
|
428
|
-
generated = await generate();
|
|
443
|
+
generated = await generate({ pendingCommit });
|
|
429
444
|
} finally {
|
|
430
445
|
process.stderr.write = write;
|
|
431
446
|
}
|
|
@@ -1605,7 +1620,7 @@ async function runPr(opts) {
|
|
|
1605
1620
|
process.stderr.write("receipts pr: not on a git branch (use --branch <name>).\n");
|
|
1606
1621
|
return 1;
|
|
1607
1622
|
}
|
|
1608
|
-
const diff = opts.wholeSession ? null : changedFiles(opts.base);
|
|
1623
|
+
const diff = opts.wholeSession ? null : changedFiles(opts.base, { includeWorkingTree: opts.pendingCommit });
|
|
1609
1624
|
const all = await listSessions();
|
|
1610
1625
|
const picked = diff ? await pickForDiff(
|
|
1611
1626
|
all,
|
|
@@ -2278,7 +2293,11 @@ async function runHook(kind, dialect) {
|
|
|
2278
2293
|
return 1;
|
|
2279
2294
|
}
|
|
2280
2295
|
const stdin = await readStdin();
|
|
2281
|
-
const res = await runHookPrePush(
|
|
2296
|
+
const res = await runHookPrePush(
|
|
2297
|
+
dialect,
|
|
2298
|
+
stdin,
|
|
2299
|
+
async (o) => runPr({ pendingCommit: o?.pendingCommit })
|
|
2300
|
+
);
|
|
2282
2301
|
if (res.message) {
|
|
2283
2302
|
process.stderr.write(`${res.message}
|
|
2284
2303
|
`);
|