openspecui 0.9.1 → 0.9.4
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/dist/cli.mjs +122 -30
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -4504,7 +4504,7 @@ var yargs_default = Yargs;
|
|
|
4504
4504
|
|
|
4505
4505
|
//#endregion
|
|
4506
4506
|
//#region package.json
|
|
4507
|
-
var version = "0.9.
|
|
4507
|
+
var version = "0.9.4";
|
|
4508
4508
|
|
|
4509
4509
|
//#endregion
|
|
4510
4510
|
//#region src/export.ts
|
|
@@ -4618,7 +4618,8 @@ function runCommand(cmd, args, cwd) {
|
|
|
4618
4618
|
return new Promise((resolvePromise, reject) => {
|
|
4619
4619
|
const child = spawn(cmd, args, {
|
|
4620
4620
|
stdio: "inherit",
|
|
4621
|
-
cwd
|
|
4621
|
+
cwd,
|
|
4622
|
+
shell: true
|
|
4622
4623
|
});
|
|
4623
4624
|
child.on("close", (code) => {
|
|
4624
4625
|
if (code === 0) resolvePromise();
|
|
@@ -4628,6 +4629,97 @@ function runCommand(cmd, args, cwd) {
|
|
|
4628
4629
|
});
|
|
4629
4630
|
}
|
|
4630
4631
|
/**
|
|
4632
|
+
* Detect the package manager used in the current project
|
|
4633
|
+
*/
|
|
4634
|
+
function detectPackageManager() {
|
|
4635
|
+
if (process.env.DENO_VERSION) return "deno";
|
|
4636
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
4637
|
+
if (userAgent) {
|
|
4638
|
+
if (userAgent.startsWith("bun")) return "bun";
|
|
4639
|
+
if (userAgent.startsWith("pnpm")) return "pnpm";
|
|
4640
|
+
if (userAgent.startsWith("yarn")) return "yarn";
|
|
4641
|
+
if (userAgent.startsWith("npm")) return "npm";
|
|
4642
|
+
if (userAgent.startsWith("deno")) return "deno";
|
|
4643
|
+
}
|
|
4644
|
+
if (existsSync("deno.lock")) return "deno";
|
|
4645
|
+
if (existsSync("bun.lockb") || existsSync("bun.lock")) return "bun";
|
|
4646
|
+
if (existsSync("pnpm-lock.yaml")) return "pnpm";
|
|
4647
|
+
if (existsSync("yarn.lock")) return "yarn";
|
|
4648
|
+
return "npm";
|
|
4649
|
+
}
|
|
4650
|
+
/**
|
|
4651
|
+
* Get the command to run a local binary (like vite)
|
|
4652
|
+
*/
|
|
4653
|
+
function getRunCommand(pm, bin) {
|
|
4654
|
+
switch (pm) {
|
|
4655
|
+
case "bun": return {
|
|
4656
|
+
cmd: "bunx",
|
|
4657
|
+
args: [bin]
|
|
4658
|
+
};
|
|
4659
|
+
case "pnpm": return {
|
|
4660
|
+
cmd: "pnpm",
|
|
4661
|
+
args: ["exec", bin]
|
|
4662
|
+
};
|
|
4663
|
+
case "yarn": return {
|
|
4664
|
+
cmd: "yarn",
|
|
4665
|
+
args: [bin]
|
|
4666
|
+
};
|
|
4667
|
+
case "deno": return {
|
|
4668
|
+
cmd: "deno",
|
|
4669
|
+
args: [
|
|
4670
|
+
"run",
|
|
4671
|
+
"-A",
|
|
4672
|
+
`npm:${bin}`
|
|
4673
|
+
]
|
|
4674
|
+
};
|
|
4675
|
+
default: return {
|
|
4676
|
+
cmd: "npx",
|
|
4677
|
+
args: [bin]
|
|
4678
|
+
};
|
|
4679
|
+
}
|
|
4680
|
+
}
|
|
4681
|
+
/**
|
|
4682
|
+
* Get the exec command for running a package binary
|
|
4683
|
+
* Uses appropriate flags to ensure the correct version of @openspecui/web is installed
|
|
4684
|
+
*/
|
|
4685
|
+
function getExecCommand(pm) {
|
|
4686
|
+
const webPkgSpec = `@openspecui/web@${version}`;
|
|
4687
|
+
switch (pm) {
|
|
4688
|
+
case "bun": return {
|
|
4689
|
+
cmd: "bunx",
|
|
4690
|
+
args: [
|
|
4691
|
+
"-p",
|
|
4692
|
+
webPkgSpec,
|
|
4693
|
+
"openspecui-ssg"
|
|
4694
|
+
]
|
|
4695
|
+
};
|
|
4696
|
+
case "pnpm": return {
|
|
4697
|
+
cmd: "pnpm",
|
|
4698
|
+
args: ["dlx", webPkgSpec]
|
|
4699
|
+
};
|
|
4700
|
+
case "yarn": return {
|
|
4701
|
+
cmd: "yarn",
|
|
4702
|
+
args: ["dlx", webPkgSpec]
|
|
4703
|
+
};
|
|
4704
|
+
case "deno": return {
|
|
4705
|
+
cmd: "deno",
|
|
4706
|
+
args: [
|
|
4707
|
+
"run",
|
|
4708
|
+
"-A",
|
|
4709
|
+
`npm:${webPkgSpec}/openspecui-ssg`
|
|
4710
|
+
]
|
|
4711
|
+
};
|
|
4712
|
+
default: return {
|
|
4713
|
+
cmd: "npx",
|
|
4714
|
+
args: [
|
|
4715
|
+
"-p",
|
|
4716
|
+
webPkgSpec,
|
|
4717
|
+
"openspecui-ssg"
|
|
4718
|
+
]
|
|
4719
|
+
};
|
|
4720
|
+
}
|
|
4721
|
+
}
|
|
4722
|
+
/**
|
|
4631
4723
|
* Export as JSON only (data.json)
|
|
4632
4724
|
*/
|
|
4633
4725
|
async function exportJson(options) {
|
|
@@ -4658,49 +4750,49 @@ async function exportHtml(options) {
|
|
|
4658
4750
|
const localWebPkg = findLocalWebPackage();
|
|
4659
4751
|
if (localWebPkg) {
|
|
4660
4752
|
console.log("\n[Local dev mode] Running SSG from local web package...");
|
|
4661
|
-
|
|
4662
|
-
await runCommand("pnpm", ["build:client"], localWebPkg);
|
|
4663
|
-
console.log("Building SSR bundle...");
|
|
4664
|
-
await runCommand("pnpm", ["build:server"], localWebPkg);
|
|
4665
|
-
console.log("Pre-rendering pages...");
|
|
4666
|
-
const clientDistDir = join$1(localWebPkg, "dist", "client");
|
|
4667
|
-
await runCommand("npx", [
|
|
4753
|
+
await runCommand("pnpm", [
|
|
4668
4754
|
"tsx",
|
|
4669
|
-
"src
|
|
4755
|
+
join$1(localWebPkg, "src", "ssg", "cli.ts"),
|
|
4670
4756
|
"--data",
|
|
4671
4757
|
dataJsonPath,
|
|
4672
4758
|
"--output",
|
|
4673
|
-
|
|
4759
|
+
outputDir,
|
|
4674
4760
|
"--base-path",
|
|
4675
4761
|
basePath
|
|
4676
4762
|
], localWebPkg);
|
|
4677
|
-
console.log("\nCopying to output directory...");
|
|
4678
|
-
const { cpSync } = await import("node:fs");
|
|
4679
|
-
cpSync(clientDistDir, outputDir, { recursive: true });
|
|
4680
|
-
writeFileSync(join$1(outputDir, "data.json"), JSON.stringify(snapshot, null, 2));
|
|
4681
|
-
console.log(`\nExport complete: ${outputDir}`);
|
|
4682
4763
|
} else {
|
|
4683
|
-
console.log("\
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4764
|
+
console.log("\n[Production mode] Running SSG via @openspecui/web...");
|
|
4765
|
+
const pm = detectPackageManager();
|
|
4766
|
+
const execCmd = getExecCommand(pm);
|
|
4767
|
+
try {
|
|
4768
|
+
await runCommand(execCmd.cmd, [
|
|
4769
|
+
...execCmd.args,
|
|
4770
|
+
"--data",
|
|
4771
|
+
dataJsonPath,
|
|
4772
|
+
"--output",
|
|
4773
|
+
outputDir,
|
|
4774
|
+
"--base-path",
|
|
4775
|
+
basePath
|
|
4776
|
+
], process.cwd());
|
|
4777
|
+
} catch (err) {
|
|
4778
|
+
console.error("\nSSG failed. Make sure @openspecui/web is installed:");
|
|
4779
|
+
console.error(` ${pm} add @openspecui/web`);
|
|
4780
|
+
throw err;
|
|
4781
|
+
}
|
|
4691
4782
|
}
|
|
4783
|
+
console.log(`\nExport complete: ${outputDir}`);
|
|
4692
4784
|
if (open) {
|
|
4693
4785
|
console.log("\nStarting preview server...");
|
|
4694
|
-
const
|
|
4695
|
-
"vite",
|
|
4786
|
+
const viteArgs = [
|
|
4696
4787
|
"preview",
|
|
4697
4788
|
"--outDir",
|
|
4698
4789
|
resolve$1(outputDir)
|
|
4699
4790
|
];
|
|
4700
|
-
if (previewPort)
|
|
4701
|
-
if (previewHost)
|
|
4702
|
-
|
|
4703
|
-
|
|
4791
|
+
if (previewPort) viteArgs.push("--port", String(previewPort));
|
|
4792
|
+
if (previewHost) viteArgs.push("--host", previewHost);
|
|
4793
|
+
viteArgs.push("--open");
|
|
4794
|
+
const { cmd, args } = getRunCommand(detectPackageManager(), "vite");
|
|
4795
|
+
await runCommand(cmd, [...args, ...viteArgs], outputDir);
|
|
4704
4796
|
}
|
|
4705
4797
|
}
|
|
4706
4798
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openspecui",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "OpenSpec UI - Visual interface for spec-driven development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typescript": "^5.7.2",
|
|
32
32
|
"vitest": "^2.1.8",
|
|
33
33
|
"yargs": "^18.0.0",
|
|
34
|
-
"@openspecui/web": "0.9.
|
|
34
|
+
"@openspecui/web": "0.9.3",
|
|
35
35
|
"@openspecui/server": "0.9.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|