@seaveyon/harness-switch 0.12.0 → 0.14.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 +21 -2
- package/dist/harness-switch.js +603 -50
- package/package.json +2 -2
- package/public/assets/main.192dace2.css +2 -0
- package/public/assets/main.538cf486.js +1 -0
- package/public/index.html +1 -1
- package/public/assets/main.11878989.css +0 -2
- package/public/assets/main.814a1870.js +0 -1
package/README.md
CHANGED
|
@@ -118,6 +118,14 @@ The **诊断 (Doctor)** panel runs read-only checks per harness: whether the too
|
|
|
118
118
|
|
|
119
119
|
The connectivity probe is **disabled by default in the MVP**: passing `--probe` only records a `unknown`-status check that reports the active base URL and explains that no network request is made.
|
|
120
120
|
|
|
121
|
+
### Local Unix users
|
|
122
|
+
|
|
123
|
+
The dashboard header can switch between local login users such as `root` and `alice`. Each user has independent profiles, Provider Vault, encryption key, active state and backups under their own home. Selecting a user does not write any harness file; only an explicit activation does.
|
|
124
|
+
|
|
125
|
+
“Sync user config” performs a one-time copy of another user's profiles and referenced Provider Vault credentials into the selected user. Secrets are decrypted only on the server and re-encrypted with the destination user's local key. Active state, backups and native config files are not copied. Same-name profiles are skipped by default and can be explicitly overwritten.
|
|
126
|
+
|
|
127
|
+
Cross-user writes require access to the destination home. Managing both `root` and regular users therefore normally requires running harness-switch as root; newly created files and directories are assigned to the destination UID/GID. The Web password then grants control over every exposed user's configs, so keep the loopback bind and SSH tunnel. Use `HSW_USERS=root,alice` to restrict the manageable accounts.
|
|
128
|
+
|
|
121
129
|
### CLI automation
|
|
122
130
|
|
|
123
131
|
The same business logic is available from the terminal without opening the browser or starting any listener: the CLI builds the same service graph in-process and reads/writes the same data directory, so it works even when the daemon is not running. Every command supports `--json` for scripting:
|
|
@@ -129,6 +137,11 @@ harness-switch doctor # read-only diagnostics
|
|
|
129
137
|
harness-switch doctor --probe --harness claude
|
|
130
138
|
harness-switch plan claude # drift inspection for a harness
|
|
131
139
|
harness-switch activate claude main --yes # activate a profile
|
|
140
|
+
harness-switch users # manageable local Unix users
|
|
141
|
+
harness-switch list --user alice # inspect alice's independent store
|
|
142
|
+
harness-switch activate codex main --user alice --yes
|
|
143
|
+
harness-switch sync --from root --to alice # one-time copy; skips conflicts
|
|
144
|
+
harness-switch sync --from root --to alice --overwrite
|
|
132
145
|
```
|
|
133
146
|
|
|
134
147
|
`plan <harness>` prints the drift inspection of the active profile (expected vs. current content per file); without an active profile it reports `status: unknown`. `activate` prompts for confirmation on a TTY and requires `--yes` in non-interactive terminals (CI). JSON output mirrors the HTTP API response shapes (`HarnessesResponse`, `ProvidersResponse`, `DoctorResponse`, `DriftSummary`, `ActivateResponse`), so scripts can reuse the same field names. `HSW_DATA_DIR` and `HSW_HOME_DIR` override where it reads state (defaults: `~/.harness-switch` and `$HOME`).
|
|
@@ -151,8 +164,10 @@ This protects against accidental plaintext disclosure in profile storage, but do
|
|
|
151
164
|
|---|---:|---|
|
|
152
165
|
| `HOST` | `127.0.0.1` | Bind address. Keep the default when using SSH tunnelling. |
|
|
153
166
|
| `PORT` | `8787` | Listening port. |
|
|
154
|
-
| `HSW_DATA_DIR` | `~/.harness-switch` |
|
|
155
|
-
| `HSW_HOME_DIR` | `$HOME` |
|
|
167
|
+
| `HSW_DATA_DIR` | `~/.harness-switch` | Control-plane and service-owner data directory; other users use `.harness-switch` in their own home. |
|
|
168
|
+
| `HSW_HOME_DIR` | `$HOME` | Service owner's home override, mainly for tests and containers. |
|
|
169
|
+
| `HSW_USERS` | auto-discovered | Comma-separated allowlist such as `root,alice`. The service owner is always manageable. |
|
|
170
|
+
| `HSW_UPDATE_CHECK` | `1` | Set to `0` to skip npm registry update checks. The local development command sets this automatically. |
|
|
156
171
|
| `HSW_SESSION_TTL_HOURS` | `24` | How long a Web login stays valid. Sessions survive a service restart. |
|
|
157
172
|
| `HSW_BACKUP_RETAIN` | `10` | Number of snapshots to keep. |
|
|
158
173
|
| `HSW_PUBLIC_DIR` | auto | Optional override for the built frontend directory. |
|
|
@@ -169,6 +184,10 @@ The UI is a React SPA. Authentication uses an HttpOnly `hsw_session` cookie.
|
|
|
169
184
|
| `POST` | `/api/auth/login` | `{ "password": "..." }` |
|
|
170
185
|
| `POST` | `/api/auth/logout` | Clears the session cookie |
|
|
171
186
|
| `GET` | `/api/auth/session` | `401` when unauthenticated |
|
|
187
|
+
| `GET` | `/api/users` | Manageable local users and the user selected by this session |
|
|
188
|
+
| `POST` | `/api/users/:username/select` | Select the target user for this Web session without writing harness files |
|
|
189
|
+
| `POST` | `/api/users/sync/preview` | Preview counts and conflicts for a cross-user config copy |
|
|
190
|
+
| `POST` | `/api/users/sync` | Copy profiles and referenced credentials using `skip` or `overwrite` conflicts |
|
|
172
191
|
| `GET` | `/api/harnesses` | Collection with nested profiles, form field specs, and live file paths |
|
|
173
192
|
| `GET` | `/api/harnesses/:id` | One harness |
|
|
174
193
|
| `POST` | `/api/harnesses/:id/profiles` | Create |
|