@modeldesk/cli 0.2.1 → 0.3.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.
- package/README.md +1 -1
- package/dist/modeldesk.js +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ not render, host, or publish documents.
|
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
10
|
-
The CLI runs on Node.js (version
|
|
10
|
+
The CLI runs on Node.js (version 22 or newer), on Linux, macOS, and Windows. It is plain JavaScript
|
|
11
11
|
with no native dependencies, so the Node version is the only requirement. Run it on demand with
|
|
12
12
|
`npx`, or install it globally.
|
|
13
13
|
|
package/dist/modeldesk.js
CHANGED
|
@@ -33,7 +33,7 @@ import{chmodSync as xe,existsSync as Ft,mkdirSync as Ht,readFileSync as Ut,write
|
|
|
33
33
|
`)};var Z=e=>{let t=[];for(let n of e)n.forEach((o,r)=>{t[r]=Math.max(t[r]??0,o.length)});return t},O=(e,{indent:t="",gap:n=2,widths:o}={})=>{let s=Z(e).map((c,l)=>o?.[l]??c),a=" ".repeat(n);return e.map(c=>t+c.map((l,d)=>d===c.length-1?l:l.padEnd(s[d])).join(a))};var Gn=["STACK","TEMPLATE","NAME"],Rt=async e=>{let{values:t}=S(e.argv,{host:{type:"string"},model:{type:"string"},stack:{type:"string"}}),n=J(e,{host:t.host,model:t.model}),o=Q(n.instance,e.env),r=await o.getJson(`/models/${n.model}`),s=(r.metamodelExtensions??[]).map(h=>h.id),a=s.length>0?{metamodelExtensions:s.join(",")}:void 0,{items:c}=await o.getJson(`/metamodels/${r.metamodel.id}/templates`,a),l=c??[];if(l.length===0)return process.stdout.write(`This model has no document templates.
|
|
34
34
|
`),0;let d=t.stack,p=d?l.filter(h=>h.stack===d):l;if(p.length===0)return process.stdout.write(`No document templates for stack '${d}'.
|
|
35
35
|
`),0;let u=p.map(h=>[h.stack??"",h.key??h.id,h.name]);for(let h of O([Gn,...u]))process.stdout.write(`${h}
|
|
36
|
-
`);return 0};var Ce={bundle:{pull:{summary:"Materialize a model's content bundle into a local folder",usage:"bundle pull --model <id> --stack <id> --template <slug> [--host <host>] [--version <name>] [--no-diagrams] [--dry-run]",handler:Pt},templates:{summary:"List a model's document templates",usage:"bundle templates --model <id> [--stack <id>] [--host <host>]",handler:Rt}},auth:{login:{summary:"Log in through the browser (OAuth authorization code + PKCE)",usage:"auth login [--host <host>]",handler:Qe},logout:{summary:"Remove the stored credential for the active host",usage:"auth logout [--host <host>]",handler:Xe},status:{summary:"Show the active host, logged-in identity, and token validity",usage:"auth status [--host <host>]",handler:Ze}}};var At={name:"@modeldesk/cli",version:"0.
|
|
36
|
+
`);return 0};var Ce={bundle:{pull:{summary:"Materialize a model's content bundle into a local folder",usage:"bundle pull --model <id> --stack <id> --template <slug> [--host <host>] [--version <name>] [--no-diagrams] [--dry-run]",handler:Pt},templates:{summary:"List a model's document templates",usage:"bundle templates --model <id> [--stack <id>] [--host <host>]",handler:Rt}},auth:{login:{summary:"Log in through the browser (OAuth authorization code + PKCE)",usage:"auth login [--host <host>]",handler:Qe},logout:{summary:"Remove the stored credential for the active host",usage:"auth logout [--host <host>]",handler:Xe},status:{summary:"Show the active host, logged-in identity, and token validity",usage:"auth status [--host <host>]",handler:Ze}}};var At={name:"@modeldesk/cli",version:"0.3.0",description:"Command-line interface (CLI) for the ModelDesk platform",keywords:["modeldesk","cli","documentation","content-bundle","respec","mim","information-model"],homepage:"https://modeldesk.io",repository:{type:"git",url:"git+https://github.com/model-desk/modeldesk.git",directory:"packages/cli"},license:"MIT",type:"module",bin:{modeldesk:"dist/modeldesk.js"},files:["dist"],publishConfig:{access:"public"},engines:{node:">=22"},scripts:{build:"node esbuild.config.mjs",prepublishOnly:"npm run build",typecheck:"tsc --noEmit",lint:"eslint","lint:fix":"eslint --fix",test:"vitest run","test:watch":"vitest"},devDependencies:{"@eslint/js":"^10.0.1","@modeldesk/content-bundle":"*","@types/node":"^24.13.2",esbuild:"^0.28.2",eslint:"^10.9.1","eslint-config-prettier":"^10.1.5","eslint-plugin-prettier":"^5.5.6",globals:"^17.11.0",prettier:"^3.9.5",typescript:"^6.0.3","typescript-eslint":"^8.69.0",vitest:"^5.0.0"}};var _t=At.version;var Wn={out:e=>process.stdout.write(e),err:e=>process.stderr.write(e)},Lt=new Set(["--help","-h","help"]),Dt=async(e,t=Wn)=>{try{return await Kn(e,t)}catch(n){return n instanceof i?(t.err(`error: ${n.message}
|
|
37
37
|
`),n.exitCode):(t.err(`error: ${n instanceof Error?n.message:String(n)}
|
|
38
38
|
`),1)}},Kn=async(e,t)=>{let[n,...o]=e;if(n===void 0||Lt.has(n))return t.out(Vn()),0;if(n==="--version"||n==="-v")return t.out(`${_t}
|
|
39
39
|
`),0;let r=Ce[n];if(!r)throw new i(`Unknown command '${n}'. Run 'modeldesk --help' to see available commands.`);let[s,...a]=o;if(s===void 0){let p=Object.keys(r).join(", ");throw new i(`'${n}' requires a subcommand (${p}). Run 'modeldesk ${n} --help'.`)}if(Lt.has(s))return t.out(Yn(n,r)),0;let c=r[s];if(!c)throw new i(`Unknown '${n}' command '${s}'. Run 'modeldesk ${n} --help'.`);let l={argv:a,env:process.env,cwd:process.cwd()},d=await c.handler(l);return typeof d=="number"?d:0},Ot=[["--help, -h","Show help"],["--version, -v","Show the CLI version"]],Vn=()=>{let e=[];for(let[o,r]of Object.entries(Ce))for(let[s,a]of Object.entries(r))e.push([`${o} ${s}`,a.summary]);let[t]=Z([...e,...Ot]);return`${["ModelDesk CLI","","Usage: modeldesk <command> <subcommand> [options]","","Commands:",...O(e,{indent:" ",widths:[t]}),"","Global options:",...O(Ot,{indent:" ",widths:[t]}),""].join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modeldesk/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Command-line interface (CLI) for the ModelDesk platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"modeldesk",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"engines": {
|
|
32
|
-
"node": ">=
|
|
32
|
+
"node": ">=22"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "node esbuild.config.mjs",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"@eslint/js": "^10.0.1",
|
|
45
45
|
"@modeldesk/content-bundle": "*",
|
|
46
46
|
"@types/node": "^24.13.2",
|
|
47
|
-
"esbuild": "^0.28.
|
|
48
|
-
"eslint": "^10.
|
|
47
|
+
"esbuild": "^0.28.2",
|
|
48
|
+
"eslint": "^10.9.1",
|
|
49
49
|
"eslint-config-prettier": "^10.1.5",
|
|
50
50
|
"eslint-plugin-prettier": "^5.5.6",
|
|
51
|
-
"globals": "^17.
|
|
51
|
+
"globals": "^17.11.0",
|
|
52
52
|
"prettier": "^3.9.5",
|
|
53
53
|
"typescript": "^6.0.3",
|
|
54
|
-
"typescript-eslint": "^8.
|
|
55
|
-
"vitest": "^
|
|
54
|
+
"typescript-eslint": "^8.69.0",
|
|
55
|
+
"vitest": "^5.0.0"
|
|
56
56
|
}
|
|
57
57
|
}
|