@miakapp/cli 4.0.0-alpha.5 → 4.0.0-alpha.6

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.
Files changed (45) hide show
  1. package/README.md +99 -32
  2. package/assets/agent-guide.md +193 -22
  3. package/bin/miakapp.js +5 -1
  4. package/dist/agent-pack.d.ts.map +1 -1
  5. package/dist/agent-pack.js +12 -5
  6. package/dist/agent-pack.js.map +1 -1
  7. package/dist/contexts.d.ts +59 -0
  8. package/dist/contexts.d.ts.map +1 -0
  9. package/dist/contexts.js +388 -0
  10. package/dist/contexts.js.map +1 -0
  11. package/dist/control-plane.d.ts +14 -0
  12. package/dist/control-plane.d.ts.map +1 -1
  13. package/dist/control-plane.js +33 -1
  14. package/dist/control-plane.js.map +1 -1
  15. package/dist/internal/names.d.ts +5 -0
  16. package/dist/internal/names.d.ts.map +1 -1
  17. package/dist/internal/names.js +6 -0
  18. package/dist/internal/names.js.map +1 -1
  19. package/dist/main.d.ts +16 -3
  20. package/dist/main.d.ts.map +1 -1
  21. package/dist/main.js +555 -49
  22. package/dist/main.js.map +1 -1
  23. package/dist/mcp.d.ts +7 -1
  24. package/dist/mcp.d.ts.map +1 -1
  25. package/dist/mcp.js +167 -26
  26. package/dist/mcp.js.map +1 -1
  27. package/dist/pairing.d.ts +27 -0
  28. package/dist/pairing.d.ts.map +1 -0
  29. package/dist/pairing.js +148 -0
  30. package/dist/pairing.js.map +1 -0
  31. package/dist/project.d.ts +3 -1
  32. package/dist/project.d.ts.map +1 -1
  33. package/dist/project.js +33 -6
  34. package/dist/project.js.map +1 -1
  35. package/dist/publication.d.ts +20 -5
  36. package/dist/publication.d.ts.map +1 -1
  37. package/dist/publication.js +58 -16
  38. package/dist/publication.js.map +1 -1
  39. package/dist/terminal.d.ts +10 -0
  40. package/dist/terminal.d.ts.map +1 -0
  41. package/dist/terminal.js +70 -0
  42. package/dist/terminal.js.map +1 -0
  43. package/dist/version.d.ts +1 -1
  44. package/dist/version.js +1 -1
  45. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @miakapp/cli
2
2
 
3
- Build, validate, publish and roll back one Miakapp home component.
3
+ Pair, build, validate, publish and roll back independent Miakapp house applications.
4
4
 
5
5
  The CLI is the deployment mechanism, not the source of truth. **Git belongs to
6
6
  you**: this tool never commits, never rewrites sources it did not generate and
@@ -12,11 +12,19 @@ stable exit code and one stable failure kind, and `--json` prints exactly one
12
12
  object on stdout.
13
13
 
14
14
  ```bash
15
- bunx @miakapp/cli init --home my-home --control-plane https://control.miakapp.app
15
+ printf '%s\n' "$CODE" | bunx @miakapp/cli pair --issuer "$MIAKAPP_ISSUER"
16
+ bunx @miakapp/cli init # home and issuer from the paired context
16
17
  bunx @miakapp/cli check
17
- bunx @miakapp/cli publish --expected-generation 0
18
+ bunx @miakapp/cli publish
19
+ bunx @miakapp/cli status # verify what is live
18
20
  ```
19
21
 
22
+ Use the exact issuer command shown by your deployment's `/pair` page; do not
23
+ guess a staging issuer. `init` writes the project manifest, not an application:
24
+ build your house UI as one classic-script IIFE (the `@miakapp/app` SDK is
25
+ optional), then run `check` and `publish`. Open and verify the returned
26
+ `home_url` as a resident before handing it over.
27
+
20
28
  ## The project file
21
29
 
22
30
  `miakapp.yaml` sits at the root of your repository:
@@ -24,24 +32,25 @@ bunx @miakapp/cli publish --expected-generation 0
24
32
  ```yaml
25
33
  schema: miakapp.project/1
26
34
  home: my-home
27
- control_plane: https://control.miakapp.app
35
+ control_plane: https://control.example.test
28
36
 
29
- component:
30
- artifact: dist/component.js
31
- release: 2026-09-13.1
37
+ app:
38
+ artifact: dist/app.js
39
+ release: 2026-10-03.1
32
40
  requires:
33
41
  state_read:
34
42
  - climate.living_room.temperature
35
- event_subscribe: []
36
- event_publish: []
37
43
  call:
38
44
  - lighting.set
39
- presentation: []
40
45
 
41
46
  coordinator:
42
47
  entry: coordinator/main.ts
43
48
  ```
