@seaveyon/harness-switch 0.1.0 → 0.2.0

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 CHANGED
@@ -2,20 +2,22 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/%40seaveyon%2Fharness-switch.svg)](https://www.npmjs.com/package/@seaveyon/harness-switch)
4
4
 
5
- **harness-switch** is a dependency-free Node.js web control plane for managing API profiles on an SSH or headless server. It switches API Base URL, API key, and model profiles for **Claude Code**, **pi**, **Codex**, **zcode**, and **Kimi Code**.
5
+ **harness-switch** is a Bun-powered web control plane for managing API profiles on an SSH or headless server. It switches API Base URL, API key, and model profiles for **Claude Code**, **pi**, **Codex**, **zcode**, and **Kimi Code**.
6
6
 
7
7
  It is a configuration manager, not an API proxy: it does not route or inspect model traffic.
8
8
 
9
9
  ## Install and run
10
10
 
11
+ Requires [Bun](https://bun.sh) >= 1.2.
12
+
11
13
  ```bash
12
- npx @seaveyon/harness-switch
14
+ bunx @seaveyon/harness-switch
13
15
  ```
14
16
 
15
17
  Or install it globally:
16
18
 
17
19
  ```bash
18
- npm install -g @seaveyon/harness-switch
20
+ bun add -g @seaveyon/harness-switch
19
21
  harness-switch
20
22
  ```
21
23
 
@@ -62,6 +64,25 @@ API keys are encrypted with AES-256-GCM in `~/.harness-switch/profiles.json`; th
62
64
  | `HOST` | `127.0.0.1` | Bind address. Keep the default when using SSH tunnelling. |
63
65
  | `PORT` | `8787` | Listening port. |
64
66
  | `HSW_DATA_DIR` | `~/.harness-switch` | Directory for encrypted profiles, active state, key, password, and env file. |
67
+ | `HSW_HOME_DIR` | `$HOME` | Home directory used when writing native Claude/Kimi configs. |
68
+ | `HSW_PUBLIC_DIR` | auto | Optional override for the built frontend directory. |
69
+
70
+ ## HTTP API
71
+
72
+ The UI is a React SPA. Authentication uses an HttpOnly `hsw_session` cookie.
73
+
74
+ | Method | Path | Notes |
75
+ |---|---|---|
76
+ | `GET` | `/healthz` | Liveness |
77
+ | `POST` | `/api/auth/login` | `{ "password": "..." }` |
78
+ | `POST` | `/api/auth/logout` | Clears the session cookie |
79
+ | `GET` | `/api/auth/session` | `401` when unauthenticated |
80
+ | `GET` | `/api/harnesses` | Collection with nested profiles |
81
+ | `GET` | `/api/harnesses/:id` | One harness |
82
+ | `POST` | `/api/harnesses/:id/profiles` | Create |
83
+ | `PATCH` | `/api/harnesses/:id/profiles/:name` | Update; omit `apiKey` to keep the stored secret |
84
+ | `DELETE` | `/api/harnesses/:id/profiles/:name` | Delete |
85
+ | `POST` | `/api/harnesses/:id/profiles/:name/activate` | Activate and rewrite env/native config |
65
86
 
66
87
  ## systemd
67
88
 
@@ -97,14 +118,63 @@ sudo journalctl -u harness-switch -f
97
118
 
98
119
  ## Development
99
120
 
121
+ This is a Bun workspace:
122
+
123
+ ```text
124
+ apps/web React + Zustand + shadcn/ui, built with Rspack
125
+ apps/server Hono + VS Code-style DI, published as @seaveyon/harness-switch
126
+ packages/shared Shared TypeScript types
127
+ ```
128
+
100
129
  ```bash
101
130
  git clone <your-repository-url>
102
131
  cd harness-switch
103
- npm test
104
- npm start
105
- npm pack --dry-run
132
+ bun install
133
+ bun run test
134
+ bun run check
135
+ bun run dev:server
136
+ bun run dev:web
137
+ ```
138
+
139
+ Linting and formatting are split: **Oxlint** for diagnostics, **Biome** for format and import organization.
140
+
141
+ ```bash
142
+ bun run lint
143
+ bun run lint:fix
144
+ bun run format
145
+ bun run format:check
146
+ bun run check
106
147
  ```
107
148
 
149
+ `bun install` installs a git `pre-commit` hook that runs `bun run check` and `bun run test`. Commits are blocked if either step fails. To run the same gate manually:
150
+
151
+ ```bash
152
+ bun run precommit
153
+ ```
154
+
155
+ Production build (frontend assets are copied into `apps/server/public`, then the CLI is bundled):
156
+
157
+ ```bash
158
+ bun run build
159
+ bun run start
160
+ bun run pack:check
161
+ ```
162
+
163
+ The web dev server listens on `http://127.0.0.1:5173` and proxies `/api` to the backend on `8787`.
164
+
165
+ ## Release
166
+
167
+ Pushes to `main` run [semantic-release](https://semantic-release.gitbook.io/). It reads conventional commits, bumps `@seaveyon/harness-switch`, tags `v*`, and publishes to npm via Trusted Publishing.
168
+
169
+ | Commit | Version bump |
170
+ |---|---|
171
+ | `fix:` | patch (`0.1.0` → `0.1.1`) |
172
+ | `feat:` | minor (`0.1.0` → `0.2.0`) |
173
+ | `feat!:` / `BREAKING CHANGE:` | major (`0.2.0` → `1.0.0`) |
174
+ | `chore:` / `ci:` / `docs:` | no release |
175
+
176
+ You can also run **Publish npm** manually from the Actions tab (`workflow_dispatch`). Commits that do not need a release will no-op.
177
+
108
178
  ## License
109
179
 
110
180
  [MIT](./LICENSE)