@archeagle087/costcrew 0.4.0 → 0.4.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.
Files changed (53) hide show
  1. package/bin.js +12 -5
  2. package/package.json +8 -5
  3. package/.github/workflows/ci.yml +0 -21
  4. package/.github/workflows/npm-release.yml +0 -107
  5. package/.github/workflows/prices-monthly.yml +0 -58
  6. package/.github/workflows/release.yml +0 -45
  7. package/Cargo.lock +0 -980
  8. package/Cargo.toml +0 -22
  9. package/assets/advise.png +0 -0
  10. package/assets/board.png +0 -0
  11. package/assets/catalog.png +0 -0
  12. package/assets/demo.png +0 -0
  13. package/assets/help.png +0 -0
  14. package/assets/mascot.png +0 -0
  15. package/assets/prices.png +0 -0
  16. package/assets/scan.png +0 -0
  17. package/assets/spend.png +0 -0
  18. package/assets/ui.png +0 -0
  19. package/data/prices.json +0 -1
  20. package/dist/costcrew-linux-x86_64.tar.gz +0 -0
  21. package/dist/costcrew-macos-aarch64.tar.gz +0 -0
  22. package/dist/costcrew-macos-x86_64.tar.gz +0 -0
  23. package/dist/costcrew-windows-x86_64.zip +0 -0
  24. package/install.ps1 +0 -38
  25. package/install.sh +0 -56
  26. package/packaging/npm/bin.js +0 -43
  27. package/packaging/npm/package.json +0 -20
  28. package/packaging/winget/0.4.0/Arch087146.costcrew.installer.yaml +0 -15
  29. package/packaging/winget/0.4.0/Arch087146.costcrew.locale.en-US.yaml +0 -28
  30. package/packaging/winget/0.4.0/Arch087146.costcrew.yaml +0 -5
  31. package/packaging/winget/README.md +0 -31
  32. package/scripts/render_screen.py +0 -221
  33. package/src/advise.rs +0 -154
  34. package/src/args.rs +0 -239
  35. package/src/board.rs +0 -227
  36. package/src/catalog.rs +0 -136
  37. package/src/demo.rs +0 -79
  38. package/src/fetch.rs +0 -155
  39. package/src/main.rs +0 -371
  40. package/src/price.rs +0 -218
  41. package/src/prices.rs +0 -182
  42. package/src/report.rs +0 -194
  43. package/src/scan.rs +0 -593
  44. package/src/spend.rs +0 -452
  45. package/src/ui.rs +0 -367
  46. package/work/costcrew-darwin-arm64/costcrew +0 -0
  47. package/work/costcrew-darwin-arm64/package.json +0 -9
  48. package/work/costcrew-darwin-x64/costcrew +0 -0
  49. package/work/costcrew-darwin-x64/package.json +0 -9
  50. package/work/costcrew-linux-x64/costcrew +0 -0
  51. package/work/costcrew-linux-x64/package.json +0 -9
  52. package/work/costcrew-win32-x64/costcrew.exe +0 -0
  53. package/work/costcrew-win32-x64/package.json +0 -9
package/bin.js CHANGED
@@ -22,15 +22,22 @@ if (!rel) {
22
22
  }
23
23
 
24
24
  function resolveBinary() {
25
- const direct = path.join(__dirname, "..", rel);
26
- if (fs.existsSync(direct)) return direct;
27
- // npm can hoist/reshape optionalDependencies — fall back to resolution
25
+ // __dirname is node_modules/@archeagle087/costcrew — two levels up is
26
+ // node_modules, where the platform packages normally live; npm can also
27
+ // nest them under the wrapper's own node_modules
28
+ const nm = path.join(__dirname, "..", "..");
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
28
35
  const [pkg, file] = rel.split("/");
29
36
  try {
30
- const dir = path.dirname(require.resolve(`${pkg}/package.json`, { paths: [__dirname] }));
37
+ const dir = path.dirname(require.resolve(`${pkg}/package.json`, { paths: [nm, __dirname] }));
31
38
  return path.join(dir, file);
32
39
  } catch {
33
- return direct; // let spawn fail with a clear ENOENT
40
+ return path.join(nm, rel); // let spawn fail with a clear ENOENT
34
41
  }
35
42
  }
36
43
 
package/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
2
  "name": "@archeagle087/costcrew",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
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.0",
10
- "@archeagle087/costcrew-linux-x64": "0.4.0",
11
- "@archeagle087/costcrew-darwin-arm64": "0.4.0",
12
- "@archeagle087/costcrew-darwin-x64": "0.4.0"
12
+ "@archeagle087/costcrew-win32-x64": "0.4.2",
13
+ "@archeagle087/costcrew-linux-x64": "0.4.2",
14
+ "@archeagle087/costcrew-darwin-arm64": "0.4.2",
15
+ "@archeagle087/costcrew-darwin-x64": "0.4.2"
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,107 +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
53
- if: steps.tok.outputs.have_token == 'true'
54
- run: |
55
- mkdir -p dist
56
- for a in costcrew-linux-x86_64.tar.gz costcrew-macos-aarch64.tar.gz \
57
- costcrew-macos-x86_64.tar.gz costcrew-windows-x86_64.zip; do
58
- curl -fsSL "https://github.com/${GITHUB_REPOSITORY}/releases/download/${{ steps.ver.outputs.tag }}/${a}" -o "dist/${a}"
59
- done
60
-
61
- - name: assemble + publish platform packages
62
- if: steps.tok.outputs.have_token == 'true'
63
- env:
64
- VERSION: ${{ steps.ver.outputs.version }}
65
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
66
- run: |
67
- set -euo pipefail
68
- V="${VERSION}"
69
- mkdir -p work
70
-
71
- # platform package = one package.json + the naked binary
72
- emit() { # name asset cmd
73
- local name="$1" asset="$2" cmd="$3" dir="work/$1"
74
- mkdir -p "$dir"
75
- tar xzf "dist/$asset" -C "$dir" || true
76
- unzip -qo "dist/$asset" -d "$dir" || true
77
- [ -f "$dir/$cmd" ] || { echo "::error::binary $cmd missing from $asset"; exit 1; }
78
- chmod +x "$dir/$cmd"
79
- cat > "$dir/package.json" <<EOF
80
- {
81
- "name": "@archeagle087/$name",
82
- "version": "$V",
83
- "description": "costcrew native binary ($name) — do not install directly",
84
- "os": ["$4"],
85
- "cpu": ["$5"],
86
- "license": "MIT",
87
- "repository": "github:Arch087146/costcrew"
88
- }
89
- EOF
90
- # files field: ship only what's needed
91
- ( cd "$dir" && npm publish --access public --non-interactive )
92
- }
93
-
94
- emit costcrew-linux-x64 costcrew-linux-x86_64.tar.gz costcrew linux x64
95
- emit costcrew-darwin-arm64 costcrew-macos-aarch64.tar.gz costcrew darwin arm64
96
- emit costcrew-darwin-x64 costcrew-macos-x86_64.tar.gz costcrew darwin x64
97
- emit costcrew-win32-x64 costcrew-windows-x86_64.zip costcrew.exe win32 x64
98
-
99
- - name: publish wrapper
100
- if: steps.tok.outputs.have_token == 'true'
101
- env:
102
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
103
- run: |
104
- cp packaging/npm/package.json .
105
- sed -i "s/\"0\.4\.0\"/\"${{ steps.ver.outputs.version }}\"/g" package.json
106
- cp packaging/npm/bin.js .
107
- 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 }}