@cardstack/boxel-cli 0.0.1 → 0.1.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 +124 -0
- package/api.ts +3 -0
- package/bin/boxel.js +15 -0
- package/dist/index.js +107 -66
- package/package.json +31 -24
- package/src/commands/file/delete.ts +110 -0
- package/src/commands/file/index.ts +20 -0
- package/src/commands/file/lint.ts +235 -0
- package/src/commands/file/list.ts +121 -0
- package/src/commands/file/read.ts +113 -0
- package/src/commands/file/touch.ts +222 -0
- package/src/commands/file/write.ts +152 -0
- package/src/commands/profile.ts +199 -106
- package/src/commands/read-transpiled.ts +120 -0
- package/src/commands/realm/cancel-indexing.ts +113 -0
- package/src/commands/realm/create.ts +1 -4
- package/src/commands/realm/history.ts +388 -0
- package/src/commands/realm/index.ts +12 -0
- package/src/commands/realm/list.ts +156 -0
- package/src/commands/realm/pull.ts +51 -17
- package/src/commands/realm/push.ts +52 -16
- package/src/commands/realm/remove.ts +281 -0
- package/src/commands/realm/sync.ts +153 -60
- package/src/commands/realm/wait-for-ready.ts +120 -0
- package/src/commands/realm/watch.ts +626 -0
- package/src/commands/run-command.ts +4 -3
- package/src/commands/search.ts +160 -0
- package/src/index.ts +60 -2
- package/src/lib/auth-resolver.ts +58 -0
- package/src/lib/auth.ts +56 -12
- package/src/lib/boxel-cli-client.ts +135 -279
- package/src/lib/cli-log.ts +132 -0
- package/src/lib/colors.ts +14 -9
- package/src/lib/find-checkpoint.ts +65 -0
- package/src/lib/profile-manager.ts +49 -4
- package/src/lib/prompt.ts +133 -0
- package/src/lib/realm-authenticator.ts +12 -0
- package/src/lib/realm-sync-base.ts +47 -10
- package/src/lib/seed-auth.ts +214 -0
- package/src/lib/watch-lock.ts +81 -0
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -33,6 +33,29 @@ boxel --help
|
|
|
33
33
|
boxel --version
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
### Environment variables
|
|
37
|
+
|
|
38
|
+
These are read by `boxel profile add`:
|
|
39
|
+
|
|
40
|
+
- `BOXEL_PASSWORD` — password for non-interactive profile creation. Preferred over `-p/--password`, which exposes the password in shell history and process listings.
|
|
41
|
+
- `BOXEL_ENVIRONMENT` — env-mode slug (typically a branch name) for per-branch local dev. Interpreted like `scripts/env-slug.sh`: the value is slugified (lowercased, `/` → `-`, other chars stripped) and URLs are derived as `http://matrix.<slug>.localhost` and `http://realm-server.<slug>.localhost/`. Overridden by `--matrix-url` / `--realm-server-url` if those flags are provided. Values that slugify to empty (e.g. `!!!`) exit with an error.
|
|
42
|
+
|
|
43
|
+
Example — create a profile for a branch running in env mode:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
BOXEL_PASSWORD=… BOXEL_ENVIRONMENT=cs-10998-my-branch \
|
|
47
|
+
boxel profile add -u @alice:cs-10998-my-branch.localhost
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Example — create a profile against a custom realm server:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
BOXEL_PASSWORD=… boxel profile add \
|
|
54
|
+
-u @alice:my.server \
|
|
55
|
+
--matrix-url https://matrix.my.server \
|
|
56
|
+
--realm-server-url https://realms.my.server/
|
|
57
|
+
```
|
|
58
|
+
|
|
36
59
|
## Development
|
|
37
60
|
|
|
38
61
|
### Building
|
|
@@ -49,6 +72,43 @@ pnpm build
|
|
|
49
72
|
pnpm start
|
|
50
73
|
```
|
|
51
74
|
|
|
75
|
+
### Local Development
|
|
76
|
+
|
|
77
|
+
Run directly from TypeScript source without building:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
cd packages/boxel-cli
|
|
81
|
+
pnpm start -- <command> [args]
|
|
82
|
+
|
|
83
|
+
# Examples:
|
|
84
|
+
pnpm start -- --help
|
|
85
|
+
pnpm start -- sync .
|
|
86
|
+
pnpm start -- profile list
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
No build step needed — changes to source are reflected immediately.
|
|
90
|
+
|
|
91
|
+
### Local Development with `npm link`
|
|
92
|
+
|
|
93
|
+
To use the `boxel` command globally during development:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# From packages/boxel-cli
|
|
97
|
+
npm link
|
|
98
|
+
|
|
99
|
+
# Now you can use `boxel` anywhere — no build required
|
|
100
|
+
boxel --help
|
|
101
|
+
boxel sync .
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The linked command automatically uses `dist/index.js` if built, or falls back to running TypeScript source via `ts-node`.
|
|
105
|
+
|
|
106
|
+
To unlink:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
npm unlink -g @cardstack/boxel-cli
|
|
110
|
+
```
|
|
111
|
+
|
|
52
112
|
### Code Quality
|
|
53
113
|
|
|
54
114
|
```bash
|
|
@@ -68,8 +128,72 @@ pnpm test
|
|
|
68
128
|
|
|
69
129
|
# Run tests in watch mode
|
|
70
130
|
pnpm test:watch
|
|
131
|
+
|
|
132
|
+
# Run integration tests
|
|
133
|
+
pnpm test:integration
|
|
71
134
|
```
|
|
72
135
|
|
|
136
|
+
#### Integration test prerequisites
|
|
137
|
+
|
|
138
|
+
`pnpm test:integration` requires:
|
|
139
|
+
|
|
140
|
+
1. **Docker** — for the test Postgres container (started automatically by
|
|
141
|
+
the test runner script).
|
|
142
|
+
2. **Dev stack running** — host app on `:4200`, base realm on
|
|
143
|
+
`:4201/base/`, prerender service on `:4221`, prerender manager on
|
|
144
|
+
`:4222`, worker-base, and dev Postgres on `:5435`. Some integration
|
|
145
|
+
tests (currently `search.test.ts`) pass `useRealPrerenderer: true`
|
|
146
|
+
to `startTestRealmServer()` so card indexing exercises the real
|
|
147
|
+
Chrome prerenderer. Without the dev stack up, those tests fail
|
|
148
|
+
their `beforeAll` with a clear "host unreachable" message; the rest
|
|
149
|
+
of the suite still passes with a noop prerenderer.
|
|
150
|
+
|
|
151
|
+
The simplest way to start everything for local dev is from the
|
|
152
|
+
repo root:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
mise run dev-all
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
This starts the host app first, waits for it to be ready, then
|
|
159
|
+
starts the realm server and supporting services (see the repo
|
|
160
|
+
root README's "ember-cli Hosted App" section for details). Leave
|
|
161
|
+
it running in another terminal, then run `pnpm test:integration`
|
|
162
|
+
from `packages/boxel-cli/`.
|
|
163
|
+
|
|
164
|
+
For a lighter setup (skips experiments / catalog / homepage /
|
|
165
|
+
submission realms), use the two-step recipe instead:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# in one terminal
|
|
169
|
+
pnpm start # from packages/host/
|
|
170
|
+
|
|
171
|
+
# in another, after host is up
|
|
172
|
+
mise run dev-minimal # from repo root
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
To match CI exactly (production-style host serve, no live reload),
|
|
176
|
+
build the host first and then run the matrix test-services task:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# one-time, from repo root
|
|
180
|
+
pnpm --filter @cardstack/host build
|
|
181
|
+
|
|
182
|
+
# then, from packages/realm-server/
|
|
183
|
+
mise run test-services:matrix
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
`mise run test-services:matrix` brings up host-dist, base realm,
|
|
187
|
+
prerender service, prerender manager, icons, worker-base, and dev
|
|
188
|
+
Postgres — the minimum needed for real card indexing. It expects
|
|
189
|
+
the host dist to already exist on disk; that's what the build step
|
|
190
|
+
above (or the CI's `test-web-assets` artifact) provides.
|
|
191
|
+
|
|
192
|
+
In CI, the `boxel-cli-test` job downloads the pre-built `test-web-assets`
|
|
193
|
+
artifact (host + icons dist) and then runs `mise run test-services:matrix`
|
|
194
|
+
in the background before the integration suite (see
|
|
195
|
+
`.github/workflows/ci.yaml`).
|
|
196
|
+
|
|
73
197
|
### Publishing
|
|
74
198
|
|
|
75
199
|
```bash
|
package/api.ts
CHANGED
|
@@ -5,6 +5,7 @@ export {
|
|
|
5
5
|
type PullOptions,
|
|
6
6
|
type PullResult,
|
|
7
7
|
type ReadResult,
|
|
8
|
+
type ReadTranspiledResult,
|
|
8
9
|
type WriteResult,
|
|
9
10
|
type DeleteResult,
|
|
10
11
|
type SearchResult,
|
|
@@ -22,3 +23,5 @@ export {
|
|
|
22
23
|
resetProfileManager,
|
|
23
24
|
setProfileManager,
|
|
24
25
|
} from './src/lib/profile-manager';
|
|
26
|
+
|
|
27
|
+
export { setQuiet, isQuiet } from './src/lib/cli-log';
|
package/bin/boxel.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
// Use the built dist version if available, otherwise fall back to ts-node
|
|
7
|
+
const distEntry = path.resolve(__dirname, '..', 'dist', 'index.js');
|
|
8
|
+
|
|
9
|
+
if (fs.existsSync(distEntry)) {
|
|
10
|
+
require(distEntry);
|
|
11
|
+
} else {
|
|
12
|
+
// Development fallback: run from TypeScript source via ts-node
|
|
13
|
+
require('ts-node').register({ transpileOnly: true });
|
|
14
|
+
require('../src/index.ts');
|
|
15
|
+
}
|