@codacy/verity-cli 0.28.1-experimental.dbd87b1 → 0.28.1-experimental.e910abc
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/bin/verity.js +59 -13
- package/package.json +1 -1
package/bin/verity.js
CHANGED
|
@@ -13579,6 +13579,13 @@ function reduce(state, events, now) {
|
|
|
13579
13579
|
});
|
|
13580
13580
|
break;
|
|
13581
13581
|
}
|
|
13582
|
+
case "goal_delivered": {
|
|
13583
|
+
const g = state.goal.find((x) => x.status === "active");
|
|
13584
|
+
if (!g) break;
|
|
13585
|
+
if (g.delivered) break;
|
|
13586
|
+
g.delivered = { at: ev.at, seq: ev.seq, summary: ev.summary };
|
|
13587
|
+
break;
|
|
13588
|
+
}
|
|
13582
13589
|
case "authored": {
|
|
13583
13590
|
authoredEvents++;
|
|
13584
13591
|
const e = byPath.get(ev.path) ?? {
|
|
@@ -13693,6 +13700,11 @@ function reduce(state, events, now) {
|
|
|
13693
13700
|
}
|
|
13694
13701
|
case "verdict": {
|
|
13695
13702
|
state.meta.last_verdict_seq = ev.seq;
|
|
13703
|
+
if (ev.intent_sig) {
|
|
13704
|
+
state.meta.intent_repeat = state.meta.intent_repeat && state.meta.intent_repeat.sig === ev.intent_sig ? { sig: ev.intent_sig, consecutive: state.meta.intent_repeat.consecutive + 1 } : { sig: ev.intent_sig, consecutive: 1 };
|
|
13705
|
+
} else {
|
|
13706
|
+
state.meta.intent_repeat = void 0;
|
|
13707
|
+
}
|
|
13696
13708
|
state.meta.watermark = {
|
|
13697
13709
|
sha: ev.head_sha,
|
|
13698
13710
|
reviewed_hash: ev.watermark_sha,
|
|
@@ -13778,7 +13790,12 @@ function compactState(s) {
|
|
|
13778
13790
|
const ms = (iso) => Date.parse(iso) || 0;
|
|
13779
13791
|
return {
|
|
13780
13792
|
v: 1,
|
|
13781
|
-
|
|
13793
|
+
// ⚠ APPEND-ONLY POSITIONALLY. Indices 11-13 carry `delivered`; a cache row
|
|
13794
|
+
// written before it existed has length 11 and expands with `delivered`
|
|
13795
|
+
// absent, which is the correct reading of "nothing had been delivered yet".
|
|
13796
|
+
// Inserting rather than appending would silently re-interpret every existing
|
|
13797
|
+
// cached row.
|
|
13798
|
+
g: s.goal.map((g) => [g.seq, ms(g.at), g.hash, g.superseded_by, g.text ?? 0, g.text_len ?? 0, g.source ?? 0, g.status ?? 0, g.repeats ?? 0, g.truncated ? 1 : 0, g.collapsed ? 1 : 0, g.delivered ? ms(g.delivered.at) : 0, g.delivered?.seq ?? 0, g.delivered?.summary ?? 0]),
|
|
13782
13799
|
a: s.authored?.map((a) => [a.path, a.origin, a.edits, a.hunks, a.adds, a.dels, a.hash_now, a.hash_at_last_verdict, a.first_seq, a.last_seq]) ?? null,
|
|
13783
13800
|
n: s.not_mine?.map((n) => [n.path, n.reason, ms(n.at), n.head_sha]) ?? null,
|
|
13784
13801
|
t: s.statements.map((x) => [x.anchor_key, x.file, x.line, x.pattern_id, x.title_hash, x.register, x.line_sha, x.said_at_seq, ms(x.said_at), x.outcome, x.outcome_at ? ms(x.outcome_at) : 0, x.repeats, x.carried ? 1 : 0]),
|
|
@@ -13824,7 +13841,14 @@ function expandState(raw) {
|
|
|
13824
13841
|
...x[7] ? { status: x[7] } : {},
|
|
13825
13842
|
...x[8] ? { repeats: x[8] } : {},
|
|
13826
13843
|
...x[9] ? { truncated: true } : {},
|
|
13827
|
-
...x[10] ? { collapsed: true } : {}
|
|
13844
|
+
...x[10] ? { collapsed: true } : {},
|
|
13845
|
+
...x[11] ? {
|
|
13846
|
+
delivered: {
|
|
13847
|
+
at: iso(x[11]),
|
|
13848
|
+
seq: x[12] ?? 0,
|
|
13849
|
+
summary: x[13] || ""
|
|
13850
|
+
}
|
|
13851
|
+
} : {}
|
|
13828
13852
|
})),
|
|
13829
13853
|
authored: decodedAuthored,
|
|
13830
13854
|
// The cache stores the BOUNDED list, so this is the bounded list too. That
|
|
@@ -14038,7 +14062,8 @@ function projectMemory(state, opts) {
|
|
|
14038
14062
|
seq: active.seq,
|
|
14039
14063
|
superseded,
|
|
14040
14064
|
truncated: active.truncated === true,
|
|
14041
|
-
collapsed: state.meta.collapsed.goal ?? 0
|
|
14065
|
+
collapsed: state.meta.collapsed.goal ?? 0,
|
|
14066
|
+
...active.delivered && { delivered: active.delivered }
|
|
14042
14067
|
};
|
|
14043
14068
|
}
|
|
14044
14069
|
const ageOf = (seq, carried) => carried ? "carried" : seq > lastVerdictSeq ? "this_turn" : "this_session";
|
|
@@ -14466,6 +14491,10 @@ function toStatus(n) {
|
|
|
14466
14491
|
}
|
|
14467
14492
|
function recordVerdict(d, v) {
|
|
14468
14493
|
const root = repoRoot();
|
|
14494
|
+
if (v.intent?.verdict === "aligned") {
|
|
14495
|
+
const summary = (v.intent.implemented ?? "").trim().slice(0, 400);
|
|
14496
|
+
if (summary) appendEvent(d, { k: "goal_delivered", summary });
|
|
14497
|
+
}
|
|
14469
14498
|
const lines = /* @__PURE__ */ new Map();
|
|
14470
14499
|
for (const f of v.findings) {
|
|
14471
14500
|
if (!f.file || typeof f.line !== "number" || !f.pattern_id) continue;
|
|
@@ -14499,9 +14528,15 @@ function recordVerdict(d, v) {
|
|
|
14499
14528
|
head_sha: getCurrentCommit(),
|
|
14500
14529
|
watermark_sha: v.watermarkSha,
|
|
14501
14530
|
branch: v.branch,
|
|
14502
|
-
decision: v.decision
|
|
14531
|
+
decision: v.decision,
|
|
14532
|
+
...intentSignature(v.intent) && { intent_sig: intentSignature(v.intent) }
|
|
14503
14533
|
});
|
|
14504
14534
|
}
|
|
14535
|
+
function intentSignature(intent) {
|
|
14536
|
+
if (!intent?.verdict) return null;
|
|
14537
|
+
if (intent.verdict !== "misaligned" && intent.verdict !== "partial") return null;
|
|
14538
|
+
return `${intent.verdict}:${lineSha(intent.gaps?.[0] ?? "")}`;
|
|
14539
|
+
}
|
|
14505
14540
|
function toRegister(severity) {
|
|
14506
14541
|
switch (severity) {
|
|
14507
14542
|
case "critical":
|
|
@@ -16287,7 +16322,7 @@ function resolveTaskContext(opts) {
|
|
|
16287
16322
|
// src/lib/cli-version.ts
|
|
16288
16323
|
function cliVersion() {
|
|
16289
16324
|
try {
|
|
16290
|
-
return true ? "0.28.1-experimental.
|
|
16325
|
+
return true ? "0.28.1-experimental.e910abc" : "dev";
|
|
16291
16326
|
} catch {
|
|
16292
16327
|
return "dev";
|
|
16293
16328
|
}
|
|
@@ -16838,9 +16873,16 @@ function buildAgentContext(input) {
|
|
|
16838
16873
|
}
|
|
16839
16874
|
if (input.intentVerdict === "misaligned" || input.intentVerdict === "partial") {
|
|
16840
16875
|
const gap = input.intentGaps?.[0];
|
|
16841
|
-
|
|
16842
|
-
|
|
16843
|
-
|
|
16876
|
+
const repeat = input.intentRepeat ?? 0;
|
|
16877
|
+
if (repeat > 0) {
|
|
16878
|
+
lines.push(
|
|
16879
|
+
`- Same intent flag as the last ${repeat === 1 ? "turn" : `${repeat} turns`}, on a goal that has not changed. Nothing new here \u2014 do not relay or re-explain it again; either act on it or carry on.`
|
|
16880
|
+
);
|
|
16881
|
+
} else {
|
|
16882
|
+
lines.push(
|
|
16883
|
+
`- This does not look like the change that was asked for` + (gap ? `: ${gap}` : ".") + " Not blocking \u2014 but check it against what you were asked to do."
|
|
16884
|
+
);
|
|
16885
|
+
}
|
|
16844
16886
|
}
|
|
16845
16887
|
const agentFindings = (input.findings ?? []).filter((f) => f.scope !== "pre-existing");
|
|
16846
16888
|
for (const f of agentFindings) {
|
|
@@ -17714,10 +17756,11 @@ async function readStopHookStdin() {
|
|
|
17714
17756
|
return empty;
|
|
17715
17757
|
}
|
|
17716
17758
|
}
|
|
17717
|
-
function agentContextFor(response) {
|
|
17759
|
+
function agentContextFor(response, intentRepeat = 0) {
|
|
17718
17760
|
const metadata = response.metadata ?? {};
|
|
17719
17761
|
const intent = response.intent_alignment ?? {};
|
|
17720
17762
|
return buildAgentContext({
|
|
17763
|
+
intentRepeat,
|
|
17721
17764
|
gateDecision: String(response.gate_decision ?? ""),
|
|
17722
17765
|
findings: response.findings ?? [],
|
|
17723
17766
|
pendingItems: response.pending_items ?? [],
|
|
@@ -18334,6 +18377,7 @@ async function runAnalyze(opts, globals) {
|
|
|
18334
18377
|
const sentPaths = codeDelta.files.map((f) => f.path);
|
|
18335
18378
|
const watermarkHash = sentPaths.length > 0 ? computeContentHash(sentPaths) : contentHash;
|
|
18336
18379
|
const watermarkIsPartial = !!codeDelta.truncated;
|
|
18380
|
+
let intentRepeatCount = 0;
|
|
18337
18381
|
if (memorySession) {
|
|
18338
18382
|
try {
|
|
18339
18383
|
recordVerdict(memorySession.d, {
|
|
@@ -18347,8 +18391,10 @@ async function runAnalyze(opts, globals) {
|
|
|
18347
18391
|
pattern_id: f.pattern_id ?? f.rule_id,
|
|
18348
18392
|
title: f.title,
|
|
18349
18393
|
severity: f.severity
|
|
18350
|
-
})) ?? []
|
|
18394
|
+
})) ?? [],
|
|
18395
|
+
intent: response.intent_alignment ?? null
|
|
18351
18396
|
});
|
|
18397
|
+
intentRepeatCount = Math.max(0, (foldDossier(memorySession.d).meta.intent_repeat?.consecutive ?? 1) - 1);
|
|
18352
18398
|
} catch {
|
|
18353
18399
|
}
|
|
18354
18400
|
}
|
|
@@ -18538,7 +18584,7 @@ ${YELLOW}${grantNudge.trim()}${NC}
|
|
|
18538
18584
|
if (autoSeedNotice) userSummary = `${autoSeedNotice} ${userSummary}`;
|
|
18539
18585
|
userSummary += loginNudge + grantNudge;
|
|
18540
18586
|
printJsonCompact(
|
|
18541
|
-
buildHookOutput("PASS", userSummary, agentContextFor(response))
|
|
18587
|
+
buildHookOutput("PASS", userSummary, agentContextFor(response, intentRepeatCount))
|
|
18542
18588
|
);
|
|
18543
18589
|
process.exit(0);
|
|
18544
18590
|
break;
|
|
@@ -18552,7 +18598,7 @@ ${YELLOW}${grantNudge.trim()}${NC}
|
|
|
18552
18598
|
if (autoSeedNotice) userSummary = `${autoSeedNotice} ${userSummary}`;
|
|
18553
18599
|
userSummary += loginNudge + grantNudge;
|
|
18554
18600
|
printJsonCompact(
|
|
18555
|
-
buildHookOutput("WARN", userSummary, agentContextFor(response))
|
|
18601
|
+
buildHookOutput("WARN", userSummary, agentContextFor(response, intentRepeatCount))
|
|
18556
18602
|
);
|
|
18557
18603
|
process.exit(0);
|
|
18558
18604
|
break;
|
|
@@ -20354,7 +20400,7 @@ function registerTelemetryCommands(program2) {
|
|
|
20354
20400
|
}
|
|
20355
20401
|
|
|
20356
20402
|
// src/cli.ts
|
|
20357
|
-
program.name("verity").description("CLI for Verity quality gate service").version("0.28.1-experimental.
|
|
20403
|
+
program.name("verity").description("CLI for Verity quality gate service").version("0.28.1-experimental.e910abc").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr").hook("preAction", async () => {
|
|
20358
20404
|
try {
|
|
20359
20405
|
await foldLegacyLocalCredential();
|
|
20360
20406
|
} catch {
|