@lahat-group/cli 1.1.7 → 2.0.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.
Files changed (3) hide show
  1. package/dist/index.js +57 -12167
  2. package/package.json +1 -2
  3. package/skill/SKILL.md +14 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lahat-group/cli",
3
- "version": "1.1.7",
3
+ "version": "2.0.0",
4
4
  "description": "CLI + Claude Skill to build, validate, price, and save wardrobe designs.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -30,7 +30,6 @@
30
30
  "test": "vitest run"
31
31
  },
32
32
  "devDependencies": {
33
- "@wardrobe/shared": "*",
34
33
  "commander": "^12.0.0",
35
34
  "ky": "^1.14.3",
36
35
  "tsup": "^8.0.0",
package/skill/SKILL.md CHANGED
@@ -12,8 +12,13 @@ agent loop is: **init → edit → validate → price → plan → apply**.
12
12
  ## Prerequisites
13
13
 
14
14
  - Install the CLI: `npm install -g @lahat-group/cli` (or run ad-hoc via `npx @lahat-group/cli <verb>`).
15
- It ships as a self-contained binary — no build step, no extra dependencies.
16
- - **Authenticate once**: `wardrobe login` runs the OAuth device flow — it prints a
15
+ It ships as a self-contained binary — no build step, no extra dependencies. It holds
16
+ no domain logic of its own; the rules live in the API.
17
+ - **Authenticate first — every verb needs it.** The CLI is a thin HTTP client: `init`,
18
+ `validate` and `describe` are served by the API just as `price` and `apply` are, so
19
+ none of them work offline. `Not authenticated. Run \`wardrobe login\` first.` means
20
+ exactly that.
21
+ - `wardrobe login` runs the OAuth device flow — it prints a
17
22
  user code, opens `/activate` in the browser, and stores a scoped agent key at
18
23
  `~/.config/wardrobe/config.json` (chmod 600). Confirm with `wardrobe whoami`.
19
24
  - The CLI targets the **production** API by default. Set `WARDROBE_API_URL` to override
@@ -26,7 +31,8 @@ agent loop is: **init → edit → validate → price → plan → apply**.
26
31
  emits a fresh, valid `WardrobeConfig` (full-width, split into optimal columns).
27
32
  2. **edit** — modify `wardrobe.json` directly (see shape below).
28
33
  3. **validate** — `wardrobe validate wardrobe.json` (or `-` for stdin). Runs the
29
- **shared constraint pipeline fully offline** — byte-identical to the web app.
34
+ **live** constraint pipeline server-side — the same rules `wardrobe price` enforces,
35
+ so a config `validate` approves can never be one `price` rejects.
30
36
  Exit 0 = valid; exit 1 + structured errors otherwise. Do this after every edit.
31
37
  4. **price** — `wardrobe price wardrobe.json` → authoritative total in **NIS** from
32
38
  the API's unified area×rate engine.
@@ -99,7 +105,10 @@ a data one. `wardrobe whoami --json` reports the truth under `agent.scopes` and
99
105
  to. A project belonging to someone else answers `403 Forbidden`, not `404`.
100
106
  - A key approved by an **admin or support** user *and* carrying **`staff:read`** sees
101
107
  **every** project, customer and order in the system. That scope is granted only to
102
- staff, only for GETs, and is listed by name on the consent screen.
108
+ staff, only for GETs, and is listed by name on the consent screen. The same approver
109
+ also receives **`staff:write`**, which lets `designs create` / `designs update` land in
110
+ a project the admin does not own. A key logged in before 2026-09-05 lacks it — a `403
111
+ Forbidden` on a write to someone else's project means `wardrobe login` again.
103
112
 
104
113
  Never tell a user something does not exist when you only know your key cannot see it.
105
114
  Say which it is: `403 Forbidden` means the row is someone else's, `404` means it is gone.
@@ -138,7 +147,7 @@ Prefer generating the skeleton with `wardrobe init` rather than hand-writing it
138
147
 
139
148
  - **The CLI can read orders but never place one.** Its key carries `profile:read`,
140
149
  `projects:read`, `customers:read`, `designs:read`, `designs:write`, `orders:read`,
141
- `price:read` (+ `staff:read` for staff) — **every write beyond designs is absent**,
150
+ `price:read` (+ `staff:read` and `staff:write` for staff) — **every write beyond designs is absent**,
142
151
  and so is every admin scope. `wardrobe orders list` and `orders pdf` work; creating
143
152
  or changing an order, a customer or a quotation answers `403 insufficient_scope`.
144
153
  Don't attempt it, and don't attempt admin/catalog operations.