@lumenflow/core 1.3.4 → 1.3.6

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 (64) hide show
  1. package/dist/adapters/filesystem-metrics.adapter.d.ts +1 -1
  2. package/dist/adapters/filesystem-metrics.adapter.js +1 -1
  3. package/dist/beacon-migration.d.ts +56 -0
  4. package/dist/beacon-migration.js +101 -0
  5. package/dist/cleanup-lock.js +3 -3
  6. package/dist/commands-logger.d.ts +2 -2
  7. package/dist/commands-logger.js +5 -5
  8. package/dist/core/tool-runner.d.ts +1 -1
  9. package/dist/core/tool-runner.js +2 -2
  10. package/dist/docs-path-validator.d.ts +2 -2
  11. package/dist/docs-path-validator.js +4 -4
  12. package/dist/domain/orchestration.constants.js +3 -3
  13. package/dist/force-bypass-audit.d.ts +2 -2
  14. package/dist/force-bypass-audit.js +8 -7
  15. package/dist/index.d.ts +2 -0
  16. package/dist/index.js +4 -0
  17. package/dist/lane-lock.d.ts +1 -1
  18. package/dist/lane-lock.js +3 -4
  19. package/dist/logs-lib.d.ts +2 -2
  20. package/dist/logs-lib.js +5 -4
  21. package/dist/lumenflow-config-schema.d.ts +1 -1
  22. package/dist/lumenflow-config-schema.js +19 -19
  23. package/dist/lumenflow-config.js +1 -1
  24. package/dist/merge-lock.js +7 -7
  25. package/dist/prompt-linter.js +3 -3
  26. package/dist/prompt-monitor.d.ts +1 -1
  27. package/dist/prompt-monitor.js +5 -5
  28. package/dist/rebase-artifact-cleanup.d.ts +1 -1
  29. package/dist/rebase-artifact-cleanup.js +1 -1
  30. package/dist/spawn-recovery.d.ts +2 -2
  31. package/dist/spawn-recovery.js +6 -6
  32. package/dist/spawn-registry-store.d.ts +2 -2
  33. package/dist/spawn-registry-store.js +2 -2
  34. package/dist/spawn-tree.d.ts +2 -2
  35. package/dist/spawn-tree.js +2 -2
  36. package/dist/stamp-utils.d.ts +1 -1
  37. package/dist/stamp-utils.js +1 -1
  38. package/dist/state-machine.d.ts +1 -0
  39. package/dist/state-machine.js +2 -1
  40. package/dist/telemetry.d.ts +1 -1
  41. package/dist/telemetry.js +1 -1
  42. package/dist/wu-checkpoint.js +4 -4
  43. package/dist/wu-consistency-checker.d.ts +22 -2
  44. package/dist/wu-consistency-checker.js +260 -30
  45. package/dist/wu-constants.d.ts +67 -4
  46. package/dist/wu-constants.js +41 -15
  47. package/dist/wu-done-branch-only.js +2 -2
  48. package/dist/wu-done-inputs.js +1 -1
  49. package/dist/wu-done-validation.js +2 -2
  50. package/dist/wu-done-worktree.js +4 -4
  51. package/dist/wu-paths.js +1 -1
  52. package/dist/wu-recovery.d.ts +4 -4
  53. package/dist/wu-recovery.js +8 -8
  54. package/dist/wu-repair-core.js +4 -4
  55. package/dist/wu-spawn-helpers.d.ts +1 -1
  56. package/dist/wu-spawn-helpers.js +3 -2
  57. package/dist/wu-spawn.js +7 -7
  58. package/dist/wu-state-schema.d.ts +24 -1
  59. package/dist/wu-state-schema.js +13 -0
  60. package/dist/wu-state-store.d.ts +23 -2
  61. package/dist/wu-state-store.js +56 -2
  62. package/package.json +3 -3
  63. package/dist/spec-branch-helpers.d.ts +0 -118
  64. package/dist/spec-branch-helpers.js +0 -199
