@lumenflow/cli 3.21.0 → 3.22.0

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 (111) hide show
  1. package/dist/chunk-2D2VOCA4.js +37 -0
  2. package/dist/chunk-2D5KFYGX.js +284 -0
  3. package/dist/chunk-2GXVIN57.js +14072 -0
  4. package/dist/chunk-2MQ7HZWZ.js +26 -0
  5. package/dist/chunk-2UFQ3A3C.js +643 -0
  6. package/dist/chunk-3RG5ZIWI.js +10 -0
  7. package/dist/chunk-4N74J3UT.js +15 -0
  8. package/dist/chunk-5GTOXFYR.js +392 -0
  9. package/dist/chunk-5VY6MQMC.js +240 -0
  10. package/dist/chunk-67XVPMRY.js +1297 -0
  11. package/dist/chunk-6HO4GWJE.js +164 -0
  12. package/dist/chunk-6W5XHWYV.js +1890 -0
  13. package/dist/chunk-6X4EMYJQ.js +64 -0
  14. package/dist/chunk-6XYXI2NQ.js +772 -0
  15. package/dist/chunk-7ANSOV6Q.js +285 -0
  16. package/dist/chunk-A624LFLB.js +1380 -0
  17. package/dist/chunk-ADN5NHG4.js +126 -0
  18. package/dist/chunk-B7YJYJKG.js +33 -0
  19. package/dist/chunk-CCLHCPKG.js +210 -0
  20. package/dist/chunk-CK36VROC.js +1584 -0
  21. package/dist/chunk-D3UOFRSB.js +81 -0
  22. package/dist/chunk-DFR4DJBM.js +230 -0
  23. package/dist/chunk-DSYBDHYH.js +79 -0
  24. package/dist/chunk-DWMLTXKQ.js +1176 -0
  25. package/dist/chunk-E3REJTAJ.js +28 -0
  26. package/dist/chunk-EA3IVO64.js +633 -0
  27. package/dist/chunk-EK2AKZKD.js +55 -0
  28. package/dist/chunk-ELD7JTTT.js +343 -0
  29. package/dist/chunk-EX6TT2XI.js +195 -0
  30. package/dist/chunk-EXINSFZE.js +82 -0
  31. package/dist/chunk-EZ6ZBYBM.js +510 -0
  32. package/dist/chunk-FBKAPTJ2.js +16 -0
  33. package/dist/chunk-FVLV5RYH.js +1118 -0
  34. package/dist/chunk-GDNSBQVK.js +2485 -0
  35. package/dist/chunk-GPQHMBNN.js +278 -0
  36. package/dist/chunk-GTFJB67L.js +68 -0
  37. package/dist/chunk-HANJXVKW.js +1127 -0
  38. package/dist/chunk-HEVS5YLD.js +269 -0
  39. package/dist/chunk-HMEVZKPQ.js +9 -0
  40. package/dist/chunk-HRGSYNLM.js +3511 -0
  41. package/dist/chunk-ISZR5N4K.js +60 -0
  42. package/dist/chunk-J6SUPR2C.js +226 -0
  43. package/dist/chunk-JERYVEIZ.js +244 -0
  44. package/dist/chunk-JHHWGL2N.js +87 -0
  45. package/dist/chunk-JONWQUB5.js +775 -0
  46. package/dist/chunk-K2DIWWDM.js +1766 -0
  47. package/dist/chunk-KY4PGL5V.js +969 -0
  48. package/dist/chunk-L737LQ4C.js +1285 -0
  49. package/dist/chunk-LFTWYIB2.js +497 -0
  50. package/dist/chunk-LV47RFNJ.js +41 -0
  51. package/dist/chunk-MKSAITI7.js +15 -0
  52. package/dist/chunk-MZ7RKIX4.js +212 -0
  53. package/dist/chunk-NAP6CFSO.js +84 -0
  54. package/dist/chunk-ND6MY37M.js +16 -0
  55. package/dist/chunk-NMG736UR.js +683 -0
  56. package/dist/chunk-NRAXROED.js +32 -0
  57. package/dist/chunk-NRIZR3A7.js +690 -0
  58. package/dist/chunk-NX43BG3M.js +233 -0
  59. package/dist/chunk-O645XLSI.js +297 -0
  60. package/dist/chunk-OMJD6A3S.js +235 -0
  61. package/dist/chunk-QB6SJD4T.js +430 -0
  62. package/dist/chunk-QFSTL4J3.js +276 -0
  63. package/dist/chunk-QLGDFMFX.js +212 -0
  64. package/dist/chunk-RIAAGL2E.js +13 -0
  65. package/dist/chunk-RWO5XMZ6.js +86 -0
  66. package/dist/chunk-RXRKBBSM.js +149 -0
  67. package/dist/chunk-RZOZMML6.js +363 -0
  68. package/dist/chunk-U7I7FS7T.js +113 -0
  69. package/dist/chunk-UI42RODY.js +717 -0
  70. package/dist/chunk-UTVMVSCO.js +519 -0
  71. package/dist/chunk-V6OJGLBA.js +1746 -0
  72. package/dist/chunk-W2JHVH7D.js +152 -0
  73. package/dist/chunk-WD3Y7VQN.js +280 -0
  74. package/dist/chunk-WOCTQ5MS.js +303 -0
  75. package/dist/chunk-WZR3ZUNN.js +696 -0
  76. package/dist/chunk-XGI665H7.js +150 -0
  77. package/dist/chunk-XKY65P2T.js +304 -0
  78. package/dist/chunk-Y4CQZY65.js +57 -0
  79. package/dist/chunk-YFEXKLVE.js +194 -0
  80. package/dist/chunk-YHO3HS5X.js +287 -0
  81. package/dist/chunk-YLS7AZSX.js +738 -0
  82. package/dist/chunk-ZE473AO6.js +49 -0
  83. package/dist/chunk-ZF747T3O.js +644 -0
  84. package/dist/chunk-ZHCZHZH3.js +43 -0
  85. package/dist/chunk-ZZNZX2XY.js +87 -0
  86. package/dist/constants-7QAP3VQ4.js +23 -0
  87. package/dist/dist-IY3UUMWK.js +33 -0
  88. package/dist/invariants-runner-W5RGHCSU.js +27 -0
  89. package/dist/lane-lock-6J36HD5O.js +35 -0
  90. package/dist/mem-checkpoint-core-EANG2GVN.js +14 -0
  91. package/dist/mem-signal-core-2LZ2WYHW.js +19 -0
  92. package/dist/memory-store-OLB5FO7K.js +18 -0
  93. package/dist/service-6BYCOCO5.js +13 -0
  94. package/dist/spawn-policy-resolver-NTSZYQ6R.js +17 -0
  95. package/dist/spawn-task-builder-R4E2BHSW.js +22 -0
  96. package/dist/wu-done-pr-WLFFFEPJ.js +25 -0
  97. package/dist/wu-done-validation-3J5E36FE.js +30 -0
  98. package/dist/wu-duplicate-id-detector-5S7JHELK.js +232 -0
  99. package/dist/wu-spawn-strategy-resolver.js +18 -5
  100. package/dist/wu-spawn-strategy-resolver.js.map +1 -1
  101. package/package.json +8 -8
  102. package/packs/agent-runtime/.turbo/turbo-build.log +1 -1
  103. package/packs/agent-runtime/.turbo/turbo-typecheck.log +4 -0
  104. package/packs/agent-runtime/package.json +1 -1
  105. package/packs/sidekick/.turbo/turbo-build.log +1 -1
  106. package/packs/sidekick/.turbo/turbo-test.log +12 -0
  107. package/packs/sidekick/.turbo/turbo-typecheck.log +4 -0
  108. package/packs/sidekick/package.json +1 -1
  109. package/packs/software-delivery/.turbo/turbo-build.log +1 -1
  110. package/packs/software-delivery/.turbo/turbo-typecheck.log +4 -0
  111. package/packs/software-delivery/package.json +1 -1