44
49
 
50
+ `app` declares only `state_read` and `call`; events, media and reserved
51
+ `miakapp.*` calls are unavailable. Use `miakapp init --kind component` for the
52
+ semantic component ABI instead. Choose exactly one of `app` and `component`.
53
+
45
54
  `requires` is the closed RFC 0002 capability object. Lists are de-duplicated and
46
55
  sorted before they are bound into an upload capability, so the value the CLI
47
56
  sends is byte-identical on every later reconciliation read.
@@ -55,10 +64,13 @@ duplicate keys — is rejected with the offending line rather than guessed at.
55
64
 
56
65
  | Command | What it does |
57
66
  | --- | --- |
67
+ | `pair` | Redeems a one-time pairing code into a new stored context. |
68
+ | `context list\|show\|use\|remove` | Manages stored contexts. Never prints a key. |
58
69
  | `init` | Writes `miakapp.yaml`. Never overwrites an existing one. |
59
70
  | `agent-pack` | Offline. Installs the guide and the MCP wiring into a repository. |
60
71
  | `discover` | Offline. Inventories a Node-RED installation from its flows export. |
61
72
  | `check` | Offline. Parses the project, verifies the artifact, prints the digest. |
73
+ | `status` | Reads the live generation, release and digest of the home. |
62
74
  | `publish` | Capability → delivery → finalization → activation, in one run. |
63
75
  | `activate` | Activates an already finalized digest at a new generation. |
64
76
  | `rollback` | Alias of `activate`, for returning to a known-good digest. |
@@ -111,9 +123,9 @@ place instead of appending another copy. `.mcp.json` is merged as a structure
111
123
  one key, by name — so every other server in it survives, and a file that does
112
124
  not parse is refused rather than replaced with a valid one.
113
125
 
114
- The server is registered as the bare `miakapp` command rather than an absolute
115
- path, because the file is committed and the next machine to check it out will
116
- not have this one's directory layout.
126
+ The generated server entry uses `npx -y @miakapp/cli@<installed-version> mcp`,
127
+ so a new machine gets the same executable as the bundled guide without relying
128
+ on a global binary or this machine's directory layout.
117
129
 
118
130
  Run it again whenever the CLI is upgraded: an unchanged file is reported
119
131
  `unchanged`, and a guide that moved on is reported `updated`.
@@ -129,8 +141,7 @@ tools over newline-delimited JSON-RPC on stdio.
129
141
  "mcpServers": {
130
142
  "miakapp": {
131
143
  "command": "bunx",
132
- "args": ["@miakapp/cli", "mcp"],
133
- "env": { "MIAKAPP_HOME_KEY": "${MIAKAPP_HOME_KEY}" }
144
+ "args": ["@miakapp/cli", "mcp"]
134
145
  }
135
146
  }
136
147
  }
@@ -138,6 +149,12 @@ tools over newline-delimited JSON-RPC on stdio.
138
149
 
139
150
  | Tool | Command | |
140
151
  | --- | --- | --- |
152
+ | `miakapp_pair` | `pair` | stores a new context; the code is a tool argument |
153
+ | `miakapp_context_list` | `context list` | read-only, offline |
154
+ | `miakapp_context_show` | `context show` | read-only, offline |
155
+ | `miakapp_context_use` | `context use` | offline, changes the current context |
156
+ | `miakapp_context_remove` | `context remove` | **deletes a stored key — needs `confirm: true`** |
157
+ | `miakapp_status` | `status` | read-only |
141
158
  | `miakapp_discover` | `discover` | read-only, offline |
142
159
  | `miakapp_check` | `check` | read-only, offline |
143
160
  | `miakapp_release` | `release` | read-only |
@@ -154,7 +171,8 @@ drift apart. A tool argument is the option name with `_` for `-`
154
171
  (`expected_generation` → `--expected-generation`); an argument the tool does not
155
172
  declare is refused rather than ignored.
156
173
 
157
- The three pointer-moving tools additionally require `confirm: true`. It is
174
+ The three pointer-moving tools and `miakapp_context_remove` additionally
175
+ require `confirm: true`. It is
158
176
  checked before anything else and never reaches the command line, so a model that
