@lumenflow/core 1.5.0 → 2.0.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.
- package/README.md +325 -1
- package/dist/adapters/context-adapters.d.ts +90 -0
- package/dist/adapters/context-adapters.js +99 -0
- package/dist/adapters/index.d.ts +14 -0
- package/dist/adapters/index.js +18 -0
- package/dist/adapters/recovery-adapters.d.ts +40 -0
- package/dist/adapters/recovery-adapters.js +43 -0
- package/dist/adapters/validation-adapters.d.ts +52 -0
- package/dist/adapters/validation-adapters.js +59 -0
- package/dist/context/context-computer.d.ts +46 -0
- package/dist/context/context-computer.js +125 -0
- package/dist/context/git-state-reader.d.ts +51 -0
- package/dist/context/git-state-reader.js +61 -0
- package/dist/context/index.d.ts +17 -0
- package/dist/context/index.js +17 -0
- package/dist/context/location-resolver.d.ts +48 -0
- package/dist/context/location-resolver.js +175 -0
- package/dist/context/wu-state-reader.d.ts +37 -0
- package/dist/context/wu-state-reader.js +76 -0
- package/dist/context-di.d.ts +184 -0
- package/dist/context-di.js +178 -0
- package/dist/context-validation-integration.d.ts +77 -0
- package/dist/context-validation-integration.js +157 -0
- package/dist/domain/context.schemas.d.ts +147 -0
- package/dist/domain/context.schemas.js +126 -0
- package/dist/domain/index.d.ts +14 -0
- package/dist/domain/index.js +18 -0
- package/dist/domain/recovery.schemas.d.ts +115 -0
- package/dist/domain/recovery.schemas.js +83 -0
- package/dist/domain/validation.schemas.d.ts +146 -0
- package/dist/domain/validation.schemas.js +114 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +43 -0
- package/dist/lumenflow-config-schema.d.ts +41 -0
- package/dist/lumenflow-config-schema.js +37 -0
- package/dist/ports/context.ports.d.ts +135 -0
- package/dist/ports/context.ports.js +21 -0
- package/dist/ports/core-tools.ports.d.ts +266 -0
- package/dist/ports/core-tools.ports.js +21 -0
- package/dist/ports/git-validator.ports.d.ts +314 -0
- package/dist/ports/git-validator.ports.js +12 -0
- package/dist/ports/index.d.ts +20 -0
- package/dist/ports/index.js +20 -0
- package/dist/ports/recovery.ports.d.ts +58 -0
- package/dist/ports/recovery.ports.js +17 -0
- package/dist/ports/validation.ports.d.ts +74 -0
- package/dist/ports/validation.ports.js +17 -0
- package/dist/ports/wu-helpers.ports.d.ts +224 -0
- package/dist/ports/wu-helpers.ports.js +12 -0
- package/dist/recovery/index.d.ts +11 -0
- package/dist/recovery/index.js +11 -0
- package/dist/recovery/recovery-analyzer.d.ts +66 -0
- package/dist/recovery/recovery-analyzer.js +129 -0
- package/dist/usecases/analyze-recovery.usecase.d.ts +42 -0
- package/dist/usecases/analyze-recovery.usecase.js +45 -0
- package/dist/usecases/compute-context.usecase.d.ts +62 -0
- package/dist/usecases/compute-context.usecase.js +101 -0
- package/dist/usecases/index.d.ts +14 -0
- package/dist/usecases/index.js +18 -0
- package/dist/usecases/validate-command.usecase.d.ts +55 -0
- package/dist/usecases/validate-command.usecase.js +154 -0
- package/dist/validation/command-registry.d.ts +38 -0
- package/dist/validation/command-registry.js +229 -0
- package/dist/validation/index.d.ts +15 -0
- package/dist/validation/index.js +15 -0
- package/dist/validation/types.d.ts +135 -0
- package/dist/validation/types.js +11 -0
- package/dist/validation/validate-command.d.ts +27 -0
- package/dist/validation/validate-command.js +160 -0
- package/dist/wu-constants.d.ts +136 -0
- package/dist/wu-constants.js +124 -0
- package/dist/wu-helpers.d.ts +5 -1
- package/dist/wu-helpers.js +12 -1
- package/package.json +4 -2
package/dist/wu-constants.d.ts
CHANGED
|
@@ -147,6 +147,14 @@ export declare const PATTERNS: {
|
|
|
147
147
|
WU_ID: RegExp;
|
|
148
148
|
/** Extract WU ID from text: captures "WU-123" */
|
|
149
149
|
WU_ID_EXTRACT: RegExp;
|
|
150
|
+
/**
|
|
151
|
+
* Extract WU ID from worktree paths (case-insensitive)
|
|
152
|
+
*
|
|
153
|
+
* WU-1090: Worktree names use lowercase like 'framework-core-wu-1090'
|
|
154
|
+
* This pattern matches both 'WU-123' and 'wu-123' to support
|
|
155
|
+
* extracting WU IDs from worktree paths.
|
|
156
|
+
*/
|
|
157
|
+
WU_ID_EXTRACT_CI: RegExp;
|
|
150
158
|
/** Lane branch format: lane/<lane-kebab>/wu-<id> */
|
|
151
159
|
LANE_BRANCH: RegExp;
|
|
152
160
|
/** Worktree path format: worktrees/<lane-kebab>-wu-<id> */
|
|
@@ -1547,3 +1555,131 @@ export declare function validateSafetyTestsExist(options?: DiscoverSafetyTestsOp
|
|
|
1547
1555
|
foundTests: any[];
|
|
1548
1556
|
error: string;
|
|
1549
1557
|
}>;
|
|
1558
|
+
/**
|
|
1559
|
+
* Context validation constants (WU-1090)
|
|
1560
|
+
*
|
|
1561
|
+
* Constants for the context-aware state machine for WU lifecycle commands.
|
|
1562
|
+
* Supports unified context model, declarative command requirements,
|
|
1563
|
+
* smart validation, and recovery paths.
|
|
1564
|
+
*/
|
|
1565
|
+
export declare const CONTEXT_VALIDATION: {
|
|
1566
|
+
/** Location types for WU operations */
|
|
1567
|
+
readonly LOCATION_TYPES: {
|
|
1568
|
+
/** Main checkout (not a worktree) */
|
|
1569
|
+
readonly MAIN: "main";
|
|
1570
|
+
/** Inside a worktree */
|
|
1571
|
+
readonly WORKTREE: "worktree";
|
|
1572
|
+
/** Detached HEAD state */
|
|
1573
|
+
readonly DETACHED: "detached";
|
|
1574
|
+
/** Unknown location (not a git repo or error) */
|
|
1575
|
+
readonly UNKNOWN: "unknown";
|
|
1576
|
+
};
|
|
1577
|
+
/** Validation error codes */
|
|
1578
|
+
readonly ERROR_CODES: {
|
|
1579
|
+
/** Command run from wrong location type */
|
|
1580
|
+
readonly WRONG_LOCATION: "WRONG_LOCATION";
|
|
1581
|
+
/** Target WU does not exist */
|
|
1582
|
+
readonly WU_NOT_FOUND: "WU_NOT_FOUND";
|
|
1583
|
+
/** WU with this ID already exists */
|
|
1584
|
+
readonly WU_ALREADY_EXISTS: "WU_ALREADY_EXISTS";
|
|
1585
|
+
/** WU in unexpected status for command */
|
|
1586
|
+
readonly WRONG_WU_STATUS: "WRONG_WU_STATUS";
|
|
1587
|
+
/** Lane already has WU in progress */
|
|
1588
|
+
readonly LANE_OCCUPIED: "LANE_OCCUPIED";
|
|
1589
|
+
/** Worktree already exists for WU */
|
|
1590
|
+
readonly WORKTREE_EXISTS: "WORKTREE_EXISTS";
|
|
1591
|
+
/** Expected worktree not found */
|
|
1592
|
+
readonly WORKTREE_MISSING: "WORKTREE_MISSING";
|
|
1593
|
+
/** Gates haven't run or failed */
|
|
1594
|
+
readonly GATES_NOT_PASSED: "GATES_NOT_PASSED";
|
|
1595
|
+
/** Uncommitted changes exist */
|
|
1596
|
+
readonly DIRTY_GIT: "DIRTY_GIT";
|
|
1597
|
+
/** Cannot reach origin remote */
|
|
1598
|
+
readonly REMOTE_UNAVAILABLE: "REMOTE_UNAVAILABLE";
|
|
1599
|
+
/** YAML and state store disagree */
|
|
1600
|
+
readonly INCONSISTENT_STATE: "INCONSISTENT_STATE";
|
|
1601
|
+
};
|
|
1602
|
+
/** Recovery action types */
|
|
1603
|
+
readonly RECOVERY_ACTIONS: {
|
|
1604
|
+
/** Reconcile state and continue working (preserves work) */
|
|
1605
|
+
readonly RESUME: "resume";
|
|
1606
|
+
/** Discard worktree, reset WU to ready */
|
|
1607
|
+
readonly RESET: "reset";
|
|
1608
|
+
/** Remove all artifacts completely (requires --force) */
|
|
1609
|
+
readonly NUKE: "nuke";
|
|
1610
|
+
/** Remove leftover worktree (for done WUs) */
|
|
1611
|
+
readonly CLEANUP: "cleanup";
|
|
1612
|
+
};
|
|
1613
|
+
/** Recovery issue codes */
|
|
1614
|
+
readonly RECOVERY_ISSUES: {
|
|
1615
|
+
/** Worktree exists but WU status is "ready" */
|
|
1616
|
+
readonly PARTIAL_CLAIM: "PARTIAL_CLAIM";
|
|
1617
|
+
/** WU is "in_progress" but worktree does not exist */
|
|
1618
|
+
readonly ORPHAN_CLAIM: "ORPHAN_CLAIM";
|
|
1619
|
+
/** YAML status differs from state store */
|
|
1620
|
+
readonly INCONSISTENT_STATE: "INCONSISTENT_STATE";
|
|
1621
|
+
/** Branch exists but worktree does not */
|
|
1622
|
+
readonly ORPHAN_BRANCH: "ORPHAN_BRANCH";
|
|
1623
|
+
/** Lock file from different WU */
|
|
1624
|
+
readonly STALE_LOCK: "STALE_LOCK";
|
|
1625
|
+
/** WU is done but worktree was not cleaned up */
|
|
1626
|
+
readonly LEFTOVER_WORKTREE: "LEFTOVER_WORKTREE";
|
|
1627
|
+
};
|
|
1628
|
+
/** Predicate severity levels */
|
|
1629
|
+
readonly SEVERITY: {
|
|
1630
|
+
/** Blocks command execution */
|
|
1631
|
+
readonly ERROR: "error";
|
|
1632
|
+
/** Shows warning but allows execution */
|
|
1633
|
+
readonly WARNING: "warning";
|
|
1634
|
+
};
|
|
1635
|
+
/** Performance thresholds */
|
|
1636
|
+
readonly THRESHOLDS: {
|
|
1637
|
+
/** Max context computation time (ms) - acceptance criterion */
|
|
1638
|
+
readonly CONTEXT_COMPUTATION_MS: 100;
|
|
1639
|
+
/** Max stale lock age (hours) */
|
|
1640
|
+
readonly STALE_LOCK_HOURS: 24;
|
|
1641
|
+
};
|
|
1642
|
+
/** Feature flag keys for .lumenflow.config.yaml */
|
|
1643
|
+
readonly FEATURE_FLAGS: {
|
|
1644
|
+
/** Enable context-aware validation */
|
|
1645
|
+
readonly CONTEXT_VALIDATION: "context_validation";
|
|
1646
|
+
/** Validation behavior: 'off' | 'warn' | 'error' */
|
|
1647
|
+
readonly VALIDATION_MODE: "validation_mode";
|
|
1648
|
+
/** Show next steps after successful commands */
|
|
1649
|
+
readonly SHOW_NEXT_STEPS: "show_next_steps";
|
|
1650
|
+
/** Enable wu:recover command */
|
|
1651
|
+
readonly RECOVERY_COMMAND: "recovery_command";
|
|
1652
|
+
};
|
|
1653
|
+
/** Validation modes */
|
|
1654
|
+
readonly VALIDATION_MODES: {
|
|
1655
|
+
/** No validation (legacy behavior) */
|
|
1656
|
+
readonly OFF: "off";
|
|
1657
|
+
/** Show warnings but proceed */
|
|
1658
|
+
readonly WARN: "warn";
|
|
1659
|
+
/** Block on validation failures */
|
|
1660
|
+
readonly ERROR: "error";
|
|
1661
|
+
};
|
|
1662
|
+
/** Command names for the registry */
|
|
1663
|
+
readonly COMMANDS: {
|
|
1664
|
+
readonly WU_CREATE: "wu:create";
|
|
1665
|
+
readonly WU_CLAIM: "wu:claim";
|
|
1666
|
+
readonly WU_DONE: "wu:done";
|
|
1667
|
+
readonly WU_BLOCK: "wu:block";
|
|
1668
|
+
readonly WU_UNBLOCK: "wu:unblock";
|
|
1669
|
+
readonly WU_STATUS: "wu:status";
|
|
1670
|
+
readonly WU_RECOVER: "wu:recover";
|
|
1671
|
+
readonly GATES: "gates";
|
|
1672
|
+
};
|
|
1673
|
+
};
|
|
1674
|
+
/** Type for location types */
|
|
1675
|
+
export type LocationType = (typeof CONTEXT_VALIDATION.LOCATION_TYPES)[keyof typeof CONTEXT_VALIDATION.LOCATION_TYPES];
|
|
1676
|
+
/** Type for validation error codes */
|
|
1677
|
+
export type ValidationErrorCode = (typeof CONTEXT_VALIDATION.ERROR_CODES)[keyof typeof CONTEXT_VALIDATION.ERROR_CODES];
|
|
1678
|
+
/** Type for recovery action types */
|
|
1679
|
+
export type RecoveryActionType = (typeof CONTEXT_VALIDATION.RECOVERY_ACTIONS)[keyof typeof CONTEXT_VALIDATION.RECOVERY_ACTIONS];
|
|
1680
|
+
/** Type for recovery issue codes */
|
|
1681
|
+
export type RecoveryIssueCode = (typeof CONTEXT_VALIDATION.RECOVERY_ISSUES)[keyof typeof CONTEXT_VALIDATION.RECOVERY_ISSUES];
|
|
1682
|
+
/** Type for predicate severity levels */
|
|
1683
|
+
export type PredicateSeverity = (typeof CONTEXT_VALIDATION.SEVERITY)[keyof typeof CONTEXT_VALIDATION.SEVERITY];
|
|
1684
|
+
/** Type for validation modes */
|
|
1685
|
+
export type ValidationMode = (typeof CONTEXT_VALIDATION.VALIDATION_MODES)[keyof typeof CONTEXT_VALIDATION.VALIDATION_MODES];
|
package/dist/wu-constants.js
CHANGED
|
@@ -162,6 +162,14 @@ export const PATTERNS = {
|
|
|
162
162
|
WU_ID: /^WU-\d+$/,
|
|
163
163
|
/** Extract WU ID from text: captures "WU-123" */
|
|
164
164
|
WU_ID_EXTRACT: /WU-\d+/,
|
|
165
|
+
/**
|
|
166
|
+
* Extract WU ID from worktree paths (case-insensitive)
|
|
167
|
+
*
|
|
168
|
+
* WU-1090: Worktree names use lowercase like 'framework-core-wu-1090'
|
|
169
|
+
* This pattern matches both 'WU-123' and 'wu-123' to support
|
|
170
|
+
* extracting WU IDs from worktree paths.
|
|
171
|
+
*/
|
|
172
|
+
WU_ID_EXTRACT_CI: /wu-\d+/i,
|
|
165
173
|
/** Lane branch format: lane/<lane-kebab>/wu-<id> */
|
|
166
174
|
LANE_BRANCH: /^lane\/[\w-]+\/wu-\d+$/,
|
|
167
175
|
/** Worktree path format: worktrees/<lane-kebab>-wu-<id> */
|
|
@@ -1627,3 +1635,119 @@ export async function validateSafetyTestsExist(options = {}) {
|
|
|
1627
1635
|
error: valid ? undefined : `Missing safety-critical tests: ${missingTests.join('; ')}`,
|
|
1628
1636
|
};
|
|
1629
1637
|
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Context validation constants (WU-1090)
|
|
1640
|
+
*
|
|
1641
|
+
* Constants for the context-aware state machine for WU lifecycle commands.
|
|
1642
|
+
* Supports unified context model, declarative command requirements,
|
|
1643
|
+
* smart validation, and recovery paths.
|
|
1644
|
+
*/
|
|
1645
|
+
export const CONTEXT_VALIDATION = {
|
|
1646
|
+
/** Location types for WU operations */
|
|
1647
|
+
LOCATION_TYPES: {
|
|
1648
|
+
/** Main checkout (not a worktree) */
|
|
1649
|
+
MAIN: 'main',
|
|
1650
|
+
/** Inside a worktree */
|
|
1651
|
+
WORKTREE: 'worktree',
|
|
1652
|
+
/** Detached HEAD state */
|
|
1653
|
+
DETACHED: 'detached',
|
|
1654
|
+
/** Unknown location (not a git repo or error) */
|
|
1655
|
+
UNKNOWN: 'unknown',
|
|
1656
|
+
},
|
|
1657
|
+
/** Validation error codes */
|
|
1658
|
+
ERROR_CODES: {
|
|
1659
|
+
/** Command run from wrong location type */
|
|
1660
|
+
WRONG_LOCATION: 'WRONG_LOCATION',
|
|
1661
|
+
/** Target WU does not exist */
|
|
1662
|
+
WU_NOT_FOUND: 'WU_NOT_FOUND',
|
|
1663
|
+
/** WU with this ID already exists */
|
|
1664
|
+
WU_ALREADY_EXISTS: 'WU_ALREADY_EXISTS',
|
|
1665
|
+
/** WU in unexpected status for command */
|
|
1666
|
+
WRONG_WU_STATUS: 'WRONG_WU_STATUS',
|
|
1667
|
+
/** Lane already has WU in progress */
|
|
1668
|
+
LANE_OCCUPIED: 'LANE_OCCUPIED',
|
|
1669
|
+
/** Worktree already exists for WU */
|
|
1670
|
+
WORKTREE_EXISTS: 'WORKTREE_EXISTS',
|
|
1671
|
+
/** Expected worktree not found */
|
|
1672
|
+
WORKTREE_MISSING: 'WORKTREE_MISSING',
|
|
1673
|
+
/** Gates haven't run or failed */
|
|
1674
|
+
GATES_NOT_PASSED: 'GATES_NOT_PASSED',
|
|
1675
|
+
/** Uncommitted changes exist */
|
|
1676
|
+
DIRTY_GIT: 'DIRTY_GIT',
|
|
1677
|
+
/** Cannot reach origin remote */
|
|
1678
|
+
REMOTE_UNAVAILABLE: 'REMOTE_UNAVAILABLE',
|
|
1679
|
+
/** YAML and state store disagree */
|
|
1680
|
+
INCONSISTENT_STATE: 'INCONSISTENT_STATE',
|
|
1681
|
+
},
|
|
1682
|
+
/** Recovery action types */
|
|
1683
|
+
RECOVERY_ACTIONS: {
|
|
1684
|
+
/** Reconcile state and continue working (preserves work) */
|
|
1685
|
+
RESUME: 'resume',
|
|
1686
|
+
/** Discard worktree, reset WU to ready */
|
|
1687
|
+
RESET: 'reset',
|
|
1688
|
+
/** Remove all artifacts completely (requires --force) */
|
|
1689
|
+
NUKE: 'nuke',
|
|
1690
|
+
/** Remove leftover worktree (for done WUs) */
|
|
1691
|
+
CLEANUP: 'cleanup',
|
|
1692
|
+
},
|
|
1693
|
+
/** Recovery issue codes */
|
|
1694
|
+
RECOVERY_ISSUES: {
|
|
1695
|
+
/** Worktree exists but WU status is "ready" */
|
|
1696
|
+
PARTIAL_CLAIM: 'PARTIAL_CLAIM',
|
|
1697
|
+
/** WU is "in_progress" but worktree does not exist */
|
|
1698
|
+
ORPHAN_CLAIM: 'ORPHAN_CLAIM',
|
|
1699
|
+
/** YAML status differs from state store */
|
|
1700
|
+
INCONSISTENT_STATE: 'INCONSISTENT_STATE',
|
|
1701
|
+
/** Branch exists but worktree does not */
|
|
1702
|
+
ORPHAN_BRANCH: 'ORPHAN_BRANCH',
|
|
1703
|
+
/** Lock file from different WU */
|
|
1704
|
+
STALE_LOCK: 'STALE_LOCK',
|
|
1705
|
+
/** WU is done but worktree was not cleaned up */
|
|
1706
|
+
LEFTOVER_WORKTREE: 'LEFTOVER_WORKTREE',
|
|
1707
|
+
},
|
|
1708
|
+
/** Predicate severity levels */
|
|
1709
|
+
SEVERITY: {
|
|
1710
|
+
/** Blocks command execution */
|
|
1711
|
+
ERROR: 'error',
|
|
1712
|
+
/** Shows warning but allows execution */
|
|
1713
|
+
WARNING: 'warning',
|
|
1714
|
+
},
|
|
1715
|
+
/** Performance thresholds */
|
|
1716
|
+
THRESHOLDS: {
|
|
1717
|
+
/** Max context computation time (ms) - acceptance criterion */
|
|
1718
|
+
CONTEXT_COMPUTATION_MS: 100,
|
|
1719
|
+
/** Max stale lock age (hours) */
|
|
1720
|
+
STALE_LOCK_HOURS: 24,
|
|
1721
|
+
},
|
|
1722
|
+
/** Feature flag keys for .lumenflow.config.yaml */
|
|
1723
|
+
FEATURE_FLAGS: {
|
|
1724
|
+
/** Enable context-aware validation */
|
|
1725
|
+
CONTEXT_VALIDATION: 'context_validation',
|
|
1726
|
+
/** Validation behavior: 'off' | 'warn' | 'error' */
|
|
1727
|
+
VALIDATION_MODE: 'validation_mode',
|
|
1728
|
+
/** Show next steps after successful commands */
|
|
1729
|
+
SHOW_NEXT_STEPS: 'show_next_steps',
|
|
1730
|
+
/** Enable wu:recover command */
|
|
1731
|
+
RECOVERY_COMMAND: 'recovery_command',
|
|
1732
|
+
},
|
|
1733
|
+
/** Validation modes */
|
|
1734
|
+
VALIDATION_MODES: {
|
|
1735
|
+
/** No validation (legacy behavior) */
|
|
1736
|
+
OFF: 'off',
|
|
1737
|
+
/** Show warnings but proceed */
|
|
1738
|
+
WARN: 'warn',
|
|
1739
|
+
/** Block on validation failures */
|
|
1740
|
+
ERROR: 'error',
|
|
1741
|
+
},
|
|
1742
|
+
/** Command names for the registry */
|
|
1743
|
+
COMMANDS: {
|
|
1744
|
+
WU_CREATE: 'wu:create',
|
|
1745
|
+
WU_CLAIM: 'wu:claim',
|
|
1746
|
+
WU_DONE: 'wu:done',
|
|
1747
|
+
WU_BLOCK: 'wu:block',
|
|
1748
|
+
WU_UNBLOCK: 'wu:unblock',
|
|
1749
|
+
WU_STATUS: 'wu:status',
|
|
1750
|
+
WU_RECOVER: 'wu:recover',
|
|
1751
|
+
GATES: 'gates',
|
|
1752
|
+
},
|
|
1753
|
+
};
|
package/dist/wu-helpers.d.ts
CHANGED
|
@@ -112,8 +112,12 @@ export declare function extractWUFromCommitMessage(message: any): any;
|
|
|
112
112
|
* Centralized from duplicated ensureOnMain() functions across wu-* scripts (WU-1256).
|
|
113
113
|
* Async version - accepts a git adapter with async getCurrentBranch() method.
|
|
114
114
|
*
|
|
115
|
+
* WU-1091: Agent branches (claude/*, codex/*, copilot/*, cursor/*, agent/*) bypass
|
|
116
|
+
* the main branch requirement for web agent commands. Lane branches still require
|
|
117
|
+
* worktree workflow (no bypass). Protected branches (main/master) remain protected.
|
|
118
|
+
*
|
|
115
119
|
* @param {object} git - Git adapter with async getCurrentBranch() method
|
|
116
|
-
* @throws {Error} If not on main branch
|
|
120
|
+
* @throws {Error} If not on main branch and not an agent branch
|
|
117
121
|
*/
|
|
118
122
|
export declare function ensureOnMain(git: any): Promise<void>;
|
|
119
123
|
/**
|
package/dist/wu-helpers.js
CHANGED
|
@@ -13,6 +13,7 @@ import path from 'node:path';
|
|
|
13
13
|
import { parse } from 'yaml';
|
|
14
14
|
import { BRANCHES, REMOTES, STDIO, REAL_GIT, PATTERNS } from './wu-constants.js';
|
|
15
15
|
import { die } from './error-handler.js';
|
|
16
|
+
import { isAgentBranchWithDetails } from './branch-check.js';
|
|
16
17
|
/**
|
|
17
18
|
* Validate WU ID format
|
|
18
19
|
*
|
|
@@ -220,12 +221,22 @@ export function extractWUFromCommitMessage(message) {
|
|
|
220
221
|
* Centralized from duplicated ensureOnMain() functions across wu-* scripts (WU-1256).
|
|
221
222
|
* Async version - accepts a git adapter with async getCurrentBranch() method.
|
|
222
223
|
*
|
|
224
|
+
* WU-1091: Agent branches (claude/*, codex/*, copilot/*, cursor/*, agent/*) bypass
|
|
225
|
+
* the main branch requirement for web agent commands. Lane branches still require
|
|
226
|
+
* worktree workflow (no bypass). Protected branches (main/master) remain protected.
|
|
227
|
+
*
|
|
223
228
|
* @param {object} git - Git adapter with async getCurrentBranch() method
|
|
224
|
-
* @throws {Error} If not on main branch
|
|
229
|
+
* @throws {Error} If not on main branch and not an agent branch
|
|
225
230
|
*/
|
|
226
231
|
export async function ensureOnMain(git) {
|
|
227
232
|
const branch = await git.getCurrentBranch();
|
|
228
233
|
if (branch !== BRANCHES.MAIN) {
|
|
234
|
+
// WU-1091: Check if this is an agent branch that can bypass the main requirement
|
|
235
|
+
const agentResult = await isAgentBranchWithDetails(branch);
|
|
236
|
+
if (agentResult.isMatch) {
|
|
237
|
+
console.log(`[ensureOnMain] Bypassing for agent branch '${branch}' (${agentResult.patternResult.source})`);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
229
240
|
throw new Error(`Run from shared checkout on '${BRANCHES.MAIN}' (found '${branch}')`);
|
|
230
241
|
}
|
|
231
242
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lumenflow/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Core WU lifecycle tools for LumenFlow workflow framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lumenflow",
|
|
@@ -78,7 +78,9 @@
|
|
|
78
78
|
"micromatch": "^4.0.8",
|
|
79
79
|
"minimatch": "^10.1.1",
|
|
80
80
|
"ms": "^2.1.3",
|
|
81
|
+
"nhs-number-validator": "^1.1.2",
|
|
81
82
|
"picocolors": "^1.1.1",
|
|
83
|
+
"postcode": "^5.1.0",
|
|
82
84
|
"pretty-ms": "^9.2.0",
|
|
83
85
|
"ps-list": "^8.1.1",
|
|
84
86
|
"simple-git": "^3.30.0",
|
|
@@ -92,7 +94,7 @@
|
|
|
92
94
|
"vitest": "^4.0.17"
|
|
93
95
|
},
|
|
94
96
|
"peerDependencies": {
|
|
95
|
-
"@lumenflow/memory": "
|
|
97
|
+
"@lumenflow/memory": "2.0.0"
|
|
96
98
|
},
|
|
97
99
|
"peerDependenciesMeta": {
|
|
98
100
|
"@lumenflow/memory": {
|