codeharbor 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.
- package/README.md +186 -2
- package/dist/cli.js +2729 -48
- package/package.json +17 -5
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ Matrix Room -> MatrixChannel -> Orchestrator -> CodexExecutor (codex exec/resume
|
|
|
37
37
|
|
|
38
38
|
## Prerequisites
|
|
39
39
|
|
|
40
|
-
- Node.js
|
|
40
|
+
- Node.js 22+
|
|
41
41
|
- `codex` CLI installed and authenticated (`codex login`)
|
|
42
42
|
- A Matrix bot user + access token
|
|
43
43
|
|
|
@@ -62,6 +62,64 @@ npm pack
|
|
|
62
62
|
npm install -g ./codeharbor-<version>.tgz
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
+
## GitHub CI/CD Publish
|
|
66
|
+
|
|
67
|
+
CodeHarbor supports auto publish to npm from GitHub Actions.
|
|
68
|
+
|
|
69
|
+
Setup once:
|
|
70
|
+
|
|
71
|
+
1. Add repository secret `NPM_TOKEN` (npm token with publish permission).
|
|
72
|
+
2. Push to `main` with a publish trigger commit message.
|
|
73
|
+
|
|
74
|
+
Trigger rules:
|
|
75
|
+
|
|
76
|
+
- `push` to `main` + commit message includes `[publish-npm]` -> run publish workflow
|
|
77
|
+
- `push` to `main` + commit message includes both `release` and a semver version -> run publish workflow
|
|
78
|
+
- examples: `release v0.1.1`, `chore: release 0.1.2`
|
|
79
|
+
- `workflow_dispatch` -> manual publish from GitHub Actions UI
|
|
80
|
+
|
|
81
|
+
The workflow runs `typecheck`, `test`, `test:e2e` (Admin UI Playwright), `build`, `node dist/cli.js --help`, `npm pack --dry-run`, then publishes with:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm publish --access public
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
If the same package version already exists on npm, publish is skipped automatically.
|
|
88
|
+
|
|
89
|
+
Release checklist (recommended):
|
|
90
|
+
|
|
91
|
+
1. Update version in `package.json` (`npm version patch|minor|major`).
|
|
92
|
+
2. Push to `main` with `[publish-npm]` or `release vX.Y.Z` in commit message.
|
|
93
|
+
3. Verify workflow status in GitHub Actions.
|
|
94
|
+
4. Verify package on npm:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npm view codeharbor version
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Run e2e locally:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm run test:e2e
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
If your machine has no system Chrome, run:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
PLAYWRIGHT_USE_SYSTEM_CHROME=false npm run e2e:install
|
|
110
|
+
PLAYWRIGHT_USE_SYSTEM_CHROME=false npm run test:e2e
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Planning Docs
|
|
114
|
+
|
|
115
|
+
- `REQUIREMENTS.md`: current baseline + next-stage requirements
|
|
116
|
+
- `TASK_LIST.md`: implementation task breakdown and status
|
|
117
|
+
- `docs/CONFIG_UI_DESIGN.md`: configuration UI MVP design
|
|
118
|
+
- `docs/CONFIG_CATALOG.md`: consolidated configuration matrix (required/runtime/UI/effective timing)
|
|
119
|
+
- `docs/ADMIN_STANDALONE_DEPLOY.md`: standalone admin deployment and Cloudflare Tunnel exposure guide
|
|
120
|
+
- `docs/BACKUP_AUTOMATION.md`: scheduled config backup and restore operations
|
|
121
|
+
- `docs/RELEASE.md`: release process and CI/publish policy
|
|
122
|
+
|
|
65
123
|
## Quick Start
|
|
66
124
|
|
|
67
125
|
For local development from source:
|
|
@@ -75,7 +133,7 @@ npm install
|
|
|
75
133
|
2. Configure environment:
|
|
76
134
|
|
|
77
135
|
```bash
|
|
78
|
-
|
|
136
|
+
codeharbor init
|
|
79
137
|
```
|
|
80
138
|
|
|
81
139
|
Required values:
|
|
@@ -97,10 +155,136 @@ npm run build
|
|
|
97
155
|
node dist/cli.js start
|
|
98
156
|
```
|
|
99
157
|
|
|
158
|
+
## Configuration Baseline
|
|
159
|
+
|
|
160
|
+
Use this layered reference to avoid mixing boot-only and runtime tuning items:
|
|
161
|
+
|
|
162
|
+
- [`docs/CONFIG_CATALOG.md`](docs/CONFIG_CATALOG.md)
|
|
163
|
+
|
|
164
|
+
It documents:
|
|
165
|
+
|
|
166
|
+
- which keys are required vs optional
|
|
167
|
+
- which keys can be edited in Admin UI
|
|
168
|
+
- whether changes are immediate or restart-scoped
|
|
169
|
+
- recommended profiles for local/internal/public deployment
|
|
170
|
+
|
|
100
171
|
## Commands
|
|
101
172
|
|
|
173
|
+
- `codeharbor init`: guided setup for `.env` (supports `--force` to overwrite directly)
|
|
102
174
|
- `codeharbor start`: start service
|
|
103
175
|
- `codeharbor doctor`: check `codex` and Matrix connectivity
|
|
176
|
+
- `codeharbor admin serve`: start admin UI + config API server
|
|
177
|
+
- `codeharbor config export`: export current config snapshot as JSON
|
|
178
|
+
- `codeharbor config import <file>`: import config snapshot JSON (supports `--dry-run`)
|
|
179
|
+
- `scripts/backup-config.sh`: export timestamped snapshot and keep latest N backups
|
|
180
|
+
- `scripts/install-backup-timer.sh`: install/update user-level systemd timer for automatic backups
|
|
181
|
+
- `npm run test:e2e`: run Admin UI end-to-end tests (Playwright)
|
|
182
|
+
|
|
183
|
+
### Config Backup Script
|
|
184
|
+
|
|
185
|
+
Create a timestamped snapshot in `backups/config` and keep latest 20 by default:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
./scripts/backup-config.sh
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Custom directory and retention:
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
./scripts/backup-config.sh --dir /var/backups/codeharbor --keep 30
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Install/update automatic backup timer:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
./scripts/install-backup-timer.sh --schedule "*-*-* 03:30:00" --dir /var/backups/codeharbor --keep 30
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Full guide:
|
|
204
|
+
|
|
205
|
+
- [`docs/BACKUP_AUTOMATION.md`](docs/BACKUP_AUTOMATION.md)
|
|
206
|
+
|
|
207
|
+
## Admin UI And API
|
|
208
|
+
|
|
209
|
+
Start server:
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
codeharbor admin serve
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Optional overrides:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
codeharbor admin serve --host 127.0.0.1 --port 8787
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
If you bind Admin to a non-loopback host and `ADMIN_TOKEN` is empty, startup is rejected by default.
|
|
222
|
+
Explicit bypass exists but is not recommended:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
codeharbor admin serve --host 0.0.0.0 --allow-insecure-no-token
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Open these UI routes in browser:
|
|
229
|
+
|
|
230
|
+
- `/` or `/settings/global`
|
|
231
|
+
- `/settings/rooms`
|
|
232
|
+
- `/health`
|
|
233
|
+
- `/audit`
|
|
234
|
+
|
|
235
|
+
Main endpoints:
|
|
236
|
+
|
|
237
|
+
- `GET /api/admin/config/global`
|
|
238
|
+
- `PUT /api/admin/config/global`
|
|
239
|
+
- `GET /api/admin/config/rooms`
|
|
240
|
+
- `GET /api/admin/config/rooms/:roomId`
|
|
241
|
+
- `PUT /api/admin/config/rooms/:roomId`
|
|
242
|
+
- `DELETE /api/admin/config/rooms/:roomId`
|
|
243
|
+
- `GET /api/admin/health`
|
|
244
|
+
- `GET /api/admin/audit?limit=50`
|
|
245
|
+
|
|
246
|
+
When `ADMIN_TOKEN` is set, requests must include:
|
|
247
|
+
|
|
248
|
+
```http
|
|
249
|
+
Authorization: Bearer <ADMIN_TOKEN>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Access control options:
|
|
253
|
+
|
|
254
|
+
- `ADMIN_TOKEN`: require bearer token for `/api/admin/*`
|
|
255
|
+
- `ADMIN_IP_ALLOWLIST`: optional comma-separated client IP whitelist (for example `127.0.0.1,192.168.1.10`)
|
|
256
|
+
- `ADMIN_ALLOWED_ORIGINS`: optional CORS origin allowlist for browser-based cross-origin admin access
|
|
257
|
+
|
|
258
|
+
Note: `PUT /api/admin/config/global` writes to `.env` and marks changes as restart-required.
|
|
259
|
+
|
|
260
|
+
### Admin UI Quick Walkthrough
|
|
261
|
+
|
|
262
|
+
1. Start server: `codeharbor admin serve`.
|
|
263
|
+
2. Open `/settings/global`, set `Admin Token` (if enabled), then click `Save Auth`.
|
|
264
|
+
3. Adjust global fields and click `Save Global Config` (UI shows restart-required warning).
|
|
265
|
+
4. Open `/settings/rooms`, fill `Room ID + Workdir`, then `Save Room`.
|
|
266
|
+
5. Open `/health` to run connectivity checks (`codex` + Matrix).
|
|
267
|
+
6. Open `/audit` to verify config revisions (actor/summary/payload).
|
|
268
|
+
|
|
269
|
+
## Standalone Admin Deployment
|
|
270
|
+
|
|
271
|
+
`codeharbor admin serve` can run as an independent service on target servers without browser/desktop.
|
|
272
|
+
Access can come from your local browser through a gateway (for example Cloudflare Tunnel).
|
|
273
|
+
|
|
274
|
+
See:
|
|
275
|
+
|
|
276
|
+
- [`docs/ADMIN_STANDALONE_DEPLOY.md`](docs/ADMIN_STANDALONE_DEPLOY.md)
|
|
277
|
+
|
|
278
|
+
## Startup Preflight
|
|
279
|
+
|
|
280
|
+
Before `codeharbor start` and `codeharbor doctor`, CodeHarbor runs a preflight check for:
|
|
281
|
+
|
|
282
|
+
- required Matrix env vars
|
|
283
|
+
- `CODEX_BIN` availability
|
|
284
|
+
- `CODEX_WORKDIR` validity
|
|
285
|
+
- `.env` presence warning
|
|
286
|
+
|
|
287
|
+
If any check fails, it prints actionable fix commands (for example `codeharbor init`).
|
|
104
288
|
|
|
105
289
|
## Message Rules
|
|
106
290
|
|