@@ -0,0 +1,43 @@
1
+ import {
2
+ getConfig
3
+ } from "./chunk-V6OJGLBA.js";
4
+
5
+ // ../initiatives/dist/initiative-paths.js
6
+ import path from "path";
7
+ var INIT_PATHS = {
8
+ /**
9
+ * Get path to Initiative YAML file
10
+ * Uses getConfig().directories.initiativesDir for config-aware resolution.
11
+ *
12
+ * @param {string} id - Initiative ID (e.g., 'INIT-001')
13
+ * @returns {string} Path to Initiative YAML file
14
+ */
15
+ INITIATIVE: (id) => {
16
+ const config = getConfig();
17
+ return path.join(config.directories.initiativesDir, `${id}.yaml`);
18
+ },
19
+ /**
20
+ * Get path to initiatives directory
21
+ * Uses getConfig().directories.initiativesDir for config-aware resolution.
22
+ *
23
+ * @returns {string} Path to initiatives directory
24
+ */
25
+ INITIATIVES_DIR: () => {
26
+ const config = getConfig();
27
+ return config.directories.initiativesDir;
28
+ },
29
+ /**
30
+ * Get path to WU directory (for scanning WUs by initiative)
31
+ * Uses getConfig().directories.wuDir for config-aware resolution.
32
+ *
33
+ * @returns {string} Path to WU directory
34
+ */
35
+ WU_DIR: () => {
36
+ const config = getConfig();
37
+ return config.directories.wuDir;
38
+ }
39
+ };
40
+
41
+ export {
42
+ INIT_PATHS
43
+ };
@@ -0,0 +1,87 @@
1
+ import {
2
+ LUMENFLOW_MEMORY_PATHS
3
+ } from "./chunk-4N74J3UT.js";
4
+
5
+ // ../memory/dist/mem-init-core.js
6
+ import fs from "fs/promises";
7
+ import path from "path";
8
+ import yaml from "yaml";
9
+ var MEMORY_PATHS = {
10
+ /** Memory directory relative to project root */
11
+ MEMORY_DIR: LUMENFLOW_MEMORY_PATHS.MEMORY_DIR,
12
+ /** Memory JSONL file name */
13
+ MEMORY_FILE: "memory.jsonl",
14
+ /** Config YAML file name */
15
+ CONFIG_FILE: "config.yaml"
16
+ };
17
+ var DEFAULT_CONFIG = {
18
+ /** Config schema version */
19
+ version: 1,
20
+ /** Retention policy for each lifecycle */
21
+ retention: {
22
+ /** Ephemeral nodes are discarded immediately after use */
23
+ ephemeral: 0,
24
+ /** Session nodes expire after 1 hour */
25
+ session: 3600,
26
+ /** WU nodes expire after 7 days */
27
+ wu: 604800,
28
+ /** Project nodes never expire (-1 = infinite) */
29
+ project: -1
30
+ }
31
+ };
32
+ async function fileExists(filePath) {
33
+ try {
34
+ await fs.access(filePath);
35
+ return true;
36
+ } catch {
37
+ return false;
38
+ }
39
+ }
40
+ function generateConfigYaml() {
41
+ const header = "# Memory layer configuration\n# Generated by pnpm mem:init (WU-1464)\n";
42
+ return header + yaml.stringify(DEFAULT_CONFIG);
43
+ }
44
+ async function initMemory(baseDir) {
45
+ const memoryDir = path.join(baseDir, MEMORY_PATHS.MEMORY_DIR);
46
+ const memoryJsonlPath = path.join(memoryDir, MEMORY_PATHS.MEMORY_FILE);
47
+ const configYamlPath = path.join(memoryDir, MEMORY_PATHS.CONFIG_FILE);
48
+ const result = {
49
+ success: false,
50
+ alreadyInitialized: false,
51
+ paths: {
52
+ memoryDir,
53
+ memoryJsonl: memoryJsonlPath,
54
+ configYaml: configYamlPath
55
+ },
56
+ created: {
57
+ directory: false,
58
+ memoryJsonl: false,
59
+ configYaml: false
60
+ }
61
+ };
62
+ const dirExists = await fileExists(memoryDir);
63
+ const memoryExists = await fileExists(memoryJsonlPath);
64
+ const configExists = await fileExists(configYamlPath);
65
+ if (dirExists && memoryExists && configExists) {
66
+ result.alreadyInitialized = true;
67
+ }
68
+ if (!dirExists) {
69
+ await fs.mkdir(memoryDir, { recursive: true });
70
+ result.created.directory = true;
71
+ }
72
+ if (!memoryExists) {
73
+ await fs.writeFile(memoryJsonlPath, "", { encoding: "utf-8" });
74
+ result.created.memoryJsonl = true;
75
+ }
76
+ if (!configExists) {
77
+ const configContent = generateConfigYaml();
78
+ await fs.writeFile(configYamlPath, configContent, { encoding: "utf-8" });
79
+ result.created.configYaml = true;
80
+ }
81
+ result.success = true;
82
+ return result;
83
+ }
84
+
85
+ export {
86
+ initMemory
87
+ };
@@ -0,0 +1,23 @@
1
+ import {
2
+ WU_LIFECYCLE_CLAIM_DEFAULTS,
3
+ WU_LIFECYCLE_COMMANDS,
4
+ WU_LIFECYCLE_EVENT_KINDS,
5
+ WU_LIFECYCLE_EVENT_SCHEMA_VERSION,
6
+ WU_LIFECYCLE_SPEC_HASH,
7
+ WU_LIFECYCLE_SYNC_CONFIG,
8
+ WU_LIFECYCLE_SYNC_LOG_PREFIX,
9
+ WU_LIFECYCLE_SYNC_RESULT_DEFAULTS,
10
+ WU_LIFECYCLE_SYNC_SKIPPED_REASONS
11
+ } from "./chunk-EK2AKZKD.js";
12
+ import "./chunk-3RG5ZIWI.js";
13
+ export {
14
+ WU_LIFECYCLE_CLAIM_DEFAULTS,
15
+ WU_LIFECYCLE_COMMANDS,
16
+ WU_LIFECYCLE_EVENT_KINDS,
17
+ WU_LIFECYCLE_EVENT_SCHEMA_VERSION,
18
+ WU_LIFECYCLE_SPEC_HASH,
19
+ WU_LIFECYCLE_SYNC_CONFIG,
20
+ WU_LIFECYCLE_SYNC_LOG_PREFIX,
21
+ WU_LIFECYCLE_SYNC_RESULT_DEFAULTS,
22
+ WU_LIFECYCLE_SYNC_SKIPPED_REASONS
23
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ CONTROL_PLANE_AUTH_TOKEN_ENV_PATTERN,
3
+ CONTROL_PLANE_POLICY_MODES,
4
+ CONTROL_PLANE_POLICY_MODE_VALUES,
5
+ ControlPlaneConfigSchema,
6
+ DEFAULT_CONTROL_PLANE_AUTH_TOKEN_ENV,
7
+ HttpControlPlaneSyncPort,
8
+ MockControlPlaneSyncPort,
9
+ MockSignalSyncPort,
10
+ WorkspaceControlPlaneSchema,
11
+ applyPolicyMode,
12
+ createHttpControlPlaneSyncPort,
13
+ createMockControlPlaneSyncPort,
14
+ createMockSignalSyncPort,
15
+ parseWorkspaceControlPlaneConfig
16
+ } from "./chunk-YLS7AZSX.js";
17
+ import "./chunk-3RG5ZIWI.js";
18
+ export {
19
+ CONTROL_PLANE_AUTH_TOKEN_ENV_PATTERN,
20
+ CONTROL_PLANE_POLICY_MODES,
21
+ CONTROL_PLANE_POLICY_MODE_VALUES,
22
+ ControlPlaneConfigSchema,
23
+ DEFAULT_CONTROL_PLANE_AUTH_TOKEN_ENV,
24
+ HttpControlPlaneSyncPort,
25
+ MockControlPlaneSyncPort,
26
+ MockSignalSyncPort,
27
+ WorkspaceControlPlaneSchema,
28
+ applyPolicyMode,
29
+ createHttpControlPlaneSyncPort,
30
+ createMockControlPlaneSyncPort,
31
+ createMockSignalSyncPort,
32
+ parseWorkspaceControlPlaneConfig
33
+ };
@@ -0,0 +1,27 @@
1
+ import {
2
+ INVARIANT_TYPES,
3
+ InvariantError,
4
+ formatInvariantError,
5
+ getInvariantChecker,
6
+ loadInvariants,
7
+ registerInvariantChecker,
8
+ runInvariants,
9
+ validateInvariants
10
+ } from "./chunk-EZ6ZBYBM.js";
11
+ import "./chunk-U7I7FS7T.js";
12
+ import "./chunk-NRIZR3A7.js";
13
+ import "./chunk-6HO4GWJE.js";
14
+ import "./chunk-DWMLTXKQ.js";
15
+ import "./chunk-V6OJGLBA.js";
16
+ import "./chunk-RXRKBBSM.js";
17
+ import "./chunk-3RG5ZIWI.js";
18
+ export {
19
+ INVARIANT_TYPES,
20
+ InvariantError,
21
+ formatInvariantError,
22
+ getInvariantChecker,
23
+ loadInvariants,
24
+ registerInvariantChecker,
25
+ runInvariants,
26
+ validateInvariants
27
+ };
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ acquireLaneLock,
4
+ auditedUnlock,
5
+ checkLaneLock,
6
+ forceRemoveStaleLock,
7
+ getAllLaneLocks,
8
+ getLockFilePath,
9
+ getLocksDir,
10
+ getStaleThresholdMs,
11
+ isLockStale,
12
+ isZombieLock,
13
+ readLockMetadata,
14
+ releaseLaneLock
15
+ } from "./chunk-JONWQUB5.js";
16
+ import "./chunk-NRIZR3A7.js";
17
+ import "./chunk-6HO4GWJE.js";
18
+ import "./chunk-DWMLTXKQ.js";
19
+ import "./chunk-V6OJGLBA.js";
20
+ import "./chunk-RXRKBBSM.js";
21
+ import "./chunk-3RG5ZIWI.js";
22
+ export {
23
+ acquireLaneLock,
24
+ auditedUnlock,
25
+ checkLaneLock,
26
+ forceRemoveStaleLock,
27
+ getAllLaneLocks,
28
+ getLockFilePath,
29
+ getLocksDir,
30
+ getStaleThresholdMs,
31
+ isLockStale,
32
+ isZombieLock,
33
+ readLockMetadata,
34
+ releaseLaneLock
35
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ createCheckpoint
3
+ } from "./chunk-RWO5XMZ6.js";
4
+ import "./chunk-ND6MY37M.js";
5
+ import "./chunk-RIAAGL2E.js";
6
+ import "./chunk-DFR4DJBM.js";
7
+ import "./chunk-4N74J3UT.js";
8
+ import "./chunk-DWMLTXKQ.js";
9
+ import "./chunk-V6OJGLBA.js";
10
+ import "./chunk-RXRKBBSM.js";
11
+ import "./chunk-3RG5ZIWI.js";
12
+ export {
13
+ createCheckpoint
14
+ };
@@ -0,0 +1,19 @@
1
+ import {
2
+ SIGNAL_FILE_NAME,
3
+ SIGNAL_RECEIPTS_FILE_NAME,
4
+ createSignal,
5
+ loadSignals,
6
+ markSignalsAsRead
7
+ } from "./chunk-OMJD6A3S.js";
8
+ import "./chunk-4N74J3UT.js";
9
+ import "./chunk-DWMLTXKQ.js";
10
+ import "./chunk-V6OJGLBA.js";
11
+ import "./chunk-RXRKBBSM.js";
12
+ import "./chunk-3RG5ZIWI.js";
13
+ export {
14
+ SIGNAL_FILE_NAME,
15
+ SIGNAL_RECEIPTS_FILE_NAME,
16
+ createSignal,
17
+ loadSignals,
18
+ markSignalsAsRead
19
+ };
@@ -0,0 +1,18 @@
1
+ import {
2
+ MEMORY_FILE_NAME,
3
+ appendNode,
4
+ loadMemory,
5
+ loadMemoryAll,
6
+ queryByWu,
7
+ queryReady
8
+ } from "./chunk-DFR4DJBM.js";
9
+ import "./chunk-RXRKBBSM.js";
10
+ import "./chunk-3RG5ZIWI.js";
11
+ export {
12
+ MEMORY_FILE_NAME,
13
+ appendNode,
14
+ loadMemory,
15
+ loadMemoryAll,
16
+ queryByWu,
17
+ queryReady
18
+ };
@@ -0,0 +1,13 @@
1
+ import {
2
+ buildWuLifecycleKernelEvent,
3
+ flushWuLifecycleSync
4
+ } from "./chunk-JERYVEIZ.js";
5
+ import "./chunk-EK2AKZKD.js";
6
+ import "./chunk-DWMLTXKQ.js";
7
+ import "./chunk-V6OJGLBA.js";
8
+ import "./chunk-RXRKBBSM.js";
9
+ import "./chunk-3RG5ZIWI.js";
10
+ export {
11
+ buildWuLifecycleKernelEvent,
12
+ flushWuLifecycleSync
13
+ };
@@ -0,0 +1,17 @@
1
+ import {
2
+ emitMethodologyTelemetry
3
+ } from "./chunk-6XYXI2NQ.js";
4
+ import {
5
+ generateEnforcementSummary,
6
+ generateMandatoryStandards
7
+ } from "./chunk-NMG736UR.js";
8
+ import "./chunk-6HO4GWJE.js";
9
+ import "./chunk-DWMLTXKQ.js";
10
+ import "./chunk-V6OJGLBA.js";
11
+ import "./chunk-RXRKBBSM.js";
12
+ import "./chunk-3RG5ZIWI.js";
13
+ export {
14
+ emitMethodologyTelemetry,
15
+ generateEnforcementSummary,
16
+ generateMandatoryStandards
17
+ };
@@ -0,0 +1,22 @@
1
+ import {
2
+ checkLaneOccupation,
3
+ generateCodexPrompt,
4
+ generateLaneOccupationWarning,
5
+ generateTaskInvocation
6
+ } from "./chunk-6W5XHWYV.js";
7
+ import "./chunk-JONWQUB5.js";
8
+ import "./chunk-NMG736UR.js";
9
+ import "./chunk-EZ6ZBYBM.js";
10
+ import "./chunk-U7I7FS7T.js";
11
+ import "./chunk-NRIZR3A7.js";
12
+ import "./chunk-6HO4GWJE.js";
13
+ import "./chunk-DWMLTXKQ.js";
14
+ import "./chunk-V6OJGLBA.js";
15
+ import "./chunk-RXRKBBSM.js";
16
+ import "./chunk-3RG5ZIWI.js";
17
+ export {
18
+ checkLaneOccupation,
19
+ generateCodexPrompt,
20
+ generateLaneOccupationWarning,
21
+ generateTaskInvocation
22
+ };
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ WU_DONE_COMPLETION_MODES,
4
+ buildPRBody,
5
+ createPR,
6
+ isGhCliAvailable,
7
+ isPRModeEnabled,
8
+ printGhCliMissingMessage,
9
+ printPRCreatedMessage
10
+ } from "./chunk-XGI665H7.js";
11
+ import "./chunk-2UFQ3A3C.js";
12
+ import "./chunk-6HO4GWJE.js";
13
+ import "./chunk-DWMLTXKQ.js";
14
+ import "./chunk-V6OJGLBA.js";
15
+ import "./chunk-RXRKBBSM.js";
16
+ import "./chunk-3RG5ZIWI.js";
17
+ export {
18
+ WU_DONE_COMPLETION_MODES,
19
+ buildPRBody,
20
+ createPR,
21
+ isGhCliAvailable,
22
+ isPRModeEnabled,
23
+ printGhCliMissingMessage,
24
+ printPRCreatedMessage
25
+ };
@@ -0,0 +1,30 @@
1
+ import {
2
+ applyExposureDefaults,
3
+ buildCodePathsCommittedErrorMessage,
4
+ buildTypeVsCodePathsErrorMessage,
5
+ validateCodePathsCommittedBeforeDone,
6
+ validateCodePathsExist,
7
+ validatePostMutation,
8
+ validateSpecCompleteness,
9
+ validateTestPathsRequired,
10
+ validateTypeVsCodePathsPreflight
11
+ } from "./chunk-L737LQ4C.js";
12
+ import "./chunk-2UFQ3A3C.js";
13
+ import "./chunk-U7I7FS7T.js";
14
+ import "./chunk-NRIZR3A7.js";
15
+ import "./chunk-6HO4GWJE.js";
16
+ import "./chunk-DWMLTXKQ.js";
17
+ import "./chunk-V6OJGLBA.js";
18
+ import "./chunk-RXRKBBSM.js";
19
+ import "./chunk-3RG5ZIWI.js";
20
+ export {
21
+ applyExposureDefaults,
22
+ buildCodePathsCommittedErrorMessage,
23
+ buildTypeVsCodePathsErrorMessage,
24
+ validateCodePathsCommittedBeforeDone,
25
+ validateCodePathsExist,
26
+ validatePostMutation,
27
+ validateSpecCompleteness,
28
+ validateTestPathsRequired,
29
+ validateTypeVsCodePathsPreflight
30
+ };
@@ -0,0 +1,232 @@
1
+ import {
2
+ WU_STATUS,
3
+ getConfig
4
+ } from "./chunk-V6OJGLBA.js";
5
+ import "./chunk-RXRKBBSM.js";
6
+ import "./chunk-3RG5ZIWI.js";
7
+
8
+ // ../core/dist/wu-duplicate-id-detector.js
9
+ import { readdirSync, readFileSync, writeFileSync, existsSync, renameSync } from "fs";
10
+ import path from "path";
11
+ import { parse, stringify } from "yaml";
12
+ var WU_YAML_EXTENSION = ".yaml";
13
+ var WU_ID_PREFIX = "WU-";
14
+ var STAMP_SUFFIX = ".done";
15
+ var EVENTS_FILE = "wu-events.jsonl";
16
+ function scanYamlFiles(wuDirAbsolute) {
17
+ const idToFiles = /* @__PURE__ */ new Map();
18
+ if (!existsSync(wuDirAbsolute)) {
19
+ return idToFiles;
20
+ }
21
+ const entries = readdirSync(wuDirAbsolute);
22
+ for (const entry of entries) {
23
+ if (!entry.endsWith(WU_YAML_EXTENSION))
24
+ continue;
25
+ const fullPath = path.join(wuDirAbsolute, entry);
26
+ try {
27
+ const content = readFileSync(fullPath, "utf-8");
28
+ const doc = parse(content);
29
+ if (!doc || typeof doc.id !== "string")
30
+ continue;
31
+ const id = doc.id;
32
+ const existing = idToFiles.get(id) ?? [];
33
+ existing.push(fullPath);
34
+ idToFiles.set(id, existing);
35
+ } catch {
36
+ }
37
+ }
38
+ return idToFiles;
39
+ }
40
+ function findStamps(stampsDirAbsolute, id) {
41
+ const stampFile = path.join(stampsDirAbsolute, `${id}${STAMP_SUFFIX}`);
42
+ if (existsSync(stampFile)) {
43
+ return [stampFile];
44
+ }
45
+ return [];
46
+ }
47
+ function findEvents(eventsFileAbsolute, id) {
48
+ if (!existsSync(eventsFileAbsolute)) {
49
+ return [];
50
+ }
51
+ const content = readFileSync(eventsFileAbsolute, "utf-8");
52
+ const lines = content.split("\n");
53
+ const results = [];
54
+ for (let i = 0; i < lines.length; i++) {
55
+ const line = lines[i]?.trim();
56
+ if (!line)
57
+ continue;
58
+ try {
59
+ const event = JSON.parse(line);
60
+ if (event.wuId === id) {
61
+ results.push({ line: i + 1, event });
62
+ }
63
+ } catch {
64
+ }
65
+ }
66
+ return results;
67
+ }
68
+ async function detectDuplicateIds(projectRoot) {
69
+ const config = getConfig({ projectRoot });
70
+ const wuDirAbsolute = path.join(projectRoot, config.directories.wuDir);
71
+ const stampsDirAbsolute = path.join(projectRoot, config.state.stampsDir);
72
+ const eventsFileAbsolute = path.join(projectRoot, config.state.stateDir, EVENTS_FILE);
73
+ const idToFiles = scanYamlFiles(wuDirAbsolute);
74
+ const duplicates = [];
75
+ let totalWUs = 0;
76
+ for (const [id, files] of idToFiles) {
77
+ totalWUs += files.length;
78
+ if (files.length > 1) {
79
+ duplicates.push({
80
+ id,
81
+ files,
82
+ stamps: findStamps(stampsDirAbsolute, id),
83
+ events: findEvents(eventsFileAbsolute, id)
84
+ });
85
+ }
86
+ }
87
+ for (const [, files] of idToFiles) {
88
+ if (files.length === 1) {
89
+ }
90
+ }
91
+ return { totalWUs, duplicates };
92
+ }
93
+ function nextAvailableId(existingIds) {
94
+ let candidate = 1;
95
+ while (existingIds.has(`${WU_ID_PREFIX}${candidate}`)) {
96
+ candidate++;
97
+ }
98
+ return `${WU_ID_PREFIX}${candidate}`;
99
+ }
100
+ function chooseCanonical(id, files) {
101
+ const expectedFilename = `${id}${WU_YAML_EXTENSION}`;
102
+ for (let i = 0; i < files.length; i++) {
103
+ if (path.basename(files[i]) === expectedFilename) {
104
+ return i;
105
+ }
106
+ }
107
+ return 0;
108
+ }
109
+ function collectAllIds(wuDirAbsolute) {
110
+ const ids = /* @__PURE__ */ new Set();
111
+ if (!existsSync(wuDirAbsolute))
112
+ return ids;
113
+ const entries = readdirSync(wuDirAbsolute);
114
+ for (const entry of entries) {
115
+ if (!entry.endsWith(WU_YAML_EXTENSION))
116
+ continue;
117
+ const fullPath = path.join(wuDirAbsolute, entry);
118
+ try {
119
+ const content = readFileSync(fullPath, "utf-8");
120
+ const doc = parse(content);
121
+ if (doc && typeof doc.id === "string") {
122
+ ids.add(doc.id);
123
+ }
124
+ } catch {
125
+ }
126
+ }
127
+ return ids;
128
+ }
129
+ function updateEvents(eventsFileAbsolute, oldId, newId, duplicateLane) {
130
+ if (!existsSync(eventsFileAbsolute))
131
+ return false;
132
+ const content = readFileSync(eventsFileAbsolute, "utf-8");
133
+ const lines = content.split("\n");
134
+ let modified = false;
135
+ const newLines = [];
136
+ for (const rawLine of lines) {
137
+ const line = rawLine.trim();
138
+ if (!line) {
139
+ newLines.push(rawLine);
140
+ continue;
141
+ }
142
+ try {
143
+ const event = JSON.parse(line);
144
+ if (event.wuId === oldId) {
145
+ if (duplicateLane && typeof event.lane === "string" && event.lane !== duplicateLane) {
146
+ newLines.push(rawLine);
147
+ continue;
148
+ }
149
+ event.wuId = newId;
150
+ newLines.push(JSON.stringify(event));
151
+ modified = true;
152
+ } else {
153
+ newLines.push(rawLine);
154
+ }
155
+ } catch {
156
+ newLines.push(rawLine);
157
+ }
158
+ }
159
+ if (modified) {
160
+ writeFileSync(eventsFileAbsolute, newLines.join("\n"), "utf-8");
161
+ }
162
+ return modified;
163
+ }
164
+ async function repairDuplicateIds(projectRoot, options) {
165
+ const report = await detectDuplicateIds(projectRoot);
166
+ if (report.duplicates.length === 0) {
167
+ return { applied: false, mappings: [] };
168
+ }
169
+ const config = getConfig({ projectRoot });
170
+ const wuDirAbsolute = path.join(projectRoot, config.directories.wuDir);
171
+ const stampsDirAbsolute = path.join(projectRoot, config.state.stampsDir);
172
+ const eventsFileAbsolute = path.join(projectRoot, config.state.stateDir, EVENTS_FILE);
173
+ const allIds = collectAllIds(wuDirAbsolute);
174
+ const mappings = [];
175
+ for (const group of report.duplicates) {
176
+ const canonicalIdx = chooseCanonical(group.id, group.files);
177
+ for (let i = 0; i < group.files.length; i++) {
178
+ if (i === canonicalIdx)
179
+ continue;
180
+ const duplicateFile = group.files[i];
181
+ const newId = nextAvailableId(allIds);
182
+ allIds.add(newId);
183
+ if (!options.apply) {
184
+ mappings.push({
185
+ oldId: group.id,
186
+ newId,
187
+ renamedFile: duplicateFile,
188
+ touchedFiles: []
189
+ });
190
+ continue;
191
+ }
192
+ const touchedFiles = [];
193
+ try {
194
+ const content = readFileSync(duplicateFile, "utf-8");
195
+ const doc = parse(content);
196
+ const duplicateLane = typeof doc.lane === "string" ? doc.lane : void 0;
197
+ doc.id = newId;
198
+ writeFileSync(duplicateFile, stringify(doc, { lineWidth: 0 }), "utf-8");
199
+ touchedFiles.push(duplicateFile);
200
+ const newFilePath = path.join(wuDirAbsolute, `${newId}${WU_YAML_EXTENSION}`);
201
+ renameSync(duplicateFile, newFilePath);
202
+ touchedFiles[touchedFiles.length - 1] = newFilePath;
203
+ const oldStampPath = path.join(stampsDirAbsolute, `${group.id}${STAMP_SUFFIX}`);
204
+ const newStampPath = path.join(stampsDirAbsolute, `${newId}${STAMP_SUFFIX}`);
205
+ if (existsSync(oldStampPath)) {
206
+ if (doc.status === WU_STATUS.DONE) {
207
+ writeFileSync(newStampPath, "", "utf-8");
208
+ touchedFiles.push(newStampPath);
209
+ }
210
+ }
211
+ if (updateEvents(eventsFileAbsolute, group.id, newId, duplicateLane)) {
212
+ touchedFiles.push(eventsFileAbsolute);
213
+ }
214
+ mappings.push({
215
+ oldId: group.id,
216
+ newId,
217
+ renamedFile: newFilePath,
218
+ touchedFiles
219
+ });
220
+ } catch {
221
+ }
222
+ }
223
+ }
224
+ return {
225
+ applied: options.apply,
226
+ mappings
227
+ };
228
+ }
229
+ export {
230
+ detectDuplicateIds,
231
+ repairDuplicateIds
232
+ };