iteration-cli 0.8.1 → 0.9.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.
@@ -14,6 +14,7 @@ const CONTEXT_RECORD_TYPES = new Set([
14
14
  "file-history-delta",
15
15
  "cost-state",
16
16
  "queue-operation",
17
+ "pr-link",
17
18
  ]);
18
19
  function object(value) {
19
20
  const parsed = z.record(z.string(), z.json()).safeParse(value);
package/dist/collector.js CHANGED
@@ -75,6 +75,7 @@ export async function scanSourceOnce(config, paths, signal) {
75
75
  ];
76
76
  const completedHooks = [];
77
77
  const queuedIds = await pendingEventIds(paths);
78
+ const tickIndexes = new Map();
78
79
  const events = [];
79
80
  let remainingBudget = MAX_SCAN_BYTES_PER_TICK;
80
81
  let caughtUp = true;
@@ -151,6 +152,16 @@ export async function scanSourceOnce(config, paths, signal) {
151
152
  for (const reason of parsed.gaps)
152
153
  logGap(filename, byteOffset, reason);
153
154
  for (const parsedEvent of parsed.events) {
155
+ // Claude repeats a response's usage on every line of that response,
156
+ // and only the last copy carries the final output count.
157
+ const queuedAt = tickIndexes.get(parsedEvent.eventId);
158
+ if (queuedAt !== undefined &&
159
+ parsedEvent.eventType === "token_usage_record") {
160
+ const event = await redactTraceEvent(parsedEvent);
161
+ if (Buffer.byteLength(JSON.stringify(event), "utf8") <= MAX_EVENT_BYTES)
162
+ events[queuedAt] = event;
163
+ continue;
164
+ }
154
165
  if (queuedIds.has(parsedEvent.eventId))
155
166
  continue;
156
167
  const event = await redactTraceEvent(parsedEvent);
@@ -159,6 +170,7 @@ export async function scanSourceOnce(config, paths, signal) {
159
170
  logGap(filename, byteOffset, "normalized_event_exceeds_upload_limit");
160
171
  }
161
172
  else {
173
+ tickIndexes.set(event.eventId, events.length);
162
174
  events.push(event);
163
175
  queuedIds.add(event.eventId);
164
176
  }
@@ -1,6 +1,10 @@
1
1
  import { lintSource } from "@secretlint/core";
2
+ import { secretLintProfiler } from "@secretlint/profiler";
2
3
  import { rules as recommendedRules } from "@secretlint/secretlint-rule-preset-recommend";
3
4
  import * as z from "zod";
5
+ // Secretlint profiles every rule run by default and keeps each timing entry,
6
+ // so a long-running collector's memory would grow without limit.
7
+ secretLintProfiler.setEnabled(false);
4
8
  const REDACTED = "[REDACTED]";
5
9
  const secretlintConfig = {
6
10
  rules: recommendedRules
package/dist/storage.js CHANGED
@@ -562,9 +562,12 @@ export async function ensureHistoryBackfill(codexHome, paths) {
562
562
  });
563
563
  return true;
564
564
  }
565
+ // Version 3 re-reads Claude history so stored sessions gain each response's
566
+ // final usage report and the PR links Claude records.
567
+ const CLAUDE_HISTORY_BACKFILL_VERSION = 3;
565
568
  export async function ensureClaudeHistoryBackfill(claudeHome, paths) {
566
569
  const version = await readHistoryBackfillVersion(paths);
567
- if (version !== null && version >= 1)
570
+ if (version !== null && version >= CLAUDE_HISTORY_BACKFILL_VERSION)
568
571
  return false;
569
572
  const state = await loadState(paths);
570
573
  if (!state.initialized ||
@@ -573,7 +576,9 @@ export async function ensureClaudeHistoryBackfill(claudeHome, paths) {
573
576
  }
574
577
  await claudeFiles(path.join(claudeHome, "projects"));
575
578
  await saveState({ ...state, cursors: {}, skipping: [] }, paths);
576
- await writeJsonAtomic(paths.historyBackfill, { version: 1 });
579
+ await writeJsonAtomic(paths.historyBackfill, {
580
+ version: CLAUDE_HISTORY_BACKFILL_VERSION,
581
+ });
577
582
  return true;
578
583
  }
579
584
  export async function ensureCursorHistoryBackfill(cursorHome, paths) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iteration-cli",
3
- "version": "0.8.1",
3
+ "version": "0.9.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,6 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@secretlint/core": "13.0.6",
21
+ "@secretlint/profiler": "13.0.6",
21
22
  "@secretlint/secretlint-rule-preset-recommend": "13.0.6",
22
23
  "zod": "4.6.4",
23
24
  "iteration-trace-contracts": "0.7.0"