ai-spend-agent 0.7.0 → 0.7.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.
@@ -228,9 +228,23 @@ export async function uninstallClaudeStatusline(options) {
228
228
  delete nextSettings.statusLine;
229
229
  }
230
230
  const removeSettingsFile = !receipt.priorFileExisted && Object.keys(nextSettings).length === 0;
231
+ let exactSettingsBackup;
232
+ if (receipt.priorFileExisted) {
233
+ const priorRaw = decodeUtf8Strict(backups.settings.bytes, "invalid-receipt", "The exact settings backup is not valid UTF-8.");
234
+ const priorSettings = parseJson(priorRaw, "invalid-receipt", "The exact settings backup is not strict finite JSON.");
235
+ if (!isJsonObject(priorSettings))
236
+ throw invalidReceiptShape();
237
+ const expectedInstalledSettings = cloneJson(priorSettings);
238
+ expectedInstalledSettings.statusLine = cloneJson(receipt.installedStatusLine);
239
+ const expectedInstalledBytes = serializeBoundedJson(expectedInstalledSettings, MAX_SETTINGS_BYTES, "invalid-receipt", "installed Claude settings");
240
+ if (bytesEqual(existing.bytes, expectedInstalledBytes)) {
241
+ exactSettingsBackup = backups.settings.bytes;
242
+ }
243
+ }
231
244
  const nextSettingsBytes = removeSettingsFile
232
245
  ? undefined
233
- : serializeBoundedJson(nextSettings, MAX_SETTINGS_BYTES, "unsafe-settings-file", "Claude settings");
246
+ : exactSettingsBackup ??
247
+ serializeBoundedJson(nextSettings, MAX_SETTINGS_BYTES, "unsafe-settings-file", "Claude settings");
234
248
  const settingsMutation = mutation(paths.settingsPath, existing, nextSettingsBytes, existing.mode ?? 0o600, false, "concurrent-edit");
235
249
  let runnerMutation;
236
250
  let runnerRemoved = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-spend-agent",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Local-first financial accountability CLI for Claude Code and Codex work, cost evidence, attribution, runway, provenance, and Context Health.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -54,8 +54,8 @@
54
54
  "prepack": "npm run build"
55
55
  },
56
56
  "dependencies": {
57
- "@agent-finops/core": "0.7.0",
58
- "@agent-finops/report": "0.7.0",
57
+ "@agent-finops/core": "0.7.1",
58
+ "@agent-finops/report": "0.7.1",
59
59
  "yocto-spinner": "^1.2.0"
60
60
  }
61
61
  }