159
177
  hallucinated a publication spends the mistake on an argument check instead of on
160
178
  a generation.
@@ -165,20 +183,69 @@ remedy — not as a JSON-RPC error. That distinction matters: a protocol error
165
183
  means the call never happened, while a publication that reached the control
166
184
  plane and failed did happen, and only `kind` says whether to reconcile.
167
185
 
168
- ## Authorization
186
+ ## Access: pairing and contexts
187
+
188
+ The owner grants access in their own browser; the agent never signs in. They
189
+ open `https://miakapp.com/pair`, choose the home, confirm, and send the
190
+ one-time code, which `pair` trades for a **new, separately revocable** Home Key:
191
+
192
+ ```bash
193
+ printf '%s\n' "$CODE" | miakapp pair # or run it in a terminal: hidden prompt
194
+ miakapp pair --code "$CODE" # allowed, but lands in shell history
195
+ ```
196
+
197
+ | Option | Default |
198
+ | --- | --- |
199
+ | `--issuer <https url>` | `https://control.miakapp.com` |
200
+ | `--label <label>` | `miakapp-cli@<host name>`, shown in the owner's key list |
201
+ | `--name <context>` | the paired home ID (`-2`, `-3`… if taken) |
202
+
203
+ Before the code is sent, the issuer must serve a discovery document naming
204
+ exactly itself; redirects are refused. The redeem response —
205
+ `POST {issuer}/v1/pairing/redeem` with `{code, label}`, answered with
206
+ `{home_key, home_id, key_id, issuer}` and `Cache-Control: no-store` — must name
207
+ the same issuer and a key whose ID is embedded in the key. The code is sent
208
+ once and never retried: a lost response is exit 7, because a key may exist.
209
+ `pair` then exchanges the key for a publication token, reported as
210
+ `publish_access`, so a key without the publish scope is caught now rather than
211
+ at the first publication.
212
+
213
+ Contexts live in `~/.miakapp` (or `$MIAKAPP_CONFIG_DIR`, absolute):
214
+
215
+ | File | Holds | Mode |
216
+ | --- | --- | --- |
217
+ | `config.json` | context names, home IDs, issuers, key IDs, labels, current context | 0600 |
218
+ | `credentials.json` | the Home Keys, nothing else | 0600 |
169
219
 
170
- The Home Key is read from `MIAKAPP_HOME_KEY` and from nowhere else. No command
171
- accepts it as an argument, because an argument lands in shell history, in a
172
- process listing and in most CI logs.
220
+ The directory is 0700. Both files are replaced through a temporary file, an
221
+ fsync and a rename, under a lock file, so concurrent runs never lose a context
222
+ and a crash never leaves half a file. A credentials file readable by another
223
+ account, a symbolic link, a foreign owner or a key that is not the one the
224
+ context was paired with is refused rather than used.
173
225
 
174
226
  ```bash
175
- export MIAKAPP_HOME_KEY="$(op read op://home/miakapp/home-key)" # or your own vault
176
- bunx @miakapp/cli publish --expected-generation 4
227
+ miakapp context list
228
+ miakapp context show [name] # credential: stored (never printed)
229
+ miakapp context use <name>
230
+ miakapp context remove <name> # local only: the owner revokes the key server-side
177
231
  ```
178
232
 
179
- The key is exchanged for a five-minute `components:publish` token before every
180
- run. Publication endpoints never accept the Home Key itself, and the CLI never
181
- prints either credential.
233
+ Which Home Key a command uses, highest precedence first:
234
+
235
+ 1. `--context <name>`, then `MIAKAPP_CONTEXT=<name>`;
236
+ 2. `MIAKAPP_HOME_KEY` — a raw key, kept for CI and compatibility;
237
+ 3. the stored context whose home and issuer match `miakapp.yaml`, the current
238
+ context breaking a tie between keys for that same home.
239
+
240
+ A selected context for another home — or a `MIAKAPP_HOME_KEY` this machine
241
+ knows was paired with another home — is refused before any request, so a key
242
+ can never publish into the wrong house. Every networked result reports
243
+ `credential_source` and `context`, never the key.
244
+
245
+ No command accepts a Home Key as an argument: an argument lands in shell
246
+ history, in a process listing and in most CI logs. The key is exchanged for a
247
+ five-minute `components:publish` token before every run, and publication
248
+ endpoints never see the Home Key itself.
182
249
 
