@zoahhq/cli 0.1.7 → 0.1.9

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 (3) hide show
  1. package/README.md +50 -3
  2. package/dist/cli.mjs +2639 -1731
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -41,8 +41,13 @@ Reads always check local first; falls back to global.
41
41
  zoah login # global default
42
42
  zoah login --local # project-specific override
43
43
  zoah login --base-url https://zoah.example.com
44
+ zoah login --organization acme # skip the organization list
44
45
  ```
45
46
 
47
+ After you sign in, the CLI asks which organization to work in. Your active organization in the web app is first and selected. Use the arrow keys to choose another, then press Enter. An account with one organization skips the question.
48
+
49
+ The CLI keeps this choice. Changing organizations in the web app does not change it. New projects from `zoah import` go into this organization, and so do directories that are imported but not swapped yet. A swapped directory stays on its project (see [Where a directory stands](#where-a-directory-stands)).
50
+
46
51
  The CLI uses `ZOAH_BASE_URL` when it is set. Otherwise, it uses `https://zoah.com`. `OPACITY_BASE_URL` remains a compatibility fallback.
47
52
 
48
53
  ### `zoah logout`
@@ -54,17 +59,37 @@ By default, this removes the **active** credentials. It removes project-local cr
54
59
 
55
60
  To clear both, run logout twice.
56
61
 
62
+ ### `zoah status`
63
+
64
+ Prints who is signed in, the CLI's organization, and this directory's project, package and state, plus what the next `zoah import` will do. It reads local files only.
65
+
66
+ ```bash
67
+ zoah status
68
+ ```
69
+
57
70
  ### `zoah whoami`
58
71
 
59
- Prints the active user, the source credentials file, and the base URL. Use this when project credentials hide the global token.
72
+ Prints the active user, the source credentials file, the base URL, and the organization the CLI works in. Use this when project credentials hide the global token.
60
73
 
61
74
  ```bash
62
75
  zoah whoami
63
76
  # Signed in as you@example.com (global).
64
77
  # Source: ~/.zoah/credentials.json
65
78
  # Base URL: https://zoah.com
79
+ # Organization: Acme (acme)
66
80
  ```
67
81
 
82
+ ### `zoah organization`
83
+
84
+ ```bash
85
+ zoah organization list # your organizations; * marks the CLI's
86
+ zoah organization switch # choose from the list with the arrow keys
87
+ zoah organization switch acme # or name one by slug, name or id
88
+ zoah organization create "Acme" # create one; switch to it to work there
89
+ ```
90
+
91
+ `switch` changes the organization for the credential it came from, so a `--local` login keeps its own organization. The MCP server uses the same organization unless `connect` names another.
92
+
68
93
  ### `zoah mcp`
69
94
 
70
95
  Runs the Zoah MCP server over stdio so a coding agent (Claude Code, Codex,
@@ -198,18 +223,32 @@ zoah import # scans ./src
198
223
  zoah import src/components # scope to a subdirectory
199
224
  zoah import --swap # also rewrite local imports after publish
200
225
  zoah import --project-name my-ui # override the first project name
226
+ zoah import --new-project # start over in a new project (before a swap)
201
227
  zoah import --branch main # target a specific branch
202
228
  zoah import --debug # also write .zoah/debug/payload.json
203
229
  zoah import --print-issues warn # print issue details at or above this level
204
230
  zoah import --dry-run # preview locally without an API call
205
231
  ```
206
232
 
207
- The first import creates a project and saves its IDs to `.zoah/config.json`. Later imports use the same project.
233
+ The first import creates a project and saves its IDs to `.zoah/config.json`. Before it scans, `zoah import` says where the directory stands and where this import goes.
234
+
235
+ #### Where a directory stands
236
+
237
+ `zoah status` prints this without scanning or calling the API.
238
+
239
+ | State | What it means | What `zoah import` does |
240
+ | -------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
241
+ | New | No `.zoah/config.json`. | Creates a project in the CLI's organization. |
242
+ | Imported | Linked to a project, but no source file uses its package yet. | Updates the linked project. If the CLI's organization is different, it creates a project there and relinks the directory. `--new-project` also starts a new project. |
243
+ | Swapped | `zoah swap` rewrote component files to use the package. | Adds and updates components in the linked project, whichever organization the CLI is in. Swapped components are already in Zoah, so the scan skips them. `--new-project` is refused, because the code depends on the package. |
244
+
245
+ A swapped directory stays on its project because its code imports that project's package. It still takes new components: add one and run `zoah import --swap`.
208
246
 
209
247
  Notable flags:
210
248
 
211
249
  - `--swap`: runs `zoah swap` after a successful import.
212
- - `--project-name <name>`: sets the first project name. Later imports use the project ID in `.zoah/config.json`.
250
+ - `--project-name <name>`: sets the name of a new project. Later imports use the project ID in `.zoah/config.json`.
251
+ - `--new-project`: creates a new project in the CLI's organization and relinks the directory. Not possible once the directory is swapped.
213
252
  - `--branch <name>`: defaults to the project's saved branch (usually `main`).
214
253
  - `--base-url <url>`: overrides the URL saved at login.
215
254
  - `--print-issues <level>`: also prints full details for every issue at or above `info | warn | error`.
@@ -255,6 +294,14 @@ default, so the install needs credentials. When the repo's `.npmrc` (and your
255
294
  `~/.npmrc`) has no token for the Zoah registry host, swap mints a registry
256
295
  API key for the project's organization and manages the file for you:
257
296
 
297
+ - A key reads only its own organization's packages. When `.npmrc` already has
298
+ a key, swap asks the registry whether that key can read this package. If the
299
+ registry refuses it (401 or 403), for example because the key came from a
300
+ project in another organization, swap replaces it with a key for this
301
+ project and says so. `.npmrc` holds one key per registry host, so a repo
302
+ that installs packages from two organizations needs a key that can read
303
+ both.
304
+
258
305
  - The key is requested through the authenticated import API, requires write
259
306
  access in the project's organization, and is **reused** on repeat runs (one
260
307
  key per project + user, not one per invocation). It appears in Project