costclaw 0.5.7 → 0.5.8

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 +28 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1743,7 +1743,7 @@ function buildClaudeMd(input, recoverable, notes, stats, carried) {
1743
1743
  if (droppedCommands > 0) {
1744
1744
  lines.push("");
1745
1745
  lines.push(
1746
- `The remaining ${droppedCommands} scripts stay in \`package.json\`; add one here only when the agent keeps needing it.`
1746
+ "The remaining scripts stay in `package.json`; add one here only when the agent keeps needing it."
1747
1747
  );
1748
1748
  notes.push(
1749
1749
  `Kept the ${commands.length} canonical commands of ${allCommands.length} detected; the rest stay in the manifest so this file stays lean.`
@@ -2090,9 +2090,12 @@ var BASE_DENY = [
2090
2090
  "Bash(rm *)",
2091
2091
  "Bash(rm -rf:*)",
2092
2092
  "Bash(sudo:*)",
2093
- "Bash(git push:*)",
2093
+ "Bash(git push --force:*)",
2094
+ "Bash(git push -f:*)",
2094
2095
  "Read(.env)",
2095
- "Read(.env.*)",
2096
+ "Read(.env.local)",
2097
+ "Read(.env.production)",
2098
+ "Read(.env.*.local)",
2096
2099
  "Read(**/*.pem)",
2097
2100
  "Read(**/*.key)",
2098
2101
  "Read(~/.ssh/**)"
@@ -3501,14 +3504,30 @@ async function detectStructure(dir, dirs) {
3501
3504
  }
3502
3505
  return structure;
3503
3506
  }
3507
+ var TEST_FILE = /\.(test|spec)\.[cm]?[jt]sx?$/;
3508
+ async function containsTestFiles(dir) {
3509
+ const top = await listEntries(dir);
3510
+ if (top.files.some((f) => TEST_FILE.test(f))) return true;
3511
+ for (const sub of top.dirs) {
3512
+ const inner = await listEntries(join5(dir, sub));
3513
+ if (inner.files.some((f) => TEST_FILE.test(f))) return true;
3514
+ }
3515
+ return false;
3516
+ }
3504
3517
  async function detectTestsLocation(dir, files, dirs) {
3505
- if (dirs.includes("tests")) return "tests in tests/";
3506
- if (dirs.includes("test")) return "tests in test/";
3507
- if (dirs.includes("__tests__")) return "tests in __tests__/";
3508
- if (files.some((f) => /\.(test|spec)\.[cm]?[jt]sx?$/.test(f))) return "tests alongside source (*.test.* / *.spec.*)";
3518
+ const candidates = ["tests", "test", "__tests__"].filter((d) => dirs.includes(d));
3519
+ if (candidates.length > 0) {
3520
+ const withTests = [];
3521
+ for (const c of candidates) {
3522
+ if (await containsTestFiles(join5(dir, c))) withTests.push(c);
3523
+ }
3524
+ const chosen = withTests.length > 0 ? withTests : candidates;
3525
+ return `tests in ${chosen.map((c) => `${c}/`).join(" and ")}`;
3526
+ }
3527
+ if (files.some((f) => TEST_FILE.test(f))) return "tests alongside source (*.test.* / *.spec.*)";
3509
3528
  if (dirs.includes("src")) {
3510
3529
  const sub = await listEntries(join5(dir, "src"));
3511
- if (sub.files.some((f) => /\.(test|spec)\.[cm]?[jt]sx?$/.test(f))) {
3530
+ if (sub.files.some((f) => TEST_FILE.test(f))) {
3512
3531
  return "tests alongside source (*.test.* / *.spec.*)";
3513
3532
  }
3514
3533
  }
@@ -4422,7 +4441,7 @@ function parseBadgeFlags(args) {
4422
4441
  };
4423
4442
  }
4424
4443
  function cliVersion() {
4425
- return true ? "0.5.7" : "0.0.0-dev";
4444
+ return true ? "0.5.8" : "0.0.0-dev";
4426
4445
  }
4427
4446
  function helpText() {
4428
4447
  return [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "costclaw",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "description": "Local cost and setup audit for Claude Code. Finds recoverable token spend and scores your setup across six pillars, with your prompts never leaving your machine.",
5
5
  "type": "module",
6
6
  "bin": {