costclaw 0.5.3 → 0.5.4
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.
- package/dist/index.js +32 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1631,7 +1631,7 @@ function stackOneLiner(stack) {
|
|
|
1631
1631
|
}
|
|
1632
1632
|
return `A ${joined} project.`;
|
|
1633
1633
|
}
|
|
1634
|
-
function buildClaudeMd(input, recoverable, notes) {
|
|
1634
|
+
function buildClaudeMd(input, recoverable, notes, stats) {
|
|
1635
1635
|
const { currentClaudeMd, project } = input;
|
|
1636
1636
|
const { title, intro, introDropped } = carriedIntro(currentClaudeMd);
|
|
1637
1637
|
const carried = carriedSections(currentClaudeMd);
|
|
@@ -1678,7 +1678,13 @@ function buildClaudeMd(input, recoverable, notes) {
|
|
|
1678
1678
|
}
|
|
1679
1679
|
const projectDesc = project?.description?.trim() || null;
|
|
1680
1680
|
const synthesized = project ? stackOneLiner(project.stack) : null;
|
|
1681
|
-
|
|
1681
|
+
let descLine;
|
|
1682
|
+
if (projectDesc ?? synthesized ?? intro) {
|
|
1683
|
+
descLine = projectDesc ?? synthesized ?? intro;
|
|
1684
|
+
} else {
|
|
1685
|
+
descLine = "<!-- one line: the stack and what this project does, e.g. Node and Postgres API on Render -->";
|
|
1686
|
+
stats.placeholders += 1;
|
|
1687
|
+
}
|
|
1682
1688
|
if (projectDesc) {
|
|
1683
1689
|
filled.push("Description");
|
|
1684
1690
|
} else if (synthesized) {
|
|
@@ -1709,6 +1715,7 @@ function buildClaudeMd(input, recoverable, notes) {
|
|
|
1709
1715
|
parts.push(lines.join("\n"));
|
|
1710
1716
|
filled.push("Commands");
|
|
1711
1717
|
} else {
|
|
1718
|
+
stats.placeholders += 1;
|
|
1712
1719
|
parts.push(
|
|
1713
1720
|
[
|
|
1714
1721
|
"## Commands",
|
|
@@ -1739,6 +1746,7 @@ function buildClaudeMd(input, recoverable, notes) {
|
|
|
1739
1746
|
parts.push(lines.join("\n"));
|
|
1740
1747
|
filled.push("Project structure");
|
|
1741
1748
|
} else {
|
|
1749
|
+
stats.placeholders += 1;
|
|
1742
1750
|
parts.push(
|
|
1743
1751
|
[
|
|
1744
1752
|
"## Project structure",
|
|
@@ -1761,6 +1769,7 @@ function buildClaudeMd(input, recoverable, notes) {
|
|
|
1761
1769
|
parts.push(lines.join("\n"));
|
|
1762
1770
|
filled.push("Code style");
|
|
1763
1771
|
} else {
|
|
1772
|
+
stats.placeholders += 1;
|
|
1764
1773
|
parts.push(
|
|
1765
1774
|
[
|
|
1766
1775
|
"## Code style",
|
|
@@ -1783,6 +1792,7 @@ function buildClaudeMd(input, recoverable, notes) {
|
|
|
1783
1792
|
parts.push(lines.join("\n"));
|
|
1784
1793
|
filled.push("Testing");
|
|
1785
1794
|
} else {
|
|
1795
|
+
stats.placeholders += 1;
|
|
1786
1796
|
parts.push(
|
|
1787
1797
|
[
|
|
1788
1798
|
"## Testing",
|
|
@@ -1800,6 +1810,7 @@ function buildClaudeMd(input, recoverable, notes) {
|
|
|
1800
1810
|
parts.push(["## Workflow", "", carried.workflow].join("\n"));
|
|
1801
1811
|
filled.push("Workflow");
|
|
1802
1812
|
} else {
|
|
1813
|
+
stats.placeholders += 1;
|
|
1803
1814
|
parts.push(
|
|
1804
1815
|
[
|
|
1805
1816
|
"## Workflow",
|
|
@@ -1817,6 +1828,7 @@ function buildClaudeMd(input, recoverable, notes) {
|
|
|
1817
1828
|
parts.push(["## Architecture and gotchas", "", carried.architecture].join("\n"));
|
|
1818
1829
|
filled.push("Architecture and gotchas");
|
|
1819
1830
|
} else {
|
|
1831
|
+
stats.placeholders += 1;
|
|
1820
1832
|
parts.push(
|
|
1821
1833
|
[
|
|
1822
1834
|
"## Architecture and gotchas",
|
|
@@ -1847,6 +1859,7 @@ function buildClaudeMd(input, recoverable, notes) {
|
|
|
1847
1859
|
);
|
|
1848
1860
|
filled.push("Environment");
|
|
1849
1861
|
} else {
|
|
1862
|
+
stats.placeholders += 1;
|
|
1850
1863
|
parts.push(
|
|
1851
1864
|
[
|
|
1852
1865
|
"## Environment",
|
|
@@ -2059,7 +2072,8 @@ function buildSettings(project) {
|
|
|
2059
2072
|
function optimize(input) {
|
|
2060
2073
|
const recoverable = cacheMissExposureUsd(input.report);
|
|
2061
2074
|
const notes = [];
|
|
2062
|
-
const
|
|
2075
|
+
const stats = { placeholders: 0 };
|
|
2076
|
+
const optimizedClaudeMd = buildClaudeMd(input, recoverable, notes, stats);
|
|
2063
2077
|
const playbook = buildPlaybook(input.report, input.fixes, input.scores, recoverable, input.project);
|
|
2064
2078
|
const settingsJson = buildSettings(input.project);
|
|
2065
2079
|
const cleanNotes = notes.map((n) => clean(n));
|
|
@@ -2068,10 +2082,11 @@ function optimize(input) {
|
|
|
2068
2082
|
optimizedClaudeMd: sanitizeText(optimizedClaudeMd),
|
|
2069
2083
|
playbook: sanitizeText(playbook),
|
|
2070
2084
|
settingsJson: sanitizeText(settingsJson),
|
|
2071
|
-
notes: cleanNotes.map(sanitizeText)
|
|
2085
|
+
notes: cleanNotes.map(sanitizeText),
|
|
2086
|
+
placeholdersRemaining: stats.placeholders
|
|
2072
2087
|
};
|
|
2073
2088
|
}
|
|
2074
|
-
return { optimizedClaudeMd, playbook, settingsJson, notes: cleanNotes };
|
|
2089
|
+
return { optimizedClaudeMd, playbook, settingsJson, notes: cleanNotes, placeholdersRemaining: stats.placeholders };
|
|
2075
2090
|
}
|
|
2076
2091
|
|
|
2077
2092
|
// ../../packages/engine/src/audit.ts
|
|
@@ -3771,7 +3786,9 @@ async function runOptimize(opts) {
|
|
|
3771
3786
|
lines.push("Diff (old vs new):");
|
|
3772
3787
|
lines.push(lineDiff(original, result.optimizedClaudeMd));
|
|
3773
3788
|
lines.push("");
|
|
3774
|
-
|
|
3789
|
+
if (result.placeholdersRemaining > 0) {
|
|
3790
|
+
lines.push("Warning: this scaffold has placeholders to fill in. Search it for <!-- ... --> and replace each with your project's real details.");
|
|
3791
|
+
}
|
|
3775
3792
|
lines.push("A suggested settings.json was written to the out dir for review; it is not applied in place.");
|
|
3776
3793
|
} else {
|
|
3777
3794
|
const optimizedPath = join6(outDir, OPTIMIZED_NAME);
|
|
@@ -3793,8 +3810,14 @@ async function runOptimize(opts) {
|
|
|
3793
3810
|
);
|
|
3794
3811
|
}
|
|
3795
3812
|
lines.push("");
|
|
3796
|
-
|
|
3797
|
-
|
|
3813
|
+
if (result.placeholdersRemaining > 0) {
|
|
3814
|
+
const n = result.placeholdersRemaining;
|
|
3815
|
+
lines.push(`The optimized CLAUDE.md has ${n} section${n === 1 ? "" : "s"} left as placeholders (no evidence to fill them).`);
|
|
3816
|
+
lines.push("Search it for <!-- ... --> and replace each with your project's real details.");
|
|
3817
|
+
} else {
|
|
3818
|
+
lines.push("Every section was filled from your project and your existing CLAUDE.md; nothing is left as a placeholder.");
|
|
3819
|
+
lines.push("Review it (the notes below say what changed), then apply it.");
|
|
3820
|
+
}
|
|
3798
3821
|
lines.push("To apply it in place (with a backup and a diff first), rerun with --write <your-CLAUDE.md>.");
|
|
3799
3822
|
lines.push("The settings.suggested.json is a conservative permission allowlist. Review it, then merge the rules you want into ~/.claude/settings.json or the project's .claude/settings.json. It is never applied unless you ask.");
|
|
3800
3823
|
lines.push("To merge it into the project's .claude/settings.json for you (with a backup and a diff first), rerun with --apply-settings.");
|
|
@@ -4126,7 +4149,7 @@ function parseBadgeFlags(args) {
|
|
|
4126
4149
|
};
|
|
4127
4150
|
}
|
|
4128
4151
|
function cliVersion() {
|
|
4129
|
-
return true ? "0.5.
|
|
4152
|
+
return true ? "0.5.4" : "0.0.0-dev";
|
|
4130
4153
|
}
|
|
4131
4154
|
function helpText() {
|
|
4132
4155
|
return [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "costclaw",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
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": {
|