@archeagle087/costcrew 0.4.1 → 0.4.3

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 (54) hide show
  1. package/README.md +1 -0
  2. package/bin.js +10 -6
  3. package/package.json +8 -5
  4. package/.github/workflows/ci.yml +0 -21
  5. package/.github/workflows/npm-release.yml +0 -123
  6. package/.github/workflows/prices-monthly.yml +0 -58
  7. package/.github/workflows/release.yml +0 -45
  8. package/Cargo.lock +0 -980
  9. package/Cargo.toml +0 -22
  10. package/assets/advise.png +0 -0
  11. package/assets/board.png +0 -0
  12. package/assets/catalog.png +0 -0
  13. package/assets/demo.png +0 -0
  14. package/assets/help.png +0 -0
  15. package/assets/mascot.png +0 -0
  16. package/assets/prices.png +0 -0
  17. package/assets/scan.png +0 -0
  18. package/assets/spend.png +0 -0
  19. package/assets/ui.png +0 -0
  20. package/data/prices.json +0 -1
  21. package/dist/costcrew-linux-x86_64.tar.gz +0 -0
  22. package/dist/costcrew-macos-aarch64.tar.gz +0 -0
  23. package/dist/costcrew-macos-x86_64.tar.gz +0 -0
  24. package/dist/costcrew-windows-x86_64.zip +0 -0
  25. package/install.ps1 +0 -38
  26. package/install.sh +0 -56
  27. package/packaging/npm/bin.js +0 -46
  28. package/packaging/npm/package.json +0 -20
  29. package/packaging/winget/0.4.0/Arch087146.costcrew.installer.yaml +0 -15
  30. package/packaging/winget/0.4.0/Arch087146.costcrew.locale.en-US.yaml +0 -28
  31. package/packaging/winget/0.4.0/Arch087146.costcrew.yaml +0 -5
  32. package/packaging/winget/README.md +0 -31
  33. package/scripts/render_screen.py +0 -221
  34. package/src/advise.rs +0 -154
  35. package/src/args.rs +0 -239
  36. package/src/board.rs +0 -227
  37. package/src/catalog.rs +0 -136
  38. package/src/demo.rs +0 -79
  39. package/src/fetch.rs +0 -155
  40. package/src/main.rs +0 -371
  41. package/src/price.rs +0 -218
  42. package/src/prices.rs +0 -182
  43. package/src/report.rs +0 -194
  44. package/src/scan.rs +0 -593
  45. package/src/spend.rs +0 -452
  46. package/src/ui.rs +0 -367
  47. package/work/costcrew-darwin-arm64/costcrew +0 -0
  48. package/work/costcrew-darwin-arm64/package.json +0 -9
  49. package/work/costcrew-darwin-x64/costcrew +0 -0
  50. package/work/costcrew-darwin-x64/package.json +0 -9
  51. package/work/costcrew-linux-x64/costcrew +0 -0
  52. package/work/costcrew-linux-x64/package.json +0 -9
  53. package/work/costcrew-win32-x64/costcrew.exe +0 -0
  54. package/work/costcrew-win32-x64/package.json +0 -9
package/README.md CHANGED
@@ -108,6 +108,7 @@ costcrew # the interactive app (splash + arrow-key menu)
108
108
  costcrew prices claude # browse the database, filtered
109
109
  costcrew spend # your recorded payments, totaled
110
110
  costcrew leaderboard # arena Elo, priced — elo-per-dollar value sort
111
+ costcrew budget 20 # best model for $20/month (asks your tasks)
111
112
  costcrew catalog # which agent ships with which models
112
113
  costcrew scan --since 7d # optional: estimate from local agent logs
113
114
  costcrew md > spend.md # shareable markdown report
