@lahat-group/cli 2.0.5 → 2.0.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 (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -72,8 +72,8 @@ To authorize this CLI, visit:
72
72
  `);for(let i of r.bomPreview?.lines??[])process.stdout.write(` ${i.qty}\xD7 ${i.part} (${i.sku}) ${i.widthMm}\xD7${i.heightMm}mm
73
73
  `)})}async function Ce(n,e={}){if(!e.project)throw new Error("--project <id> is required.");let t=await $(n),r=await Y().post("designs",{json:{projectId:e.project,name:e.name??"CLI design",config:t}}).json();d(r,!!e.json,()=>process.stdout.write(`${r.id}
74
74
  `))}async function Vt(n,e={}){if(!e.file&&!e.name)throw new Error("Nothing to update \u2014 pass --file <config> and/or --name <name>.");let t=Y(),r=await t.get(`designs/${n}`).json(),i={};e.file&&(i.config=await $(e.file)),e.name&&(i.name=e.name),r.version!==void 0&&(i.version=r.version);let s=await t.put(`designs/${n}`,{json:i}).json();d(s,!!e.json,()=>process.stdout.write(`${s.id} v${s.version??"?"}
75
- `))}async function Dt(n,e={}){let t=await Y().post("quotations/pdf",{json:{projectId:n}}),r=Number(t.headers.get("x-quote-number")),i=Number(t.headers.get("x-quote-revision")),s=t.headers.get("x-quote-minted")==="true",o=e.out??`quotation-${n}-rev${i}.pdf`,c=Buffer.from(await t.arrayBuffer());qr(o,c),d({path:o,bytes:c.length,quoteNumber:r,revision:i,minted:s},!!e.json,()=>process.stdout.write(`${o} quote ${r} rev ${i} ${s?"new revision minted":"price unchanged \u2014 existing revision re-served"}
75
+ `))}async function Dt(n,e={}){let t=await Y().post("quotations/pdf",{json:{projectId:n},timeout:12e4}),r=Number(t.headers.get("x-quote-number")),i=Number(t.headers.get("x-quote-revision")),s=t.headers.get("x-quote-minted")==="true",o=e.out??`quotation-${n}-rev${i}.pdf`,c=Buffer.from(await t.arrayBuffer());qr(o,c),d({path:o,bytes:c.length,quoteNumber:r,revision:i,minted:s},!!e.json,()=>process.stdout.write(`${o} quote ${r} rev ${i} ${s?"new revision minted":"price unchanged \u2014 existing revision re-served"}
76
76
  `))}u();import{fileURLToPath as Nr}from"url";import{dirname as Ft,join as k}from"path";import{homedir as Hr}from"os";import{existsSync as Ir,mkdirSync as Vr,readdirSync as Dr,copyFileSync as Fr,statSync as Lr}from"fs";function Ur(){let n=Ft(Nr(import.meta.url));for(let e=0;e<6;e++){let t=k(n,"skill");if(Ir(k(t,"SKILL.md")))return t;n=Ft(n)}throw new Error("Bundled SKILL.md not found next to the CLI package")}function Mr(n){let e=n?k(process.cwd(),".claude"):k(Hr(),".claude");return k(e,"skills","wardrobe-configurator")}function Br(n={}){let e=n.sourceDir??Ur(),t=n.targetDir??Mr(!!n.project);Vr(t,{recursive:!0});let r=[];for(let i of Dr(e)){let s=k(e,i);Lr(s).isFile()&&(Fr(s,k(t,i)),r.push(i))}return{target:t,files:r}}function Lt(n){let e=Br({project:n.project});d(e,!!n.json,()=>{process.stdout.write(`Installed ${e.files.length} file(s) to ${e.target}
77
77
  `),process.stdout.write(`Restart Claude Code, then invoke /wardrobe-configurator
78
- `)})}u();async function Wr(n){if(!(n instanceof j))return null;try{return await n.response.json()}catch{return null}}async function Ut(n,e){let t=await Wr(n);if(e)return JSON.stringify(t?{error:t.error??"request_failed",...t}:{error:n.message},null,2);if(!t)return`Error: ${n.message}`;let r=[t.error??"Request failed"];return t.detail&&r.push(t.detail),t.fix_hint&&r.push(`fix: ${t.fix_hint}`),t.issues&&r.push(JSON.stringify(t.issues)),`Error: ${r.join(" \u2014 ")}`}u();var Mt="2.0.5";y.name("wardrobe").description("Wardrobe configurator CLI").version(Mt);y.command("login").description("Authenticate via the OAuth device flow").option("--json","machine-readable output").action(n=>gt(n));y.command("whoami").description("Show the authenticated user").option("--json","machine-readable output").action(n=>bt(n));y.command("logout").description("Remove the stored agent key").option("--json","machine-readable output").action(n=>yt(n));y.command("init").description("Emit a fresh, valid WardrobeConfig JSON (via the API)").option("--width <cm>","total width in cm",n=>Number(n)).option("--height <cm>","height in cm",n=>Number(n)).option("--depth <cm>","depth in cm",n=>Number(n)).action(n=>mt(n));y.command("validate <file>").description("Validate a config against the live rules (file or - for stdin)").option("--json","machine-readable output").action((n,e)=>pt(n,e));y.command("describe <idOrFile>").description("Describe a config (local file/-) or saved design (id), via the API").option("--locale <locale>","en or he","en").option("--json","machine-readable output").action((n,e)=>ft(n,e));y.command("price <file>").description("Price a config via the API (file or - for stdin)").option("--json","machine-readable output").action((n,e)=>Rt(n,e));y.command("plan <file>").description("Dry-run: price a config + BOM preview (mutates nothing)").option("--json","machine-readable output").action((n,e)=>It(n,e));y.command("apply <file>").description("Save a config as a design (file or - for stdin)").requiredOption("--project <id>","project id").option("--name <name>","design name").option("--json","machine-readable output").action((n,e)=>Ce(n,e));var U=y.command("designs").description("Manage saved designs");U.command("list").description("List designs in a project, or the newest across every project with --project omitted").option("--project <id>","project id").option("--limit <n>","cross-project mode only: max rows (default 20, max 100)",n=>Number(n)).option("--since <iso>","cross-project mode only: only designs updated at/after this ISO 8601 timestamp").option("--json","machine-readable output").action(n=>qt(n));U.command("create <file>").description("Save a config as a new design in a project (same as `apply`)").requiredOption("--project <id>","project id").option("--name <name>","design name").option("--json","machine-readable output").action((n,e)=>Ce(n,e));U.command("get <id>").description("Show one saved design with its stored config \u2014 read this before `designs update`, which replaces the whole config").option("--config","print only the bare config: exactly what `designs update --file` accepts").option("--json","machine-readable output: id, projectId, name, version, nisTotal, serviceTotal, config").action((n,e)=>At(n,e));U.command("update <id>").description("Revise a saved design (config and/or name)").option("--file <file>","new config JSON (file or - for stdin)").option("--name <name>","new design name").option("--json","machine-readable output").action((n,e)=>Vt(n,e));U.command("thumbnail <id>").description("Download a design's thumbnail image").option("--out <file>","destination path").option("--json","machine-readable output").action((n,e)=>St(n,e));var $e=y.command("projects").description("Manage projects");$e.command("list").description("List accessible projects").option("--phone <number>","filter by the customer's phone number").option("--designer <idOrName>","filter by the designer who owns the project").option("--json","machine-readable output").action(n=>Ht(n));$e.command("get <id>").description("Show one project").option("--json","machine-readable output").action((n,e)=>wt(n,e));$e.command("members <id>").description("List a project's owner and members").option("--json","machine-readable output").action((n,e)=>_t(n,e));var Ae=y.command("customers").description("Read customers");Ae.command("list").description("List your customers").option("--json","machine-readable output").action(n=>jt(n));Ae.command("get <id>").description("Show one customer").option("--json","machine-readable output").action((n,e)=>xt(n,e));Ae.command("projects <id>").description("List a customer's projects").option("--json","machine-readable output").action((n,e)=>Ot(n,e));var Ee=y.command("orders").description("Read orders");Ee.command("list").description("List a project's orders, or the newest-updated across every project with --project omitted").option("--project <id>","project id").option("--open","only the project's active (non-cancelled) order (requires --project)").option("--limit <n>","cross-project mode only: max rows (default 20, max 100)",n=>Number(n)).option("--since <iso>","cross-project mode only: only orders updated at/after this ISO 8601 timestamp").option("--json","machine-readable output").action(n=>vt(n));Ee.command("get <id>").description("Show one order, with its designs embedded").option("--json","machine-readable output").action((n,e)=>Ct(n,e));Ee.command("pdf <id>").description("Download an order PDF").option("--out <file>","destination path").option("--json","machine-readable output").action((n,e)=>$t(n,e));var Se=y.command("quotations").description("Read quotations (quotations:read), or mint a revision (quotations:write)");Se.command("list").description("Show a project's quote history, or the newest-generated across every project with --project omitted").option("--project <id>","project id").option("--limit <n>","cross-project mode only: max rows (default 20, max 100)",n=>Number(n)).option("--since <iso>","cross-project mode only: only quotations generated at/after this ISO 8601 timestamp").option("--json","machine-readable output").action(n=>Nt(n));Se.command("pdf <projectId>").description("Download a quotation PDF (default: the project's current revision) \u2014 never mints a new one").option("--revision <n>","a specific historical revision instead of the current one",n=>Number(n)).option("--out <file>","destination path").option("--json","machine-readable output").action((n,e)=>Et(n,e));Se.command("mint <projectId>").description("File the project's quotation at its current price and download the PDF \u2014 unlike `pdf`, this can mint a new revision (requires quotations:write)").option("--out <file>","destination path").option("--json","machine-readable output: path, bytes, quoteNumber, revision, minted").action((n,e)=>Dt(n,e));var Bt=y.command("users").description("Read registered accounts (requires staff:read)");Bt.command("list").description("List registered users, newest-registered first").option("--limit <n>","max rows (default 20, max 100)",n=>Number(n)).option("--since <iso>","only users registered at/after this ISO 8601 timestamp").option("--json","machine-readable output").action(n=>Pt(n));Bt.command("by-phone <phone>").description("Find the account(s) whose own phone is this number (+972\u2026 and 05\u2026 forms match)").option("--json","machine-readable output").action((n,e)=>Tt(n,e));y.command("help-texts").description("Read the help-text table").option("--json","machine-readable output").action(n=>kt(n));var Jr=y.command("skill").description("Manage the bundled Claude Skill");Jr.command("install").description("Install the wardrobe-configurator Skill for Claude Code").option("--project","install into ./.claude/skills instead of ~/.claude/skills").option("--json","machine-readable output").action(n=>Lt(n));y.parseAsync().catch(async n=>{let e=await Ut(n,process.argv.includes("--json"));process.stderr.write(`${e}
78
+ `)})}u();async function Wr(n){if(!(n instanceof j))return null;try{return await n.response.json()}catch{return null}}async function Ut(n,e){let t=await Wr(n);if(e)return JSON.stringify(t?{error:t.error??"request_failed",...t}:{error:n.message},null,2);if(!t)return`Error: ${n.message}`;let r=[t.error??"Request failed"];return t.detail&&r.push(t.detail),t.fix_hint&&r.push(`fix: ${t.fix_hint}`),t.issues&&r.push(JSON.stringify(t.issues)),`Error: ${r.join(" \u2014 ")}`}u();var Mt="2.0.6";y.name("wardrobe").description("Wardrobe configurator CLI").version(Mt);y.command("login").description("Authenticate via the OAuth device flow").option("--json","machine-readable output").action(n=>gt(n));y.command("whoami").description("Show the authenticated user").option("--json","machine-readable output").action(n=>bt(n));y.command("logout").description("Remove the stored agent key").option("--json","machine-readable output").action(n=>yt(n));y.command("init").description("Emit a fresh, valid WardrobeConfig JSON (via the API)").option("--width <cm>","total width in cm",n=>Number(n)).option("--height <cm>","height in cm",n=>Number(n)).option("--depth <cm>","depth in cm",n=>Number(n)).action(n=>mt(n));y.command("validate <file>").description("Validate a config against the live rules (file or - for stdin)").option("--json","machine-readable output").action((n,e)=>pt(n,e));y.command("describe <idOrFile>").description("Describe a config (local file/-) or saved design (id), via the API").option("--locale <locale>","en or he","en").option("--json","machine-readable output").action((n,e)=>ft(n,e));y.command("price <file>").description("Price a config via the API (file or - for stdin)").option("--json","machine-readable output").action((n,e)=>Rt(n,e));y.command("plan <file>").description("Dry-run: price a config + BOM preview (mutates nothing)").option("--json","machine-readable output").action((n,e)=>It(n,e));y.command("apply <file>").description("Save a config as a design (file or - for stdin)").requiredOption("--project <id>","project id").option("--name <name>","design name").option("--json","machine-readable output").action((n,e)=>Ce(n,e));var U=y.command("designs").description("Manage saved designs");U.command("list").description("List designs in a project, or the newest across every project with --project omitted").option("--project <id>","project id").option("--limit <n>","cross-project mode only: max rows (default 20, max 100)",n=>Number(n)).option("--since <iso>","cross-project mode only: only designs updated at/after this ISO 8601 timestamp").option("--json","machine-readable output").action(n=>qt(n));U.command("create <file>").description("Save a config as a new design in a project (same as `apply`)").requiredOption("--project <id>","project id").option("--name <name>","design name").option("--json","machine-readable output").action((n,e)=>Ce(n,e));U.command("get <id>").description("Show one saved design with its stored config \u2014 read this before `designs update`, which replaces the whole config").option("--config","print only the bare config: exactly what `designs update --file` accepts").option("--json","machine-readable output: id, projectId, name, version, nisTotal, serviceTotal, config").action((n,e)=>At(n,e));U.command("update <id>").description("Revise a saved design (config and/or name)").option("--file <file>","new config JSON (file or - for stdin)").option("--name <name>","new design name").option("--json","machine-readable output").action((n,e)=>Vt(n,e));U.command("thumbnail <id>").description("Download a design's thumbnail image").option("--out <file>","destination path").option("--json","machine-readable output").action((n,e)=>St(n,e));var $e=y.command("projects").description("Manage projects");$e.command("list").description("List accessible projects").option("--phone <number>","filter by the customer's phone number").option("--designer <idOrName>","filter by the designer who owns the project").option("--json","machine-readable output").action(n=>Ht(n));$e.command("get <id>").description("Show one project").option("--json","machine-readable output").action((n,e)=>wt(n,e));$e.command("members <id>").description("List a project's owner and members").option("--json","machine-readable output").action((n,e)=>_t(n,e));var Ae=y.command("customers").description("Read customers");Ae.command("list").description("List your customers").option("--json","machine-readable output").action(n=>jt(n));Ae.command("get <id>").description("Show one customer").option("--json","machine-readable output").action((n,e)=>xt(n,e));Ae.command("projects <id>").description("List a customer's projects").option("--json","machine-readable output").action((n,e)=>Ot(n,e));var Ee=y.command("orders").description("Read orders");Ee.command("list").description("List a project's orders, or the newest-updated across every project with --project omitted").option("--project <id>","project id").option("--open","only the project's active (non-cancelled) order (requires --project)").option("--limit <n>","cross-project mode only: max rows (default 20, max 100)",n=>Number(n)).option("--since <iso>","cross-project mode only: only orders updated at/after this ISO 8601 timestamp").option("--json","machine-readable output").action(n=>vt(n));Ee.command("get <id>").description("Show one order, with its designs embedded").option("--json","machine-readable output").action((n,e)=>Ct(n,e));Ee.command("pdf <id>").description("Download an order PDF").option("--out <file>","destination path").option("--json","machine-readable output").action((n,e)=>$t(n,e));var Se=y.command("quotations").description("Read quotations (quotations:read), or mint a revision (quotations:write)");Se.command("list").description("Show a project's quote history, or the newest-generated across every project with --project omitted").option("--project <id>","project id").option("--limit <n>","cross-project mode only: max rows (default 20, max 100)",n=>Number(n)).option("--since <iso>","cross-project mode only: only quotations generated at/after this ISO 8601 timestamp").option("--json","machine-readable output").action(n=>Nt(n));Se.command("pdf <projectId>").description("Download a quotation PDF (default: the project's current revision) \u2014 never mints a new one").option("--revision <n>","a specific historical revision instead of the current one",n=>Number(n)).option("--out <file>","destination path").option("--json","machine-readable output").action((n,e)=>Et(n,e));Se.command("mint <projectId>").description("File the project's quotation at its current price and download the PDF \u2014 unlike `pdf`, this can mint a new revision (requires quotations:write)").option("--out <file>","destination path").option("--json","machine-readable output: path, bytes, quoteNumber, revision, minted").action((n,e)=>Dt(n,e));var Bt=y.command("users").description("Read registered accounts (requires staff:read)");Bt.command("list").description("List registered users, newest-registered first").option("--limit <n>","max rows (default 20, max 100)",n=>Number(n)).option("--since <iso>","only users registered at/after this ISO 8601 timestamp").option("--json","machine-readable output").action(n=>Pt(n));Bt.command("by-phone <phone>").description("Find the account(s) whose own phone is this number (+972\u2026 and 05\u2026 forms match)").option("--json","machine-readable output").action((n,e)=>Tt(n,e));y.command("help-texts").description("Read the help-text table").option("--json","machine-readable output").action(n=>kt(n));var Jr=y.command("skill").description("Manage the bundled Claude Skill");Jr.command("install").description("Install the wardrobe-configurator Skill for Claude Code").option("--project","install into ./.claude/skills instead of ~/.claude/skills").option("--json","machine-readable output").action(n=>Lt(n));y.parseAsync().catch(async n=>{let e=await Ut(n,process.argv.includes("--json"));process.stderr.write(`${e}
79
79
  `),process.exit(1)});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lahat-group/cli",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "CLI + Claude Skill to build, validate, price, and save wardrobe designs.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",