@alexeiled/claude-router 0.1.0 → 0.1.1

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "router",
3
3
  "displayName": "Router",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "description": "Local gateway that selects a model and an effort level for each user turn with a TypeSafe Jev Choice.",
6
6
  "author": { "name": "Alexei Ledenev", "url": "https://github.com/alexei-led" },
7
7
  "repository": "https://github.com/alexei-led/claude-router",
package/README.md CHANGED
@@ -64,6 +64,7 @@ authorization header and the OAuth value of `anthropic-beta` unchanged.
64
64
 
65
65
  ```sh
66
66
  npm install
67
+ git config --local core.hooksPath scripts/git-hooks # pre-commit: biome + gitleaks; pre-push: check, test, pack, gitleaks
67
68
  npm test # node:test
68
69
  npm run check # biome lint and format
69
70
  npm run validate # claude plugin validate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexeiled/claude-router",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Claude Code plugin: a local gateway that selects a model and an effort level for each user turn with a TypeSafe Jev Choice.",
5
5
  "license": "MIT",
6
6
  "author": "Alexei Ledenev",
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env bash
2
+ # Staged-only checks: Biome on staged .mjs/.json, Gitleaks on the staged diff.
3
+ # Full check/test/pack runs in pre-push.
4
+ set -euo pipefail
5
+
6
+ cd "$(git rev-parse --show-toplevel)"
7
+
8
+ biome=node_modules/.bin/biome
9
+ [ -x "$biome" ] || {
10
+ echo "pre-commit: $biome missing; run 'npm ci'" >&2
11
+ exit 1
12
+ }
13
+ command -v gitleaks >/dev/null || {
14
+ echo "pre-commit: gitleaks missing; run 'brew install gitleaks'" >&2
15
+ exit 1
16
+ }
17
+
18
+ files=()
19
+ while IFS= read -r -d '' f; do
20
+ case "$f" in *.mjs | *.json) files+=("$f") ;; esac
21
+ done < <(git diff --cached --name-only -z --diff-filter=ACMR)
22
+
23
+ if [ "${#files[@]}" -gt 0 ]; then
24
+ "$biome" check --no-errors-on-unmatched -- "${files[@]}"
25
+ fi
26
+
27
+ gitleaks git --pre-commit --staged --redact --verbose --no-banner
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+ # CI-equivalent validation before code leaves the machine (mirrors .github/workflows/ci.yml).
3
+ set -euo pipefail
4
+
5
+ cd "$(git rev-parse --show-toplevel)"
6
+ zero=0000000000000000000000000000000000000000
7
+
8
+ [ -x node_modules/.bin/biome ] || {
9
+ echo "pre-push: node_modules/.bin/biome missing; run 'npm ci'" >&2
10
+ exit 1
11
+ }
12
+ command -v gitleaks >/dev/null || {
13
+ echo "pre-push: gitleaks missing; run 'brew install gitleaks'" >&2
14
+ exit 1
15
+ }
16
+
17
+ ranges=()
18
+ while read -r _local_ref local_sha _remote_ref remote_sha; do
19
+ [ "$local_sha" = "$zero" ] && continue
20
+ if [ "$remote_sha" = "$zero" ]; then
21
+ ranges+=("$local_sha") # new remote branch: scan all reachable history
22
+ else
23
+ ranges+=("$remote_sha..$local_sha")
24
+ fi
25
+ done
26
+
27
+ [ "${#ranges[@]}" -eq 0 ] && exit 0 # deletion-only push
28
+
29
+ npm run check
30
+ npm test
31
+ npm run pack:dry
32
+ for range in "${ranges[@]}"; do
33
+ gitleaks git --redact --no-banner --log-opts="$range"
34
+ done