package/bin.js CHANGED
@@ -23,17 +23,21 @@ if (!rel) {
23
23
 
24
24
  function resolveBinary() {
25
25
  // __dirname is node_modules/@archeagle087/costcrew — two levels up is
26
- // node_modules, where the platform packages live
26
+ // node_modules, where the platform packages normally live; npm can also
27
+ // nest them under the wrapper's own node_modules
27
28
  const nm = path.join(__dirname, "..", "..");
28
- const direct = path.join(nm, rel);
29
- if (fs.existsSync(direct)) return direct;
30
- // npm can hoist/reshape optionalDependencies — fall back to resolution
29
+ const nested = path.join(__dirname, "node_modules");
30
+ for (const base of [nm, nested]) {
31
+ const direct = path.join(base, rel);
32
+ if (fs.existsSync(direct)) return direct;
33
+ }
34
+ // last resort: node resolution from both bases
31
35
  const [pkg, file] = rel.split("/");
32
36
  try {
33
- const dir = path.dirname(require.resolve(`${pkg}/package.json`, { paths: [nm] }));
37
+ const dir = path.dirname(require.resolve(`${pkg}/package.json`, { paths: [nm, __dirname] }));
34
38
  return path.join(dir, file);
35
39
  } catch {
36
- return direct; // let spawn fail with a clear ENOENT
40
+ return path.join(nm, rel); // let spawn fail with a clear ENOENT
37
41
  }
38
42
  }
39
43
 
package/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
2
  "name": "@archeagle087/costcrew",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "The AI coding price database, plus what you spend on it — interactive terminal app. Bundled 465+ model prices, your spend ledger, arena leaderboard priced elo-per-dollar.",
5
5
  "bin": {
6
6
  "costcrew": "bin.js"
7
7
  },
8
+ "files": [
9
+ "bin.js"
10
+ ],
8
11
  "optionalDependencies": {
9
- "@archeagle087/costcrew-win32-x64": "0.4.1",
10
- "@archeagle087/costcrew-linux-x64": "0.4.1",
11
- "@archeagle087/costcrew-darwin-arm64": "0.4.1",
12
- "@archeagle087/costcrew-darwin-x64": "0.4.1"
12
+ "@archeagle087/costcrew-win32-x64": "0.4.3",
13
+ "@archeagle087/costcrew-linux-x64": "0.4.3",
14
+ "@archeagle087/costcrew-darwin-arm64": "0.4.3",
15
+ "@archeagle087/costcrew-darwin-x64": "0.4.3"
13
16
  },
14
17
  "os": ["win32", "linux", "darwin"],
15
18
  "cpu": ["x64", "arm64"],
@@ -1,21 +0,0 @@
1
- name: CI
2
- on:
3
- push:
4
- branches: [main]
5
- pull_request:
6
-
7
- jobs:
8
- check:
9
- runs-on: ${{ matrix.os }}
10
- strategy:
11
- matrix:
12
- os: [ubuntu-latest, windows-latest, macos-latest]
13
- steps:
14
- - uses: actions/checkout@v4
15
- - uses: dtolnay/rust-toolchain@stable
16
- with:
17
- components: clippy, rustfmt
18
- - run: cargo fmt --all -- --check
19
- - run: cargo clippy --all-targets -- -D warnings
20
- - run: cargo test
21
- - run: cargo build --release
@@ -1,123 +0,0 @@
1
- name: npm-release
2
- # Publishes @archeagle087/costcrew plus one binary package per platform.
3
- # Runs on every v* tag, after the Release workflow has uploaded assets.
4
- # Without NPM_TOKEN set in repo secrets this publishes nothing — it exits
5
- # with a notice so the run stays green and the steps are easy to find.
6
-
7
- on:
8
- push:
9
- tags: ["v*"]
10
- workflow_dispatch:
11
-
12
- permissions:
13
- contents: read
14
-
15
- jobs:
16
- publish:
17
- runs-on: ubuntu-latest
18
- steps:
19
- - uses: actions/checkout@v4
20
-
21
- - uses: actions/setup-node@v4
22
- with:
23
- node-version: 20
24
- registry-url: https://registry.npmjs.org
25
-
26
- - name: resolve version + tag
27
- id: ver
28
- env:
29
- GH_TOKEN: ${{ github.token }}
30
- run: |
31
- if [[ "${GITHUB_REF_NAME}" == v* ]]; then
32
- TAG="${GITHUB_REF_NAME}"
33
- else
34
- # manual dispatch from a branch: fall back to the latest release
35
- TAG="$(gh api "repos/${GITHUB_REPOSITORY}/releases/latest" --jq .tag_name)"
36
- fi
37
- echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
38
- echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
39
-
40
- - name: check for NPM_TOKEN
41
- id: tok
42
- run: |
43
- if [ -n "${NPM_TOKEN:-}" ]; then
44
- echo "have_token=true" >> "$GITHUB_OUTPUT"
45
- else
46
- echo "have_token=false" >> "$GITHUB_OUTPUT"
47
- echo "::notice::NPM_TOKEN secret not set — skipping npm publish. Add it in Settings → Secrets → Actions."
48
- fi
49
- env:
50
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
51
-
52
- - name: download release assets (waits for Release to finish)
53
- if: steps.tok.outputs.have_token == 'true'
54
- run: |
55
- mkdir -p dist
56
- assets="costcrew-linux-x86_64.tar.gz costcrew-macos-aarch64.tar.gz costcrew-macos-x86_64.tar.gz costcrew-windows-x86_64.zip"
57
- TAG="${{ steps.ver.outputs.tag }}"
58
- fetch() {
59
- for a in $assets; do
60
- if [ ! -s "dist/$a" ]; then
61
- # 404 if Release hasn't uploaded yet — retry later, never
62
- # leave a partial file behind
63
- curl -fsSL "https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG}/${a}" -o "dist/$a.part" \
64
- && mv "dist/$a.part" "dist/$a" || rm -f "dist/$a.part"
65
- fi
66
- done
67
- for a in $assets; do [ -s "dist/$a" ] || return 1; done
68
- }
69
- fetch && exit 0
70
- for i in $(seq 1 120); do # Release builds take a few minutes
71
- sleep 10
72
- fetch && exit 0
73
- done
74
- echo "::error::release assets for ${TAG} not found after 20 minutes"
75
- exit 1
76
-
77
- - name: assemble + publish platform packages
78
- if: steps.tok.outputs.have_token == 'true'
79
- env:
80
- VERSION: ${{ steps.ver.outputs.version }}
81
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
82
- run: |
83
- set -euo pipefail
84
- V="${VERSION}"
85
- mkdir -p work
86
-
87
- # platform package = one package.json + the naked binary
88
- emit() { # name asset cmd
89
- local name="$1" asset="$2" cmd="$3" dir="work/$1"
90
- mkdir -p "$dir"
91
- tar xzf "dist/$asset" -C "$dir" || true
92
- unzip -qo "dist/$asset" -d "$dir" || true
93
- [ -f "$dir/$cmd" ] || { echo "::error::binary $cmd missing from $asset"; exit 1; }
94
- chmod +x "$dir/$cmd"
95
- cat > "$dir/package.json" <<EOF
96
- {
97
- "name": "@archeagle087/$name",
98
- "version": "$V",
99
- "description": "costcrew native binary ($name) — do not install directly",
100
- "os": ["$4"],
101
- "cpu": ["$5"],
102
- "license": "MIT",
103
- "repository": "github:Arch087146/costcrew"
104
- }
105
- EOF
106
- # files field: ship only what's needed
107
- ( cd "$dir" && npm publish --access public --non-interactive )
108
- }
109
-
110
- emit costcrew-linux-x64 costcrew-linux-x86_64.tar.gz costcrew linux x64
111
- emit costcrew-darwin-arm64 costcrew-macos-aarch64.tar.gz costcrew darwin arm64
112
- emit costcrew-darwin-x64 costcrew-macos-x86_64.tar.gz costcrew darwin x64
113
- emit costcrew-win32-x64 costcrew-windows-x86_64.zip costcrew.exe win32 x64
114
-
115
- - name: publish wrapper
116
- if: steps.tok.outputs.have_token == 'true'
117
- env:
118
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
119
- run: |
120
- cp packaging/npm/package.json .
121
- sed -i "s/\"0\.4\.0\"/\"${{ steps.ver.outputs.version }}\"/g" package.json
122
- cp packaging/npm/bin.js .
123
- npm publish --access public --non-interactive
@@ -1,58 +0,0 @@
1
- # Refresh data/prices.json monthly so the bundled price database
2
- # ships fresh. Runs on the 3rd of each month + manual dispatch.
3
- # If OpenRouter returned anything new, it commits directly to main.
4
- name: prices-monthly
5
-
6
- on:
7
- schedule:
8
- - cron: "17 5 3 * *" # 05:17 UTC, 3rd of the month
9
- workflow_dispatch:
10
-
11
- permissions:
12
- contents: write
13
-
14
- jobs:
15
- refresh:
16
- runs-on: ubuntu-latest
17
- steps:
18
- - uses: actions/checkout@v4
19
-
20
- - name: Fetch live OpenRouter catalog
21
- run: |
22
- python3 - <<'EOF'
23
- import json, time, urllib.request
24
- url = "https://openrouter.ai/api/v1/models"
25
- with urllib.request.urlopen(url, timeout=30) as r:
26
- v = json.load(r)
27
- models = []
28
- for m in v.get("data", []):
29
- p = m.get("pricing", {})
30
- f = lambda k: float(p.get(k) or 0) * 1_000_000
31
- models.append({
32
- "id": m.get("id"),
33
- "prompt": f("prompt"),
34
- "completion": f("completion"),
35
- "cache_read": f("input_cache_read"),
36
- "cache_write": f("input_cache_write"),
37
- })
38
- doc = {
39
- "version": 1,
40
- "fetched_at_ms": int(time.time() * 1000),
41
- "models": [m for m in models if m["id"]],
42
- }
43
- with open("data/prices.json", "w") as fh:
44
- json.dump(doc, fh)
45
- print("models:", len(doc["models"]))
46
- EOF
47
-
48
- - name: Commit if changed
49
- run: |
50
- git config user.name "costcrew-bot"
51
- git config user.email "actions@users.noreply.github.com"
52
- git add data/prices.json
53
- if git diff --cached --quiet; then
54
- echo "no price changes"
55
- else
56
- git commit -m "prices: monthly refresh from OpenRouter ($(date -u +%Y-%m-%d))"
57
- git push
58
- fi
@@ -1,45 +0,0 @@
1
- name: Release
2
- on:
3
- push:
4
- tags: ["v*"]
5
-
6
- permissions:
7
- contents: write
8
-
9
- jobs:
10
- build:
11
- strategy:
12
- matrix:
13
- include:
14
- - os: ubuntu-latest
15
- target: x86_64-unknown-linux-gnu
16
- artifact: costcrew-linux-x86_64.tar.gz
17
- - os: macos-latest
18
- target: aarch64-apple-darwin
19
- artifact: costcrew-macos-aarch64.tar.gz
20
- - os: macos-latest
21
- target: x86_64-apple-darwin
22
- artifact: costcrew-macos-x86_64.tar.gz
23
- - os: windows-latest
24
- target: x86_64-pc-windows-msvc
25
- artifact: costcrew-windows-x86_64.zip
26
- runs-on: ${{ matrix.os }}
27
- steps:
28
- - uses: actions/checkout@v4
29
- - uses: dtolnay/rust-toolchain@stable
30
- with:
31
- targets: ${{ matrix.target }}
32
- - run: cargo build --release --target ${{ matrix.target }}
33
- - name: Package (unix)
34
- if: runner.os != 'Windows'
35
- run: |
36
- cd target/${{ matrix.target }}/release
37
- tar czf ../../../${{ matrix.artifact }} costcrew
38
- - name: Package (windows)
39
- if: runner.os == 'Windows'
40
- shell: pwsh
41
- run: |
42
- Compress-Archive target/${{ matrix.target }}/release/costcrew.exe ${{ matrix.artifact }}
43
- - uses: softprops/action-gh-release@v2
44
- with:
45
- files: ${{ matrix.artifact }}