@lahat-group/cli 1.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 +11839 -0
  2. package/package.json +32 -0
  3. package/skill/SKILL.md +80 -0
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@lahat-group/cli",
3
+ "version": "1.0.0",
4
+ "description": "CLI + Claude Skill to build, validate, price, and save wardrobe designs.",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "bin": { "wardrobe": "dist/index.js" },
8
+ "files": ["dist", "skill"],
9
+ "engines": { "node": ">=18" },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/shahar-abra/wardrobe-configurator.git",
13
+ "directory": "tools/cli"
14
+ },
15
+ "publishConfig": { "access": "public" },
16
+ "scripts": {
17
+ "build": "tsup",
18
+ "prepublishOnly": "npm run build",
19
+ "dev": "tsx src/index.ts",
20
+ "typecheck": "tsc --noEmit",
21
+ "test": "vitest run"
22
+ },
23
+ "devDependencies": {
24
+ "@wardrobe/shared": "*",
25
+ "commander": "^12.0.0",
26
+ "ky": "^1.14.3",
27
+ "tsup": "^8.0.0",
28
+ "tsx": "^4.0.0",
29
+ "typescript": "^5.5.0",
30
+ "vitest": "^3.1.1"
31
+ }
32
+ }
package/skill/SKILL.md ADDED
@@ -0,0 +1,80 @@
1
+ ---
2
+ name: wardrobe-configurator
3
+ description: Use when the user wants to build, configure, validate, price, or order a wardrobe/closet design from the terminal — phrases like "configure a wardrobe", "price a design", "build a closet layout", "validate my wardrobe config". Drives the `wardrobe` CLI (HTTP client over the configurator API); a WardrobeConfig JSON file on disk is the unit of work.
4
+ ---
5
+
6
+ # Wardrobe Configurator CLI
7
+
8
+ Build, validate, price, save, and stage wardrobe designs from the terminal via the
9
+ `wardrobe` CLI. A **`WardrobeConfig` JSON file on disk is the unit of work**. The
10
+ agent loop is: **init → edit → validate → price → plan → apply**.
11
+
12
+ ## Prerequisites
13
+
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
17
+ user code, opens `/activate` in the browser, and stores a scoped agent key at
18
+ `~/.config/wardrobe/config.json` (chmod 600). Confirm with `wardrobe whoami`.
19
+ - The CLI targets the **production** API by default. Set `WARDROBE_API_URL` to override
20
+ (e.g. `http://localhost:3001/api` for a local dev server).
21
+ - Every verb accepts `--json` for machine-readable output. Read those; don't scrape prose.
22
+
23
+ ## The loop
24
+
25
+ 1. **init** — `wardrobe init [--width <cm>] [--height <cm>] [--depth <cm>] > wardrobe.json`
26
+ emits a fresh, valid `WardrobeConfig` (full-width, split into optimal columns).
27
+ 2. **edit** — modify `wardrobe.json` directly (see shape below).
28
+ 3. **validate** — `wardrobe validate wardrobe.json` (or `-` for stdin). Runs the
29
+ **shared constraint pipeline fully offline** — byte-identical to the web app.
30
+ Exit 0 = valid; exit 1 + structured errors otherwise. Do this after every edit.
31
+ 4. **price** — `wardrobe price wardrobe.json` → authoritative total in **NIS** from
32
+ the API's unified area×rate engine.
33
+ 5. **plan** — `wardrobe plan wardrobe.json` → dry-run price **plus a BOM preview**.
34
+ Mutates nothing. Use this to preview before applying.
35
+ 6. **apply** — `wardrobe apply wardrobe.json --project <id> [--name <name>]` → saves
36
+ the config as a design and prints its `{id}`. **`--project` is required.**
37
+
38
+ `wardrobe describe <idOrFile>` gives a human-readable summary of a local file/`-`
39
+ or a saved design id.
40
+
41
+ ## Listing context
42
+
43
+ - `wardrobe projects list` — projects you can access (needed for `--project`).
44
+ - `wardrobe designs list --project <id>` — designs saved in a project.
45
+
46
+ ## WardrobeConfig shape (top-level)
47
+
48
+ ```jsonc
49
+ {
50
+ "roomPosition": "freestanding", // placement
51
+ "width": 100, "height": 240, "depth": 60, // cm
52
+ "material": "<externalMaterialId>",
53
+ "materialInternal": "<internalMaterialId>",
54
+ "materialExternal": "<externalMaterialId>",
55
+ "columns": [ // one or more columns, widths sum to `width`
56
+ { "id": "<nanoid>", "width": 100, "modules": [ /* rails, shelves, drawers */ ] }
57
+ ],
58
+ "ruleVersion": "<current rule version>"
59
+ }
60
+ ```
61
+
62
+ Prefer generating the skeleton with `wardrobe init` rather than hand-writing it —
63
+ `init` fills materials, `ruleVersion`, and a valid column layout for you. Column
64
+ `id`s are `nanoid()` and are not stable across rebuilds.
65
+
66
+ ## Guardrails — orders require a human
67
+
68
+ - **The CLI cannot place orders.** Ordering is intentionally not an agent verb: the
69
+ agent key carries only `designs:read`, `designs:write`, `price:read` — **no order or
70
+ admin scope**. Don't attempt to order, or to run admin/catalog operations.
71
+ - To turn a saved design into an order, direct the **human** to the web app: they
72
+ open the project, review the design, and complete the **verify-details** flow —
73
+ which computes the final price, freezes the PDF, and advances the order. Only a
74
+ human does this. Your job ends at `apply` (a saved design) plus a clear summary.
75
+
76
+ ## Error handling
77
+
78
+ Zod validation errors from the API return `{ error, issues, fix_hint }`. Read
79
+ `fix_hint` — it names the offending field/path and how to correct it. Re-run
80
+ `validate` locally before retrying a networked verb.