@openspecui/core 1.0.2 → 1.0.3

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
@@ -17,13 +17,13 @@ declare const ChangeFileSchema: z.ZodObject<{
17
17
  /** Optional byte size for files */
18
18
  size: z.ZodOptional<z.ZodNumber>;
19
19
  }, "strip", z.ZodTypeAny, {
20
- path: string;
21
20
  type: "file" | "directory";
21
+ path: string;
22
22
  content?: string | undefined;
23
23
  size?: number | undefined;
24
24
  }, {
25
- path: string;
26
25
  type: "file" | "directory";
26
+ path: string;
27
27
  content?: string | undefined;
28
28
  size?: number | undefined;
29
29
  }>;
@@ -1673,14 +1673,14 @@ declare const ArtifactStatusSchema: z.ZodObject<{
1673
1673
  missingDeps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1674
1674
  relativePath: z.ZodOptional<z.ZodString>;
1675
1675
  }, "strip", z.ZodTypeAny, {
1676
- id: string;
1677
1676
  status: "done" | "ready" | "blocked";
1677
+ id: string;
1678
1678
  outputPath: string;
1679
1679
  missingDeps?: string[] | undefined;
1680
1680
  relativePath?: string | undefined;
1681
1681
  }, {
1682
- id: string;
1683
1682
  status: "done" | "ready" | "blocked";
1683
+ id: string;
1684
1684
  outputPath: string;
1685
1685
  missingDeps?: string[] | undefined;
1686
1686
  relativePath?: string | undefined;
@@ -1698,14 +1698,14 @@ declare const ChangeStatusSchema: z.ZodObject<{
1698
1698
  missingDeps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1699
1699
  relativePath: z.ZodOptional<z.ZodString>;
1700
1700
  }, "strip", z.ZodTypeAny, {
1701
- id: string;
1702
1701
  status: "done" | "ready" | "blocked";
1702
+ id: string;
1703
1703
  outputPath: string;
1704
1704
  missingDeps?: string[] | undefined;
1705
1705
  relativePath?: string | undefined;
1706
1706
  }, {
1707
- id: string;
1708
1707
  status: "done" | "ready" | "blocked";
1708
+ id: string;
1709
1709
  outputPath: string;
1710
1710
  missingDeps?: string[] | undefined;
1711
1711
  relativePath?: string | undefined;
@@ -1716,8 +1716,8 @@ declare const ChangeStatusSchema: z.ZodObject<{
1716
1716
  isComplete: boolean;
1717
1717
  applyRequires: string[];
1718
1718
  artifacts: {
1719
- id: string;
1720
1719
  status: "done" | "ready" | "blocked";
1720
+ id: string;
1721
1721
  outputPath: string;
1722
1722
  missingDeps?: string[] | undefined;
1723
1723
  relativePath?: string | undefined;
@@ -1728,8 +1728,8 @@ declare const ChangeStatusSchema: z.ZodObject<{
1728
1728
  isComplete: boolean;
1729
1729
  applyRequires: string[];
1730
1730
  artifacts: {
1731
- id: string;
1732
1731
  status: "done" | "ready" | "blocked";
1732
+ id: string;
1733
1733
  outputPath: string;
1734
1734
  missingDeps?: string[] | undefined;
1735
1735
  relativePath?: string | undefined;
@@ -1742,13 +1742,13 @@ declare const DependencyInfoSchema: z.ZodObject<{
1742
1742
  path: z.ZodString;
1743
1743
  description: z.ZodString;
1744
1744
  }, "strip", z.ZodTypeAny, {
1745
- id: string;
1746
1745
  path: string;
1746
+ id: string;
1747
1747
  description: string;
1748
1748
  done: boolean;
1749
1749
  }, {
1750
- id: string;
1751
1750
  path: string;
1751
+ id: string;
1752
1752
  description: string;
1753
1753
  done: boolean;
1754
1754
  }>;
@@ -1856,13 +1856,13 @@ declare const ArtifactInstructionsSchema: z.ZodObject<{
1856
1856
  path: z.ZodString;
1857
1857
  description: z.ZodString;
1858
1858
  }, "strip", z.ZodTypeAny, {
1859
- id: string;
1860
1859
  path: string;
1860
+ id: string;
1861
1861
  description: string;
1862
1862
  done: boolean;
1863
1863
  }, {
1864
- id: string;
1865
1864
  path: string;
1865
+ id: string;
1866
1866
  description: string;
1867
1867
  done: boolean;
1868
1868
  }>, "many">;
@@ -1876,8 +1876,8 @@ declare const ArtifactInstructionsSchema: z.ZodObject<{
1876
1876
  artifactId: string;
1877
1877
  template: string;
1878
1878
  dependencies: {
1879
- id: string;
1880
1879
  path: string;
1880
+ id: string;
1881
1881
  description: string;
1882
1882
  done: boolean;
1883
1883
  }[];
@@ -1894,8 +1894,8 @@ declare const ArtifactInstructionsSchema: z.ZodObject<{
1894
1894
  artifactId: string;
1895
1895
  template: string;
1896
1896
  dependencies: {
1897
- id: string;
1898
1897
  path: string;
1898
+ id: string;
1899
1899
  description: string;
1900
1900
  done: boolean;
1901
1901
  }[];
@@ -1937,16 +1937,16 @@ declare const SchemaResolutionSchema: z.ZodObject<{
1937
1937
  source: "project" | "user" | "package";
1938
1938
  }>, "many">;
1939
1939
  }, "strip", z.ZodTypeAny, {
1940
- name: string;
1941
1940
  path: string;
1941
+ name: string;
1942
1942
  source: "project" | "user" | "package";
1943
1943
  shadows: {
1944
1944
  path: string;
1945
1945
  source: "project" | "user" | "package";
1946
1946
  }[];
1947
1947
  }, {
1948
- name: string;
1949
1948
  path: string;
1949
+ name: string;
1950
1950
  source: "project" | "user" | "package";
1951
1951
  shadows: {
1952
1952
  path: string;
@@ -2244,20 +2244,20 @@ declare const PtySessionInfoSchema: z.ZodObject<{
2244
2244
  isExited: z.ZodBoolean;
2245
2245
  exitCode: z.ZodNullable<z.ZodNumber>;
2246
2246
  }, "strip", z.ZodTypeAny, {
2247
- id: string;
2248
2247
  command: string;
2249
2248
  args: string[];
2250
2249
  platform: "windows" | "macos" | "common";
2251
2250
  exitCode: number | null;
2252
2251
  title: string;
2252
+ id: string;
2253
2253
  isExited: boolean;
2254
2254
  }, {
2255
- id: string;
2256
2255
  command: string;
2257
2256
  args: string[];
2258
2257
  platform: "windows" | "macos" | "common";
2259
2258
  exitCode: number | null;
2260
2259
  title: string;
2260
+ id: string;
2261
2261
  isExited: boolean;
2262
2262
  }>;
2263
2263
  declare const PtyCreateMessageSchema: z.ZodObject<{
@@ -2502,42 +2502,42 @@ declare const PtyListResponseSchema: z.ZodObject<{
2502
2502
  isExited: z.ZodBoolean;
2503
2503
  exitCode: z.ZodNullable<z.ZodNumber>;
2504
2504
  }, "strip", z.ZodTypeAny, {
2505
- id: string;
2506
2505
  command: string;
2507
2506
  args: string[];
2508
2507
  platform: "windows" | "macos" | "common";
2509
2508
  exitCode: number | null;
2510
2509
  title: string;
2510
+ id: string;
2511
2511
  isExited: boolean;
2512
2512
  }, {
2513
- id: string;
2514
2513
  command: string;
2515
2514
  args: string[];
2516
2515
  platform: "windows" | "macos" | "common";
2517
2516
  exitCode: number | null;
2518
2517
  title: string;
2518
+ id: string;
2519
2519
  isExited: boolean;
2520
2520
  }>, "many">;
2521
2521
  }, "strip", z.ZodTypeAny, {
2522
2522
  type: "list";
2523
2523
  sessions: {
2524
- id: string;
2525
2524
  command: string;
2526
2525
  args: string[];
2527
2526
  platform: "windows" | "macos" | "common";
2528
2527
  exitCode: number | null;
2529
2528
  title: string;
2529
+ id: string;
2530
2530
  isExited: boolean;
2531
2531
  }[];
2532
2532
  }, {
2533
2533
  type: "list";
2534
2534
  sessions: {
2535
- id: string;
2536
2535
  command: string;
2537
2536
  args: string[];
2538
2537
  platform: "windows" | "macos" | "common";
2539
2538
  exitCode: number | null;
2540
2539
  title: string;
2540
+ id: string;
2541
2541
  isExited: boolean;
2542
2542
  }[];
2543
2543
  }>;
@@ -2548,14 +2548,14 @@ declare const PtyErrorResponseSchema: z.ZodObject<{
2548
2548
  message: z.ZodString;
2549
2549
  sessionId: z.ZodOptional<z.ZodString>;
2550
2550
  }, "strip", z.ZodTypeAny, {
2551
+ type: "error";
2551
2552
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND";
2552
2553
  message: string;
2553
- type: "error";
2554
2554
  sessionId?: string | undefined;
2555
2555
  }, {
2556
+ type: "error";
2556
2557
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND";
2557
2558
  message: string;
2558
- type: "error";
2559
2559
  sessionId?: string | undefined;
2560
2560
  }>;
2561
2561
  declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
@@ -2632,42 +2632,42 @@ declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
2632
2632
  isExited: z.ZodBoolean;
2633
2633
  exitCode: z.ZodNullable<z.ZodNumber>;
2634
2634
  }, "strip", z.ZodTypeAny, {
2635
- id: string;
2636
2635
  command: string;
2637
2636
  args: string[];
2638
2637
  platform: "windows" | "macos" | "common";
2639
2638
  exitCode: number | null;
2640
2639
  title: string;
2640
+ id: string;
2641
2641
  isExited: boolean;
2642
2642
  }, {
2643
- id: string;
2644
2643
  command: string;
2645
2644
  args: string[];
2646
2645
  platform: "windows" | "macos" | "common";
2647
2646
  exitCode: number | null;
2648
2647
  title: string;
2648
+ id: string;
2649
2649
  isExited: boolean;
2650
2650
  }>, "many">;
2651
2651
  }, "strip", z.ZodTypeAny, {
2652
2652
  type: "list";
2653
2653
  sessions: {
2654
- id: string;
2655
2654
  command: string;
2656
2655
  args: string[];
2657
2656
  platform: "windows" | "macos" | "common";
2658
2657
  exitCode: number | null;
2659
2658
  title: string;
2659
+ id: string;
2660
2660
  isExited: boolean;
2661
2661
  }[];
2662
2662
  }, {
2663
2663
  type: "list";
2664
2664
  sessions: {
2665
- id: string;
2666
2665
  command: string;
2667
2666
  args: string[];
2668
2667
  platform: "windows" | "macos" | "common";
2669
2668
  exitCode: number | null;
2670
2669
  title: string;
2670
+ id: string;
2671
2671
  isExited: boolean;
2672
2672
  }[];
2673
2673
  }>, z.ZodObject<{
@@ -2676,14 +2676,14 @@ declare const PtyServerMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
2676
2676
  message: z.ZodString;
2677
2677
  sessionId: z.ZodOptional<z.ZodString>;
2678
2678
  }, "strip", z.ZodTypeAny, {
2679
+ type: "error";
2679
2680
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND";
2680
2681
  message: string;
2681
- type: "error";
2682
2682
  sessionId?: string | undefined;
2683
2683
  }, {
2684
+ type: "error";
2684
2685
  code: "INVALID_JSON" | "INVALID_MESSAGE" | "SESSION_NOT_FOUND";
2685
2686
  message: string;
2686
- type: "error";
2687
2687
  sessionId?: string | undefined;
2688
2688
  }>]>;
2689
2689
  type PtyClientMessage = z.infer<typeof PtyClientMessageSchema>;
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { mkdir, readFile, rename, writeFile } from "fs/promises";
2
- import { join } from "path";
2
+ import { dirname, join } from "path";
3
3
  import { AsyncLocalStorage } from "node:async_hooks";
4
4
  import { readFile as readFile$1, readdir, stat } from "node:fs/promises";
5
- import { dirname, join as join$1, matchesGlob, relative, resolve, sep } from "node:path";
5
+ import { dirname as dirname$1, join as join$1, matchesGlob, relative, resolve, sep } from "node:path";
6
6
  import { existsSync, realpathSync, utimesSync } from "node:fs";
7
7
  import { z } from "zod";
8
8
  import { watch } from "fs";
@@ -704,7 +704,7 @@ var ProjectWatcher = class {
704
704
  const eventPath = event.path;
705
705
  if (sub.watchChildren) return eventPath.startsWith(sub.path + "/") || eventPath === sub.path;
706
706
  else {
707
- const eventDir = dirname(eventPath);
707
+ const eventDir = dirname$1(eventPath);
708
708
  return eventPath === sub.path || eventDir === sub.path;
709
709
  }
710
710
  }
@@ -1065,7 +1065,7 @@ async function reactiveReadFile(filepath) {
1065
1065
  if (!state) {
1066
1066
  state = new ReactiveState(await getValue());
1067
1067
  stateCache$1.set(key, state);
1068
- const release = acquireWatcher(dirname(normalizedPath), async () => {
1068
+ const release = acquireWatcher(dirname$1(normalizedPath), async () => {
1069
1069
  const newValue = await getValue();
1070
1070
  state.set(newValue);
1071
1071
  }, { onError: () => {
@@ -1153,7 +1153,7 @@ async function reactiveExists(path) {
1153
1153
  if (!state) {
1154
1154
  state = new ReactiveState(await getValue());
1155
1155
  stateCache$1.set(key, state);
1156
- const release = acquireWatcher(dirname(normalizedPath), async () => {
1156
+ const release = acquireWatcher(dirname$1(normalizedPath), async () => {
1157
1157
  const newValue = await getValue();
1158
1158
  state.set(newValue);
1159
1159
  }, { onError: () => {
@@ -1194,7 +1194,7 @@ async function reactiveStat(path) {
1194
1194
  return a.isDirectory === b.isDirectory && a.isFile === b.isFile && a.mtime === b.mtime && a.birthtime === b.birthtime;
1195
1195
  } });
1196
1196
  stateCache$1.set(key, state);
1197
- const release = acquireWatcher(dirname(normalizedPath), async () => {
1197
+ const release = acquireWatcher(dirname$1(normalizedPath), async () => {
1198
1198
  const newValue = await getValue();
1199
1199
  state.set(newValue);
1200
1200
  }, { onError: () => {
@@ -2315,6 +2315,7 @@ var ConfigManager = class {
2315
2315
  }
2316
2316
  };
2317
2317
  const serialized = JSON.stringify(merged, null, 2);
2318
+ await mkdir(dirname(this.configPath), { recursive: true });
2318
2319
  await writeFile(this.configPath, serialized, "utf-8");
2319
2320
  updateReactiveFileCache(this.configPath, serialized);
2320
2321
  this.invalidateResolvedCliRunner();
@@ -2349,10 +2350,14 @@ var ConfigManager = class {
2349
2350
  const [resolvedCommand, ...resolvedArgs] = resolved.commandParts;
2350
2351
  const currentCommand = config.cli.command?.trim();
2351
2352
  const currentArgs = config.cli.args ?? [];
2352
- if (currentCommand !== resolvedCommand || currentArgs.length !== resolvedArgs.length || currentArgs.some((arg, index) => arg !== resolvedArgs[index])) await this.writeConfig({ cli: {
2353
- command: resolvedCommand,
2354
- args: resolvedArgs
2355
- } });
2353
+ if (currentCommand !== resolvedCommand || currentArgs.length !== resolvedArgs.length || currentArgs.some((arg, index) => arg !== resolvedArgs[index])) try {
2354
+ await this.writeConfig({ cli: {
2355
+ command: resolvedCommand,
2356
+ args: resolvedArgs
2357
+ } });
2358
+ } catch (err) {
2359
+ console.warn("Failed to persist auto-detected CLI command:", err);
2360
+ }
2356
2361
  }
2357
2362
  return resolved;
2358
2363
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openspecui/core",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Core OpenSpec adapter and parser",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",