@weave-os/router 0.2.29 → 0.2.30
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 +20 -16
- package/bin.js +53 -10
- package/cc-statusline.sh +269 -56
- package/codex-skills/force-parent/SKILL.md +23 -0
- package/codex-skills/force-parent/scripts/emit.sh +7 -0
- package/codex-skills/router-models/SKILL.md +1 -1
- package/codex-status.sh +312 -48
- package/codex-toggle.sh +1 -1
- package/commands/force-parent.md +6 -0
- package/commands/models.md +1 -1
- package/commands/router-models.md +1 -1
- package/directives.tsv +1 -0
- package/install.sh +1566 -218
- package/package.json +8 -2
- package/pi-router/README.md +4 -2
- package/pi-router/src/force-model.ts +109 -38
- package/pi-router/src/pricing.generated.ts +8 -3
- package/pi-router/src/routed-model.ts +51 -7
- package/pi-router/src/ui.ts +3 -3
- package/uninstall.sh +167 -9
- package/windows.js +545 -0
package/README.md
CHANGED
|
@@ -8,16 +8,16 @@ it prints a migration warning directing users to `@weave-os/router`.
|
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npx @weave-os/router # open the hosted setup page
|
|
11
|
-
npx @weave-os/router --claude #
|
|
12
|
-
npx @weave-os/router --codex #
|
|
11
|
+
npx @weave-os/router --claude # install for Claude Code
|
|
12
|
+
npx @weave-os/router --codex # install for the OpenAI Codex CLI
|
|
13
13
|
npx @weave-os/router setup --claude --codex # configure both native clients
|
|
14
14
|
npx @weave-os/router accounts list --claude # list enrolled subscription accounts
|
|
15
15
|
npx @weave-os/router login claude # enroll Claude Pro/Max with PKCE
|
|
16
16
|
npx @weave-os/router login codex # enroll ChatGPT Pro/Plus device flow
|
|
17
17
|
npx @weave-os/router status # connectivity, native configs, account health
|
|
18
|
-
npx @weave-os/router --opencode #
|
|
19
|
-
npx @weave-os/router --pi #
|
|
20
|
-
npx @weave-os/router --scope project # per-repo install
|
|
18
|
+
npx @weave-os/router --opencode # install for opencode
|
|
19
|
+
npx @weave-os/router --pi # install for pi + Loom UI
|
|
20
|
+
npx @weave-os/router --scope project # per-repo install; key-bearing config stays out of git
|
|
21
21
|
npx @weave-os/router --local # self-hosted via docker-compose (localhost:8080)
|
|
22
22
|
npx @weave-os/router --base-url https://router.acme.internal
|
|
23
23
|
npx @weave-os/router --email you@example.com # set identity without prompting
|
|
@@ -87,11 +87,14 @@ npx @weave-os/router --uninstall --codex --scope project
|
|
|
87
87
|
|
|
88
88
|
## What it does
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
On macOS and Linux, this package runs [`install.sh`](../install.sh). On
|
|
91
|
+
Windows, it uses the full Bash installer when Git Bash is available and
|
|
92
|
+
otherwise falls back to a native Node.js installer, so a fresh Windows machine
|
|
93
|
+
does not need Git Bash, WSL, or jq for basic setup. The no-Bash path configures
|
|
94
|
+
the client's router connection and supports uninstall for Claude Code, Codex,
|
|
95
|
+
OpenCode, and pi. It does not yet install shell-based status displays, hooks, or
|
|
96
|
+
slash-command assets; commands such as `status`, `update`, `models`,
|
|
97
|
+
subscription login, and account management still require Git Bash or WSL.
|
|
95
98
|
|
|
96
99
|
Four install targets:
|
|
97
100
|
|
|
@@ -114,9 +117,8 @@ Four install targets:
|
|
|
114
117
|
install. `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`, and `gpt-6-sol`
|
|
115
118
|
can use the active ChatGPT plan; other selected models use their WorkWeave
|
|
116
119
|
deployment or BYOK credential.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
removes it without touching the rest of your config. Codex does not load
|
|
120
|
+
Re-running the installer refreshes the Weave provider, and `--uninstall --codex`
|
|
121
|
+
removes it while preserving the other settings in your config. Codex does not load
|
|
120
122
|
third-party slash-command files; the installer provides native skills
|
|
121
123
|
`$force-model` (`$fm`), `$unforce-model` (`$ufm`), and `$router-feedback`
|
|
122
124
|
(`$rf`), whose invocations are handled by the router directly. It also
|
|
@@ -156,13 +158,15 @@ dependencies are separately licensed and are not bundled in this package.
|
|
|
156
158
|
## Requirements
|
|
157
159
|
|
|
158
160
|
- Node ≥ 18 (ships with `npx`)
|
|
159
|
-
-
|
|
161
|
+
- Windows users can run the command from PowerShell with Node.js/npm installed;
|
|
162
|
+
Git Bash/WSL is optional for basic setup
|
|
163
|
+
- macOS/Linux users need Bash on PATH
|
|
160
164
|
- `jq` is reused when available; otherwise, on macOS (arm64/x86_64), Linux (arm64/x86_64), and Windows Git Bash (x86_64), the installer downloads checksum-verified jq 1.8.1 to `~/.weave/bin`. Other architectures need jq installed manually. No Homebrew or administrator access is needed. Downloads require access to GitHub.
|
|
161
165
|
|
|
162
166
|
## Why npx
|
|
163
167
|
|
|
164
|
-
`npx @weave-os/router`
|
|
165
|
-
pinning
|
|
168
|
+
`npx @weave-os/router` provides one-command setup and painless version
|
|
169
|
+
pinning.
|
|
166
170
|
|
|
167
171
|
## Older npm
|
|
168
172
|
|
package/bin.js
CHANGED
|
@@ -38,6 +38,37 @@ if (!existsSync(script)) {
|
|
|
38
38
|
process.exit(1);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
if (process.platform === "win32") {
|
|
42
|
+
const bash = pickBash();
|
|
43
|
+
if (bash) {
|
|
44
|
+
const bashResult = spawnSync(bash, [script, ...args], {
|
|
45
|
+
stdio: "inherit",
|
|
46
|
+
env: { ...process.env, WEAVE_ROUTER_NPM_PACKAGE: packageName },
|
|
47
|
+
});
|
|
48
|
+
if (bashResult.error) {
|
|
49
|
+
console.error("Weave Router:", bashResult.error.message);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
process.exit(bashResult.status ?? 1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const windowsInstaller = path.join(__dirname, "windows.js");
|
|
56
|
+
if (!existsSync(windowsInstaller)) {
|
|
57
|
+
console.error("Weave Router: native Windows installer missing from package.");
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
console.log("Git Bash was not found; using the native Windows installer.");
|
|
61
|
+
const installerResult = spawnSync(process.execPath, [windowsInstaller, ...(isUninstall ? ["--uninstall"] : []), ...args], {
|
|
62
|
+
stdio: "inherit",
|
|
63
|
+
env: { ...process.env, WEAVE_ROUTER_NPM_PACKAGE: packageName },
|
|
64
|
+
});
|
|
65
|
+
if (installerResult.error) {
|
|
66
|
+
console.error("Weave Router:", installerResult.error.message);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
process.exit(installerResult.status ?? 1);
|
|
70
|
+
}
|
|
71
|
+
|
|
41
72
|
const bash = pickBash();
|
|
42
73
|
if (!bash) {
|
|
43
74
|
console.error(
|
|
@@ -46,7 +77,7 @@ if (!bash) {
|
|
|
46
77
|
process.exit(1);
|
|
47
78
|
}
|
|
48
79
|
|
|
49
|
-
const
|
|
80
|
+
const unixBashResult = spawnSync(bash, [script, ...args], {
|
|
50
81
|
stdio: "inherit",
|
|
51
82
|
env: {
|
|
52
83
|
...process.env,
|
|
@@ -54,26 +85,38 @@ const result = spawnSync(bash, [script, ...args], {
|
|
|
54
85
|
},
|
|
55
86
|
});
|
|
56
87
|
|
|
57
|
-
if (
|
|
58
|
-
console.error("Weave Router:",
|
|
88
|
+
if (unixBashResult.error) {
|
|
89
|
+
console.error("Weave Router:", unixBashResult.error.message);
|
|
59
90
|
process.exit(1);
|
|
60
91
|
}
|
|
61
|
-
process.exit(
|
|
92
|
+
process.exit(unixBashResult.status ?? 1);
|
|
62
93
|
|
|
63
94
|
function pickBash() {
|
|
64
95
|
if (process.platform !== "win32") return "bash";
|
|
65
|
-
const
|
|
96
|
+
const bashCandidates = [
|
|
66
97
|
process.env.SHELL,
|
|
67
98
|
"C:\\Program Files\\Git\\bin\\bash.exe",
|
|
68
99
|
"C:\\Program Files (x86)\\Git\\bin\\bash.exe",
|
|
100
|
+
...String(process.env.PATH || "").split(path.delimiter).map((directory) => path.join(directory, "bash.exe")),
|
|
69
101
|
].filter(Boolean);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
102
|
+
return bashCandidates.find((candidate) => existsSync(candidate) && isGitBash(candidate)) || null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function isGitBash(executable) {
|
|
106
|
+
const probe = spawnSync(executable, ["--noprofile", "--norc", "-c", "uname -s"], {
|
|
107
|
+
encoding: "utf8",
|
|
108
|
+
timeout: 3000,
|
|
109
|
+
windowsHide: true,
|
|
110
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
111
|
+
env: { ...process.env, BASH_ENV: "" },
|
|
112
|
+
});
|
|
113
|
+
return probe.status === 0 && /^(?:MINGW|MSYS)/.test(probe.stdout.trim());
|
|
74
114
|
}
|
|
75
115
|
|
|
76
116
|
function openDefaultEntrypoint(url) {
|
|
117
|
+
console.log(`Weave Router: opening ${url} in your browser to get your key and finish setup.`);
|
|
118
|
+
console.log("Already have a key? Run npx @weave-os/router --claude (or --codex, --opencode, --pi).");
|
|
119
|
+
console.log("All options: npx @weave-os/router --help");
|
|
77
120
|
const opener = process.platform === "darwin"
|
|
78
121
|
? ["open", [url]]
|
|
79
122
|
: process.platform === "win32"
|
|
@@ -81,6 +124,6 @@ function openDefaultEntrypoint(url) {
|
|
|
81
124
|
: ["xdg-open", [url]];
|
|
82
125
|
const result = spawnSync(opener[0], opener[1], { stdio: "ignore" });
|
|
83
126
|
if (result.error || result.status !== 0) {
|
|
84
|
-
console.log(`Open ${url}
|
|
127
|
+
console.log(`Couldn't open a browser. Open ${url} to get started.`);
|
|
85
128
|
}
|
|
86
129
|
}
|