183
250
  ## Generations
184
251
 
@@ -187,11 +254,11 @@ believe the pointer holds, and `--generation` (default: expected + 1) is the one
187
254
  you are publishing. A stale expectation fails with `generation_conflict` and
188
255
  exit code 6 rather than last-write-wins.
189
256
 
190
- `--expected-generation` is required rather than discovered, because RFC 0004
191
- §13.2 publishes no read for the current pointer: the pointer lives in
192
- `components/{homeID}` and reaches clients as authenticated platform data. Until
193
- that surface exists, the CLI asks you for the number instead of guessing one —
194
- inventing an endpoint would be worse than an explicit flag.
257
+ Without `--expected-generation`, `publish` and `activate` read the live pointer
258
+ first (`GET /v1/homes/{homeId}/component-pointer`, RFC 0004 §13.2) and use its
259
+ generation. That read takes no lock, so the activation is still a
260
+ compare-and-set: a publication that lands in between makes this one fail with
261
+ exit 6, never overwrites it. `miakapp status` prints the same read.
195
262
 
196
263
  ## Exit codes
197
264
 
@@ -213,14 +280,14 @@ committed, so the next step is a read — `miakapp upload <id>` or
213
280
  ## Failure output
214
281
 
215
282
  ```console
216
- $ miakapp publish --expected-generation 0
283
+ $ miakapp publish
217
284
  miakapp: conflict: Activation failed with HTTP 409 generation_conflict (request Zq1...)
218
285
  Another publication advanced the pointer. Read the active generation and retry
219
286
  the activation with the observed expected_generation.
220
287
  ```
221
288
 
222
289
  ```console
223
- $ miakapp publish --expected-generation 0 --json
290
+ $ miakapp publish --json
224
291
  {"ok":false,"kind":"conflict","exit_code":6,"message":"...","remedy":"..."}
225
292
  ```
226
293
 
@@ -10,6 +10,43 @@ Everything below is true of the code in this repository. Where a rule exists for
10
10
  a reason that is not obvious, the reason is given, because a rule whose purpose
11
11
  you cannot see is one you will optimize away.
12
12
 
13
+ ## 0. What "done" means
14
+
15
+ The owner asked for a home they can use, not for a picture of one. You are done
16
+ when the household can open the published interface, read real values from it
17
+ and use every control the owner authorized — and you checked that yourself.
18
+ Concretely:
19
+
20
+ - **Publish, then verify.** A build that only runs on your machine, a mockup, a
21
+ prototype kept offline or a screenshot is an intermediate result, never the
22
+ deliverable. Do not stop to show one and ask whether to continue: the owner
23
+ asked for the home, and publication is reversible in one command (§8).
24
+ - **Hand over a link that works.** Give the owner the `home_url` that
25
+ `miakapp publish` and `miakapp status` print — the Miakapp address where the
26
+ home opens for its members — and say what you verified there. The
27
+ `artifact_url` (JSON `url`) is the raw bundle, not an interface: never send it
28
+ as "the link". If the control plane advertises no `home_url`, say so instead of
29
+ inventing one, and say what `miakapp status` proved.
30
+ - **Ask once, at the start, and only for what you cannot find.** Access comes
31
+ from pairing (§9), the existing installation from inventory (§3). Repeated
32
+ permission questions in the middle of the work are a failure of the work.
33
+ - **You need nothing from the platform's source.** This guide, the CLI, the
34
+ public packages and `templates/home` are the whole toolchain. Never edit or
35
+ redeploy the Miakapp platform to make one house work; if a capability is
36
+ missing, report it to the owner as missing instead of patching around it.
37
+
38
+ Two scopes must not be confused:
39
+
40
+ | In scope by default | Needs the owner's explicit, separate request |
41
+ | --- | --- |
42
+ | reading the existing installation (§3) | changing flows, automations, brokers or devices that already run the house |
43
+ | writing and testing a coordinator and a component | granting a physical action (heat, lock, unlock, open, close) that the owner has not named |
44
+ | publishing, verifying and rolling back the V4 interface | anything on the owner's own machines beyond the coordinator you were asked to run |
45
+
46
+ Caution about the second column is not a reason to withhold the first. A new V4
47
+ interface that only reads is still a useful, publishable V1; say plainly which
48
+ controls are not offered and why.
49
+
13
50
  ## 1. What you are building
14
51
 
15
52
  Three artifacts, and no more:
