costgrep-cli 0.7.3 → 0.7.5
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/README.md +13 -0
- package/package.json +2 -2
- package/scripts/costgrep.mjs +5 -2
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# costgrep
|
|
2
2
|
|
|
3
3
|
[](LICENSE)
|
|
4
|
+
[](https://www.npmjs.com/package/costgrep-cli)
|
|
4
5
|
[](https://github.com/Paraphern/costgrep/actions/workflows/test.yml)
|
|
5
6
|
[](https://github.com/Paraphern/costgrep/actions/workflows/audit.yml)
|
|
6
7
|
|
|
@@ -51,6 +52,18 @@ dependencies (single-file CLI core + a plain `agents.json` for the classifier
|
|
|
51
52
|
lists — the core works standalone if the data file is missing), no telemetry,
|
|
52
53
|
no code/log access — workflow-run metadata only.
|
|
53
54
|
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx costgrep-cli --repo owner/name # one-shot
|
|
59
|
+
npm i -g costgrep-cli && costgrep --repo owner/name
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The npm package is **`costgrep-cli`** (both binaries: `costgrep` and `costgrep-cli`).
|
|
63
|
+
Honest naming note: npm's typosquat filter blocks the plain name `costgrep` as
|
|
64
|
+
"too similar to `postgres`" (edit distance, really) — the repo, the GitHub action
|
|
65
|
+
and everything else stay `costgrep`.
|
|
66
|
+
|
|
54
67
|
## Quick start (composite action)
|
|
55
68
|
|
|
56
69
|
```yaml
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "costgrep-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "GitHub Actions cost breakdown: human vs AI agent vs bot. Zero-dependency CLI + composite action.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"homepage": "https://github.com/Paraphern/costgrep#readme",
|
|
9
9
|
"repository": { "type": "git", "url": "git+https://github.com/Paraphern/costgrep.git" },
|
|
10
10
|
"bugs": "https://github.com/Paraphern/costgrep/issues",
|
|
11
|
-
"bin": { "costgrep": "scripts/costgrep.mjs" },
|
|
11
|
+
"bin": { "costgrep": "scripts/costgrep.mjs", "costgrep-cli": "scripts/costgrep.mjs" },
|
|
12
12
|
"scripts": {
|
|
13
13
|
"test": "node --test"
|
|
14
14
|
},
|
package/scripts/costgrep.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import { parseArgs } from 'node:util';
|
|
|
22
22
|
|
|
23
23
|
const API = process.env.COSTGREP_API || 'https://api.github.com'; // env override exists for local-mock verification only
|
|
24
24
|
const HTTP_TIMEOUT = Math.max(1_000, parseInt(process.env.COSTGREP_TIMEOUT_MS, 10) || 30_000);
|
|
25
|
-
const VERSION = '0.7.
|
|
25
|
+
const VERSION = '0.7.5'; // keep in sync with package.json
|
|
26
26
|
|
|
27
27
|
// ---------------------------------------------------------------------------
|
|
28
28
|
// Rate matrix — GitHub-hosted runners, list prices effective 2026-01-01.
|
|
@@ -175,7 +175,7 @@ async function gh(path, token) {
|
|
|
175
175
|
if (attempt === 0) {
|
|
176
176
|
const wait = Math.min(Math.max(reset - Date.now(), 2000), 60_000);
|
|
177
177
|
if (!process.env.COSTGREP_NO_WAIT) {
|
|
178
|
-
console.error(`rate limit hit, retrying in ${Math.round(wait / 1000)}s`);
|
|
178
|
+
console.error(`rate limit hit (${token ? 'token' : 'anonymous access: 60 requests/hour'}), retrying in ${Math.round(wait / 1000)}s — pass --token (Actions:read) for 5000/hour`);
|
|
179
179
|
await new Promise(r => setTimeout(r, wait));
|
|
180
180
|
continue;
|
|
181
181
|
}
|
|
@@ -933,6 +933,9 @@ async function main() {
|
|
|
933
933
|
const vis = await repoVisibility(args.repo, token);
|
|
934
934
|
const runs = await listRuns(args.repo, since, token, args['max-runs']);
|
|
935
935
|
runsArr = runs;
|
|
936
|
+
if (!token && runs.length > 40) {
|
|
937
|
+
console.error(`hint: no --token given — anonymous access allows 60 requests/hour and this audit needs ~${runs.length + Math.ceil(runs.length / 100)} calls; it may fail mid-way. A fine-grained PAT with Actions:read raises the limit to 5000/hour.`);
|
|
938
|
+
}
|
|
936
939
|
const jobsByRun = new Map();
|
|
937
940
|
let done = 0;
|
|
938
941
|
for (const run of runs) {
|