@delegance/claude-autopilot 5.2.1 → 5.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.
@@ -22,7 +22,8 @@ function fmtTokens(n) {
22
22
  export async function runCosts(cwd = process.cwd()) {
23
23
  const log = readCostLog(cwd);
24
24
  if (log.length === 0) {
25
- console.log(fmt('yellow', '[costs] No run history found — run `guardrail run` first.'));
25
+ console.log(fmt('yellow', `[costs] No run history found in ${cwd} — run \`guardrail run\` first.`));
26
+ console.log(fmt('dim', ` (Costs are scoped per-project. \`cd\` to the project before checking.)`));
26
27
  return 0;
27
28
  }
28
29
  // 7-day window
@@ -33,12 +34,13 @@ export async function runCosts(cwd = process.cwd()) {
33
34
  const totalInput = log.reduce((s, e) => s + e.inputTokens, 0);
34
35
  const totalOutput = log.reduce((s, e) => s + e.outputTokens, 0);
35
36
  const recentCost = recent.reduce((s, e) => s + e.costUSD, 0);
36
- console.log(`\n${fmt('bold', '[costs]')}\n`);
37
+ console.log(`\n${fmt('bold', '[costs]')} ${fmt('dim', cwd)}\n`);
37
38
  // Summary row
38
39
  console.log(fmt('bold', 'Summary'));
39
40
  console.log(` All-time runs: ${log.length}`);
40
41
  console.log(` All-time cost: ${fmtUSD(totalCost)} (${fmtTokens(totalInput)} in / ${fmtTokens(totalOutput)} out)`);
41
42
  console.log(` Last 7 days: ${fmtUSD(recentCost)} (${recent.length} run${recent.length !== 1 ? 's' : ''})`);
43
+ console.log(fmt('dim', ` (per-project — scoped to ${cwd}/.guardrail-cache/costs.jsonl)`));
42
44
  console.log('');
43
45
  // Last 10 runs table
44
46
  console.log(fmt('bold', `Recent runs (last ${last10.length})`));
@@ -25,9 +25,15 @@ function gitFetch(remote, ref, cwd) {
25
25
  export async function runPr(options = {}) {
26
26
  const cwd = options.cwd ?? process.cwd();
27
27
  const configPath = options.configPath ?? path.join(cwd, 'guardrail.config.yaml');
28
+ // 5.2.2 — pr previously hard-failed when guardrail.config.yaml was missing
29
+ // ("not found at <path>"). The first-run UX surprised users running
30
+ // `claude-autopilot pr <n>` on a fresh repo: setup hadn't been invoked, and
31
+ // the error didn't say to invoke it. Now matches `run`'s behavior — defer
32
+ // config-loading to the underlying runCommand, which auto-detects stack +
33
+ // testCommand when the file is missing.
28
34
  if (!fs.existsSync(configPath)) {
29
- console.error(fmt('red', `[pr] guardrail.config.yaml not found at ${configPath}`));
30
- return 1;
35
+ console.log(fmt('dim', `[pr] guardrail.config.yaml not found auto-detecting from stack signals.`));
36
+ console.log(fmt('dim', ` Run \`claude-autopilot setup\` first to commit a config.`));
31
37
  }
32
38
  // Resolve PR number
33
39
  let prNumber = options.prNumber;
@@ -3,6 +3,14 @@ import * as path from 'node:path';
3
3
  const CACHE_DIR = '.guardrail-cache';
4
4
  const LOG_FILE = 'costs.jsonl';
5
5
  export function appendCostLog(cwd, entry) {
6
+ // Skip no-op entries that only pollute the report — runs that didn't
7
+ // actually invoke an LLM (dry-runs, no-findings paths, "no code files at
8
+ // path" early returns). Without this filter, randai's costs.jsonl picked up
9
+ // 6 zero-token zero-duration entries from setup-flow scans, drowning the
10
+ // 4 real review entries in `claude-autopilot costs` output.
11
+ if (entry.inputTokens === 0 && entry.outputTokens === 0 && entry.costUSD === 0) {
12
+ return;
13
+ }
6
14
  // Cost log is observability, not a contract. A failed write (read-only FS,
7
15
  // full disk, permission error) must NEVER block the caller — every callsite
8
16
  // calls this *after* its primary output is emitted, and a throw here would
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delegance/claude-autopilot",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "type": "module",
5
5
  "description": "Autonomous development pipeline for Claude Code: brainstorm → spec → plan → implement → migrate → validate → PR → review → merge. Multi-model, local-first, every phase a skill you can intervene in.",
6
6
  "keywords": [