@@ -17,10 +54,16 @@ Three artifacts, and no more:
17
54
  | Artifact | Where it runs | What it owns |
18
55
  | --- | --- | --- |
19
56
  | Coordinator | the owner's machine, under Bun | state, events, functions, **authorization** |
20
- | Component | a sandboxed Worker in the household's browser | the interface |
21
- | `miakapp.yaml` | neither; it is the contract | what the component may ask for |
57
+ | Interface | an isolated frame (app) or sandboxed Worker (component) in the household's browser | what residents see and touch |
58
+ | `miakapp.yaml` | neither; it is the contract | what the interface may ask for |
59
+
60
+ The interface is, by default, a **whole-house application** (`app:` in
61
+ `miakapp.yaml`, ABI `miakapp.app/1`): your own layout, styles, navigation and
62
+ libraries, bundled into one file. A semantic **component** (`component:`,
63
+ `miakapp.component/1`) is still supported for a minimal tree Miakapp draws for
64
+ you. §5 covers both.
22
65
 
23
- The coordinator is trusted. The component is not. The relay between them is
66
+ The coordinator is trusted. The interface is not. The relay between them is
24
67
  platform-untrusted but not blind: it terminates TLS, stores plaintext state and
25
68
  enforces routing, so self-hosting it does not give end-to-end confidentiality.
26
69
  Do not tell the owner otherwise.
@@ -94,6 +137,37 @@ Write down what you found before you write the configuration. The state paths yo
94
137
  choose become a disclosure boundary and a public interface at the same time, and
95
138
  renaming one after the household has used it is not free.
96
139
 
140
+ ### The inventory comes before the design
141
+
142
+ Commit the inventory as `docs/inventory.md` in the home repository, one line per
143
+ datum or action, before you design a single screen:
144
+
145
+ | Field | Example |
146
+ | --- | --- |
147
+ | source | `zigbee2mqtt/salon_thermo` over the house broker |
148
+ | what it is | temperature, °C, one decimal |
149
+ | how fresh | reports every ~60 s; last seen 2 min ago |
150
+ | who may read it | every member / owner only |
151
+ | command | none — a measurement, not a control |
152
+
153
+ Then design **from** it: the V1 shows every datum the household would care
154
+ about and every action that is both technically possible and authorized,
155
+ grouped the way people live in the house — by room or by use, not by device
156
+ or protocol. Anything you leave out, leave out on purpose, and say why in the
157
+ inventory. A V1 that shows three values when the house reports twenty is not a
158
+ first version; it is an unfinished one.
159
+
160
+ What the interface must never do:
161
+
162
+ - **invent data.** A value with no source is shown as absent, never filled in
163
+ with a plausible number or a demo fixture;
164
+ - **blur freshness.** Distinguish *current*, *stale* (with its age) and
165
+ *unavailable* for every value, in words a resident understands;
166
+ - **spend space on plumbing.** No protocol or platform vocabulary
167
+ (`ACCEPTED`, "relay connected", ABI, schema names, IDs), no banner restating
168
+ that a view is read-only, no title repeating the home's name on every card.
169
+ Every line of text is either information or an action.
170
+
97
171
  ### Reading a V3 house you inherited
98
172
 
99
173
  Most houses arriving at V4 already run Node-RED with the v3 MiakAPI nodes. Ask
@@ -180,7 +254,43 @@ The relay keeps ownership tables for topics, state paths and functions, detects
180
254
  collisions and rejects with `4409`. If you claim `lighting.set` for the whole
181
255
  house, you have taken a name another integration may need; scope what you own.
182
256
 
