openspecui 2.0.1 → 2.0.2

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as SchemaInfoSchema, c as toOpsxDisplayPath, d as DEFAULT_CONFIG, f as OpenSpecAdapter, i as SchemaDetailSchema, l as CliExecutor, m as __toESM, o as SchemaResolutionSchema, p as __commonJS, r as require_dist, s as TemplatesSchema, t as startServer, u as ConfigManager } from "./src-CFsMWl3_.mjs";
2
+ import { a as SchemaInfoSchema, c as toOpsxDisplayPath, d as DEFAULT_CONFIG, f as OpenSpecAdapter, i as SchemaDetailSchema, l as CliExecutor, m as __toESM, o as SchemaResolutionSchema, p as __commonJS, r as require_dist, s as TemplatesSchema, t as startServer, u as ConfigManager } from "./src-Cx7GJTGT.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { basename, dirname, extname, join, normalize, relative, resolve } from "path";
5
5
  import { readFile } from "node:fs/promises";
@@ -4507,7 +4507,7 @@ var yargs_default = Yargs;
4507
4507
  //#endregion
4508
4508
  //#region package.json
4509
4509
  var import_dist = require_dist();
4510
- var version = "2.0.1";
4510
+ var version = "2.0.2";
4511
4511
 
4512
4512
  //#endregion
4513
4513
  //#region src/export.ts
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as createServer, t as startServer } from "./src-CFsMWl3_.mjs";
1
+ import { n as createServer, t as startServer } from "./src-Cx7GJTGT.mjs";
2
2
 
3
3
  export { createServer, startServer };
@@ -24027,43 +24027,51 @@ function endDashboardGitTask(error) {
24027
24027
  if (error) dashboardGitTaskStatus.lastError = error instanceof Error ? error.message : String(error);
24028
24028
  emitDashboardGitTaskStatus();
24029
24029
  }
24030
- function parseGitDirFromDotGitFile(content) {
24031
- const line = content.split(/\r?\n/).map((item) => item.trim()).find((item) => item.startsWith("gitdir:"));
24032
- if (!line) return null;
24033
- const rawPath = line.slice(7).trim();
24034
- return rawPath.length > 0 ? rawPath : null;
24030
+ const DASHBOARD_GIT_REFRESH_STAMP_NAME = "openspecui-dashboard-git-refresh.stamp";
24031
+ async function resolveGitMetadataDir(projectDir) {
24032
+ try {
24033
+ const { stdout } = await execFileAsync("git", ["rev-parse", "--git-dir"], {
24034
+ cwd: projectDir,
24035
+ maxBuffer: 1024 * 1024,
24036
+ encoding: "utf8"
24037
+ });
24038
+ const gitDirRaw = stdout.trim();
24039
+ if (!gitDirRaw) return null;
24040
+ const gitDirPath = resolve$1(projectDir, gitDirRaw);
24041
+ if (!(await stat(gitDirPath)).isDirectory()) return null;
24042
+ return gitDirPath;
24043
+ } catch {
24044
+ return null;
24045
+ }
24046
+ }
24047
+ async function resolveGitMetadataDirReactive(projectDir) {
24048
+ const gitMetadataDir = await resolveGitMetadataDir(projectDir);
24049
+ if (!gitMetadataDir) return null;
24050
+ await reactiveReadDir(gitMetadataDir, { includeHidden: true });
24051
+ return gitMetadataDir;
24035
24052
  }
24036
- function getDashboardGitRefreshStampPath(projectDir) {
24037
- return join$1(projectDir, "openspec", ".openspecui-dashboard-git-refresh.stamp");
24053
+ function getDashboardGitRefreshStampPath(gitMetadataDir) {
24054
+ return join$1(gitMetadataDir, DASHBOARD_GIT_REFRESH_STAMP_NAME);
24038
24055
  }
24039
24056
  async function touchDashboardGitRefreshStamp(projectDir, reason) {
24040
- const stampPath = getDashboardGitRefreshStampPath(projectDir);
24057
+ const gitMetadataDir = await resolveGitMetadataDir(projectDir);
24058
+ if (!gitMetadataDir) return { skipped: true };
24059
+ const stampPath = getDashboardGitRefreshStampPath(gitMetadataDir);
24041
24060
  await mkdir$1(dirname$1(stampPath), { recursive: true });
24042
24061
  await writeFile$1(stampPath, `${Date.now()} ${reason}\n`, "utf8");
24062
+ return { skipped: false };
24043
24063
  }
24044
24064
  async function registerDashboardGitReactiveDeps(projectDir) {
24045
24065
  await reactiveReadDir(projectDir, {
24046
24066
  includeHidden: true,
24047
24067
  exclude: ["node_modules"]
24048
24068
  });
24049
- await reactiveReadFile(getDashboardGitRefreshStampPath(projectDir));
24050
- const dotGitPath = join$1(projectDir, ".git");
24051
- if (!await reactiveExists(dotGitPath)) return;
24052
- const dotGitFileContent = await reactiveReadFile(dotGitPath);
24053
- if (dotGitFileContent !== null) {
24054
- const gitDirRaw = parseGitDirFromDotGitFile(dotGitFileContent);
24055
- if (!gitDirRaw) return;
24056
- const gitDirPath = resolve$1(projectDir, gitDirRaw);
24057
- await reactiveReadDir(gitDirPath, { includeHidden: true });
24058
- await reactiveReadFile(join$1(gitDirPath, "HEAD"));
24059
- await reactiveReadFile(join$1(gitDirPath, "index"));
24060
- await reactiveReadFile(join$1(gitDirPath, "packed-refs"));
24061
- return;
24062
- }
24063
- await reactiveReadDir(dotGitPath, { includeHidden: true });
24064
- await reactiveReadFile(join$1(dotGitPath, "HEAD"));
24065
- await reactiveReadFile(join$1(dotGitPath, "index"));
24066
- await reactiveReadFile(join$1(dotGitPath, "packed-refs"));
24069
+ const gitMetadataDir = await resolveGitMetadataDirReactive(projectDir);
24070
+ if (!gitMetadataDir) return;
24071
+ await reactiveReadFile(getDashboardGitRefreshStampPath(gitMetadataDir));
24072
+ await reactiveReadFile(join$1(gitMetadataDir, "HEAD"));
24073
+ await reactiveReadFile(join$1(gitMetadataDir, "index"));
24074
+ await reactiveReadFile(join$1(gitMetadataDir, "packed-refs"));
24067
24075
  }
24068
24076
  function requireChangeId(changeId) {
24069
24077
  if (!changeId) throw new Error("change is required");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openspecui",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "OpenSpec UI - Visual interface for spec-driven development",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -34,7 +34,7 @@
34
34
  "vitest": "^2.1.8",
35
35
  "yargs": "^18.0.0",
36
36
  "@openspecui/web": "2.0.1",
37
- "@openspecui/server": "2.0.0"
37
+ "@openspecui/server": "2.0.2"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "pnpm run build:web && pnpm run build:copy-web && tsdown",