@lumenflow/core 2.2.2 → 2.3.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/active-wu-detector.d.ts +1 -1
- package/dist/active-wu-detector.js +1 -1
- package/dist/arg-parser.js +51 -18
- package/dist/backlog-generator.d.ts +4 -4
- package/dist/backlog-generator.js +4 -4
- package/dist/backlog-sync-validator.js +1 -1
- package/dist/cleanup-lock.d.ts +9 -2
- package/dist/cleanup-lock.js +17 -7
- package/dist/code-path-validator.d.ts +3 -3
- package/dist/code-path-validator.js +3 -3
- package/dist/compliance-parser.d.ts +1 -1
- package/dist/compliance-parser.js +1 -1
- package/dist/constants/backlog-patterns.d.ts +1 -1
- package/dist/constants/backlog-patterns.js +1 -1
- package/dist/constants/dora-constants.d.ts +1 -1
- package/dist/constants/dora-constants.js +1 -1
- package/dist/constants/gate-constants.d.ts +1 -1
- package/dist/constants/gate-constants.js +1 -1
- package/dist/constants/linter-constants.d.ts +1 -1
- package/dist/constants/linter-constants.js +1 -1
- package/dist/constants/tokenizer-constants.d.ts +1 -1
- package/dist/constants/tokenizer-constants.js +1 -1
- package/dist/context/location-resolver.js +2 -1
- package/dist/context-validation-integration.d.ts +1 -0
- package/dist/core/scope-checker.d.ts +3 -3
- package/dist/core/scope-checker.js +3 -3
- package/dist/core/tool-runner.d.ts +5 -5
- package/dist/core/tool-runner.js +5 -5
- package/dist/core/tool.constants.d.ts +1 -1
- package/dist/core/tool.constants.js +1 -1
- package/dist/core/tool.schemas.d.ts +2 -2
- package/dist/core/tool.schemas.js +1 -1
- package/dist/core/worktree-guard.d.ts +1 -1
- package/dist/core/worktree-guard.js +1 -1
- package/dist/coverage-gate.d.ts +12 -3
- package/dist/coverage-gate.js +15 -8
- package/dist/date-utils.d.ts +4 -4
- package/dist/date-utils.js +4 -4
- package/dist/dependency-graph.d.ts +6 -0
- package/dist/dependency-graph.js +43 -2
- package/dist/dependency-guard.d.ts +2 -2
- package/dist/dependency-guard.js +3 -3
- package/dist/dependency-validator.d.ts +4 -4
- package/dist/dependency-validator.js +4 -7
- package/dist/domain/orchestration.constants.d.ts +31 -10
- package/dist/domain/orchestration.constants.js +45 -16
- package/dist/domain/orchestration.schemas.d.ts +54 -28
- package/dist/domain/orchestration.schemas.js +2 -2
- package/dist/domain/orchestration.types.d.ts +2 -2
- package/dist/domain/orchestration.types.js +2 -2
- package/dist/error-handler.d.ts +10 -10
- package/dist/error-handler.js +10 -10
- package/dist/file-classifiers.d.ts +6 -6
- package/dist/file-classifiers.js +6 -6
- package/dist/gates-config.d.ts +74 -0
- package/dist/gates-config.js +209 -2
- package/dist/git-adapter.d.ts +11 -11
- package/dist/git-adapter.js +11 -11
- package/dist/git-context-extractor.d.ts +112 -0
- package/dist/git-context-extractor.js +559 -0
- package/dist/hardcoded-strings.d.ts +1 -1
- package/dist/hardcoded-strings.js +1 -1
- package/dist/incremental-lint.d.ts +1 -1
- package/dist/incremental-lint.js +2 -2
- package/dist/incremental-test.d.ts +1 -1
- package/dist/incremental-test.js +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.js +25 -0
- package/dist/invariants/check-automated-tests.d.ts +2 -2
- package/dist/invariants/check-automated-tests.js +3 -3
- package/dist/lane-checker.d.ts +28 -7
- package/dist/lane-checker.js +316 -159
- package/dist/lane-suggest-prompt.d.ts +108 -0
- package/dist/lane-suggest-prompt.js +359 -0
- package/dist/lane-validator.d.ts +3 -3
- package/dist/lane-validator.js +3 -3
- package/dist/logs-lib.d.ts +1 -1
- package/dist/logs-lib.js +1 -1
- package/dist/lumenflow-config-schema.d.ts +162 -0
- package/dist/lumenflow-config-schema.js +180 -0
- package/dist/manual-test-validator.d.ts +2 -2
- package/dist/manual-test-validator.js +3 -3
- package/dist/merge-lock.d.ts +8 -1
- package/dist/merge-lock.js +16 -7
- package/dist/micro-worktree.d.ts +81 -13
- package/dist/micro-worktree.js +98 -17
- package/dist/migration-deployer.d.ts +1 -1
- package/dist/migration-deployer.js +1 -1
- package/dist/orchestration-advisory-loader.d.ts +2 -2
- package/dist/orchestration-advisory-loader.js +10 -6
- package/dist/orchestration-advisory.d.ts +3 -3
- package/dist/orchestration-advisory.js +4 -4
- package/dist/orchestration-di.d.ts +4 -4
- package/dist/orchestration-di.js +4 -4
- package/dist/orchestration-rules.d.ts +4 -4
- package/dist/orchestration-rules.js +18 -10
- package/dist/orphan-detector.d.ts +3 -3
- package/dist/orphan-detector.js +3 -3
- package/dist/patrol-loop.d.ts +170 -0
- package/dist/patrol-loop.js +186 -0
- package/dist/process-detector.d.ts +5 -5
- package/dist/process-detector.js +5 -5
- package/dist/rebase-artifact-cleanup.d.ts +3 -3
- package/dist/rebase-artifact-cleanup.js +3 -3
- package/dist/resolve-policy.d.ts +195 -0
- package/dist/resolve-policy.js +203 -0
- package/dist/risk-detector.d.ts +2 -2
- package/dist/risk-detector.js +2 -2
- package/dist/rollback-utils.d.ts +1 -1
- package/dist/rollback-utils.js +1 -1
- package/dist/section-headings.d.ts +1 -1
- package/dist/section-headings.js +1 -1
- package/dist/spawn-escalation.d.ts +4 -4
- package/dist/spawn-escalation.js +3 -3
- package/dist/spawn-monitor.d.ts +4 -4
- package/dist/spawn-monitor.js +4 -4
- package/dist/spawn-recovery.d.ts +3 -3
- package/dist/spawn-recovery.js +3 -3
- package/dist/spawn-registry-schema.d.ts +2 -2
- package/dist/spawn-registry-schema.js +2 -2
- package/dist/spawn-registry-store.d.ts +2 -2
- package/dist/spawn-registry-store.js +2 -2
- package/dist/spawn-strategy.d.ts +17 -11
- package/dist/spawn-strategy.js +47 -44
- package/dist/spawn-tree.d.ts +3 -3
- package/dist/spawn-tree.js +3 -3
- package/dist/state-cleanup-core.d.ts +205 -0
- package/dist/state-cleanup-core.js +240 -0
- package/dist/state-doctor-core.d.ts +168 -0
- package/dist/state-doctor-core.js +251 -0
- package/dist/stream-error-handler.d.ts +67 -0
- package/dist/stream-error-handler.js +94 -0
- package/dist/telemetry.d.ts +1 -1
- package/dist/telemetry.js +1 -1
- package/dist/template-loader.d.ts +162 -0
- package/dist/template-loader.js +372 -0
- package/dist/test-baseline.d.ts +176 -0
- package/dist/test-baseline.js +282 -0
- package/dist/usecases/get-suggestions.usecase.d.ts +1 -1
- package/dist/validation/command-registry.js +37 -0
- package/dist/validators/backlog-sync.js +4 -2
- package/dist/worktree-scanner.d.ts +1 -1
- package/dist/worktree-scanner.js +1 -1
- package/dist/worktree-symlink.d.ts +3 -3
- package/dist/worktree-symlink.js +3 -3
- package/dist/wu-backlog-updater.d.ts +1 -1
- package/dist/wu-backlog-updater.js +1 -1
- package/dist/wu-claim-helpers.d.ts +1 -1
- package/dist/wu-claim-helpers.js +1 -1
- package/dist/wu-claim-resume.d.ts +1 -1
- package/dist/wu-claim-resume.js +1 -1
- package/dist/wu-consistency-checker.d.ts +1 -1
- package/dist/wu-consistency-checker.js +17 -11
- package/dist/wu-constants.d.ts +73 -21
- package/dist/wu-constants.js +65 -22
- package/dist/wu-done-branch-only.d.ts +1 -1
- package/dist/wu-done-branch-only.js +1 -1
- package/dist/wu-done-docs-generate.d.ts +1 -1
- package/dist/wu-done-docs-generate.js +1 -1
- package/dist/wu-done-messages.d.ts +2 -2
- package/dist/wu-done-messages.js +2 -2
- package/dist/wu-done-metadata.d.ts +3 -3
- package/dist/wu-done-metadata.js +3 -3
- package/dist/wu-done-pr.d.ts +1 -1
- package/dist/wu-done-pr.js +4 -2
- package/dist/wu-done-preflight.d.ts +8 -0
- package/dist/wu-done-preflight.js +18 -2
- package/dist/wu-done-ui.d.ts +3 -3
- package/dist/wu-done-ui.js +3 -3
- package/dist/wu-done-validation.d.ts +30 -0
- package/dist/wu-done-validation.js +106 -1
- package/dist/wu-done-worktree.d.ts +1 -1
- package/dist/wu-done-worktree.js +11 -1
- package/dist/wu-events-cleanup.d.ts +148 -0
- package/dist/wu-events-cleanup.js +401 -0
- package/dist/wu-helpers.d.ts +2 -2
- package/dist/wu-helpers.js +2 -2
- package/dist/wu-id-generator.d.ts +58 -0
- package/dist/wu-id-generator.js +103 -0
- package/dist/wu-lint.js +1 -1
- package/dist/wu-preflight-validators.d.ts +13 -1
- package/dist/wu-preflight-validators.js +56 -1
- package/dist/wu-recovery.d.ts +2 -2
- package/dist/wu-recovery.js +4 -4
- package/dist/wu-repair-core.d.ts +5 -5
- package/dist/wu-repair-core.js +6 -6
- package/dist/wu-schema-normalization.d.ts +1 -1
- package/dist/wu-schema-normalization.js +1 -1
- package/dist/wu-schema.d.ts +7 -7
- package/dist/wu-schema.js +8 -8
- package/dist/wu-spawn-context.d.ts +87 -0
- package/dist/wu-spawn-context.js +175 -0
- package/dist/wu-spawn-helpers.d.ts +1 -1
- package/dist/wu-spawn-helpers.js +1 -1
- package/dist/wu-spawn.d.ts +177 -4
- package/dist/wu-spawn.js +694 -72
- package/dist/wu-state-schema.d.ts +1 -1
- package/dist/wu-state-schema.js +1 -1
- package/dist/wu-state-store.d.ts +3 -3
- package/dist/wu-state-store.js +3 -3
- package/dist/wu-status-transition.d.ts +1 -1
- package/dist/wu-status-transition.js +1 -1
- package/dist/wu-status-updater.d.ts +3 -3
- package/dist/wu-status-updater.js +3 -3
- package/dist/wu-validation-constants.d.ts +2 -2
- package/dist/wu-validation-constants.js +2 -2
- package/dist/wu-validation.d.ts +3 -3
- package/dist/wu-validation.js +3 -3
- package/dist/wu-yaml-fixer.d.ts +2 -2
- package/dist/wu-yaml-fixer.js +3 -3
- package/dist/wu-yaml.d.ts +23 -0
- package/dist/wu-yaml.js +76 -2
- package/package.json +5 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Active WU Detection Utilities
|
|
3
3
|
*
|
|
4
4
|
* Detects which WU YAMLs are "active" (referenced in backlog.md/status.md)
|
|
5
|
-
* vs "orphan" (legacy/unreferenced). Used by validate.
|
|
5
|
+
* vs "orphan" (legacy/unreferenced). Used by validate.ts to suppress
|
|
6
6
|
* lane-checker warnings for orphan WUs.
|
|
7
7
|
*
|
|
8
8
|
* WU-1814: Stop lane-checker warnings for orphan WU YAMLs
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Active WU Detection Utilities
|
|
3
3
|
*
|
|
4
4
|
* Detects which WU YAMLs are "active" (referenced in backlog.md/status.md)
|
|
5
|
-
* vs "orphan" (legacy/unreferenced). Used by validate.
|
|
5
|
+
* vs "orphan" (legacy/unreferenced). Used by validate.ts to suppress
|
|
6
6
|
* lane-checker warnings for orphan WUs.
|
|
7
7
|
*
|
|
8
8
|
* WU-1814: Stop lane-checker warnings for orphan WU YAMLs
|
package/dist/arg-parser.js
CHANGED
|
@@ -5,6 +5,12 @@ import { EXIT_CODES } from './wu-constants.js';
|
|
|
5
5
|
* Collector function for Commander.js repeatable options.
|
|
6
6
|
* Accumulates multiple flag values into an array.
|
|
7
7
|
*
|
|
8
|
+
* Usage: --flag a --flag b → ['a', 'b']
|
|
9
|
+
*
|
|
10
|
+
* This follows Commander.js best practices - use repeatable pattern for
|
|
11
|
+
* multi-value options. Do NOT split on commas here; that's a separate
|
|
12
|
+
* pattern with different semantics (see Commander.js docs).
|
|
13
|
+
*
|
|
8
14
|
* @param {string} value - New value from CLI
|
|
9
15
|
* @param {string[]} previous - Previously accumulated values
|
|
10
16
|
* @returns {string[]} Updated array with new value appended
|
|
@@ -28,7 +34,7 @@ export const WU_OPTIONS = {
|
|
|
28
34
|
id: {
|
|
29
35
|
name: 'id',
|
|
30
36
|
flags: '-i, --id <wuId>',
|
|
31
|
-
description: 'Work Unit ID (e.g., WU-123)',
|
|
37
|
+
description: 'Work Unit ID (e.g., WU-123). If not provided, auto-generates next sequential ID.',
|
|
32
38
|
},
|
|
33
39
|
wu: {
|
|
34
40
|
name: 'wu',
|
|
@@ -205,17 +211,20 @@ export const WU_OPTIONS = {
|
|
|
205
211
|
blockedBy: {
|
|
206
212
|
name: 'blockedBy',
|
|
207
213
|
flags: '--blocked-by <wuIds>',
|
|
208
|
-
description: '
|
|
214
|
+
description: 'WU IDs that block this WU (repeatable)',
|
|
215
|
+
isRepeatable: true,
|
|
209
216
|
},
|
|
210
217
|
blocks: {
|
|
211
218
|
name: 'blocks',
|
|
212
219
|
flags: '--blocks <wuIds>',
|
|
213
|
-
description: '
|
|
220
|
+
description: 'WU IDs this WU blocks (repeatable)',
|
|
221
|
+
isRepeatable: true,
|
|
214
222
|
},
|
|
215
223
|
labels: {
|
|
216
224
|
name: 'labels',
|
|
217
225
|
flags: '--labels <labels>',
|
|
218
|
-
description: '
|
|
226
|
+
description: 'Labels (repeatable)',
|
|
227
|
+
isRepeatable: true,
|
|
219
228
|
},
|
|
220
229
|
slug: {
|
|
221
230
|
name: 'slug',
|
|
@@ -311,22 +320,26 @@ export const WU_OPTIONS = {
|
|
|
311
320
|
codePaths: {
|
|
312
321
|
name: 'codePaths',
|
|
313
322
|
flags: '--code-paths <paths>',
|
|
314
|
-
description: 'Code paths (
|
|
323
|
+
description: 'Code paths (repeatable)',
|
|
324
|
+
isRepeatable: true,
|
|
315
325
|
},
|
|
316
326
|
testPathsManual: {
|
|
317
327
|
name: 'testPathsManual',
|
|
318
328
|
flags: '--test-paths-manual <tests>',
|
|
319
|
-
description: 'Manual test descriptions (
|
|
329
|
+
description: 'Manual test descriptions (repeatable)',
|
|
330
|
+
isRepeatable: true,
|
|
320
331
|
},
|
|
321
332
|
testPathsUnit: {
|
|
322
333
|
name: 'testPathsUnit',
|
|
323
334
|
flags: '--test-paths-unit <paths>',
|
|
324
|
-
description: 'Unit test file paths (
|
|
335
|
+
description: 'Unit test file paths (repeatable)',
|
|
336
|
+
isRepeatable: true,
|
|
325
337
|
},
|
|
326
338
|
testPathsE2e: {
|
|
327
339
|
name: 'testPathsE2e',
|
|
328
340
|
flags: '--test-paths-e2e <paths>',
|
|
329
|
-
description: 'E2E test file paths (
|
|
341
|
+
description: 'E2E test file paths (repeatable)',
|
|
342
|
+
isRepeatable: true,
|
|
330
343
|
},
|
|
331
344
|
validate: {
|
|
332
345
|
name: 'validate',
|
|
@@ -337,7 +350,8 @@ export const WU_OPTIONS = {
|
|
|
337
350
|
specRefs: {
|
|
338
351
|
name: 'specRefs',
|
|
339
352
|
flags: '--spec-refs <paths>',
|
|
340
|
-
description: 'Spec/plan references (comma-separated
|
|
353
|
+
description: 'Spec/plan references (repeatable or comma-separated, required for type: feature)',
|
|
354
|
+
isRepeatable: true,
|
|
341
355
|
},
|
|
342
356
|
// WU-1998: Exposure field options
|
|
343
357
|
exposure: {
|
|
@@ -353,7 +367,8 @@ export const WU_OPTIONS = {
|
|
|
353
367
|
uiPairingWus: {
|
|
354
368
|
name: 'uiPairingWus',
|
|
355
369
|
flags: '--ui-pairing-wus <wuIds>',
|
|
356
|
-
description: '
|
|
370
|
+
description: 'UI WU IDs that consume this API (repeatable or comma-separated, for api exposure)',
|
|
371
|
+
isRepeatable: true,
|
|
357
372
|
},
|
|
358
373
|
// WU-1577: Thinking mode options for wu:spawn
|
|
359
374
|
thinking: {
|
|
@@ -384,11 +399,18 @@ export const WU_OPTIONS = {
|
|
|
384
399
|
flags: '--parent-wu <wuId>',
|
|
385
400
|
description: 'Parent WU ID for orchestrator context (e.g., WU-1000)',
|
|
386
401
|
},
|
|
402
|
+
// WU-1240: Skip memory context injection in spawn prompts
|
|
403
|
+
noContext: {
|
|
404
|
+
name: 'noContext',
|
|
405
|
+
flags: '--no-context',
|
|
406
|
+
description: 'Skip memory context injection in spawn prompts',
|
|
407
|
+
isNegated: true,
|
|
408
|
+
},
|
|
387
409
|
// WU-1542: Mandatory agent enforcement for wu:done
|
|
388
410
|
requireAgents: {
|
|
389
411
|
name: 'requireAgents',
|
|
390
412
|
flags: '--require-agents',
|
|
391
|
-
description: 'Block wu:done if mandatory agents (
|
|
413
|
+
description: 'Block wu:done if mandatory agents (configured in MANDATORY_TRIGGERS) were not invoked for WUs touching their trigger paths',
|
|
392
414
|
},
|
|
393
415
|
// WU-2411: Agent handoff for crashed/killed agents
|
|
394
416
|
resume: {
|
|
@@ -433,22 +455,33 @@ const NEGATED_OPTIONS = ['auto', 'remove', 'merge', 'autoRebase', 'push'];
|
|
|
433
455
|
* @returns {object} Processed options with noFoo properties
|
|
434
456
|
*/
|
|
435
457
|
function processNegatedOptions(opts) {
|
|
436
|
-
|
|
458
|
+
// Build a new object, excluding keys that need removal
|
|
459
|
+
// This avoids dynamic delete which violates @typescript-eslint/no-dynamic-delete
|
|
460
|
+
const keysToRemove = new Set();
|
|
461
|
+
const keysToAdd = {};
|
|
437
462
|
for (const key of NEGATED_OPTIONS) {
|
|
438
463
|
// Commander sets the property to false when --no-foo is used
|
|
439
464
|
// and undefined when not specified
|
|
440
|
-
if (key in
|
|
465
|
+
if (key in opts && opts[key] === false) {
|
|
441
466
|
// Convert: auto=false → noAuto=true
|
|
442
467
|
const camelKey = `no${key.charAt(0).toUpperCase()}${key.slice(1)}`;
|
|
443
|
-
|
|
444
|
-
|
|
468
|
+
keysToAdd[camelKey] = true;
|
|
469
|
+
keysToRemove.add(key);
|
|
445
470
|
}
|
|
446
|
-
else if (key in
|
|
471
|
+
else if (key in opts && opts[key] === true) {
|
|
447
472
|
// Default value (not negated) - remove it
|
|
448
|
-
|
|
473
|
+
keysToRemove.add(key);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
// Build result by filtering out removed keys and adding new ones
|
|
477
|
+
const result = {};
|
|
478
|
+
for (const [key, value] of Object.entries(opts)) {
|
|
479
|
+
if (!keysToRemove.has(key)) {
|
|
480
|
+
result[key] = value;
|
|
449
481
|
}
|
|
450
482
|
}
|
|
451
|
-
|
|
483
|
+
// Add the transformed keys
|
|
484
|
+
return { ...result, ...keysToAdd };
|
|
452
485
|
}
|
|
453
486
|
/**
|
|
454
487
|
* Create a commander-based CLI parser for a WU script.
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
* - computeStoreChecksum(): Computes deterministic checksum of store state
|
|
12
12
|
* - getCompletionDate(): Retrieves completion date from event timestamp
|
|
13
13
|
*
|
|
14
|
-
* @see {@link
|
|
15
|
-
* @see {@link
|
|
16
|
-
* @see {@link
|
|
17
|
-
* @see {@link
|
|
14
|
+
* @see {@link packages/@lumenflow/cli/src/__tests__/backlog-generator.test.ts} - Tests
|
|
15
|
+
* @see {@link packages/@lumenflow/cli/src/__tests__/backlog-checksum.test.ts} - Checksum tests
|
|
16
|
+
* @see {@link packages/@lumenflow/cli/src/__tests__/status-date-from-event.test.ts} - Date tests
|
|
17
|
+
* @see {@link packages/@lumenflow/cli/src/lib/wu-state-store.ts} - State store
|
|
18
18
|
*/
|
|
19
19
|
interface BacklogYamlOptions {
|
|
20
20
|
wuDir?: string;
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
* - computeStoreChecksum(): Computes deterministic checksum of store state
|
|
12
12
|
* - getCompletionDate(): Retrieves completion date from event timestamp
|
|
13
13
|
*
|
|
14
|
-
* @see {@link
|
|
15
|
-
* @see {@link
|
|
16
|
-
* @see {@link
|
|
17
|
-
* @see {@link
|
|
14
|
+
* @see {@link packages/@lumenflow/cli/src/__tests__/backlog-generator.test.ts} - Tests
|
|
15
|
+
* @see {@link packages/@lumenflow/cli/src/__tests__/backlog-checksum.test.ts} - Checksum tests
|
|
16
|
+
* @see {@link packages/@lumenflow/cli/src/__tests__/status-date-from-event.test.ts} - Date tests
|
|
17
|
+
* @see {@link packages/@lumenflow/cli/src/lib/wu-state-store.ts} - State store
|
|
18
18
|
*/
|
|
19
19
|
import { createHash } from 'node:crypto';
|
|
20
20
|
import { existsSync, readdirSync } from 'node:fs';
|
|
@@ -151,7 +151,7 @@ export function validateBacklogSync(backlogPath) {
|
|
|
151
151
|
` Fix: Migrate to sub-lane format using:${STRING_LITERALS.NEWLINE}` +
|
|
152
152
|
` pnpm wu:infer-lane --id WU-123 # Suggest a sub-lane${STRING_LITERALS.NEWLINE}` +
|
|
153
153
|
` pnpm wu:edit --id WU-123 --lane "Parent: Sub"${STRING_LITERALS.NEWLINE}` +
|
|
154
|
-
` See:
|
|
154
|
+
` See: https://lumenflow.dev/reference/sub-lanes/`);
|
|
155
155
|
}
|
|
156
156
|
return {
|
|
157
157
|
valid: errors.length === 0,
|
package/dist/cleanup-lock.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WU-2241: Cleanup Lock Module
|
|
3
|
+
* WU-1174: Lock files moved to temp directory to avoid polluting main checkout
|
|
3
4
|
*
|
|
4
5
|
* Provides atomic locking mechanism for wu:done cleanup operations
|
|
5
6
|
* to prevent race conditions during concurrent worktree/branch cleanup.
|
|
@@ -10,11 +11,12 @@
|
|
|
10
11
|
* - Zombie lock detection (PID not running)
|
|
11
12
|
* - Idempotent re-acquisition for same WU
|
|
12
13
|
* - Guaranteed cleanup via withCleanupLock wrapper
|
|
14
|
+
* - Lock files stored in temp directory (not main checkout)
|
|
13
15
|
*
|
|
14
16
|
* Lock ordering (WU-2241):
|
|
15
17
|
* Lane lock (phase-scoped) -> Merge lock -> Cleanup lock -> State store lock
|
|
16
18
|
*
|
|
17
|
-
* Pattern: Follows lane-lock.
|
|
19
|
+
* Pattern: Follows lane-lock.ts and merge-lock.ts internal patterns.
|
|
18
20
|
*
|
|
19
21
|
* @module cleanup-lock
|
|
20
22
|
*/
|
|
@@ -49,7 +51,12 @@ export declare const CLEANUP_LOCK_STALE_MS: number;
|
|
|
49
51
|
* Options for lock file operations
|
|
50
52
|
*/
|
|
51
53
|
interface BaseDirOptions {
|
|
52
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Base directory override (for testing only)
|
|
56
|
+
*
|
|
57
|
+
* WU-1174: In production, locks are always stored in LUMENFLOW_PATHS.LOCK_DIR
|
|
58
|
+
* (a temp directory). This option allows tests to use isolated directories.
|
|
59
|
+
*/
|
|
53
60
|
baseDir?: string;
|
|
54
61
|
}
|
|
55
62
|
/**
|
package/dist/cleanup-lock.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WU-2241: Cleanup Lock Module
|
|
3
|
+
* WU-1174: Lock files moved to temp directory to avoid polluting main checkout
|
|
3
4
|
*
|
|
4
5
|
* Provides atomic locking mechanism for wu:done cleanup operations
|
|
5
6
|
* to prevent race conditions during concurrent worktree/branch cleanup.
|
|
@@ -10,11 +11,12 @@
|
|
|
10
11
|
* - Zombie lock detection (PID not running)
|
|
11
12
|
* - Idempotent re-acquisition for same WU
|
|
12
13
|
* - Guaranteed cleanup via withCleanupLock wrapper
|
|
14
|
+
* - Lock files stored in temp directory (not main checkout)
|
|
13
15
|
*
|
|
14
16
|
* Lock ordering (WU-2241):
|
|
15
17
|
* Lane lock (phase-scoped) -> Merge lock -> Cleanup lock -> State store lock
|
|
16
18
|
*
|
|
17
|
-
* Pattern: Follows lane-lock.
|
|
19
|
+
* Pattern: Follows lane-lock.ts and merge-lock.ts internal patterns.
|
|
18
20
|
*
|
|
19
21
|
* @module cleanup-lock
|
|
20
22
|
*/
|
|
@@ -22,7 +24,7 @@
|
|
|
22
24
|
import { existsSync, readFileSync, writeFileSync, unlinkSync, mkdirSync, openSync, closeSync, } from 'node:fs';
|
|
23
25
|
import path from 'node:path';
|
|
24
26
|
import crypto from 'node:crypto';
|
|
25
|
-
import { LOG_PREFIX, EMOJI, LUMENFLOW_PATHS } from './wu-constants.js';
|
|
27
|
+
import { LOG_PREFIX, EMOJI, LUMENFLOW_PATHS, LOCK_DIR_NAME } from './wu-constants.js';
|
|
26
28
|
import { createError, ErrorCodes } from './error-handler.js';
|
|
27
29
|
/**
|
|
28
30
|
* Default timeout for waiting to acquire lock (ms)
|
|
@@ -44,12 +46,19 @@ const LOCK_POLL_INTERVAL_MS = 500;
|
|
|
44
46
|
/**
|
|
45
47
|
* Get the path to the cleanup lock file
|
|
46
48
|
*
|
|
49
|
+
* WU-1174: Lock files are stored in a temp directory to avoid polluting
|
|
50
|
+
* the main checkout. The baseDir option is only for testing isolation.
|
|
51
|
+
*
|
|
47
52
|
* @param {BaseDirOptions} [options]
|
|
48
53
|
* @returns {string} Path to lock file
|
|
49
54
|
*/
|
|
50
55
|
function getLockPath(options = {}) {
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
// WU-1174: Use temp directory for locks (not main checkout's .lumenflow/)
|
|
57
|
+
// baseDir is only used for test isolation
|
|
58
|
+
const lockDir = options.baseDir
|
|
59
|
+
? path.join(options.baseDir, LOCK_DIR_NAME)
|
|
60
|
+
: LUMENFLOW_PATHS.LOCK_DIR;
|
|
61
|
+
return path.join(lockDir, LOCK_FILE_NAME);
|
|
53
62
|
}
|
|
54
63
|
/**
|
|
55
64
|
* Read lock file contents
|
|
@@ -168,9 +177,10 @@ export function getCleanupLockInfo(options = {}) {
|
|
|
168
177
|
*/
|
|
169
178
|
function tryAtomicLockCreate(lockInfo, options) {
|
|
170
179
|
const lockPath = getLockPath(options);
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
180
|
+
const lockDir = path.dirname(lockPath);
|
|
181
|
+
// WU-1174: Ensure lock directory exists (temp directory, not .lumenflow/)
|
|
182
|
+
if (!existsSync(lockDir)) {
|
|
183
|
+
mkdirSync(lockDir, { recursive: true });
|
|
174
184
|
}
|
|
175
185
|
try {
|
|
176
186
|
// Use 'wx' flag for atomic creation
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Unified Code Path Validator (WU-1825)
|
|
4
4
|
*
|
|
5
5
|
* Consolidates three separate code path validators into one module:
|
|
6
|
-
* - validateCodePathsExist (wu-done-validators.
|
|
7
|
-
* - validateLaneCodePaths (lane-validator.
|
|
8
|
-
* - validateWUCodePaths (wu-validator.
|
|
6
|
+
* - validateCodePathsExist (wu-done-validators.ts) - file existence for wu:done
|
|
7
|
+
* - validateLaneCodePaths (lane-validator.ts) - lane pattern matching
|
|
8
|
+
* - validateWUCodePaths (wu-validator.ts) - code quality (TODOs, mocks)
|
|
9
9
|
*
|
|
10
10
|
* Usage:
|
|
11
11
|
* import { validate } from './code-path-validator.js';
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Unified Code Path Validator (WU-1825)
|
|
4
4
|
*
|
|
5
5
|
* Consolidates three separate code path validators into one module:
|
|
6
|
-
* - validateCodePathsExist (wu-done-validators.
|
|
7
|
-
* - validateLaneCodePaths (lane-validator.
|
|
8
|
-
* - validateWUCodePaths (wu-validator.
|
|
6
|
+
* - validateCodePathsExist (wu-done-validators.ts) - file existence for wu:done
|
|
7
|
+
* - validateLaneCodePaths (lane-validator.ts) - lane pattern matching
|
|
8
|
+
* - validateWUCodePaths (wu-validator.ts) - code quality (TODOs, mocks)
|
|
9
9
|
*
|
|
10
10
|
* Usage:
|
|
11
11
|
* import { validate } from './code-path-validator.js';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Backlog Parsing Patterns
|
|
3
3
|
*
|
|
4
4
|
* Centralizes patterns for parsing status.md and backlog.md files.
|
|
5
|
-
* Used by lane-checker.
|
|
5
|
+
* Used by lane-checker.ts and related backlog utilities.
|
|
6
6
|
*/
|
|
7
7
|
/** Markdown section header patterns for In Progress section */
|
|
8
8
|
export declare const IN_PROGRESS_HEADERS: string[];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Backlog Parsing Patterns
|
|
3
3
|
*
|
|
4
4
|
* Centralizes patterns for parsing status.md and backlog.md files.
|
|
5
|
-
* Used by lane-checker.
|
|
5
|
+
* Used by lane-checker.ts and related backlog utilities.
|
|
6
6
|
*/
|
|
7
7
|
/** Markdown section header patterns for In Progress section */
|
|
8
8
|
export const IN_PROGRESS_HEADERS = ['## in progress', '## 🔧 in progress'];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* DORA Metrics Constants
|
|
3
3
|
*
|
|
4
4
|
* Thresholds based on "Accelerate" research by Nicole Forsgren, Jez Humble, Gene Kim.
|
|
5
|
-
* Used by calculate-dora-metrics.
|
|
5
|
+
* Used by calculate-dora-metrics.ts.
|
|
6
6
|
*/
|
|
7
7
|
/** Deployment frequency classification thresholds (deploys per week) */
|
|
8
8
|
export declare const DEPLOYMENT_FREQUENCY: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* DORA Metrics Constants
|
|
3
3
|
*
|
|
4
4
|
* Thresholds based on "Accelerate" research by Nicole Forsgren, Jez Humble, Gene Kim.
|
|
5
|
-
* Used by calculate-dora-metrics.
|
|
5
|
+
* Used by calculate-dora-metrics.ts.
|
|
6
6
|
*/
|
|
7
7
|
/** Deployment frequency classification thresholds (deploys per week) */
|
|
8
8
|
export const DEPLOYMENT_FREQUENCY = {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Gate Configuration Constants
|
|
3
3
|
*
|
|
4
4
|
* Centralizes magic numbers for pre-commit and local gates.
|
|
5
|
-
* Used by gates-pre-commit.
|
|
5
|
+
* Used by gates-pre-commit.ts and gates-local.ts.
|
|
6
6
|
*/
|
|
7
7
|
/** Gate execution configuration */
|
|
8
8
|
export declare const GATE_CONFIG: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Gate Configuration Constants
|
|
3
3
|
*
|
|
4
4
|
* Centralizes magic numbers for pre-commit and local gates.
|
|
5
|
-
* Used by gates-pre-commit.
|
|
5
|
+
* Used by gates-pre-commit.ts and gates-local.ts.
|
|
6
6
|
*/
|
|
7
7
|
/** Gate execution configuration */
|
|
8
8
|
export const GATE_CONFIG = {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Linter Configuration Constants
|
|
3
3
|
*
|
|
4
4
|
* Centralizes magic numbers for spec-linter and related validation tools.
|
|
5
|
-
* Used by packages/linters/spec-linter.
|
|
5
|
+
* Used by packages/linters/spec-linter.ts.
|
|
6
6
|
*/
|
|
7
7
|
/** Spec linter configuration */
|
|
8
8
|
export declare const LINTER_CONFIG: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Linter Configuration Constants
|
|
3
3
|
*
|
|
4
4
|
* Centralizes magic numbers for spec-linter and related validation tools.
|
|
5
|
-
* Used by packages/linters/spec-linter.
|
|
5
|
+
* Used by packages/linters/spec-linter.ts.
|
|
6
6
|
*/
|
|
7
7
|
/** Spec linter configuration */
|
|
8
8
|
export const LINTER_CONFIG = {
|
|
@@ -38,7 +38,8 @@ export async function resolveLocation(cwd = process.cwd()) {
|
|
|
38
38
|
const gitRoot = (await git.revparse(['--show-toplevel'])).trim();
|
|
39
39
|
const gitDir = (await git.revparse(['--git-dir'])).trim();
|
|
40
40
|
// Detect if we're in a worktree (in worktrees, .git is a file not a dir)
|
|
41
|
-
|
|
41
|
+
// WU-1223: Fixed - check .git in gitRoot, not the gitDir path returned by rev-parse
|
|
42
|
+
const isWorktree = isGitDirFile(resolve(gitRoot, '.git'));
|
|
42
43
|
const mainCheckout = isWorktree ? await findMainCheckout(git) : gitRoot;
|
|
43
44
|
// Parse worktree info
|
|
44
45
|
const worktreeName = isWorktree ? parseWorktreeName(gitRoot, mainCheckout) : null;
|
|
@@ -12,6 +12,7 @@ import type { WuContext, ValidationResult } from './validation/types.js';
|
|
|
12
12
|
declare const COMMANDS: {
|
|
13
13
|
readonly WU_CREATE: "wu:create";
|
|
14
14
|
readonly WU_CLAIM: "wu:claim";
|
|
15
|
+
readonly WU_PREP: "wu:prep";
|
|
15
16
|
readonly WU_DONE: "wu:done";
|
|
16
17
|
readonly WU_BLOCK: "wu:block";
|
|
17
18
|
readonly WU_UNBLOCK: "wu:unblock";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file scope-checker.
|
|
2
|
+
* @file scope-checker.ts
|
|
3
3
|
* @description WU scope validation and code_paths enforcement (WU-1397)
|
|
4
4
|
*
|
|
5
5
|
* Provides runtime validation that file modifications stay within WU code_paths.
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Used by wu- scripts and future file operation guards.
|
|
15
15
|
*
|
|
16
|
-
* @see {@link
|
|
17
|
-
* @see {@link
|
|
16
|
+
* @see {@link packages/@lumenflow/cli/src/lib/core/worktree-guard.ts} - WU context detection
|
|
17
|
+
* @see {@link packages/@lumenflow/cli/src/lib/wu-schema.ts} - WU YAML parsing
|
|
18
18
|
*/
|
|
19
19
|
import { getWUContext } from './worktree-guard.js';
|
|
20
20
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file scope-checker.
|
|
2
|
+
* @file scope-checker.ts
|
|
3
3
|
* @description WU scope validation and code_paths enforcement (WU-1397)
|
|
4
4
|
*
|
|
5
5
|
* Provides runtime validation that file modifications stay within WU code_paths.
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Used by wu- scripts and future file operation guards.
|
|
15
15
|
*
|
|
16
|
-
* @see {@link
|
|
17
|
-
* @see {@link
|
|
16
|
+
* @see {@link packages/@lumenflow/cli/src/lib/core/worktree-guard.ts} - WU context detection
|
|
17
|
+
* @see {@link packages/@lumenflow/cli/src/lib/wu-schema.ts} - WU YAML parsing
|
|
18
18
|
*/
|
|
19
19
|
import micromatch from 'micromatch';
|
|
20
20
|
import { getWUContext } from './worktree-guard.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file tool-runner.
|
|
2
|
+
* @file tool-runner.ts
|
|
3
3
|
* @description Unified tool execution layer integrating all core components (WU-1398)
|
|
4
4
|
*
|
|
5
5
|
* This module provides a higher-order function pattern for executing tools with:
|
|
6
6
|
* - Input validation via Zod schemas (tool.schemas.ts)
|
|
7
|
-
* - Worktree context detection (worktree-guard.
|
|
8
|
-
* - Scope validation against code_paths (scope-checker.
|
|
7
|
+
* - Worktree context detection (worktree-guard.ts)
|
|
8
|
+
* - Scope validation against code_paths (scope-checker.ts)
|
|
9
9
|
* - Audit logging for telemetry (.lumenflow/telemetry/tools.ndjson)
|
|
10
10
|
* - Consistent error handling with agent-friendly messages
|
|
11
11
|
*
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
* const result = await runner.run('tool:name', { arg: 'value' });
|
|
22
22
|
*
|
|
23
23
|
* @see tools/lib/core/tool.schemas.ts - Zod schemas for tool I/O
|
|
24
|
-
* @see tools/lib/core/worktree-guard.
|
|
25
|
-
* @see tools/lib/core/scope-checker.
|
|
24
|
+
* @see tools/lib/core/worktree-guard.ts - WU context detection
|
|
25
|
+
* @see tools/lib/core/scope-checker.ts - Code path validation
|
|
26
26
|
*/
|
|
27
27
|
interface ToolMetadata {
|
|
28
28
|
name: string;
|
package/dist/core/tool-runner.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @file tool-runner.
|
|
2
|
+
* @file tool-runner.ts
|
|
3
3
|
* @description Unified tool execution layer integrating all core components (WU-1398)
|
|
4
4
|
*
|
|
5
5
|
* This module provides a higher-order function pattern for executing tools with:
|
|
6
6
|
* - Input validation via Zod schemas (tool.schemas.ts)
|
|
7
|
-
* - Worktree context detection (worktree-guard.
|
|
8
|
-
* - Scope validation against code_paths (scope-checker.
|
|
7
|
+
* - Worktree context detection (worktree-guard.ts)
|
|
8
|
+
* - Scope validation against code_paths (scope-checker.ts)
|
|
9
9
|
* - Audit logging for telemetry (.lumenflow/telemetry/tools.ndjson)
|
|
10
10
|
* - Consistent error handling with agent-friendly messages
|
|
11
11
|
*
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
* const result = await runner.run('tool:name', { arg: 'value' });
|
|
22
22
|
*
|
|
23
23
|
* @see tools/lib/core/tool.schemas.ts - Zod schemas for tool I/O
|
|
24
|
-
* @see tools/lib/core/worktree-guard.
|
|
25
|
-
* @see tools/lib/core/scope-checker.
|
|
24
|
+
* @see tools/lib/core/worktree-guard.ts - WU context detection
|
|
25
|
+
* @see tools/lib/core/scope-checker.ts - Code path validation
|
|
26
26
|
*/
|
|
27
27
|
import { TOOL_ERROR_CODES, PERMISSION_LEVELS, TOOL_STATUS, DEFAULT_TOOL_TIMEOUT_MS, } from './tool.constants.js';
|
|
28
28
|
import { validateToolInput, createErrorOutput } from './tool.schemas.js';
|
|
@@ -48,7 +48,7 @@ export declare const PERMISSION_LEVELS: {
|
|
|
48
48
|
};
|
|
49
49
|
export type PermissionLevel = (typeof PERMISSION_LEVELS)[keyof typeof PERMISSION_LEVELS];
|
|
50
50
|
/**
|
|
51
|
-
* Tool error codes (extends existing ErrorCodes from error-handler.
|
|
51
|
+
* Tool error codes (extends existing ErrorCodes from error-handler.ts)
|
|
52
52
|
*/
|
|
53
53
|
export declare const TOOL_ERROR_CODES: {
|
|
54
54
|
/** Tool not found in registry */
|
|
@@ -46,7 +46,7 @@ export const PERMISSION_LEVELS = {
|
|
|
46
46
|
ADMIN: 'admin',
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
49
|
-
* Tool error codes (extends existing ErrorCodes from error-handler.
|
|
49
|
+
* Tool error codes (extends existing ErrorCodes from error-handler.ts)
|
|
50
50
|
*/
|
|
51
51
|
export const TOOL_ERROR_CODES = {
|
|
52
52
|
/** Tool not found in registry */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* outputs, and metadata. Supports JSON Schema export for provider adapters
|
|
7
7
|
* (MCP, OpenAI, Gemini).
|
|
8
8
|
*
|
|
9
|
-
* Reference: tools/lib/arg-parser.
|
|
9
|
+
* Reference: tools/lib/arg-parser.ts for current argument handling patterns
|
|
10
10
|
*/
|
|
11
11
|
import { z, type ZodTypeAny } from 'zod';
|
|
12
12
|
/**
|
|
@@ -140,8 +140,8 @@ export declare const ToolExecutionResultSchema: z.ZodObject<{
|
|
|
140
140
|
tool: z.ZodString;
|
|
141
141
|
status: z.ZodEnum<{
|
|
142
142
|
cancelled: "cancelled";
|
|
143
|
-
timeout: "timeout";
|
|
144
143
|
success: "success";
|
|
144
|
+
timeout: "timeout";
|
|
145
145
|
failed: "failed";
|
|
146
146
|
pending: "pending";
|
|
147
147
|
running: "running";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* outputs, and metadata. Supports JSON Schema export for provider adapters
|
|
7
7
|
* (MCP, OpenAI, Gemini).
|
|
8
8
|
*
|
|
9
|
-
* Reference: tools/lib/arg-parser.
|
|
9
|
+
* Reference: tools/lib/arg-parser.ts for current argument handling patterns
|
|
10
10
|
*/
|
|
11
11
|
import { z } from 'zod';
|
|
12
12
|
import { TOOL_DOMAINS, PERMISSION_LEVELS, TOOL_STATUS, } from './tool.constants.js';
|