@@ -1,199 +0,0 @@
1
- /**
2
- * Spec Branch Helpers
3
- *
4
- * WU-1062: External plan storage and no-main-write mode
5
- *
6
- * Provides helpers for working with spec branches (spec/wu-XXXX).
7
- * wu:create writes to spec branches by default; wu:claim merges them to main.
8
- *
9
- * @module
10
- */
11
- import { WU_PATHS } from './wu-paths.js';
12
- import { REMOTES, GIT_REFS, GIT_COMMANDS, GIT_FLAGS } from './wu-constants.js';
13
- /**
14
- * Spec branch prefix
15
- */
16
- export const SPEC_BRANCH_PREFIX = 'spec/';
17
- /**
18
- * WU source location constants
19
- */
20
- export const WU_SOURCE = {
21
- /** WU exists on main branch only */
22
- MAIN: 'main',
23
- /** WU exists on spec branch only */
24
- SPEC_BRANCH: 'spec_branch',
25
- /** WU exists on both main and spec branch */
26
- BOTH: 'both',
27
- /** WU not found anywhere */
28
- NOT_FOUND: 'not_found',
29
- };
30
- /**
31
- * Get the spec branch name for a WU
32
- *
33
- * @param {string} wuId - Work Unit ID (e.g., 'WU-1062')
34
- * @returns {string} Spec branch name (e.g., 'spec/wu-1062')
35
- *
36
- * @example
37
- * getSpecBranchName('WU-1062') // 'spec/wu-1062'
38
- */
39
- export function getSpecBranchName(wuId) {
40
- return `${SPEC_BRANCH_PREFIX}${wuId.toLowerCase()}`;
41
- }
42
- /**
43
- * Get the origin-qualified spec branch name
44
- *
45
- * @param {string} wuId - Work Unit ID
46
- * @returns {string} Origin-qualified branch name (e.g., 'origin/spec/wu-1062')
47
- */
48
- export function getOriginSpecBranch(wuId) {
49
- return GIT_REFS.remote(REMOTES.ORIGIN, getSpecBranchName(wuId));
50
- }
51
- /**
52
- * Check if a spec branch exists on origin
53
- *
54
- * @param {string} wuId - Work Unit ID
55
- * @param {SimpleGit} git - Git adapter instance
56
- * @returns {Promise<boolean>} True if spec branch exists
57
- *
58
- * @example
59
- * const exists = await specBranchExists('WU-1062', git);
60
- */
61
- export async function specBranchExists(wuId, git) {
62
- try {
63
- const originBranch = getOriginSpecBranch(wuId);
64
- // Use branchExists if available, otherwise check with ls-remote
65
- if ('branchExists' in git && typeof git.branchExists === 'function') {
66
- return await git.branchExists(originBranch);
67
- }
68
- // Fallback: use ls-remote to check if branch exists
69
- const result = await git.raw([
70
- GIT_COMMANDS.LS_REMOTE,
71
- GIT_FLAGS.HEADS,
72
- REMOTES.ORIGIN,
73
- getSpecBranchName(wuId),
74
- ]);
75
- return result.trim().length > 0;
76
- }
77
- catch {
78
- return false;
79
- }
80
- }
81
- /**
82
- * Check if a WU exists on main branch
83
- *
84
- * @param {string} wuId - Work Unit ID
85
- * @param {SimpleGit} git - Git adapter instance
86
- * @returns {Promise<boolean>} True if WU YAML exists on main
87
- */
88
- export async function isWUOnMain(wuId, git) {
89
- try {
90
- const wuPath = WU_PATHS.WU(wuId);
91
- // Check if file exists on origin/main
92
- // git ls-tree returns exit 0 with empty output if file doesn't exist
93
- const result = await git.raw([GIT_COMMANDS.LS_TREE, GIT_REFS.ORIGIN_MAIN, GIT_FLAGS.PATH_SEPARATOR, wuPath]);
94
- return result.trim().length > 0;
95
- }
96
- catch {
97
- return false;
98
- }
99
- }
100
- /**
101
- * Merge spec branch to main branch (fast-forward only)
102
- *
103
- * This is used by wu:claim when a WU exists only on a spec branch.
104
- * The spec branch is merged to main before creating the worktree.
105
- *
106
- * @param {string} wuId - Work Unit ID
107
- * @param {SimpleGit} git - Git adapter instance
108
- * @throws {Error} If merge fails (e.g., due to conflicts)
109
- *
110
- * @example
111
- * await mergeSpecBranchToMain('WU-1062', git);
112
- */
113
- export async function mergeSpecBranchToMain(wuId, git) {
114
- const specBranch = getSpecBranchName(wuId);
115
- const originSpecBranch = getOriginSpecBranch(wuId);
116
- // Fetch the spec branch
117
- await git.fetch(REMOTES.ORIGIN, specBranch);
118
- // Merge with fast-forward only (safe merge)
119
- await git.merge(originSpecBranch, { ffOnly: true });
120
- }
121
- /**
122
- * Delete spec branch after merge
123
- *
124
- * @param {string} wuId - Work Unit ID
125
- * @param {SimpleGit} git - Git adapter instance
126
- */
127
- export async function deleteSpecBranch(wuId, git) {
128
- const specBranch = getSpecBranchName(wuId);
129
- try {
130
- // Delete local branch if exists
131
- await git.deleteBranch(specBranch);
132
- }
133
- catch {
134
- // Ignore if local branch doesn't exist
135
- }
136
- try {
137
- // Delete remote branch
138
- await git.raw([GIT_COMMANDS.PUSH, REMOTES.ORIGIN, GIT_FLAGS.DELETE_REMOTE, specBranch]);
139
- }
140
- catch {
141
- // Ignore if remote branch doesn't exist
142
- }
143
- }
144
- /**
145
- * Determine the source of a WU (main, spec branch, both, or not found)
146
- *
147
- * Used by wu:claim to decide whether to merge spec branch before creating worktree.
148
- *
149
- * @param {string} wuId - Work Unit ID
150
- * @param {SimpleGit} git - Git adapter instance
151
- * @returns {Promise<WUSourceType>} Source location constant
152
- *
153
- * @example
154
- * const source = await getWUSource('WU-1062', git);
155
- * if (source === WU_SOURCE.SPEC_BRANCH) {
156
- * await mergeSpecBranchToMain('WU-1062', git);
157
- * }
158
- */
159
- export async function getWUSource(wuId, git) {
160
- // Check both locations in parallel for efficiency
161
- const [onMain, hasSpecBranch] = await Promise.all([
162
- isWUOnMain(wuId, git),
163
- specBranchExists(wuId, git),
164
- ]);
165
- if (onMain && hasSpecBranch) {
166
- return WU_SOURCE.BOTH;
167
- }
168
- if (onMain) {
169
- return WU_SOURCE.MAIN;
170
- }
171
- if (hasSpecBranch) {
172
- return WU_SOURCE.SPEC_BRANCH;
173
- }
174
- return WU_SOURCE.NOT_FOUND;
175
- }
176
- /**
177
- * Create a spec branch from current HEAD
178
- *
179
- * Used by wu:create in default mode (no --direct flag).
180
- *
181
- * @param {string} wuId - Work Unit ID
182
- * @param {SimpleGit} git - Git adapter instance
183
- */
184
- export async function createSpecBranch(wuId, git) {
185
- const specBranch = getSpecBranchName(wuId);
186
- // Create local branch and checkout
187
- await git.createBranch(specBranch);
188
- }
189
- /**
190
- * Push spec branch to origin
191
- *
192
- * @param {string} wuId - Work Unit ID
193
- * @param {SimpleGit} git - Git adapter instance
194
- */
195
- export async function pushSpecBranch(wuId, git) {
196
- const specBranch = getSpecBranchName(wuId);
197
- // Push to origin
198
- await git.push(REMOTES.ORIGIN, specBranch);
199
- }