openspecui 1.5.0 → 1.5.1

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/cli.mjs +36 -20
  2. package/package.json +3 -3
package/dist/cli.mjs CHANGED
@@ -4506,22 +4506,7 @@ var yargs_default = Yargs;
4506
4506
  //#endregion
4507
4507
  //#region package.json
4508
4508
  var import_dist = require_dist();
4509
- var version = "1.5.0";
4510
- var devDependencies = {
4511
- "@hono/node-server": "^1.14.1",
4512
- "@openspecui/server": "workspace:*",
4513
- "@openspecui/web": "workspace:*",
4514
- "@types/node": "^22.10.2",
4515
- "@types/ws": "^8.5.13",
4516
- "@types/yargs": "^17.0.35",
4517
- "hono": "^4.7.3",
4518
- "open": "^10.1.0",
4519
- "tsdown": "^0.16.6",
4520
- "tsx": "^4.19.2",
4521
- "typescript": "^5.7.2",
4522
- "vitest": "^2.1.8",
4523
- "yargs": "^18.0.0"
4524
- };
4509
+ var version = "1.5.1";
4525
4510
 
4526
4511
  //#endregion
4527
4512
  //#region src/export.ts
@@ -4747,6 +4732,11 @@ function runCommand(cmd, args, cwd) {
4747
4732
  child.on("error", (err) => reject(err));
4748
4733
  });
4749
4734
  }
4735
+ const LOCAL_PACKAGE_PROTOCOLS = [
4736
+ "workspace:",
4737
+ "file:",
4738
+ "link:"
4739
+ ];
4750
4740
  /**
4751
4741
  * Detect the package manager used in the current project
4752
4742
  */
@@ -4797,12 +4787,36 @@ function getRunCommand(pm, bin) {
4797
4787
  };
4798
4788
  }
4799
4789
  }
4790
+ function findNearestPackageJson(startDir) {
4791
+ let currentDir = startDir;
4792
+ while (true) {
4793
+ const packageJsonPath = join$1(currentDir, "package.json");
4794
+ if (existsSync(packageJsonPath)) return packageJsonPath;
4795
+ const parentDir = dirname$1(currentDir);
4796
+ if (parentDir === currentDir) return null;
4797
+ currentDir = parentDir;
4798
+ }
4799
+ }
4800
+ function readWebPackageRangeFromPackageJson(startDir) {
4801
+ const packageJsonPath = findNearestPackageJson(startDir);
4802
+ if (!packageJsonPath) return null;
4803
+ try {
4804
+ const packageJsonRaw = readFileSync(packageJsonPath, "utf-8");
4805
+ const parsed = JSON.parse(packageJsonRaw);
4806
+ return parsed.dependencies?.["@openspecui/web"] ?? parsed.devDependencies?.["@openspecui/web"] ?? parsed.peerDependencies?.["@openspecui/web"] ?? parsed.optionalDependencies?.["@openspecui/web"] ?? null;
4807
+ } catch {
4808
+ return null;
4809
+ }
4810
+ }
4811
+ function isLocalPackageRange(range) {
4812
+ if (!range) return false;
4813
+ return LOCAL_PACKAGE_PROTOCOLS.some((protocol) => range.startsWith(protocol));
4814
+ }
4800
4815
  /**
4801
4816
  * Get the exec command for running a package binary
4802
4817
  * Uses appropriate flags to ensure the correct version of @openspecui/web is installed
4803
4818
  */
4804
- function getExecCommand(pm) {
4805
- const webPkgSpec = `@openspecui/web@${devDependencies["@openspecui/web"]}`;
4819
+ function getExecCommand(pm, webPkgSpec) {
4806
4820
  switch (pm) {
4807
4821
  case "bun": return {
4808
4822
  cmd: "bunx",
@@ -4867,7 +4881,9 @@ async function exportHtml(options) {
4867
4881
  writeFileSync(dataJsonPath, JSON.stringify(snapshot, null, 2));
4868
4882
  console.log(`Data snapshot written to ${dataJsonPath}`);
4869
4883
  const localWebPkg = findLocalWebPackage();
4870
- if (localWebPkg) {
4884
+ const webPackageRange = readWebPackageRangeFromPackageJson(__dirname$1);
4885
+ if (isLocalPackageRange(webPackageRange)) {
4886
+ if (!localWebPkg) throw new Error(`Detected local/dev @openspecui/web range "${webPackageRange}" but local web package was not found`);
4871
4887
  console.log("\n[Local dev mode] Running SSG from local web package...");
4872
4888
  await runCommand("pnpm", [
4873
4889
  "tsx",
@@ -4882,7 +4898,7 @@ async function exportHtml(options) {
4882
4898
  } else {
4883
4899
  console.log("\n[Production mode] Running SSG via @openspecui/web...");
4884
4900
  const pm = detectPackageManager();
4885
- const execCmd = getExecCommand(pm);
4901
+ const execCmd = getExecCommand(pm, `@openspecui/web@${webPackageRange || version}`);
4886
4902
  try {
4887
4903
  await runCommand(execCmd.cmd, [
4888
4904
  ...execCmd.args,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openspecui",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "OpenSpec UI - Visual interface for spec-driven development",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -33,8 +33,8 @@
33
33
  "typescript": "^5.7.2",
34
34
  "vitest": "^2.1.8",
35
35
  "yargs": "^18.0.0",
36
- "@openspecui/server": "1.5.0",
37
- "@openspecui/web": "1.5.0"
36
+ "@openspecui/web": "1.5.0",
37
+ "@openspecui/server": "1.5.0"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "pnpm run build:web && pnpm run build:copy-web && tsdown",