183
- ## 5. The component
257
+ ## 5. The interface
258
+
259
+ ### A whole-house application (default)
260
+
261
+ `miakapp init` writes an `app:` section; `templates/home/app/` is a working
262
+ example. You own the document: build any DOM, ship your own CSS, route with
263
+ `location.hash`, use React, Svelte, Vue, charts or WebAssembly — anything a
264
+ bundler can inline. The deliverable is **one classic-script IIFE** of at most
265
+ 2 MiB, with no `import()` and no source map:
266
+
267
+ ```bash
268
+ bun build app/main.ts --format=iife --minify --outfile dist/app.js
269
+ ```
270
+
271
+ Miakapp runs it in an isolated, opaque-origin frame below a permanent Miakapp
272
+ bar, after the resident agreed to open the home. The frame has no network, no
273
+ cookies or storage, no popups and no fullscreen; assets go in the bundle as
274
+ `data:`/`blob:` URLs. Its only way to the home is `@miakapp/app`:
275
+
276
+ ```ts
277
+ import { callErrorCode, connect } from '@miakapp/app';
278
+
279
+ const home = connect();
280
+ home.subscribe((state) => render(state)); // also called once immediately
281
+ await home.call('lighting.set', { on: true }); // rejects with a closed code
282
+ ```
283
+
284
+ Declare every state path (exact or `prefix.*`) under `app.requires.state_read`
285
+ and every function under `app.requires.call`. Events, media and `miakapp.*`
286
+ functions are refused by `miakapp check`. Show `state.stale`, disable controls
287
+ while it is true, and handle `outcome_unknown` exactly as below.
288
+
289
+ **The bundle is not private.** Any signed-in user who learns its digest can
290
+ fetch it. Put no household data in it — no names, rooms, devices or accounts —
291
+ and read everything from state, which the coordinator filters per resident.
292
+
293
+ ### A semantic component (compatible)
184
294
 
185
295
  Import from `@miakapp/component`. The whole public surface is one module, and the
186
296
  whole rendering vocabulary is `ui.*`:
@@ -305,25 +415,35 @@ writes no history, rewrites no source it did not generate, and invents no
305
415
  control-plane endpoint. The repository is the owner's.
306
416
 
307
417
  ```bash
308
- miakapp agent-pack # once, per repository
309
- miakapp init --home <homeId> --control-plane <https url>
418
+ miakapp docs start # this guide, from the installed CLI
419
+ miakapp pair # once per home and machine (§9)
420
+ miakapp agent-pack # once, per repository
421
+ miakapp init # app: by default; --kind component for a semantic tree
310
422
  miakapp check
311
- miakapp publish --expected-generation <n>
312
- miakapp activate --sha256 <digest> --expected-generation <n>
313
- miakapp rollback --sha256 <digest> --expected-generation <n> # alias of activate
423
+ miakapp status # what is live now: generation, release, digest
424
+ miakapp publish # upload, finalize, activate
425
+ miakapp status # verify the new digest is what is live
426
+ miakapp activate --sha256 <digest> # promote an already finalized digest
427
+ miakapp rollback --sha256 <digest> # alias of activate
314
428
  miakapp release <sha256> # read one finalized release
315
429
  miakapp upload <uploadId> # reconcile a lost request
316
430
  ```
317
431
 
318
- `--expected-generation` is a compare-and-swap on the home's component pointer: the
319
- generation you believe it currently holds. It is `0` for a home that has never
320
- published. It is required, and it is what stops two agents from silently
321
- overwriting each other.
432
+ Activation is a compare-and-set on the home's component pointer. Without
433
+ `--expected-generation` the CLI reads the live generation first and activates
434
+ the next one; the read takes no lock, so another publication landing in between
435
+ still fails with `conflict` instead of being overwritten. Pass
436
+ `--expected-generation <n>` when you want to assert the state you reviewed.
322
437
 
323
438
  Rollback is `activate` pointed at a digest you already trust. Keep the digest of
324
439
  every release you shipped; a rollback you can perform in one command is worth
325
440
  more than an incident you can explain.
326
441
 
442
+ `miakapp status` after `publish` is the minimum verification: the live `sha256`
443
+ must be the one you just built. It proves what the home runs, not that the
444
+ interface is right — open its `home_url` as a member would before telling the
445
+ owner it works.
446
+
327
447
  ### Driving the CLI as a program
328
448
 
329
449
  Every failure maps to exactly one stable exit code and one stable
@@ -366,22 +486,68 @@ Three differences are worth knowing before you call anything:
366
486
  `packages/cli/README.md` lists the tools. The exit codes above are the
367
487
  `exit_code` field in every result, so branch on the same table either way.
368
488
 
369
- ## 9. Secrets
489
+ ## 9. Access: pairing and contexts
490
+
491
+ You never sign in as the owner and never ask for a password, a Google login or
492
+ an existing key. The owner grants access to one home, in their own browser:
493
+
494
+ 1. Ask the owner to open **https://miakapp.com/pair**, sign in to their own
495
+ account, choose the home (or create it), confirm the access it grants, and
496
+ send you the one-time code it shows. A code works once, for ten minutes.
497
+ 2. Redeem it. The code is read from stdin and never echoed:
370
498
 
