@openspecui/core 1.5.0 → 1.6.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/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { n as toOpsxDisplayPath, t as VIRTUAL_PROJECT_DIRNAME } from "./opsx-display-path-RBULE8_G.mjs";
1
2
  import { AsyncLocalStorage } from "node:async_hooks";
2
3
  import { z } from "zod";
3
4
  import { EventEmitter } from "events";
@@ -17,13 +18,13 @@ declare const ChangeFileSchema: z.ZodObject<{
17
18
  /** Optional byte size for files */
18
19
  size: z.ZodOptional<z.ZodNumber>;
19
20
  }, "strip", z.ZodTypeAny, {
20
- type: "file" | "directory";
21
21
  path: string;
22
+ type: "file" | "directory";
22
23
  content?: string | undefined;
23
24
  size?: number | undefined;
24
25
  }, {
25
- type: "file" | "directory";
26
26
  path: string;
27
+ type: "file" | "directory";
27
28
  content?: string | undefined;
28
29
  size?: number | undefined;
29
30
  }>;
@@ -677,14 +678,16 @@ declare class OpenSpecAdapter {
677
678
  listChanges(): Promise<string[]>;
678
679
  /**
679
680
  * List changes with metadata (id, name, progress, and time info)
680
- * Only returns changes that have valid proposal.md
681
+ * Returns every change directory, including schema-specific layouts that
682
+ * don't use proposal.md/tasks.md.
681
683
  * Sorted by updatedAt descending (most recent first)
682
684
  */
683
685
  listChangesWithMeta(): Promise<ChangeMeta[]>;
684
686
  listArchivedChanges(): Promise<string[]>;
685
687
  /**
686
688
  * List archived changes with metadata and time info
687
- * Only returns archives that have valid proposal.md
689
+ * Returns every archive directory, including schema-specific layouts that
690
+ * don't use proposal.md/tasks.md.
688
691
  * Sorted by updatedAt descending (most recent first)
689
692
  */
690
693
  listArchivedChangesWithMeta(): Promise<ArchiveMeta[]>;
@@ -1308,8 +1311,11 @@ declare function createFileChangeObservable(watcher: OpenSpecWatcher): {
1308
1311
  };
1309
1312
  //#endregion
1310
1313
  //#region src/config.d.ts
1314
+ declare const CODE_EDITOR_THEME_VALUES: readonly ["github", "material", "vscode", "tokyo", "gruvbox", "monokai", "nord"];
1311
1315
  declare const TerminalRendererEngineSchema: z.ZodEnum<["xterm", "ghostty"]>;
1312
1316
  type TerminalRendererEngine = z.infer<typeof TerminalRendererEngineSchema>;
1317
+ declare const CodeEditorThemeSchema: z.ZodEnum<["github", "material", "vscode", "tokyo", "gruvbox", "monokai", "nord"]>;
1318
+ type CodeEditorTheme = z.infer<typeof CodeEditorThemeSchema>;
1313
1319
  declare function isTerminalRendererEngine(value: string): value is TerminalRendererEngine;
1314
1320
  type RunnerId = 'configured' | 'openspec' | 'npx' | 'bunx' | 'deno' | 'pnpm' | 'yarn';
1315
1321
  interface CliRunnerCandidate {
@@ -1428,6 +1434,14 @@ declare const OpenSpecUIConfigSchema: z.ZodObject<{
1428
1434
  }>>;
1429
1435
  /** 主题 */
1430
1436
  theme: z.ZodDefault<z.ZodEnum<["light", "dark", "system"]>>;
1437
+ /** 代码编辑器配置 */
1438
+ codeEditor: z.ZodDefault<z.ZodObject<{
1439
+ theme: z.ZodDefault<z.ZodEnum<["github", "material", "vscode", "tokyo", "gruvbox", "monokai", "nord"]>>;
1440
+ }, "strip", z.ZodTypeAny, {
1441
+ theme: "github" | "material" | "vscode" | "tokyo" | "gruvbox" | "monokai" | "nord";
1442
+ }, {
1443
+ theme?: "github" | "material" | "vscode" | "tokyo" | "gruvbox" | "monokai" | "nord" | undefined;
1444
+ }>>;
1431
1445
  /** 终端配置 */
1432
1446
  terminal: z.ZodDefault<z.ZodObject<{
1433
1447
  fontSize: z.ZodDefault<z.ZodNumber>;
@@ -1460,11 +1474,14 @@ declare const OpenSpecUIConfigSchema: z.ZodObject<{
1460
1474
  trendPointLimit?: number | undefined;
1461
1475
  }>>;
1462
1476
  }, "strip", z.ZodTypeAny, {
1477
+ theme: "light" | "dark" | "system";
1463
1478
  cli: {
1464
1479
  command?: string | undefined;
1465
1480
  args?: string[] | undefined;
1466
1481
  };
1467
- theme: "light" | "dark" | "system";
1482
+ codeEditor: {
1483
+ theme: "github" | "material" | "vscode" | "tokyo" | "gruvbox" | "monokai" | "nord";
1484
+ };
1468
1485
  terminal: {
1469
1486
  fontSize: number;
1470
1487
  fontFamily: string;
@@ -1477,11 +1494,14 @@ declare const OpenSpecUIConfigSchema: z.ZodObject<{
1477
1494
  trendPointLimit: number;
1478
1495
  };
1479
1496
  }, {
1497
+ theme?: "light" | "dark" | "system" | undefined;
1480
1498
  cli?: {
1481
1499
  command?: string | undefined;
1482
1500
  args?: string[] | undefined;
1483
1501
  } | undefined;
1484
- theme?: "light" | "dark" | "system" | undefined;
1502
+ codeEditor?: {
1503
+ theme?: "github" | "material" | "vscode" | "tokyo" | "gruvbox" | "monokai" | "nord" | undefined;
1504
+ } | undefined;
1485
1505
  terminal?: {
1486
1506
  fontSize?: number | undefined;
1487
1507
  fontFamily?: string | undefined;
@@ -1501,6 +1521,7 @@ type OpenSpecUIConfigUpdate = {
1501
1521
  args?: string[] | null;
1502
1522
  };
1503
1523
  theme?: OpenSpecUIConfig['theme'];
1524
+ codeEditor?: Partial<OpenSpecUIConfig['codeEditor']>;
1504
1525
  terminal?: Partial<TerminalConfig>;
1505
1526
  dashboard?: Partial<DashboardConfig>;
1506
1527
  };
@@ -1824,14 +1845,14 @@ declare const ArtifactStatusSchema: z.ZodObject<{
1824
1845
  missingDeps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1825
1846
  relativePath: z.ZodOptional<z.ZodString>;
1826
1847
  }, "strip", z.ZodTypeAny, {
1827
- status: "done" | "ready" | "blocked";
1828
1848
  id: string;
1849
+ status: "done" | "ready" | "blocked";
1829
1850
  outputPath: string;
1830
1851
  missingDeps?: string[] | undefined;
1831
1852
  relativePath?: string | undefined;
1832
1853
  }, {
1833
- status: "done" | "ready" | "blocked";
1834
1854
  id: string;
1855
+ status: "done" | "ready" | "blocked";
1835
1856
  outputPath: string;
1836
1857
  missingDeps?: string[] | undefined;
1837
1858
  relativePath?: string | undefined;
@@ -1849,14 +1870,14 @@ declare const ChangeStatusSchema: z.ZodObject<{
1849
1870
  missingDeps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1850
1871
  relativePath: z.ZodOptional<z.ZodString>;
1851
1872
  }, "strip", z.ZodTypeAny, {
1852
- status: "done" | "ready" | "blocked";
1853
1873
  id: string;
1874
+ status: "done" | "ready" | "blocked";
1854
1875
  outputPath: string;
1855
1876
  missingDeps?: string[] | undefined;
1856
1877
  relativePath?: string | undefined;
1857
1878
  }, {
1858
- status: "done" | "ready" | "blocked";
1859
1879
  id: string;
1880
+ status: "done" | "ready" | "blocked";
1860
1881
  outputPath: string;
1861
1882
  missingDeps?: string[] | undefined;
1862
1883
  relativePath?: string | undefined;
@@ -1867,8 +1888,8 @@ declare const ChangeStatusSchema: z.ZodObject<{
1867
1888
  isComplete: boolean;
1868
1889
  applyRequires: string[];
1869
1890
  artifacts: {
1870
- status: "done" | "ready" | "blocked";
1871
1891
  id: string;
1892
+ status: "done" | "ready" | "blocked";
1872
1893
  outputPath: string;
1873
1894
  missingDeps?: string[] | undefined;
1874
1895
  relativePath?: string | undefined;
@@ -1879,8 +1900,8 @@ declare const ChangeStatusSchema: z.ZodObject<{
1879
1900
  isComplete: boolean;
1880
1901
  applyRequires: string[];
1881
1902
  artifacts: {
1882
- status: "done" | "ready" | "blocked";
1883
1903
  id: string;
1904
+ status: "done" | "ready" | "blocked";
1884
1905
  outputPath: string;
1885
1906
  missingDeps?: string[] | undefined;
1886
1907
  relativePath?: string | undefined;
@@ -1893,13 +1914,13 @@ declare const DependencyInfoSchema: z.ZodObject<{
1893
1914
  path: z.ZodString;
1894
1915
  description: z.ZodString;
1895
1916
  }, "strip", z.ZodTypeAny, {
1896
- path: string;
1897
1917
  id: string;
1918
+ path: string;
1898
1919
  description: string;
1899
1920
  done: boolean;
1900
1921
  }, {
1901
- path: string;
1902
1922
  id: string;
1923
+ path: string;
1903
1924
  description: string;
1904
1925
  done: boolean;
1905
1926
  }>;
@@ -2007,13 +2028,13 @@ declare const ArtifactInstructionsSchema: z.ZodObject<{
2007
2028
  path: z.ZodString;
2008
2029
  description: z.ZodString;
2009
2030
  }, "strip", z.ZodTypeAny, {
2010
- path: string;
2011
2031
  id: string;
2032
+ path: string;
2012
2033
  description: string;
2013
2034
  done: boolean;
2014
2035
  }, {
2015
- path: string;
2016
2036
  id: string;
2037
+ path: string;
2017
2038
  description: string;
2018
2039
  done: boolean;
2019
2040
  }>, "many">;
@@ -2027,8 +2048,8 @@ declare const ArtifactInstructionsSchema: z.ZodObject<{
2027
2048
  artifactId: string;
2028
2049
  template: string;
2029
2050
  dependencies: {
2030
- path: string;
2031
2051
  id: string;
2052
+ path: string;
2032
2053
  description: string;
2033
2054
  done: boolean;
2034
2055
  }[];
@@ -2045,8 +2066,8 @@ declare const ArtifactInstructionsSchema: z.ZodObject<{
2045
2066
  artifactId: string;
2046
2067
  template: string;
2047
2068
  dependencies: {
2048
- path: string;
2049
2069
  id: string;
2070
+ path: string;
2050
2071
  description: string;
2051
2072
  done: boolean;
2052
2073
  }[];
@@ -2077,43 +2098,54 @@ declare const SchemaResolutionSchema: z.ZodObject<{
2077
2098
  name: z.ZodString;
2078
2099
  source: z.ZodEnum<["project", "user", "package"]>;
2079
2100
  path: z.ZodString;
2101
+ displayPath: z.ZodOptional<z.ZodString>;
2080
2102
  shadows: z.ZodArray<z.ZodObject<{
2081
2103
  source: z.ZodEnum<["project", "user", "package"]>;
2082
2104
  path: z.ZodString;
2105
+ displayPath: z.ZodOptional<z.ZodString>;
2083
2106
  }, "strip", z.ZodTypeAny, {
2084
2107
  path: string;
2085
2108
  source: "project" | "user" | "package";
2109
+ displayPath?: string | undefined;
2086
2110
  }, {
2087
2111
  path: string;
2088
2112
  source: "project" | "user" | "package";
2113
+ displayPath?: string | undefined;
2089
2114
  }>, "many">;
2090
2115
  }, "strip", z.ZodTypeAny, {
2091
- path: string;
2092
2116
  name: string;
2117
+ path: string;
2093
2118
  source: "project" | "user" | "package";
2094
2119
  shadows: {
2095
2120
  path: string;
2096
2121
  source: "project" | "user" | "package";
2122
+ displayPath?: string | undefined;
2097
2123
  }[];
2124
+ displayPath?: string | undefined;
2098
2125
  }, {
2099
- path: string;
2100
2126
  name: string;
2127
+ path: string;
2101
2128
  source: "project" | "user" | "package";
2102
2129
  shadows: {
2103
2130
  path: string;
2104
2131
  source: "project" | "user" | "package";
2132
+ displayPath?: string | undefined;
2105
2133
  }[];
2134
+ displayPath?: string | undefined;
2106
2135
  }>;
2107
2136
  type SchemaResolution = z.infer<typeof SchemaResolutionSchema>;
2108
2137
  declare const TemplatesSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
2109
2138
  path: z.ZodString;
2139
+ displayPath: z.ZodOptional<z.ZodString>;
2110
2140
  source: z.ZodEnum<["project", "user", "package"]>;
2111
2141
  }, "strip", z.ZodTypeAny, {
2112
2142
  path: string;
2113
2143
  source: "project" | "user" | "package";
2144
+ displayPath?: string | undefined;
2114
2145
  }, {
2115
2146
  path: string;
2116
2147
  source: "project" | "user" | "package";
2148
+ displayPath?: string | undefined;
2117
2149
  }>>;
2118
2150
  type TemplatesMap = z.infer<typeof TemplatesSchema>;
2119
2151
  declare const SchemaArtifactSchema: z.ZodObject<{
@@ -2218,6 +2250,23 @@ interface ExportSnapshot {
2218
2250
  changesCount: number;
2219
2251
  archivesCount: number;
2220
2252
  };
2253
+ /** Git snapshot used by static dashboard */
2254
+ git?: {
2255
+ defaultBranch: string;
2256
+ repositoryUrl: string | null;
2257
+ latestCommitTs: number | null;
2258
+ recentCommits: Array<{
2259
+ hash: string;
2260
+ title: string;
2261
+ committedAt: number;
2262
+ relatedChanges: string[];
2263
+ diff: {
2264
+ files: number;
2265
+ insertions: number;
2266
+ deletions: number;
2267
+ };
2268
+ }>;
2269
+ };
2221
2270
  /** OpenSpecUI runtime config captured during export */
2222
2271
  config?: OpenSpecUIConfig;
2223
2272
  /** All specs with parsed content */
@@ -2289,8 +2338,15 @@ interface ExportSnapshot {
2289
2338
  configYaml?: string;
2290
2339
  schemas: SchemaInfo[];
2291
2340
  schemaDetails: Record<string, SchemaDetail>;
2341
+ schemaYamls?: Record<string, string>;
2292
2342
  schemaResolutions: Record<string, SchemaResolution>;
2293
2343
  templates: Record<string, TemplatesMap>;
2344
+ templateContents?: Record<string, Record<string, {
2345
+ content: string | null;
2346
+ path: string;
2347
+ displayPath?: string;
2348
+ source: 'project' | 'user' | 'package';
2349
+ }>>;
2294
2350
  changeMetadata: Record<string, string | null>;
2295
2351
  };
2296
2352
  }
@@ -2299,6 +2355,7 @@ interface ExportSnapshot {
2299
2355
  type TemplateContentMap = Record<string, {
2300
2356
  content: string | null;
2301
2357
  path: string;
2358
+ displayPath?: string;
2302
2359
  source: TemplatesMap[string]['source'];
2303
2360
  }>;
2304
2361
  interface GlobArtifactFile {
@@ -2407,22 +2464,22 @@ declare const PtySessionInfoSchema: z.ZodObject<{
2407
2464
  closeTip: z.ZodOptional<z.ZodString>;
2408
2465
  closeCallbackUrl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
2409
2466
  }, "strip", z.ZodTypeAny, {
2467
+ id: string;
2410
2468
  command: string;
2411
2469
  args: string[];
2412
2470
  platform: "windows" | "macos" | "common";
2413
2471
  exitCode: number | null;
2414
2472
  title: string;
2415
- id: string;
2416
2473
  isExited: boolean;
2417
2474
  closeTip?: string | undefined;
2418
2475
  closeCallbackUrl?: string | Record<string, string> | undefined;
2419
2476
  }, {
2477
+ id: string;
2420
2478
  command: string;
2421
2479
  args: string[];
2422
2480
  platform: "windows" | "macos" | "common";
2423
2481
  exitCode: number | null;
2424
2482
  title: string;
2425
- id: string;
2426
2483
  isExited: boolean;
2427
2484
  closeTip?: string | undefined;
2428
2485
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -2439,19 +2496,19 @@ declare const PtyCreateMessageSchema: z.ZodObject<{
2439
2496
  }, "strip", z.ZodTypeAny, {
2440
2497
  type: "create";
2441
2498
  requestId: string;
2442
- cols?: number | undefined;
2443
- rows?: number | undefined;
2444
2499
  command?: string | undefined;
2445
2500
  args?: string[] | undefined;
2501
+ cols?: number | undefined;
2502
+ rows?: number | undefined;
2446
2503
  closeTip?: string | undefined;
2447
2504
  closeCallbackUrl?: string | Record<string, string> | undefined;
2448
2505
  }, {
2449
2506
  type: "create";
2450
2507
  requestId: string;
2451
- cols?: number | undefined;
2452
- rows?: number | undefined;
2453
2508
  command?: string | undefined;
2454
2509
  args?: string[] | undefined;
2510
+ cols?: number | undefined;
2511
+ rows?: number | undefined;
2455
2512
  closeTip?: string | undefined;
2456
2513
  closeCallbackUrl?: string | Record<string, string> | undefined;
2457
2514
  }>;
@@ -2529,19 +2586,19 @@ declare const PtyClientMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
2529
2586
  }, "strip", z.ZodTypeAny, {
2530
2587
  type: "create";
2531
2588
  requestId: string;
2532
- cols?: number | undefined;
2533
- rows?: number | undefined;
2534
2589
  command?: string | undefined;
2535
2590
  args?: string[] | undefined;
2591
+ cols?: number | undefined;
2592
+ rows?: number | undefined;
2536
2593
  closeTip?: string | undefined;
2537
2594
  closeCallbackUrl?: string | Record<string, string> | undefined;
2538
2595
  }, {
2539
2596
  type: "create";
2540
2597
  requestId: string;
2541
- cols?: number | undefined;
2542
- rows?: number | undefined;
2543
2598
  command?: string | undefined;
2544
2599
  args?: string[] | undefined;
2600
+ cols?: number | undefined;
2601
+ rows?: number | undefined;
2545
2602
  closeTip?: string | undefined;
2546
2603
  closeCallbackUrl?: string | Record<string, string> | undefined;
2547
2604
  }>, z.ZodObject<{
@@ -2683,22 +2740,22 @@ declare const PtyListResponseSchema: z.ZodObject<{
2683
2740
  closeTip: z.ZodOptional<z.ZodString>;
2684
2741
  closeCallbackUrl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
2685
2742
  }, "strip", z.ZodTypeAny, {
2743
+ id: string;
2686
2744
  command: string;
2687
2745
  args: string[];
2688
2746
  platform: "windows" | "macos" | "common";
2689
2747
  exitCode: number | null;
2690
2748
  title: string;
2691
- id: string;
2692
2749
  isExited: boolean;
2693
2750
  closeTip?: string | undefined;
2694
2751
  closeCallbackUrl?: string | Record<string, string> | undefined;
2695
2752
  }, {
2753
+ id: string;
2696
2754
  command: string;
2697
2755
  args: string[];
2698
2756
  platform: "windows" | "macos" | "common";
2699
2757
  exitCode: number | null;
2700
2758
  title: string;
2701
- id: string;
2702
2759
  isExited: boolean;
2703
2760
  closeTip?: string | undefined;
2704
2761
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -2706,12 +2763,12 @@ declare const PtyListResponseSchema: z.ZodObject<{
2706
2763
  }, "strip", z.ZodTypeAny, {
2707
2764
  type: "list";
2708
2765
  sessions: {
2766
+ id: string;
2709
2767
  command: string;
2710
2768
  args: string[];
2711
2769
  platform: "windows" | "macos" | "common";
2712
2770
  exitCode: number | null;
2713
2771
  title: string;
2714
- id: string;
2715
2772
  isExited: boolean;
2716
2773
  closeTip?: string | undefined;
2717
2774
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -2719,12 +2776,12 @@ declare const PtyListResponseSchema: z.ZodObject<{
2719
2776
  }, {
2720
2777
  type: "list";
2721
2778
  sessions: {
2779
+ id: string;
2722
2780
  command: string;
2723
2781
  args: string[];
2724
2782
  platform: "windows" | "macos" | "common";
2725
2783
  exitCode: number | null;
2726
2784
  title: string;
2727
- id: string;
2728
2785
  isExited: boolean;
2729
2786
  closeTip?: string | undefined;
2730
2787
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -2737,14 +2794,14 @@ declare const PtyErrorResponseSchema: z.ZodObject<{
2737
2794
  message: z.ZodString;
2738
2795
  sessionId: z.ZodOptional<z.ZodString>;
2739
2796
  }, "strip", z.ZodTypeAny, {
2740
- type: "error";
2741
2797
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND" | "PTY_CREATE_FAILED";
2742
2798
  message: string;
2799
+ type: "error";
2743
2800
  sessionId?: string | undefined;
2744
2801
  }, {
2745
- type: "error";
2746
2802
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND" | "PTY_CREATE_FAILED";
2747
2803
  message: string;
2804
+ type: "error";
2748
2805
  sessionId?: string | undefined;
2749
2806
  }>;
2750
2807
  declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
@@ -2823,22 +2880,22 @@ declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
2823
2880
  closeTip: z.ZodOptional<z.ZodString>;
2824
2881
  closeCallbackUrl: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
2825
2882
  }, "strip", z.ZodTypeAny, {
2883
+ id: string;
2826
2884
  command: string;
2827
2885
  args: string[];
2828
2886
  platform: "windows" | "macos" | "common";
2829
2887
  exitCode: number | null;
2830
2888
  title: string;
2831
- id: string;
2832
2889
  isExited: boolean;
2833
2890
  closeTip?: string | undefined;
2834
2891
  closeCallbackUrl?: string | Record<string, string> | undefined;
2835
2892
  }, {
2893
+ id: string;
2836
2894
  command: string;
2837
2895
  args: string[];
2838
2896
  platform: "windows" | "macos" | "common";
2839
2897
  exitCode: number | null;
2840
2898
  title: string;
2841
- id: string;
2842
2899
  isExited: boolean;
2843
2900
  closeTip?: string | undefined;
2844
2901
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -2846,12 +2903,12 @@ declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
2846
2903
  }, "strip", z.ZodTypeAny, {
2847
2904
  type: "list";
2848
2905
  sessions: {
2906
+ id: string;
2849
2907
  command: string;
2850
2908
  args: string[];
2851
2909
  platform: "windows" | "macos" | "common";
2852
2910
  exitCode: number | null;
2853
2911
  title: string;
2854
- id: string;
2855
2912
  isExited: boolean;
2856
2913
  closeTip?: string | undefined;
2857
2914
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -2859,12 +2916,12 @@ declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
2859
2916
  }, {
2860
2917
  type: "list";
2861
2918
  sessions: {
2919
+ id: string;
2862
2920
  command: string;
2863
2921
  args: string[];
2864
2922
  platform: "windows" | "macos" | "common";
2865
2923
  exitCode: number | null;
2866
2924
  title: string;
2867
- id: string;
2868
2925
  isExited: boolean;
2869
2926
  closeTip?: string | undefined;
2870
2927
  closeCallbackUrl?: string | Record<string, string> | undefined;
@@ -2875,14 +2932,14 @@ declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
2875
2932
  message: z.ZodString;
2876
2933
  sessionId: z.ZodOptional<z.ZodString>;
2877
2934
  }, "strip", z.ZodTypeAny, {
2878
- type: "error";
2879
2935
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND" | "PTY_CREATE_FAILED";
2880
2936
  message: string;
2937
+ type: "error";
2881
2938
  sessionId?: string | undefined;
2882
2939
  }, {
2883
- type: "error";
2884
2940
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND" | "PTY_CREATE_FAILED";
2885
2941
  message: string;
2942
+ type: "error";
2886
2943
  sessionId?: string | undefined;
2887
2944
  }>]>;
2888
2945
  type PtyClientMessage = z.infer<typeof PtyClientMessageSchema>;
@@ -2890,4 +2947,4 @@ type PtyServerMessage = z.infer<typeof PtyServerMessageSchema>;
2890
2947
  type PtySessionInfo = z.infer<typeof PtySessionInfoSchema>;
2891
2948
  type PtyPlatform = z.infer<typeof PtyPlatformSchema>;
2892
2949
  //#endregion
2893
- export { type AIToolOption, AI_TOOLS, type ApplyInstructions, ApplyInstructionsSchema, type ApplyTask, ApplyTaskSchema, type ArchiveMeta, type ArtifactInstructions, ArtifactInstructionsSchema, type ArtifactStatus, ArtifactStatusSchema, type Change, type ChangeFile, ChangeFileSchema, type ChangeMeta, ChangeSchema, type ChangeStatus, ChangeStatusSchema, CliExecutor, type CliResult, type CliRunnerAttempt, type CliSniffResult, type CliStreamEvent, ConfigManager, DASHBOARD_METRIC_KEYS, DEFAULT_CONFIG, type DashboardCardAvailability, type DashboardConfig, DashboardConfigSchema, type DashboardGitCommitEntry, type DashboardGitDiffStats, type DashboardGitEntry, type DashboardGitSnapshot, type DashboardGitUncommittedEntry, type DashboardGitWorktree, type DashboardMetricKey, type DashboardOverview, type DashboardSummary, type DashboardTrendKind, type DashboardTrendMeta, type DashboardTrendPoint, type DashboardTriColorTrendPoint, type Delta, type DeltaOperation, DeltaOperationType, DeltaSchema, type DeltaSpec, DeltaSpecSchema, type DependencyInfo, DependencyInfoSchema, type ExportSnapshot, type FileChangeEvent, type FileChangeType, MarkdownParser, OpenSpecAdapter, type OpenSpecUIConfig, OpenSpecUIConfigSchema, type OpenSpecUIConfigUpdate, OpenSpecWatcher, OpsxKernel, type PathCallback, ProjectWatcher, type ProjectWatcherReinitializeReason, type ProjectWatcherRuntimeStatus, PtyAttachMessageSchema, PtyBufferResponseSchema, type PtyClientMessage, PtyClientMessageSchema, PtyCloseMessageSchema, PtyCreateMessageSchema, PtyCreatedResponseSchema, PtyErrorCodeSchema, PtyErrorResponseSchema, PtyExitResponseSchema, PtyInputMessageSchema, PtyListMessageSchema, PtyListResponseSchema, PtyOutputResponseSchema, type PtyPlatform, PtyPlatformSchema, PtyResizeMessageSchema, type PtyServerMessage, PtyServerMessageSchema, type PtySessionInfo, PtyTitleResponseSchema, ReactiveContext, ReactiveState, type ReactiveStateOptions, type Requirement, RequirementSchema, type ResolvedCliRunner, type SchemaArtifact, SchemaArtifactSchema, type SchemaDetail, SchemaDetailSchema, type SchemaInfo, SchemaInfoSchema, type SchemaResolution, SchemaResolutionSchema, type Spec, type SpecMeta, SpecSchema, type Task, TaskSchema, type TemplateContentMap, type TemplatesMap, TemplatesSchema, type TerminalConfig, TerminalConfigSchema, type TerminalRendererEngine, TerminalRendererEngineSchema, type ToolConfig, type ValidationIssue, type ValidationResult, Validator, type WatchEvent, type WatchEventType, type WatcherRuntimeStatus, acquireWatcher, buildCliRunnerCandidates, clearCache, closeAllProjectWatchers, closeAllWatchers, contextStorage, createCleanCliEnv, createFileChangeObservable, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getProjectWatcher, getToolById, getWatchedProjectDir, getWatcherRuntimeStatus, initWatcherPool, isGlobPattern, isTerminalRendererEngine, isToolConfigured, isWatcherPoolInitialized, parseCliCommand, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, sniffGlobalCli };
2950
+ export { type AIToolOption, AI_TOOLS, type ApplyInstructions, ApplyInstructionsSchema, type ApplyTask, ApplyTaskSchema, type ArchiveMeta, type ArtifactInstructions, ArtifactInstructionsSchema, type ArtifactStatus, ArtifactStatusSchema, CODE_EDITOR_THEME_VALUES, type Change, type ChangeFile, ChangeFileSchema, type ChangeMeta, ChangeSchema, type ChangeStatus, ChangeStatusSchema, CliExecutor, type CliResult, type CliRunnerAttempt, type CliSniffResult, type CliStreamEvent, type CodeEditorTheme, CodeEditorThemeSchema, ConfigManager, DASHBOARD_METRIC_KEYS, DEFAULT_CONFIG, type DashboardCardAvailability, type DashboardConfig, DashboardConfigSchema, type DashboardGitCommitEntry, type DashboardGitDiffStats, type DashboardGitEntry, type DashboardGitSnapshot, type DashboardGitUncommittedEntry, type DashboardGitWorktree, type DashboardMetricKey, type DashboardOverview, type DashboardSummary, type DashboardTrendKind, type DashboardTrendMeta, type DashboardTrendPoint, type DashboardTriColorTrendPoint, type Delta, type DeltaOperation, DeltaOperationType, DeltaSchema, type DeltaSpec, DeltaSpecSchema, type DependencyInfo, DependencyInfoSchema, type ExportSnapshot, type FileChangeEvent, type FileChangeType, MarkdownParser, OpenSpecAdapter, type OpenSpecUIConfig, OpenSpecUIConfigSchema, type OpenSpecUIConfigUpdate, OpenSpecWatcher, OpsxKernel, type PathCallback, ProjectWatcher, type ProjectWatcherReinitializeReason, type ProjectWatcherRuntimeStatus, PtyAttachMessageSchema, PtyBufferResponseSchema, type PtyClientMessage, PtyClientMessageSchema, PtyCloseMessageSchema, PtyCreateMessageSchema, PtyCreatedResponseSchema, PtyErrorCodeSchema, PtyErrorResponseSchema, PtyExitResponseSchema, PtyInputMessageSchema, PtyListMessageSchema, PtyListResponseSchema, PtyOutputResponseSchema, type PtyPlatform, PtyPlatformSchema, PtyResizeMessageSchema, type PtyServerMessage, PtyServerMessageSchema, type PtySessionInfo, PtyTitleResponseSchema, ReactiveContext, ReactiveState, type ReactiveStateOptions, type Requirement, RequirementSchema, type ResolvedCliRunner, type SchemaArtifact, SchemaArtifactSchema, type SchemaDetail, SchemaDetailSchema, type SchemaInfo, SchemaInfoSchema, type SchemaResolution, SchemaResolutionSchema, type Spec, type SpecMeta, SpecSchema, type Task, TaskSchema, type TemplateContentMap, type TemplatesMap, TemplatesSchema, type TerminalConfig, TerminalConfigSchema, type TerminalRendererEngine, TerminalRendererEngineSchema, type ToolConfig, VIRTUAL_PROJECT_DIRNAME, type ValidationIssue, type ValidationResult, Validator, type WatchEvent, type WatchEventType, type WatcherRuntimeStatus, acquireWatcher, buildCliRunnerCandidates, clearCache, closeAllProjectWatchers, closeAllWatchers, contextStorage, createCleanCliEnv, createFileChangeObservable, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getProjectWatcher, getToolById, getWatchedProjectDir, getWatcherRuntimeStatus, initWatcherPool, isGlobPattern, isTerminalRendererEngine, isToolConfigured, isWatcherPoolInitialized, parseCliCommand, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, sniffGlobalCli, toOpsxDisplayPath };
package/dist/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { n as toOpsxDisplayPath, t as VIRTUAL_PROJECT_DIRNAME } from "./opsx-display-path-DYIjMsbM.mjs";
1
2
  import { mkdir, readFile, rename, writeFile } from "fs/promises";
2
3
  import { dirname, join } from "path";
3
4
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -1363,47 +1364,50 @@ var OpenSpecAdapter = class {
1363
1364
  }
1364
1365
  /**
1365
1366
  * List changes with metadata (id, name, progress, and time info)
1366
- * Only returns changes that have valid proposal.md
1367
+ * Returns every change directory, including schema-specific layouts that
1368
+ * don't use proposal.md/tasks.md.
1367
1369
  * Sorted by updatedAt descending (most recent first)
1368
1370
  */
1369
1371
  async listChangesWithMeta() {
1370
1372
  const ids = await this.listChanges();
1371
1373
  return (await Promise.all(ids.map(async (id) => {
1372
1374
  const change = await this.readChange(id);
1373
- if (!change) return null;
1374
- const proposalPath = join(this.changesDir, id, "proposal.md");
1375
- const timeInfo = await this.getFileTimeInfo(proposalPath);
1375
+ const changeDir = join(this.changesDir, id);
1376
+ const timeInfo = await this.getFileTimeInfo(changeDir);
1376
1377
  return {
1377
1378
  id,
1378
- name: change.name,
1379
- progress: change.progress,
1379
+ name: change?.name ?? id,
1380
+ progress: change?.progress ?? {
1381
+ total: 0,
1382
+ completed: 0
1383
+ },
1380
1384
  createdAt: timeInfo?.createdAt ?? 0,
1381
1385
  updatedAt: timeInfo?.updatedAt ?? 0
1382
1386
  };
1383
- }))).filter((r) => r !== null).sort((a, b) => b.updatedAt - a.updatedAt);
1387
+ }))).sort((a, b) => b.updatedAt - a.updatedAt);
1384
1388
  }
1385
1389
  async listArchivedChanges() {
1386
1390
  return reactiveReadDir(this.archiveDir, { directoriesOnly: true });
1387
1391
  }
1388
1392
  /**
1389
1393
  * List archived changes with metadata and time info
1390
- * Only returns archives that have valid proposal.md
1394
+ * Returns every archive directory, including schema-specific layouts that
1395
+ * don't use proposal.md/tasks.md.
1391
1396
  * Sorted by updatedAt descending (most recent first)
1392
1397
  */
1393
1398
  async listArchivedChangesWithMeta() {
1394
1399
  const ids = await this.listArchivedChanges();
1395
1400
  return (await Promise.all(ids.map(async (id) => {
1396
1401
  const change = await this.readArchivedChange(id);
1397
- if (!change) return null;
1398
- const proposalPath = join(this.archiveDir, id, "proposal.md");
1399
- const timeInfo = await this.getFileTimeInfo(proposalPath);
1402
+ const archiveDir = join(this.archiveDir, id);
1403
+ const timeInfo = await this.getFileTimeInfo(archiveDir);
1400
1404
  return {
1401
1405
  id,
1402
- name: change.name,
1406
+ name: change?.name ?? id,
1403
1407
  createdAt: timeInfo?.createdAt ?? 0,
1404
1408
  updatedAt: timeInfo?.updatedAt ?? 0
1405
1409
  };
1406
- }))).filter((r) => r !== null).sort((a, b) => b.updatedAt - a.updatedAt);
1410
+ }))).sort((a, b) => b.updatedAt - a.updatedAt);
1407
1411
  }
1408
1412
  /**
1409
1413
  * Read project.md content (reactive)
@@ -1957,8 +1961,18 @@ const CURSOR_STYLE_VALUES = [
1957
1961
  "underline",
1958
1962
  "bar"
1959
1963
  ];
1964
+ const CODE_EDITOR_THEME_VALUES = [
1965
+ "github",
1966
+ "material",
1967
+ "vscode",
1968
+ "tokyo",
1969
+ "gruvbox",
1970
+ "monokai",
1971
+ "nord"
1972
+ ];
1960
1973
  const TERMINAL_RENDERER_ENGINE_VALUES = ["xterm", "ghostty"];
1961
1974
  const TerminalRendererEngineSchema = z.enum(TERMINAL_RENDERER_ENGINE_VALUES);
1975
+ const CodeEditorThemeSchema = z.enum(CODE_EDITOR_THEME_VALUES);
1962
1976
  function isTerminalRendererEngine(value) {
1963
1977
  return TERMINAL_RENDERER_ENGINE_VALUES.includes(value);
1964
1978
  }
@@ -2303,6 +2317,7 @@ const TerminalConfigSchema = z.object({
2303
2317
  rendererEngine: z.string().default("xterm")
2304
2318
  });
2305
2319
  const DashboardConfigSchema = z.object({ trendPointLimit: z.number().int().min(20).max(500).default(100) });
2320
+ const CodeEditorConfigSchema = z.object({ theme: CodeEditorThemeSchema.default("github") });
2306
2321
  /**
2307
2322
  * OpenSpecUI 配置 Schema
2308
2323
  *
@@ -2314,6 +2329,7 @@ const OpenSpecUIConfigSchema = z.object({
2314
2329
  args: z.array(z.string()).optional()
2315
2330
  }).default({}),
2316
2331
  theme: z.enum(THEME_VALUES).default("system"),
2332
+ codeEditor: CodeEditorConfigSchema.default(CodeEditorConfigSchema.parse({})),
2317
2333
  terminal: TerminalConfigSchema.default(TerminalConfigSchema.parse({})),
2318
2334
  dashboard: DashboardConfigSchema.default(DashboardConfigSchema.parse({}))
2319
2335
  });
@@ -2321,6 +2337,7 @@ const OpenSpecUIConfigSchema = z.object({
2321
2337
  const DEFAULT_CONFIG = {
2322
2338
  cli: {},
2323
2339
  theme: "system",
2340
+ codeEditor: CodeEditorConfigSchema.parse({}),
2324
2341
  terminal: TerminalConfigSchema.parse({}),
2325
2342
  dashboard: DashboardConfigSchema.parse({})
2326
2343
  };
@@ -2385,6 +2402,10 @@ var ConfigManager = class {
2385
2402
  ...current,
2386
2403
  cli: nextCli,
2387
2404
  theme: config.theme ?? current.theme,
2405
+ codeEditor: {
2406
+ ...current.codeEditor,
2407
+ ...config.codeEditor
2408
+ },
2388
2409
  terminal: {
2389
2410
  ...current.terminal,
2390
2411
  ...config.terminal
@@ -3226,17 +3247,20 @@ const SchemaResolutionSchema = z.object({
3226
3247
  "package"
3227
3248
  ]),
3228
3249
  path: z.string(),
3250
+ displayPath: z.string().optional(),
3229
3251
  shadows: z.array(z.object({
3230
3252
  source: z.enum([
3231
3253
  "project",
3232
3254
  "user",
3233
3255
  "package"
3234
3256
  ]),
3235
- path: z.string()
3257
+ path: z.string(),
3258
+ displayPath: z.string().optional()
3236
3259
  }))
3237
3260
  });
3238
3261
  const TemplatesSchema = z.record(z.object({
3239
3262
  path: z.string(),
3263
+ displayPath: z.string().optional(),
3240
3264
  source: z.enum([
3241
3265
  "project",
3242
3266
  "user",
@@ -3280,6 +3304,12 @@ function parseCliJson(raw, schema, label) {
3280
3304
  function toRelativePath(root, absolutePath) {
3281
3305
  return relative(root, absolutePath).split(sep).join("/");
3282
3306
  }
3307
+ function isAbsoluteFsPath(path) {
3308
+ return path.startsWith("/") || /^[A-Za-z]:\//.test(path);
3309
+ }
3310
+ function toAbsoluteProjectPath(projectDir, path) {
3311
+ return isAbsoluteFsPath(path.replace(/\\/g, "/")) ? path : resolve(projectDir, path);
3312
+ }
3283
3313
  async function readEntriesUnderRoot(root) {
3284
3314
  if (!(await reactiveStat(root))?.isDirectory) return [];
3285
3315
  const collectEntries = async (dir) => {
@@ -3718,7 +3748,21 @@ var OpsxKernel = class {
3718
3748
  await touchOpsxProjectDeps(this.projectDir);
3719
3749
  const result = await this.cliExecutor.schemaWhich(name);
3720
3750
  if (!result.success) throw new Error(result.stderr || `openspec schema which failed (exit ${result.exitCode ?? "null"})`);
3721
- return parseCliJson(result.stdout, SchemaResolutionSchema, "openspec schema which");
3751
+ const parsed = parseCliJson(result.stdout, SchemaResolutionSchema, "openspec schema which");
3752
+ return {
3753
+ ...parsed,
3754
+ displayPath: toOpsxDisplayPath(parsed.path, {
3755
+ source: parsed.source,
3756
+ projectDir: this.projectDir
3757
+ }),
3758
+ shadows: parsed.shadows.map((shadow) => ({
3759
+ ...shadow,
3760
+ displayPath: toOpsxDisplayPath(shadow.path, {
3761
+ source: shadow.source,
3762
+ projectDir: this.projectDir
3763
+ })
3764
+ }))
3765
+ };
3722
3766
  }
3723
3767
  async fetchSchemaDetail(name) {
3724
3768
  await touchOpsxProjectDeps(this.projectDir);
@@ -3742,7 +3786,15 @@ var OpsxKernel = class {
3742
3786
  await touchOpsxProjectDeps(this.projectDir);
3743
3787
  const result = await this.cliExecutor.templates(schema);
3744
3788
  if (!result.success) throw new Error(result.stderr || `openspec templates failed (exit ${result.exitCode ?? "null"})`);
3745
- return parseCliJson(result.stdout, TemplatesSchema, "openspec templates");
3789
+ const templates = parseCliJson(result.stdout, TemplatesSchema, "openspec templates");
3790
+ return Object.fromEntries(Object.entries(templates).map(([artifactId, info]) => [artifactId, {
3791
+ ...info,
3792
+ path: toAbsoluteProjectPath(this.projectDir, info.path),
3793
+ displayPath: toOpsxDisplayPath(info.path, {
3794
+ source: info.source,
3795
+ projectDir: this.projectDir
3796
+ })
3797
+ }]));
3746
3798
  }
3747
3799
  async fetchTemplateContents(schema) {
3748
3800
  await this.ensureTemplates(schema);
@@ -3751,6 +3803,10 @@ var OpsxKernel = class {
3751
3803
  return [artifactId, {
3752
3804
  content: await reactiveReadFile(info.path),
3753
3805
  path: info.path,
3806
+ displayPath: info.displayPath ?? toOpsxDisplayPath(info.path, {
3807
+ source: info.source,
3808
+ projectDir: this.projectDir
3809
+ }),
3754
3810
  source: info.source
3755
3811
  }];
3756
3812
  }));
@@ -3999,4 +4055,4 @@ const PtyServerMessageSchema = z.discriminatedUnion("type", [
3999
4055
  ]);
4000
4056
 
4001
4057
  //#endregion
4002
- export { AI_TOOLS, ApplyInstructionsSchema, ApplyTaskSchema, ArtifactInstructionsSchema, ArtifactStatusSchema, ChangeFileSchema, ChangeSchema, ChangeStatusSchema, CliExecutor, ConfigManager, DASHBOARD_METRIC_KEYS, DEFAULT_CONFIG, DashboardConfigSchema, DeltaOperationType, DeltaSchema, DeltaSpecSchema, DependencyInfoSchema, MarkdownParser, OpenSpecAdapter, OpenSpecUIConfigSchema, OpenSpecWatcher, OpsxKernel, ProjectWatcher, PtyAttachMessageSchema, PtyBufferResponseSchema, PtyClientMessageSchema, PtyCloseMessageSchema, PtyCreateMessageSchema, PtyCreatedResponseSchema, PtyErrorCodeSchema, PtyErrorResponseSchema, PtyExitResponseSchema, PtyInputMessageSchema, PtyListMessageSchema, PtyListResponseSchema, PtyOutputResponseSchema, PtyPlatformSchema, PtyResizeMessageSchema, PtyServerMessageSchema, PtyTitleResponseSchema, ReactiveContext, ReactiveState, RequirementSchema, SchemaArtifactSchema, SchemaDetailSchema, SchemaInfoSchema, SchemaResolutionSchema, SpecSchema, TaskSchema, TemplatesSchema, TerminalConfigSchema, TerminalRendererEngineSchema, Validator, acquireWatcher, buildCliRunnerCandidates, clearCache, closeAllProjectWatchers, closeAllWatchers, contextStorage, createCleanCliEnv, createFileChangeObservable, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getProjectWatcher, getToolById, getWatchedProjectDir, getWatcherRuntimeStatus, initWatcherPool, isGlobPattern, isTerminalRendererEngine, isToolConfigured, isWatcherPoolInitialized, parseCliCommand, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, sniffGlobalCli };
4058
+ export { AI_TOOLS, ApplyInstructionsSchema, ApplyTaskSchema, ArtifactInstructionsSchema, ArtifactStatusSchema, CODE_EDITOR_THEME_VALUES, ChangeFileSchema, ChangeSchema, ChangeStatusSchema, CliExecutor, CodeEditorThemeSchema, ConfigManager, DASHBOARD_METRIC_KEYS, DEFAULT_CONFIG, DashboardConfigSchema, DeltaOperationType, DeltaSchema, DeltaSpecSchema, DependencyInfoSchema, MarkdownParser, OpenSpecAdapter, OpenSpecUIConfigSchema, OpenSpecWatcher, OpsxKernel, ProjectWatcher, PtyAttachMessageSchema, PtyBufferResponseSchema, PtyClientMessageSchema, PtyCloseMessageSchema, PtyCreateMessageSchema, PtyCreatedResponseSchema, PtyErrorCodeSchema, PtyErrorResponseSchema, PtyExitResponseSchema, PtyInputMessageSchema, PtyListMessageSchema, PtyListResponseSchema, PtyOutputResponseSchema, PtyPlatformSchema, PtyResizeMessageSchema, PtyServerMessageSchema, PtyTitleResponseSchema, ReactiveContext, ReactiveState, RequirementSchema, SchemaArtifactSchema, SchemaDetailSchema, SchemaInfoSchema, SchemaResolutionSchema, SpecSchema, TaskSchema, TemplatesSchema, TerminalConfigSchema, TerminalRendererEngineSchema, VIRTUAL_PROJECT_DIRNAME, Validator, acquireWatcher, buildCliRunnerCandidates, clearCache, closeAllProjectWatchers, closeAllWatchers, contextStorage, createCleanCliEnv, createFileChangeObservable, getActiveWatcherCount, getAllToolIds, getAllTools, getAvailableToolIds, getAvailableTools, getCacheSize, getConfiguredTools, getDefaultCliCommand, getDefaultCliCommandString, getProjectWatcher, getToolById, getWatchedProjectDir, getWatcherRuntimeStatus, initWatcherPool, isGlobPattern, isTerminalRendererEngine, isToolConfigured, isWatcherPoolInitialized, parseCliCommand, reactiveExists, reactiveReadDir, reactiveReadFile, reactiveStat, sniffGlobalCli, toOpsxDisplayPath };
@@ -0,0 +1,63 @@
1
+ //#region src/opsx-display-path.ts
2
+ const VIRTUAL_PROJECT_DIRNAME = "project";
3
+ const WINDOWS_DRIVE_PREFIX = /^[A-Za-z]:\//;
4
+ function normalizeFsPath(path) {
5
+ return path.replace(/\\/g, "/").replace(/\/+$/g, "");
6
+ }
7
+ function isAbsolutePath(path) {
8
+ return path.startsWith("/") || WINDOWS_DRIVE_PREFIX.test(path);
9
+ }
10
+ function stripRelativePrefix(path) {
11
+ return path.replace(/^\.?\//, "");
12
+ }
13
+ function splitSegments(path) {
14
+ return normalizeFsPath(path).split("/").filter(Boolean);
15
+ }
16
+ function toNpmSpecifier(path) {
17
+ const normalized = normalizeFsPath(path);
18
+ const match = /(?:^|\/)node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(@[^/]+\/[^/]+|[^/]+)(\/.*)?/.exec(normalized);
19
+ const pkgName = match?.[1];
20
+ if (!pkgName) return null;
21
+ return `npm:${pkgName}${match[2] ?? ""}`;
22
+ }
23
+ function toVirtualProjectPath(path) {
24
+ return `${VIRTUAL_PROJECT_DIRNAME}:${stripRelativePrefix(path)}`;
25
+ }
26
+ function isPathInside(root, target) {
27
+ const normalizedRoot = normalizeFsPath(root);
28
+ const normalizedTarget = normalizeFsPath(target);
29
+ const rootLower = normalizedRoot.toLowerCase();
30
+ const targetLower = normalizedTarget.toLowerCase();
31
+ return targetLower === rootLower || targetLower.startsWith(`${rootLower}/`);
32
+ }
33
+ function toRelativeFromRoot(root, target) {
34
+ const rootSegments = splitSegments(root);
35
+ const targetSegments = splitSegments(target);
36
+ let index = 0;
37
+ while (index < rootSegments.length && index < targetSegments.length) {
38
+ if (rootSegments[index]?.toLowerCase() !== targetSegments[index]?.toLowerCase()) break;
39
+ index += 1;
40
+ }
41
+ return targetSegments.slice(index).join("/");
42
+ }
43
+ function findOpspecSlice(path) {
44
+ const segments = splitSegments(path);
45
+ const idx = segments.lastIndexOf("openspec");
46
+ if (idx < 0) return null;
47
+ return segments.slice(idx).join("/");
48
+ }
49
+ function toOpsxDisplayPath(absoluteOrRelativePath, options) {
50
+ const normalized = normalizeFsPath(absoluteOrRelativePath);
51
+ const npmSpecifier = toNpmSpecifier(normalized);
52
+ if (options?.source === "package" || npmSpecifier) {
53
+ if (npmSpecifier) return npmSpecifier;
54
+ }
55
+ if (!isAbsolutePath(normalized)) return toVirtualProjectPath(normalized);
56
+ if (options?.projectDir && isPathInside(options.projectDir, normalized)) return toVirtualProjectPath(toRelativeFromRoot(options.projectDir, normalized));
57
+ const openspecSlice = findOpspecSlice(normalized);
58
+ if (openspecSlice) return toVirtualProjectPath(openspecSlice);
59
+ return toVirtualProjectPath(splitSegments(normalized).slice(-4).join("/"));
60
+ }
61
+
62
+ //#endregion
63
+ export { toOpsxDisplayPath as n, VIRTUAL_PROJECT_DIRNAME as t };
@@ -0,0 +1,8 @@
1
+ //#region src/opsx-display-path.d.ts
2
+ declare const VIRTUAL_PROJECT_DIRNAME = "project";
3
+ declare function toOpsxDisplayPath(absoluteOrRelativePath: string, options?: {
4
+ source?: 'project' | 'user' | 'package';
5
+ projectDir?: string;
6
+ }): string;
7
+ //#endregion
8
+ export { toOpsxDisplayPath as n, VIRTUAL_PROJECT_DIRNAME as t };
@@ -0,0 +1,2 @@
1
+ import { n as toOpsxDisplayPath, t as VIRTUAL_PROJECT_DIRNAME } from "./opsx-display-path-RBULE8_G.mjs";
2
+ export { VIRTUAL_PROJECT_DIRNAME, toOpsxDisplayPath };
@@ -0,0 +1,3 @@
1
+ import { n as toOpsxDisplayPath, t as VIRTUAL_PROJECT_DIRNAME } from "./opsx-display-path-DYIjMsbM.mjs";
2
+
3
+ export { VIRTUAL_PROJECT_DIRNAME, toOpsxDisplayPath };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openspecui/core",
3
- "version": "1.5.0",
3
+ "version": "1.6.2",
4
4
  "description": "Core OpenSpec adapter and parser",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -9,6 +9,10 @@
9
9
  ".": {
10
10
  "import": "./dist/index.mjs",
11
11
  "types": "./dist/index.d.mts"
12
+ },
13
+ "./opsx-display-path": {
14
+ "import": "./dist/opsx-display-path.mjs",
15
+ "types": "./dist/opsx-display-path.d.mts"
12
16
  }
13
17
  },
14
18
  "files": [
@@ -29,8 +33,8 @@
29
33
  "typescript": "^5.0.0"
30
34
  },
31
35
  "scripts": {
32
- "build": "tsdown src/index.ts --format esm --dts",
33
- "dev": "tsdown src/index.ts --format esm --dts --watch",
36
+ "build": "tsdown src/index.ts src/opsx-display-path.ts --format esm --dts",
37
+ "dev": "tsdown src/index.ts src/opsx-display-path.ts --format esm --dts --watch",
34
38
  "test": "vitest run",
35
39
  "test:watch": "vitest",
36
40
  "typecheck": "tsc --noEmit"