@product-model/cli 0.1.0 → 0.2.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/LICENSE +21 -0
- package/dist/index.js +94 -9
- package/dist/index.js.map +1 -1
- package/package.json +28 -25
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Product Model Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { defineCommand as
|
|
4
|
+
import { defineCommand as defineCommand4, runMain } from "citty";
|
|
5
5
|
|
|
6
6
|
// src/commands/build.ts
|
|
7
7
|
import { readFile, writeFile } from "fs/promises";
|
|
@@ -91,12 +91,96 @@ var buildCommand = defineCommand({
|
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
|
|
94
|
+
// src/commands/studio.ts
|
|
95
|
+
import { defineCommand as defineCommand2 } from "citty";
|
|
96
|
+
import { spawn, exec } from "child_process";
|
|
97
|
+
import { createServer } from "net";
|
|
98
|
+
import { createRequire } from "module";
|
|
99
|
+
import { dirname, join, resolve as resolve2 } from "path";
|
|
100
|
+
function isPortFree(port) {
|
|
101
|
+
return new Promise((resolve4) => {
|
|
102
|
+
const server = createServer();
|
|
103
|
+
server.once("error", () => resolve4(false));
|
|
104
|
+
server.once("listening", () => {
|
|
105
|
+
server.close(() => resolve4(true));
|
|
106
|
+
});
|
|
107
|
+
server.listen(port, "localhost");
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function openBrowser(url) {
|
|
111
|
+
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
112
|
+
exec(`${cmd} ${url}`);
|
|
113
|
+
}
|
|
114
|
+
var studioCommand = defineCommand2({
|
|
115
|
+
meta: {
|
|
116
|
+
name: "studio",
|
|
117
|
+
description: "Launch the Product Model visual editor"
|
|
118
|
+
},
|
|
119
|
+
args: {
|
|
120
|
+
port: {
|
|
121
|
+
type: "string",
|
|
122
|
+
description: "Port to run on",
|
|
123
|
+
default: "3000"
|
|
124
|
+
},
|
|
125
|
+
root: {
|
|
126
|
+
type: "string",
|
|
127
|
+
description: "Project root directory (defaults to current directory)"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
async run({ args }) {
|
|
131
|
+
const projectRoot = resolve2(args.root ?? process.cwd());
|
|
132
|
+
const port = Number(args.port);
|
|
133
|
+
const free = await isPortFree(port);
|
|
134
|
+
if (!free) {
|
|
135
|
+
console.error(`Error: Port ${port} is already in use.`);
|
|
136
|
+
console.error(`Try: pm studio --port ${port + 1}`);
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
const require2 = createRequire(import.meta.url);
|
|
140
|
+
let studioDir;
|
|
141
|
+
try {
|
|
142
|
+
const studioPkgPath = require2.resolve("@product-model/studio/package.json");
|
|
143
|
+
studioDir = dirname(studioPkgPath);
|
|
144
|
+
} catch {
|
|
145
|
+
console.error(
|
|
146
|
+
"Error: @product-model/studio is not installed.\nRun: npm install @product-model/studio"
|
|
147
|
+
);
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
const standaloneDir = join(studioDir, ".next/standalone");
|
|
151
|
+
const serverPath = join(standaloneDir, "apps/studio/server.js");
|
|
152
|
+
console.log("Starting Product Model Studio...");
|
|
153
|
+
console.log(` Root: ${projectRoot}`);
|
|
154
|
+
console.log(` URL: http://localhost:${port}
|
|
155
|
+
`);
|
|
156
|
+
const child = spawn("node", [serverPath], {
|
|
157
|
+
env: {
|
|
158
|
+
...process.env,
|
|
159
|
+
PRODUCT_MODEL_ROOT: projectRoot,
|
|
160
|
+
PORT: String(port),
|
|
161
|
+
HOSTNAME: "localhost"
|
|
162
|
+
},
|
|
163
|
+
stdio: "inherit",
|
|
164
|
+
cwd: join(standaloneDir, "apps/studio")
|
|
165
|
+
});
|
|
166
|
+
setTimeout(() => openBrowser(`http://localhost:${port}`), 1500);
|
|
167
|
+
for (const signal of ["SIGINT", "SIGTERM"]) {
|
|
168
|
+
process.on(signal, () => {
|
|
169
|
+
child.kill(signal);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
child.on("exit", (code) => {
|
|
173
|
+
process.exit(code ?? 0);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
94
178
|
// src/commands/validate.ts
|
|
95
179
|
import { readFile as readFile2 } from "fs/promises";
|
|
96
|
-
import { resolve as
|
|
180
|
+
import { resolve as resolve3 } from "path";
|
|
97
181
|
import { parse as parse2, parseWorkspace as parseWorkspace2, validate as validate2, validateWorkspace as validateWorkspace2 } from "@product-model/core";
|
|
98
|
-
import { defineCommand as
|
|
99
|
-
var validateCommand =
|
|
182
|
+
import { defineCommand as defineCommand3 } from "citty";
|
|
183
|
+
var validateCommand = defineCommand3({
|
|
100
184
|
meta: {
|
|
101
185
|
name: "validate",
|
|
102
186
|
description: "Validate a .product.mdx file"
|
|
@@ -125,7 +209,7 @@ var validateCommand = defineCommand2({
|
|
|
125
209
|
async run({ args }) {
|
|
126
210
|
try {
|
|
127
211
|
if (args.workspaceRoot) {
|
|
128
|
-
const workspaceRoot =
|
|
212
|
+
const workspaceRoot = resolve3(args.workspaceRoot);
|
|
129
213
|
const workspace = await parseWorkspace2({
|
|
130
214
|
workspaceRoot,
|
|
131
215
|
version: args.version,
|
|
@@ -153,7 +237,7 @@ var validateCommand = defineCommand2({
|
|
|
153
237
|
console.error('\u2717 Missing required argument: <file> (or use --workspace-root "<dir>")');
|
|
154
238
|
process.exit(1);
|
|
155
239
|
}
|
|
156
|
-
const filePath =
|
|
240
|
+
const filePath = resolve3(args.file);
|
|
157
241
|
const source = await readFile2(filePath, "utf-8");
|
|
158
242
|
const document = await parse2(source, {
|
|
159
243
|
version: args.version,
|
|
@@ -173,7 +257,7 @@ var validateCommand = defineCommand2({
|
|
|
173
257
|
console.log(`\u2713 ${filePath} is valid`);
|
|
174
258
|
}
|
|
175
259
|
} catch (error) {
|
|
176
|
-
const target = args.workspaceRoot ?
|
|
260
|
+
const target = args.workspaceRoot ? resolve3(args.workspaceRoot) : resolve3(args.file ?? ".");
|
|
177
261
|
console.error(`\u2717 Parse error in ${target}:`);
|
|
178
262
|
console.error(` ${error instanceof Error ? error.message : String(error)}`);
|
|
179
263
|
process.exit(1);
|
|
@@ -182,7 +266,7 @@ var validateCommand = defineCommand2({
|
|
|
182
266
|
});
|
|
183
267
|
|
|
184
268
|
// src/index.ts
|
|
185
|
-
var main =
|
|
269
|
+
var main = defineCommand4({
|
|
186
270
|
meta: {
|
|
187
271
|
name: "pm",
|
|
188
272
|
version: "0.1.0",
|
|
@@ -190,7 +274,8 @@ var main = defineCommand3({
|
|
|
190
274
|
},
|
|
191
275
|
subCommands: {
|
|
192
276
|
validate: validateCommand,
|
|
193
|
-
build: buildCommand
|
|
277
|
+
build: buildCommand,
|
|
278
|
+
studio: studioCommand
|
|
194
279
|
}
|
|
195
280
|
});
|
|
196
281
|
runMain(main);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/commands/build.ts","../src/commands/validate.ts"],"sourcesContent":["import { defineCommand, runMain } from \"citty\";\nimport { buildCommand } from \"./commands/build.js\";\nimport { validateCommand } from \"./commands/validate.js\";\n\nconst main = defineCommand({\n\tmeta: {\n\t\tname: \"pm\",\n\t\tversion: \"0.1.0\",\n\t\tdescription: \"Product Model CLI — validate and build .product.mdx files\",\n\t},\n\tsubCommands: {\n\t\tvalidate: validateCommand,\n\t\tbuild: buildCommand,\n\t},\n});\n\nrunMain(main);\n","import { readFile, writeFile } from \"node:fs/promises\";\nimport { basename, resolve } from \"node:path\";\nimport { parse, parseWorkspace, validate, validateWorkspace } from \"@product-model/core\";\nimport { defineCommand } from \"citty\";\n\nexport const buildCommand = defineCommand({\n\tmeta: {\n\t\tname: \"build\",\n\t\tdescription: \"Parse, validate, and output a JSON AST from a .product.mdx file\",\n\t},\n\targs: {\n\t\tfile: {\n\t\t\ttype: \"positional\",\n\t\t\tdescription: \"Path to the .product.mdx file\",\n\t\t\trequired: false,\n\t\t},\n\t\tworkspaceRoot: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Workspace root directory for multi-file build\",\n\t\t},\n\t\toutput: {\n\t\t\ttype: \"string\",\n\t\t\talias: \"o\",\n\t\t\tdescription: \"Output file path (defaults to <filename>.json)\",\n\t\t},\n\t\ttitle: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Document title\",\n\t\t\tdefault: \"Untitled\",\n\t\t},\n\t\tversion: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Document version\",\n\t\t\tdefault: \"0.1.0\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tif (args.workspaceRoot) {\n\t\t\tconst workspaceRoot = resolve(args.workspaceRoot);\n\t\t\tconst workspace = await parseWorkspace({\n\t\t\t\tworkspaceRoot,\n\t\t\t\tversion: args.version,\n\t\t\t\ttitle: args.title,\n\t\t\t});\n\t\t\tconst result = validateWorkspace(workspace);\n\n\t\t\tif (!result.valid) {\n\t\t\t\tconsole.error(`✗ Validation failed with ${result.diagnostics.length} error(s):\\n`);\n\t\t\t\tfor (const d of result.diagnostics) {\n\t\t\t\t\tconst prefix =\n\t\t\t\t\t\td.severity === \"error\" ? \"ERROR\" : d.severity === \"warning\" ? \"WARN\" : \"INFO\";\n\t\t\t\t\tconst pathInfo = d.path ? ` (${d.path})` : \"\";\n\t\t\t\t\tconst blockInfo = d.blockId ? ` [${d.blockId}]` : \"\";\n\t\t\t\t\tconsole.error(` ${prefix}${pathInfo}${blockInfo}: ${d.message}`);\n\t\t\t\t}\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\tconst outputPath = args.output ? resolve(args.output) : resolve(\"workspace.json\");\n\t\t\tawait writeFile(outputPath, JSON.stringify(workspace, null, 2), \"utf-8\");\n\t\t\tconsole.log(`✓ Built ${outputPath}`);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!args.file) {\n\t\t\tconsole.error('✗ Missing required argument: <file> (or use --workspace-root \"<dir>\")');\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tconst filePath = resolve(args.file);\n\t\tconst source = await readFile(filePath, \"utf-8\");\n\t\tconst document = await parse(source, {\n\t\t\tversion: args.version,\n\t\t\ttitle: args.title,\n\t\t});\n\t\tconst result = validate(document);\n\n\t\tif (!result.valid) {\n\t\t\tconsole.error(`✗ Validation failed with ${result.diagnostics.length} error(s):\\n`);\n\t\t\tfor (const d of result.diagnostics) {\n\t\t\t\tconst prefix =\n\t\t\t\t\td.severity === \"error\" ? \"ERROR\" : d.severity === \"warning\" ? \"WARN\" : \"INFO\";\n\t\t\t\tconst blockInfo = d.blockId ? ` [${d.blockId}]` : \"\";\n\t\t\t\tconsole.error(` ${prefix}${blockInfo}: ${d.message}`);\n\t\t\t}\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tconst outputPath = args.output\n\t\t\t? resolve(args.output)\n\t\t\t: resolve(basename(filePath).replace(/\\.product\\.mdx$/, \".json\"));\n\n\t\tawait writeFile(outputPath, JSON.stringify(document, null, 2), \"utf-8\");\n\t\tconsole.log(`✓ Built ${outputPath}`);\n\t},\n});\n","import { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { parse, parseWorkspace, validate, validateWorkspace } from \"@product-model/core\";\nimport { defineCommand } from \"citty\";\n\nexport const validateCommand = defineCommand({\n\tmeta: {\n\t\tname: \"validate\",\n\t\tdescription: \"Validate a .product.mdx file\",\n\t},\n\targs: {\n\t\tfile: {\n\t\t\ttype: \"positional\",\n\t\t\tdescription: \"Path to the .product.mdx file\",\n\t\t\trequired: false,\n\t\t},\n\t\tworkspaceRoot: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Workspace root directory for multi-file validation\",\n\t\t},\n\t\ttitle: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Document title\",\n\t\t\tdefault: \"Untitled\",\n\t\t},\n\t\tversion: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Document version\",\n\t\t\tdefault: \"0.1.0\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\ttry {\n\t\t\tif (args.workspaceRoot) {\n\t\t\t\tconst workspaceRoot = resolve(args.workspaceRoot);\n\t\t\t\tconst workspace = await parseWorkspace({\n\t\t\t\t\tworkspaceRoot,\n\t\t\t\t\tversion: args.version,\n\t\t\t\t\ttitle: args.title,\n\t\t\t\t});\n\t\t\t\tconst result = validateWorkspace(workspace);\n\n\t\t\t\tif (result.valid) {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t`✓ ${workspaceRoot} workspace is valid (${workspace.modules.length} file(s))`,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`✗ ${workspaceRoot} has ${result.diagnostics.length} issue(s):\\n`);\n\t\t\t\t\tfor (const d of result.diagnostics) {\n\t\t\t\t\t\tconst prefix =\n\t\t\t\t\t\t\td.severity === \"error\" ? \"ERROR\" : d.severity === \"warning\" ? \"WARN\" : \"INFO\";\n\t\t\t\t\t\tconst pathInfo = d.path ? ` (${d.path})` : \"\";\n\t\t\t\t\t\tconst blockInfo = d.blockId ? ` [${d.blockId}]` : \"\";\n\t\t\t\t\t\tconsole.error(` ${prefix}${pathInfo}${blockInfo}: ${d.message}`);\n\t\t\t\t\t}\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!args.file) {\n\t\t\t\tconsole.error('✗ Missing required argument: <file> (or use --workspace-root \"<dir>\")');\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\tconst filePath = resolve(args.file);\n\t\t\tconst source = await readFile(filePath, \"utf-8\");\n\t\t\tconst document = await parse(source, {\n\t\t\t\tversion: args.version,\n\t\t\t\ttitle: args.title,\n\t\t\t});\n\t\t\tconst result = validate(document);\n\n\t\t\tif (!result.valid) {\n\t\t\t\tconsole.error(`✗ ${filePath} has ${result.diagnostics.length} issue(s):\\n`);\n\t\t\t\tfor (const d of result.diagnostics) {\n\t\t\t\t\tconst prefix =\n\t\t\t\t\t\td.severity === \"error\" ? \"ERROR\" : d.severity === \"warning\" ? \"WARN\" : \"INFO\";\n\t\t\t\t\tconst blockInfo = d.blockId ? ` [${d.blockId}]` : \"\";\n\t\t\t\t\tconsole.error(` ${prefix}${blockInfo}: ${d.message}`);\n\t\t\t\t}\n\t\t\t\tprocess.exit(1);\n\t\t\t} else {\n\t\t\t\tconsole.log(`✓ ${filePath} is valid`);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst target = args.workspaceRoot ? resolve(args.workspaceRoot) : resolve(args.file ?? \".\");\n\t\t\tconsole.error(`✗ Parse error in ${target}:`);\n\t\t\tconsole.error(` ${error instanceof Error ? error.message : String(error)}`);\n\t\t\tprocess.exit(1);\n\t\t}\n\t},\n});\n"],"mappings":";;;AAAA,SAAS,iBAAAA,gBAAe,eAAe;;;ACAvC,SAAS,UAAU,iBAAiB;AACpC,SAAS,UAAU,eAAe;AAClC,SAAS,OAAO,gBAAgB,UAAU,yBAAyB;AACnE,SAAS,qBAAqB;AAEvB,IAAM,eAAe,cAAc;AAAA,EACzC,MAAM;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,EACd;AAAA,EACA,MAAM;AAAA,IACL,MAAM;AAAA,MACL,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,IACX;AAAA,IACA,eAAe;AAAA,MACd,MAAM;AAAA,MACN,aAAa;AAAA,IACd;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,MACN,aAAa;AAAA,MACb,SAAS;AAAA,IACV;AAAA,IACA,SAAS;AAAA,MACR,MAAM;AAAA,MACN,aAAa;AAAA,MACb,SAAS;AAAA,IACV;AAAA,EACD;AAAA,EACA,MAAM,IAAI,EAAE,KAAK,GAAG;AACnB,QAAI,KAAK,eAAe;AACvB,YAAM,gBAAgB,QAAQ,KAAK,aAAa;AAChD,YAAM,YAAY,MAAM,eAAe;AAAA,QACtC;AAAA,QACA,SAAS,KAAK;AAAA,QACd,OAAO,KAAK;AAAA,MACb,CAAC;AACD,YAAMC,UAAS,kBAAkB,SAAS;AAE1C,UAAI,CAACA,QAAO,OAAO;AAClB,gBAAQ,MAAM,iCAA4BA,QAAO,YAAY,MAAM;AAAA,CAAc;AACjF,mBAAW,K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,MAAM,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAC3E,cAAQ,KAAK,CAAC;AAAA,IACf;AAAA,EACD;AACD,CAAC;;;AFxFD,IAAM,OAAOO,eAAc;AAAA,EAC1B,MAAM;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,EACd;AAAA,EACA,aAAa;AAAA,IACZ,UAAU;AAAA,IACV,OAAO;AAAA,EACR;AACD,CAAC;AAED,QAAQ,IAAI;","names":["defineCommand","result","outputPath","readFile","resolve","parse","parseWorkspace","validate","validateWorkspace","defineCommand","result","defineCommand"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/commands/build.ts","../src/commands/studio.ts","../src/commands/validate.ts"],"sourcesContent":["import { defineCommand, runMain } from \"citty\";\nimport { buildCommand } from \"./commands/build.js\";\nimport { studioCommand } from \"./commands/studio.js\";\nimport { validateCommand } from \"./commands/validate.js\";\n\nconst main = defineCommand({\n\tmeta: {\n\t\tname: \"pm\",\n\t\tversion: \"0.1.0\",\n\t\tdescription: \"Product Model CLI — validate and build .product.mdx files\",\n\t},\n\tsubCommands: {\n\t\tvalidate: validateCommand,\n\t\tbuild: buildCommand,\n\t\tstudio: studioCommand,\n\t},\n});\n\nrunMain(main);\n","import { readFile, writeFile } from \"node:fs/promises\";\nimport { basename, resolve } from \"node:path\";\nimport { parse, parseWorkspace, validate, validateWorkspace } from \"@product-model/core\";\nimport { defineCommand } from \"citty\";\n\nexport const buildCommand = defineCommand({\n\tmeta: {\n\t\tname: \"build\",\n\t\tdescription: \"Parse, validate, and output a JSON AST from a .product.mdx file\",\n\t},\n\targs: {\n\t\tfile: {\n\t\t\ttype: \"positional\",\n\t\t\tdescription: \"Path to the .product.mdx file\",\n\t\t\trequired: false,\n\t\t},\n\t\tworkspaceRoot: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Workspace root directory for multi-file build\",\n\t\t},\n\t\toutput: {\n\t\t\ttype: \"string\",\n\t\t\talias: \"o\",\n\t\t\tdescription: \"Output file path (defaults to <filename>.json)\",\n\t\t},\n\t\ttitle: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Document title\",\n\t\t\tdefault: \"Untitled\",\n\t\t},\n\t\tversion: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Document version\",\n\t\t\tdefault: \"0.1.0\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tif (args.workspaceRoot) {\n\t\t\tconst workspaceRoot = resolve(args.workspaceRoot);\n\t\t\tconst workspace = await parseWorkspace({\n\t\t\t\tworkspaceRoot,\n\t\t\t\tversion: args.version,\n\t\t\t\ttitle: args.title,\n\t\t\t});\n\t\t\tconst result = validateWorkspace(workspace);\n\n\t\t\tif (!result.valid) {\n\t\t\t\tconsole.error(`✗ Validation failed with ${result.diagnostics.length} error(s):\\n`);\n\t\t\t\tfor (const d of result.diagnostics) {\n\t\t\t\t\tconst prefix =\n\t\t\t\t\t\td.severity === \"error\" ? \"ERROR\" : d.severity === \"warning\" ? \"WARN\" : \"INFO\";\n\t\t\t\t\tconst pathInfo = d.path ? ` (${d.path})` : \"\";\n\t\t\t\t\tconst blockInfo = d.blockId ? ` [${d.blockId}]` : \"\";\n\t\t\t\t\tconsole.error(` ${prefix}${pathInfo}${blockInfo}: ${d.message}`);\n\t\t\t\t}\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\tconst outputPath = args.output ? resolve(args.output) : resolve(\"workspace.json\");\n\t\t\tawait writeFile(outputPath, JSON.stringify(workspace, null, 2), \"utf-8\");\n\t\t\tconsole.log(`✓ Built ${outputPath}`);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!args.file) {\n\t\t\tconsole.error('✗ Missing required argument: <file> (or use --workspace-root \"<dir>\")');\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tconst filePath = resolve(args.file);\n\t\tconst source = await readFile(filePath, \"utf-8\");\n\t\tconst document = await parse(source, {\n\t\t\tversion: args.version,\n\t\t\ttitle: args.title,\n\t\t});\n\t\tconst result = validate(document);\n\n\t\tif (!result.valid) {\n\t\t\tconsole.error(`✗ Validation failed with ${result.diagnostics.length} error(s):\\n`);\n\t\t\tfor (const d of result.diagnostics) {\n\t\t\t\tconst prefix =\n\t\t\t\t\td.severity === \"error\" ? \"ERROR\" : d.severity === \"warning\" ? \"WARN\" : \"INFO\";\n\t\t\t\tconst blockInfo = d.blockId ? ` [${d.blockId}]` : \"\";\n\t\t\t\tconsole.error(` ${prefix}${blockInfo}: ${d.message}`);\n\t\t\t}\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tconst outputPath = args.output\n\t\t\t? resolve(args.output)\n\t\t\t: resolve(basename(filePath).replace(/\\.product\\.mdx$/, \".json\"));\n\n\t\tawait writeFile(outputPath, JSON.stringify(document, null, 2), \"utf-8\");\n\t\tconsole.log(`✓ Built ${outputPath}`);\n\t},\n});\n","import { defineCommand } from \"citty\";\nimport { spawn, exec } from \"node:child_process\";\nimport { createServer } from \"node:net\";\nimport { createRequire } from \"node:module\";\nimport { dirname, join, resolve } from \"node:path\";\n\nfunction isPortFree(port: number): Promise<boolean> {\n\treturn new Promise((resolve) => {\n\t\tconst server = createServer();\n\t\tserver.once(\"error\", () => resolve(false));\n\t\tserver.once(\"listening\", () => {\n\t\t\tserver.close(() => resolve(true));\n\t\t});\n\t\tserver.listen(port, \"localhost\");\n\t});\n}\n\nfunction openBrowser(url: string): void {\n\tconst cmd =\n\t\tprocess.platform === \"darwin\"\n\t\t\t? \"open\"\n\t\t\t: process.platform === \"win32\"\n\t\t\t\t? \"start\"\n\t\t\t\t: \"xdg-open\";\n\texec(`${cmd} ${url}`);\n}\n\nexport const studioCommand = defineCommand({\n\tmeta: {\n\t\tname: \"studio\",\n\t\tdescription: \"Launch the Product Model visual editor\",\n\t},\n\targs: {\n\t\tport: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Port to run on\",\n\t\t\tdefault: \"3000\",\n\t\t},\n\t\troot: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Project root directory (defaults to current directory)\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst projectRoot = resolve(args.root ?? process.cwd());\n\t\tconst port = Number(args.port);\n\n\t\tconst free = await isPortFree(port);\n\t\tif (!free) {\n\t\t\tconsole.error(`Error: Port ${port} is already in use.`);\n\t\t\tconsole.error(`Try: pm studio --port ${port + 1}`);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tconst require = createRequire(import.meta.url);\n\t\tlet studioDir: string;\n\t\ttry {\n\t\t\tconst studioPkgPath = require.resolve(\"@product-model/studio/package.json\");\n\t\t\tstudioDir = dirname(studioPkgPath);\n\t\t} catch {\n\t\t\tconsole.error(\n\t\t\t\t\"Error: @product-model/studio is not installed.\\n\" +\n\t\t\t\t\t\"Run: npm install @product-model/studio\",\n\t\t\t);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\t// Next.js standalone in a monorepo mirrors the workspace layout\n\t\tconst standaloneDir = join(studioDir, \".next/standalone\");\n\t\tconst serverPath = join(standaloneDir, \"apps/studio/server.js\");\n\n\t\tconsole.log(\"Starting Product Model Studio...\");\n\t\tconsole.log(` Root: ${projectRoot}`);\n\t\tconsole.log(` URL: http://localhost:${port}\\n`);\n\n\t\tconst child = spawn(\"node\", [serverPath], {\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\tPRODUCT_MODEL_ROOT: projectRoot,\n\t\t\t\tPORT: String(port),\n\t\t\t\tHOSTNAME: \"localhost\",\n\t\t\t},\n\t\t\tstdio: \"inherit\",\n\t\t\tcwd: join(standaloneDir, \"apps/studio\"),\n\t\t});\n\n\t\tsetTimeout(() => openBrowser(`http://localhost:${port}`), 1500);\n\n\t\tfor (const signal of [\"SIGINT\", \"SIGTERM\"] as const) {\n\t\t\tprocess.on(signal, () => {\n\t\t\t\tchild.kill(signal);\n\t\t\t});\n\t\t}\n\n\t\tchild.on(\"exit\", (code) => {\n\t\t\tprocess.exit(code ?? 0);\n\t\t});\n\t},\n});\n","import { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\nimport { parse, parseWorkspace, validate, validateWorkspace } from \"@product-model/core\";\nimport { defineCommand } from \"citty\";\n\nexport const validateCommand = defineCommand({\n\tmeta: {\n\t\tname: \"validate\",\n\t\tdescription: \"Validate a .product.mdx file\",\n\t},\n\targs: {\n\t\tfile: {\n\t\t\ttype: \"positional\",\n\t\t\tdescription: \"Path to the .product.mdx file\",\n\t\t\trequired: false,\n\t\t},\n\t\tworkspaceRoot: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Workspace root directory for multi-file validation\",\n\t\t},\n\t\ttitle: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Document title\",\n\t\t\tdefault: \"Untitled\",\n\t\t},\n\t\tversion: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Document version\",\n\t\t\tdefault: \"0.1.0\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\ttry {\n\t\t\tif (args.workspaceRoot) {\n\t\t\t\tconst workspaceRoot = resolve(args.workspaceRoot);\n\t\t\t\tconst workspace = await parseWorkspace({\n\t\t\t\t\tworkspaceRoot,\n\t\t\t\t\tversion: args.version,\n\t\t\t\t\ttitle: args.title,\n\t\t\t\t});\n\t\t\t\tconst result = validateWorkspace(workspace);\n\n\t\t\t\tif (result.valid) {\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t`✓ ${workspaceRoot} workspace is valid (${workspace.modules.length} file(s))`,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`✗ ${workspaceRoot} has ${result.diagnostics.length} issue(s):\\n`);\n\t\t\t\t\tfor (const d of result.diagnostics) {\n\t\t\t\t\t\tconst prefix =\n\t\t\t\t\t\t\td.severity === \"error\" ? \"ERROR\" : d.severity === \"warning\" ? \"WARN\" : \"INFO\";\n\t\t\t\t\t\tconst pathInfo = d.path ? ` (${d.path})` : \"\";\n\t\t\t\t\t\tconst blockInfo = d.blockId ? ` [${d.blockId}]` : \"\";\n\t\t\t\t\t\tconsole.error(` ${prefix}${pathInfo}${blockInfo}: ${d.message}`);\n\t\t\t\t\t}\n\t\t\t\t\tprocess.exit(1);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!args.file) {\n\t\t\t\tconsole.error('✗ Missing required argument: <file> (or use --workspace-root \"<dir>\")');\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\n\t\t\tconst filePath = resolve(args.file);\n\t\t\tconst source = await readFile(filePath, \"utf-8\");\n\t\t\tconst document = await parse(source, {\n\t\t\t\tversion: args.version,\n\t\t\t\ttitle: args.title,\n\t\t\t});\n\t\t\tconst result = validate(document);\n\n\t\t\tif (!result.valid) {\n\t\t\t\tconsole.error(`✗ ${filePath} has ${result.diagnostics.length} issue(s):\\n`);\n\t\t\t\tfor (const d of result.diagnostics) {\n\t\t\t\t\tconst prefix =\n\t\t\t\t\t\td.severity === \"error\" ? \"ERROR\" : d.severity === \"warning\" ? \"WARN\" : \"INFO\";\n\t\t\t\t\tconst blockInfo = d.blockId ? ` [${d.blockId}]` : \"\";\n\t\t\t\t\tconsole.error(` ${prefix}${blockInfo}: ${d.message}`);\n\t\t\t\t}\n\t\t\t\tprocess.exit(1);\n\t\t\t} else {\n\t\t\t\tconsole.log(`✓ ${filePath} is valid`);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst target = args.workspaceRoot ? resolve(args.workspaceRoot) : resolve(args.file ?? \".\");\n\t\t\tconsole.error(`✗ Parse error in ${target}:`);\n\t\t\tconsole.error(` ${error instanceof Error ? error.message : String(error)}`);\n\t\t\tprocess.exit(1);\n\t\t}\n\t},\n});\n"],"mappings":";;;AAAA,SAAS,iBAAAA,gBAAe,eAAe;;;ACAvC,SAAS,UAAU,iBAAiB;AACpC,SAAS,UAAU,eAAe;AAClC,SAAS,OAAO,gBAAgB,UAAU,yBAAyB;AACnE,SAAS,qBAAqB;AAE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aAAa;AACnC,gBAAM,SACL,EAAE,aAAa,UAAU,UAAU,EAAE,aAAa,YAAY,SAAS;AACxE,gBAAM,YAAY,EAAE,UAAU,KAAK,EAAE,OAAO,MAAM;AAClD,kBAAQ,MAAM,KAAK,MAAM,GAAG,SAAS,KAAK,EAAE,OAAO,EAAE;AAAA,QACtD;AACA,gBAAQ,KAAK,CAAC;AAAA,MACf,OAAO;AACN,gBAAQ,IAAI,UAAK,QAAQ,WAAW;AAAA,MACrC;AAAA,IACD,SAAS,OAAO;AACf,YAAM,SAAS,KAAK,gBAAgBH,SAAQ,KAAK,aAAa,IAAIA,SAAQ,KAAK,QAAQ,GAAG;AAC1F,cAAQ,MAAM,yBAAoB,MAAM,GAAG;AAC3C,cAAQ,MAAM,KAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAC3E,cAAQ,KAAK,CAAC;AAAA,IACf;AAAA,EACD;AACD,CAAC;;;AHvFD,IAAM,OAAOO,eAAc;AAAA,EAC1B,MAAM;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,EACd;AAAA,EACA,aAAa;AAAA,IACZ,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,EACT;AACD,CAAC;AAED,QAAQ,IAAI;","names":["defineCommand","result","outputPath","defineCommand","resolve","require","readFile","resolve","parse","parseWorkspace","validate","validateWorkspace","defineCommand","result","defineCommand"]}
|
package/package.json
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
2
|
+
"name": "@product-model/cli",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"pm": "./dist/index.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"citty": "^0.1.6",
|
|
13
|
+
"@product-model/core": "0.1.0",
|
|
14
|
+
"@product-model/studio": "0.1.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/node": "^25.3.2",
|
|
18
|
+
"tsup": "^8.3.6",
|
|
19
|
+
"typescript": "^5.7.3"
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=22"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup",
|
|
27
|
+
"typecheck": "tsc --noEmit"
|
|
28
|
+
}
|
|
29
|
+
}
|