371
- `MIAKAPP_HOME_KEY` comes from the environment. It is never a command-line
372
- argument, never printed, never written into a project file. No command accepts
373
- one, deliberately: an argument lands in shell history, in a process listing and
374
- in most CI logs.
499
+ ```bash
500
+ printf '%s\n' "<code>" | miakapp pair # add --issuer <url> if the page shows one
501
+ ```
502
+
503
+ Over MCP, call `miakapp_pair` with `code`. Never repeat the code back in a
504
+ message, and never retry a refused code — ask for a new one.
505
+ 3. `pair` stores a **new, separately revocable** Home Key for this machine as a
506
+ context in `~/.miakapp`, keeps every other context, makes the new one
507
+ current, and proves the key can publish. It prints the key ID and label,
508
+ never the key.
375
509
 
376
510
  ```bash
377
- export MIAKAPP_HOME_KEY="$(your-secret-manager read miakapp/home-key)"
511
+ miakapp context list # every home this machine can publish to
512
+ miakapp context show [name] # one context; the key is never printed
513
+ miakapp context use <name> # make a context current
514
+ miakapp context remove <name> # delete it locally (the owner revokes it server-side)
378
515
  ```
379
516
 
380
- If you are about to write a secret into `miakapp.yaml` so something works, stop:
381
- that is the failure this design exists to prevent.
517
+ `~/.miakapp/config.json` holds names, homes, issuers and key IDs;
518
+ `credentials.json` holds the keys. Both are mode 0600 in a 0700 directory and
519
+ are replaced atomically; the CLI refuses a credentials file other accounts can
520
+ read. `MIAKAPP_CONFIG_DIR` relocates the directory.
521
+
522
+ Which key a command uses, highest precedence first:
523
+
524
+ 1. `--context <name>`, then `MIAKAPP_CONTEXT=<name>`;
525
+ 2. `MIAKAPP_HOME_KEY`, a raw key for CI and compatibility;
526
+ 3. the stored context paired with the home and issuer in `miakapp.yaml` — the
527
+ current context breaks a tie between two keys for that same home.
528
+
529
+ A context, or a known key, for a different home than `miakapp.yaml` names is
530
+ refused before any request: a key can never publish into the wrong house.
531
+
532
+ Prefer one key per agent or machine, so the owner can revoke one without
533
+ breaking the others. A coordinator running on the owner's machine still reads
534
+ its own key from its environment (`templates/home/README.md`).
535
+
536
+ If you are about to write a secret into `miakapp.yaml` or any file in the
537
+ repository so something works, stop: that is the failure this design exists to
538
+ prevent.
382
539
 
383
540
  ## 10. Before you tell the owner you are done
384
541
 
542
+ - [ ] `docs/inventory.md` lists every source, datum and action you found, and
543
+ the interface covers it or says why not.
544
+ - [ ] Every value shows whether it is current, stale or unavailable; nothing is
545
+ invented, and no technical vocabulary is on screen.
546
+ - [ ] The interface is published, `miakapp status` shows your digest live, and
547
+ you opened it as a member would — or you say precisely what you could not
548
+ check.
549
+ - [ ] The owner received a working link and the rollback digest, not a
550
+ screenshot or a mockup.
385
551
  - [ ] Every physically consequential function authorizes its caller on its first
386
552
  line, and a test proves an unauthorized caller is refused.
387
553
  - [ ] Every name in `miakapp.yaml` is covered by the coordinator, and a test
@@ -390,11 +556,16 @@ that is the failure this design exists to prevent.
390
556
  - [ ] No call path retries an unknown outcome.
391
557
  - [ ] State is written before its event is published.
392
558
  - [ ] `bun run check` is green, and CI ran it — not just you.
393
- - [ ] The Home Key exists only in the environment.
559
+ - [ ] The Home Key exists only in `~/.miakapp` or the environment, never in the
560
+ repository.
394
561
  - [ ] You recorded the digest of what you published, so rollback is one command.
395
562
 
396
563
  ## Where to read further
397
564
 
565
+ Everything a home needs is above, in the CLI and in the template. The RFCs and
566
+ platform paths below explain *why* the platform behaves as it does; you never
567
+ need them, or the platform repository, to build and publish a home.
568
+
398
569
  - `packages/cli/README.md` — every command and every tool, including what the
399
570
  pack writes and what it refuses to overwrite.
400
571
  - `templates/home/README.md` — the mechanics of the template itself.
