ai-spend-agent 0.2.1 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +22 -5
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -124,7 +124,10 @@ async function quickstartCommand(args) {
124
124
  mode,
125
125
  nextSteps,
126
126
  deadContext,
127
- detectedPlans
127
+ detectedPlans,
128
+ // An explicit --group-by is a drill-down question: answer with just the
129
+ // table + window instead of repeating the whole readout.
130
+ view: args.groupBy ? "breakdown" : "full"
128
131
  });
129
132
  const header = [` ${dataModeBanner(mode)}`, ...warnings.map((warning) => ` ! ${warning}`)].join("\n");
130
133
  return ok(`${header}\n${summaryText}`);
@@ -172,7 +175,10 @@ async function loadInstantReadData(args) {
172
175
  codexSessionsDir: process.env.AI_SPEND_CODEX_LOGS_DIR
173
176
  }).catch(() => undefined);
174
177
  if (logs && logs.records.length > 0) {
175
- if (persisted && persisted.records.length > 0 && persisted.mode !== "connected_provider") {
178
+ // Persisted local_logs state (written by report/apply-artifact) is the
179
+ // same data source we just re-read — superseding it silently is correct,
180
+ // not worth a scary "sample/legacy" warning.
181
+ if (persisted && persisted.records.length > 0 && persisted.mode !== "connected_provider" && persisted.mode !== "local_logs") {
176
182
  warnings.push("Ignored persisted sample/legacy state in .ai-spend-agent/spend.json — showing your real local agent logs. Run `ai-spend-agent reset` to clear it, or pass --ignore-state.");
177
183
  }
178
184
  return { records: logs.records, mode: "local-logs", warnings };
@@ -828,7 +834,12 @@ async function reportCommand(args) {
828
834
  `verification plan: ${artifactPaths.verificationPlan}`,
829
835
  `demo package: ${artifactPaths.demoPackage}`,
830
836
  `total spend: $${reportInput.summary.totalUsd.toFixed(2)}`,
831
- "privacy: local files only; no cloud upload performed"
837
+ "privacy: local files only; no cloud upload performed",
838
+ "",
839
+ "next:",
840
+ ` open ${htmlPath} view the full report in your browser`,
841
+ ` less ${markdownPath} read it in the terminal`,
842
+ " npx ai-spend-agent apply-artifact print the paste-ready coding-agent prompt"
832
843
  ].join("\n"));
833
844
  }
834
845
  catch (error) {
@@ -882,15 +893,21 @@ async function applyArtifactCommand(args) {
882
893
  try {
883
894
  const reportInput = await buildReportInput(stateDir, rootPath);
884
895
  const artifactPaths = await writeApplyArtifacts(stateDir, reportInput);
896
+ // The prompt IS the product of this command — print it so a terminal
897
+ // user can copy it right here instead of hunting for a file path.
898
+ const codingPrompt = await readFile(artifactPaths.codingPrompt, "utf8");
885
899
  return ok([
886
900
  "AI Spend Analyst Agent apply-artifact",
887
901
  `path: ${rootPath}`,
888
- `coding prompt: ${artifactPaths.codingPrompt}`,
889
902
  `action plan: ${artifactPaths.actionPlan}`,
890
903
  `policy/config draft: ${artifactPaths.policyConfigDraft}`,
891
904
  `verification plan: ${artifactPaths.verificationPlan}`,
892
905
  `demo package: ${artifactPaths.demoPackage}`,
893
- "safety: generated artifacts only; no external systems changed"
906
+ "safety: generated artifacts only; no external systems changed",
907
+ "",
908
+ `──── copy everything below into Claude Code / Codex (also saved at ${artifactPaths.codingPrompt}) ────`,
909
+ "",
910
+ codingPrompt.trimEnd()
894
911
  ].join("\n"));
895
912
  }
896
913
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-spend-agent",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Your AI spend in one view, in 90 seconds — local-first CLI for OpenAI, Anthropic, Cursor, Copilot + Claude Code/Codex session logs, with a ranked savings cut list, and flags the tools your agent loads but never uses (dead context).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,8 +49,8 @@
49
49
  "prepack": "npm run build"
50
50
  },
51
51
  "dependencies": {
52
- "@agent-finops/core": "0.2.1",
53
- "@agent-finops/report": "0.2.1",
52
+ "@agent-finops/core": "0.2.2",
53
+ "@agent-finops/report": "0.2.2",
54
54
  "yocto-spinner": "^1.2.0"
55
55
  }
56
56
  }