package/bin/miakapp.js CHANGED
@@ -1,10 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { run } from '../dist/main.js';
3
+ import { readSecret } from '../dist/terminal.js';
4
+
5
+ const writeError = (text) => void process.stderr.write(text);
3
6
 
4
7
  process.exitCode = await run(process.argv.slice(2), {
5
8
  write: (text) => void process.stdout.write(text),
6
- writeError: (text) => void process.stderr.write(text),
9
+ writeError,
7
10
  cwd: () => process.cwd(),
8
11
  env: (name) => process.env[name],
9
12
  input: process.stdin,
13
+ readSecret: (prompt) => readSecret(process.stdin, prompt, writeError),
10
14
  });
@@ -1 +1 @@
1
- {"version":3,"file":"agent-pack.d.ts","sourceRoot":"","sources":["../src/agent-pack.ts"],"names":[],"mappings":"AAsBA,6DAA6D;AAC7D,eAAO,MAAM,cAAc,aAAa,CAAC;AAEzC,sEAAsE;AACtE,eAAO,MAAM,UAAU,4BAAqC,CAAC;AAE7D,4EAA4E;AAC5E,eAAO,MAAM,QAAQ,cAAc,CAAC;AAEpC,yEAAyE;AACzE,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAG1F,CAAC;AAEF,eAAO,MAAM,YAAY,2BAA2B,CAAC;AACrD,eAAO,MAAM,UAAU,yBAAyB,CAAC;AAEjD,uEAAuE;AACvE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,CAAC;AAE7D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAA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AS,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAiBrF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMrD;AAMD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CA+BnE;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,UAAU,CAAC,CAiBrB"}
@@ -76,8 +76,9 @@ export function instructionBlock(client) {
76
76
  ## Miakapp
77
77
 
78
78
  This repository is a Miakapp home: a coordinator that runs on the owner's
79
- machine and owns state, events and authorization, and a component that runs
80
- sandboxed in the household's browser and owns nothing but the interface.
79
+ machine and owns state, events and authorization, and an interface — by default
80
+ a whole-house application bundled as one IIFE — that runs isolated in the
81
+ household's browser and owns nothing but what residents see.
81
82
 
82
83
  **Read \`${GUIDE_FILE}\` before writing or publishing anything here.** It is the
83
84
  full guide, copied into this repository so it is readable offline, and it is the
@@ -88,9 +89,13 @@ inventory an existing installation, validate the project, publish, and roll back
88
89
  The same commands exist as \`${SERVER_NAME}\` on the command line; they are one
89
90
  implementation, so neither surface can drift from the other.
90
91
 
91
- Three rules the guide explains and this file repeats because getting them wrong
92
+ Four rules the guide explains and this file repeats because getting them wrong
92
93
  is expensive:
93
94
 
95
+ - Done means published and verified: inventory the house first, publish a V1
96
+ that covers the real data, check \`${SERVER_NAME} status\`, open it as a member
97
+ would, and hand the owner the printed \`home_url\` — never the artifact URL, a
98
+ screenshot or a mockup.
94
99
  - \`publish\`, \`activate\` and \`rollback\` change what every device in the home
95
100
  runs. Over MCP they refuse to act without \`confirm: true\`. Set it when the
96
101
  owner asked for that publication, never to get past an error.
@@ -98,8 +103,10 @@ is expensive:
98
103
  \`conflict\` means re-read the pointer; \`unknown_outcome\` means the effect is
99
104
  undetermined — reconcile with \`${SERVER_NAME} release\` or \`${SERVER_NAME} upload\`
100
105
  before acting again, and never retry it.
101
- - The Home Key lives in \`MIAKAPP_HOME_KEY\` in the environment. No command
102
- accepts it as an argument, and it belongs in no file in this repository.
106
+ - Access comes from \`${SERVER_NAME} pair\`: the owner confirms the home at
107
+ https://miakapp.com/pair and sends a one-time code; never ask for a login or
108
+ a key. Keys live in \`~/.miakapp\` (or \`MIAKAPP_HOME_KEY\` for CI), never in
109
+ this repository and never in a command argument.
103
110
  ${END_MARKER}`;
104
111
  }
105
112
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"agent-pack.js","sourceRoot":"","sources":["../src/agent-pack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEzD,6DAA6D;AAC7D,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AAEzC,sEAAsE;AACtE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,cAAc,iBAAiB,CAAC;AAE7D,4EAA4E;AAC5E,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAC;AAEpC,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAkE;IAC9F,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE;IACtC,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE;CAC7C,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,wBAAwB,CAAC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