@lumenflow/core 1.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.
Files changed (263) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +119 -0
  3. package/dist/active-wu-detector.d.ts +33 -0
  4. package/dist/active-wu-detector.js +106 -0
  5. package/dist/adapters/filesystem-metrics.adapter.d.ts +108 -0
  6. package/dist/adapters/filesystem-metrics.adapter.js +519 -0
  7. package/dist/adapters/terminal-renderer.adapter.d.ts +106 -0
  8. package/dist/adapters/terminal-renderer.adapter.js +337 -0
  9. package/dist/arg-parser.d.ts +63 -0
  10. package/dist/arg-parser.js +560 -0
  11. package/dist/backlog-editor.d.ts +98 -0
  12. package/dist/backlog-editor.js +179 -0
  13. package/dist/backlog-generator.d.ts +111 -0
  14. package/dist/backlog-generator.js +381 -0
  15. package/dist/backlog-parser.d.ts +45 -0
  16. package/dist/backlog-parser.js +102 -0
  17. package/dist/backlog-sync-validator.d.ts +78 -0
  18. package/dist/backlog-sync-validator.js +294 -0
  19. package/dist/branch-drift.d.ts +34 -0
  20. package/dist/branch-drift.js +51 -0
  21. package/dist/cleanup-install-config.d.ts +33 -0
  22. package/dist/cleanup-install-config.js +37 -0
  23. package/dist/cleanup-lock.d.ts +139 -0
  24. package/dist/cleanup-lock.js +313 -0
  25. package/dist/code-path-validator.d.ts +146 -0
  26. package/dist/code-path-validator.js +537 -0
  27. package/dist/code-paths-overlap.d.ts +55 -0
  28. package/dist/code-paths-overlap.js +245 -0
  29. package/dist/commands-logger.d.ts +77 -0
  30. package/dist/commands-logger.js +254 -0
  31. package/dist/commit-message-utils.d.ts +25 -0
  32. package/dist/commit-message-utils.js +41 -0
  33. package/dist/compliance-parser.d.ts +150 -0
  34. package/dist/compliance-parser.js +507 -0
  35. package/dist/constants/backlog-patterns.d.ts +20 -0
  36. package/dist/constants/backlog-patterns.js +23 -0
  37. package/dist/constants/dora-constants.d.ts +49 -0
  38. package/dist/constants/dora-constants.js +53 -0
  39. package/dist/constants/gate-constants.d.ts +15 -0
  40. package/dist/constants/gate-constants.js +15 -0
  41. package/dist/constants/linter-constants.d.ts +16 -0
  42. package/dist/constants/linter-constants.js +16 -0
  43. package/dist/constants/tokenizer-constants.d.ts +15 -0
  44. package/dist/constants/tokenizer-constants.js +15 -0
  45. package/dist/core/scope-checker.d.ts +97 -0
  46. package/dist/core/scope-checker.js +163 -0
  47. package/dist/core/tool-runner.d.ts +161 -0
  48. package/dist/core/tool-runner.js +393 -0
  49. package/dist/core/tool.constants.d.ts +105 -0
  50. package/dist/core/tool.constants.js +101 -0
  51. package/dist/core/tool.schemas.d.ts +226 -0
  52. package/dist/core/tool.schemas.js +226 -0
  53. package/dist/core/worktree-guard.d.ts +130 -0
  54. package/dist/core/worktree-guard.js +242 -0
  55. package/dist/coverage-gate.d.ts +108 -0
  56. package/dist/coverage-gate.js +196 -0
  57. package/dist/date-utils.d.ts +75 -0
  58. package/dist/date-utils.js +140 -0
  59. package/dist/dependency-graph.d.ts +142 -0
  60. package/dist/dependency-graph.js +550 -0
  61. package/dist/dependency-guard.d.ts +54 -0
  62. package/dist/dependency-guard.js +142 -0
  63. package/dist/dependency-validator.d.ts +105 -0
  64. package/dist/dependency-validator.js +154 -0
  65. package/dist/docs-path-validator.d.ts +36 -0
  66. package/dist/docs-path-validator.js +95 -0
  67. package/dist/domain/orchestration.constants.d.ts +99 -0
  68. package/dist/domain/orchestration.constants.js +97 -0
  69. package/dist/domain/orchestration.schemas.d.ts +280 -0
  70. package/dist/domain/orchestration.schemas.js +211 -0
  71. package/dist/domain/orchestration.types.d.ts +133 -0
  72. package/dist/domain/orchestration.types.js +12 -0
  73. package/dist/error-handler.d.ts +116 -0
  74. package/dist/error-handler.js +136 -0
  75. package/dist/file-classifiers.d.ts +62 -0
  76. package/dist/file-classifiers.js +108 -0
  77. package/dist/gates-agent-mode.d.ts +81 -0
  78. package/dist/gates-agent-mode.js +94 -0
  79. package/dist/generate-traceability.d.ts +107 -0
  80. package/dist/generate-traceability.js +411 -0
  81. package/dist/git-adapter.d.ts +395 -0
  82. package/dist/git-adapter.js +649 -0
  83. package/dist/git-staged-validator.d.ts +32 -0
  84. package/dist/git-staged-validator.js +48 -0
  85. package/dist/hardcoded-strings.d.ts +61 -0
  86. package/dist/hardcoded-strings.js +270 -0
  87. package/dist/incremental-lint.d.ts +78 -0
  88. package/dist/incremental-lint.js +129 -0
  89. package/dist/incremental-test.d.ts +39 -0
  90. package/dist/incremental-test.js +61 -0
  91. package/dist/index.d.ts +42 -0
  92. package/dist/index.js +61 -0
  93. package/dist/invariants/check-automated-tests.d.ts +50 -0
  94. package/dist/invariants/check-automated-tests.js +166 -0
  95. package/dist/invariants-runner.d.ts +103 -0
  96. package/dist/invariants-runner.js +527 -0
  97. package/dist/lane-checker.d.ts +50 -0
  98. package/dist/lane-checker.js +319 -0
  99. package/dist/lane-inference.d.ts +39 -0
  100. package/dist/lane-inference.js +195 -0
  101. package/dist/lane-lock.d.ts +211 -0
  102. package/dist/lane-lock.js +474 -0
  103. package/dist/lane-validator.d.ts +48 -0
  104. package/dist/lane-validator.js +114 -0
  105. package/dist/logs-lib.d.ts +104 -0
  106. package/dist/logs-lib.js +207 -0
  107. package/dist/lumenflow-config-schema.d.ts +272 -0
  108. package/dist/lumenflow-config-schema.js +207 -0
  109. package/dist/lumenflow-config.d.ts +95 -0
  110. package/dist/lumenflow-config.js +236 -0
  111. package/dist/manual-test-validator.d.ts +80 -0
  112. package/dist/manual-test-validator.js +200 -0
  113. package/dist/merge-lock.d.ts +115 -0
  114. package/dist/merge-lock.js +251 -0
  115. package/dist/micro-worktree.d.ts +159 -0
  116. package/dist/micro-worktree.js +427 -0
  117. package/dist/migration-deployer.d.ts +69 -0
  118. package/dist/migration-deployer.js +151 -0
  119. package/dist/orchestration-advisory-loader.d.ts +28 -0
  120. package/dist/orchestration-advisory-loader.js +87 -0
  121. package/dist/orchestration-advisory.d.ts +58 -0
  122. package/dist/orchestration-advisory.js +94 -0
  123. package/dist/orchestration-di.d.ts +48 -0
  124. package/dist/orchestration-di.js +57 -0
  125. package/dist/orchestration-rules.d.ts +57 -0
  126. package/dist/orchestration-rules.js +201 -0
  127. package/dist/orphan-detector.d.ts +131 -0
  128. package/dist/orphan-detector.js +226 -0
  129. package/dist/path-classifiers.d.ts +57 -0
  130. package/dist/path-classifiers.js +93 -0
  131. package/dist/piped-command-detector.d.ts +34 -0
  132. package/dist/piped-command-detector.js +64 -0
  133. package/dist/ports/dashboard-renderer.port.d.ts +112 -0
  134. package/dist/ports/dashboard-renderer.port.js +25 -0
  135. package/dist/ports/metrics-collector.port.d.ts +132 -0
  136. package/dist/ports/metrics-collector.port.js +26 -0
  137. package/dist/process-detector.d.ts +84 -0
  138. package/dist/process-detector.js +172 -0
  139. package/dist/prompt-linter.d.ts +72 -0
  140. package/dist/prompt-linter.js +312 -0
  141. package/dist/prompt-monitor.d.ts +15 -0
  142. package/dist/prompt-monitor.js +205 -0
  143. package/dist/rebase-artifact-cleanup.d.ts +145 -0
  144. package/dist/rebase-artifact-cleanup.js +433 -0
  145. package/dist/retry-strategy.d.ts +189 -0
  146. package/dist/retry-strategy.js +283 -0
  147. package/dist/risk-detector.d.ts +108 -0
  148. package/dist/risk-detector.js +252 -0
  149. package/dist/rollback-utils.d.ts +76 -0
  150. package/dist/rollback-utils.js +104 -0
  151. package/dist/section-headings.d.ts +43 -0
  152. package/dist/section-headings.js +49 -0
  153. package/dist/spawn-escalation.d.ts +90 -0
  154. package/dist/spawn-escalation.js +253 -0
  155. package/dist/spawn-monitor.d.ts +229 -0
  156. package/dist/spawn-monitor.js +672 -0
  157. package/dist/spawn-recovery.d.ts +82 -0
  158. package/dist/spawn-recovery.js +298 -0
  159. package/dist/spawn-registry-schema.d.ts +98 -0
  160. package/dist/spawn-registry-schema.js +108 -0
  161. package/dist/spawn-registry-store.d.ts +146 -0
  162. package/dist/spawn-registry-store.js +273 -0
  163. package/dist/spawn-tree.d.ts +121 -0
  164. package/dist/spawn-tree.js +285 -0
  165. package/dist/stamp-status-validator.d.ts +84 -0
  166. package/dist/stamp-status-validator.js +134 -0
  167. package/dist/stamp-utils.d.ts +100 -0
  168. package/dist/stamp-utils.js +229 -0
  169. package/dist/state-machine.d.ts +26 -0
  170. package/dist/state-machine.js +83 -0
  171. package/dist/system-map-validator.d.ts +80 -0
  172. package/dist/system-map-validator.js +272 -0
  173. package/dist/telemetry.d.ts +80 -0
  174. package/dist/telemetry.js +213 -0
  175. package/dist/token-counter.d.ts +51 -0
  176. package/dist/token-counter.js +145 -0
  177. package/dist/usecases/get-dashboard-data.usecase.d.ts +52 -0
  178. package/dist/usecases/get-dashboard-data.usecase.js +61 -0
  179. package/dist/usecases/get-suggestions.usecase.d.ts +100 -0
  180. package/dist/usecases/get-suggestions.usecase.js +153 -0
  181. package/dist/user-normalizer.d.ts +41 -0
  182. package/dist/user-normalizer.js +141 -0
  183. package/dist/validators/phi-constants.d.ts +97 -0
  184. package/dist/validators/phi-constants.js +152 -0
  185. package/dist/validators/phi-scanner.d.ts +58 -0
  186. package/dist/validators/phi-scanner.js +215 -0
  187. package/dist/worktree-ownership.d.ts +50 -0
  188. package/dist/worktree-ownership.js +74 -0
  189. package/dist/worktree-scanner.d.ts +103 -0
  190. package/dist/worktree-scanner.js +168 -0
  191. package/dist/worktree-symlink.d.ts +99 -0
  192. package/dist/worktree-symlink.js +359 -0
  193. package/dist/wu-backlog-updater.d.ts +17 -0
  194. package/dist/wu-backlog-updater.js +37 -0
  195. package/dist/wu-checkpoint.d.ts +124 -0
  196. package/dist/wu-checkpoint.js +233 -0
  197. package/dist/wu-claim-helpers.d.ts +26 -0
  198. package/dist/wu-claim-helpers.js +63 -0
  199. package/dist/wu-claim-resume.d.ts +106 -0
  200. package/dist/wu-claim-resume.js +276 -0
  201. package/dist/wu-consistency-checker.d.ts +95 -0
  202. package/dist/wu-consistency-checker.js +567 -0
  203. package/dist/wu-constants.d.ts +1275 -0
  204. package/dist/wu-constants.js +1382 -0
  205. package/dist/wu-create-validators.d.ts +42 -0
  206. package/dist/wu-create-validators.js +93 -0
  207. package/dist/wu-done-branch-only.d.ts +63 -0
  208. package/dist/wu-done-branch-only.js +191 -0
  209. package/dist/wu-done-messages.d.ts +119 -0
  210. package/dist/wu-done-messages.js +185 -0
  211. package/dist/wu-done-pr.d.ts +72 -0
  212. package/dist/wu-done-pr.js +174 -0
  213. package/dist/wu-done-retry-helpers.d.ts +85 -0
  214. package/dist/wu-done-retry-helpers.js +172 -0
  215. package/dist/wu-done-ui.d.ts +37 -0
  216. package/dist/wu-done-ui.js +69 -0
  217. package/dist/wu-done-validators.d.ts +411 -0
  218. package/dist/wu-done-validators.js +1229 -0
  219. package/dist/wu-done-worktree.d.ts +182 -0
  220. package/dist/wu-done-worktree.js +1097 -0
  221. package/dist/wu-helpers.d.ts +128 -0
  222. package/dist/wu-helpers.js +248 -0
  223. package/dist/wu-lint.d.ts +70 -0
  224. package/dist/wu-lint.js +234 -0
  225. package/dist/wu-paths.d.ts +171 -0
  226. package/dist/wu-paths.js +178 -0
  227. package/dist/wu-preflight-validators.d.ts +86 -0
  228. package/dist/wu-preflight-validators.js +251 -0
  229. package/dist/wu-recovery.d.ts +138 -0
  230. package/dist/wu-recovery.js +341 -0
  231. package/dist/wu-repair-core.d.ts +131 -0
  232. package/dist/wu-repair-core.js +669 -0
  233. package/dist/wu-schema-normalization.d.ts +17 -0
  234. package/dist/wu-schema-normalization.js +82 -0
  235. package/dist/wu-schema.d.ts +793 -0
  236. package/dist/wu-schema.js +881 -0
  237. package/dist/wu-spawn-helpers.d.ts +121 -0
  238. package/dist/wu-spawn-helpers.js +271 -0
  239. package/dist/wu-spawn.d.ts +158 -0
  240. package/dist/wu-spawn.js +1306 -0
  241. package/dist/wu-state-schema.d.ts +213 -0
  242. package/dist/wu-state-schema.js +156 -0
  243. package/dist/wu-state-store.d.ts +264 -0
  244. package/dist/wu-state-store.js +691 -0
  245. package/dist/wu-status-transition.d.ts +63 -0
  246. package/dist/wu-status-transition.js +382 -0
  247. package/dist/wu-status-updater.d.ts +25 -0
  248. package/dist/wu-status-updater.js +116 -0
  249. package/dist/wu-transaction-collectors.d.ts +116 -0
  250. package/dist/wu-transaction-collectors.js +272 -0
  251. package/dist/wu-transaction.d.ts +170 -0
  252. package/dist/wu-transaction.js +273 -0
  253. package/dist/wu-validation-constants.d.ts +60 -0
  254. package/dist/wu-validation-constants.js +66 -0
  255. package/dist/wu-validation.d.ts +118 -0
  256. package/dist/wu-validation.js +243 -0
  257. package/dist/wu-validator.d.ts +62 -0
  258. package/dist/wu-validator.js +325 -0
  259. package/dist/wu-yaml-fixer.d.ts +97 -0
  260. package/dist/wu-yaml-fixer.js +264 -0
  261. package/dist/wu-yaml.d.ts +86 -0
  262. package/dist/wu-yaml.js +222 -0
  263. package/package.json +114 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 HellmAI
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # @lumenflow/core
2
+
3
+ Core WU lifecycle tools for the LumenFlow workflow framework.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @lumenflow/core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Git Operations
14
+
15
+ ```typescript
16
+ import { createGitAdapter } from '@lumenflow/core';
17
+ // Or: import { createGitAdapter } from '@lumenflow/core/git';
18
+
19
+ const git = createGitAdapter({ baseDir: '/path/to/repo' });
20
+
21
+ // Check status
22
+ const status = await git.getStatus();
23
+ if (!status.isClean) {
24
+ console.log('Modified:', status.modified);
25
+ console.log('Untracked:', status.untracked);
26
+ }
27
+
28
+ // Commit changes
29
+ await git.add('.');
30
+ await git.commit('feat: add new feature');
31
+ await git.push();
32
+
33
+ // Fast-forward merge
34
+ await git.mergeFastForward('feature-branch');
35
+
36
+ // Branch operations
37
+ await git.createBranch('feature/new-feature', 'main');
38
+ const exists = await git.branchExists('feature/new-feature');
39
+ await git.checkout('main');
40
+ await git.deleteBranch('feature/new-feature');
41
+ ```
42
+
43
+ ### Worktree Management
44
+
45
+ ```typescript
46
+ import { createWorktreeManager } from '@lumenflow/core';
47
+ // Or: import { createWorktreeManager } from '@lumenflow/core/git';
48
+
49
+ const worktrees = createWorktreeManager({ baseDir: '/path/to/repo' });
50
+
51
+ // Create worktree for a WU
52
+ const result = await worktrees.create({
53
+ path: 'worktrees/operations-wu-123',
54
+ branch: 'lane/operations/wu-123',
55
+ startPoint: 'origin/main',
56
+ });
57
+
58
+ // List worktrees
59
+ const list = await worktrees.list();
60
+ for (const wt of list) {
61
+ console.log(`${wt.path} -> ${wt.branch}`);
62
+ }
63
+
64
+ // Check if worktree exists
65
+ const exists = await worktrees.exists('/path/to/worktree');
66
+
67
+ // Remove worktree (handles orphan cleanup)
68
+ await worktrees.remove('worktrees/operations-wu-123');
69
+ ```
70
+
71
+ ## API Reference
72
+
73
+ ### GitAdapter
74
+
75
+ | Method | Description |
76
+ | ----------------------------------- | ------------------------------------- |
77
+ | `getStatus()` | Get normalized git status information |
78
+ | `isClean()` | Check if working tree has no changes |
79
+ | `add(files)` | Add files to staging area |
80
+ | `commit(message)` | Commit staged changes |
81
+ | `push(options?)` | Push to remote repository |
82
+ | `mergeFastForward(branch)` | Fast-forward only merge |
83
+ | `getCurrentBranch()` | Get current branch name |
84
+ | `branchExists(branch)` | Check if branch exists |
85
+ | `fetch(options?)` | Fetch from remote |
86
+ | `getCommitHash(ref?)` | Get commit hash for ref |
87
+ | `createBranch(branch, startPoint?)` | Create and checkout new branch |
88
+ | `checkout(branch)` | Checkout existing branch |
89
+ | `deleteBranch(branch, options?)` | Delete a branch |
90
+ | `raw(args)` | Execute raw git command |
91
+
92
+ ### WorktreeManager
93
+
94
+ | Method | Description |
95
+ | ------------------------ | ------------------------------- |
96
+ | `create(options)` | Create worktree with new branch |
97
+ | `remove(path, options?)` | Remove worktree safely |
98
+ | `list()` | List all worktrees |
99
+ | `exists(path)` | Check if worktree exists |
100
+
101
+ ## Features
102
+
103
+ - **Type-safe**: Full TypeScript support with detailed type definitions
104
+ - **Dependency injection**: Easy to test with mock git instances
105
+ - **Safe worktree cleanup**: Handles orphan directories and corrupted metadata
106
+ - **Modern**: Node 22+, ESM-only, strict TypeScript
107
+
108
+ ## Status
109
+
110
+ This package is under active development. Current features:
111
+
112
+ - Git operations (GitAdapter)
113
+ - Worktree management (WorktreeManager)
114
+ - Modern tooling (Node 22, ESLint 9, TypeScript 5.7, Vitest 4)
115
+ - Security and code quality linting
116
+
117
+ ## License
118
+
119
+ Apache-2.0
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Active WU Detection Utilities
3
+ *
4
+ * Detects which WU YAMLs are "active" (referenced in backlog.md/status.md)
5
+ * vs "orphan" (legacy/unreferenced). Used by validate.mjs to suppress
6
+ * lane-checker warnings for orphan WUs.
7
+ *
8
+ * WU-1814: Stop lane-checker warnings for orphan WU YAMLs
9
+ */
10
+ /**
11
+ * Remediation message shown in summary for orphan WU warnings
12
+ * @type {string}
13
+ */
14
+ export declare const ORPHAN_REMEDIATION_MESSAGE = "Use pnpm wu:delete --id WU-XXX if truly obsolete, or add to backlog if still needed.";
15
+ /**
16
+ * Extract WU IDs from a markdown content string (backlog.md or status.md)
17
+ * Only extracts from active sections (Ready, In Progress, Blocked, Waiting)
18
+ * NOT from Done/Completed sections
19
+ *
20
+ * @param {string} backlogContent - Content of backlog.md
21
+ * @param {string} statusContent - Content of status.md
22
+ * @param {string} [currentWuId] - Optional WU_ID env var to include
23
+ * @returns {Set<string>} Set of active WU IDs
24
+ */
25
+ export declare function extractActiveWuIds(backlogContent: any, statusContent: any, currentWuId?: any): Set<unknown>;
26
+ /**
27
+ * Check if a WU is an "orphan" (not referenced in backlog.md/status.md)
28
+ *
29
+ * @param {string} wuId - WU ID to check (e.g., "WU-123")
30
+ * @param {Set<string>} activeIds - Set of active WU IDs
31
+ * @returns {boolean} True if WU is orphan (not in active set)
32
+ */
33
+ export declare function isOrphanWu(wuId: any, activeIds: any): boolean;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Active WU Detection Utilities
3
+ *
4
+ * Detects which WU YAMLs are "active" (referenced in backlog.md/status.md)
5
+ * vs "orphan" (legacy/unreferenced). Used by validate.mjs to suppress
6
+ * lane-checker warnings for orphan WUs.
7
+ *
8
+ * WU-1814: Stop lane-checker warnings for orphan WU YAMLs
9
+ */
10
+ import { WU_LINK_PATTERN } from './constants/backlog-patterns.js';
11
+ /**
12
+ * Remediation message shown in summary for orphan WU warnings
13
+ * @type {string}
14
+ */
15
+ export const ORPHAN_REMEDIATION_MESSAGE = 'Use pnpm wu:delete --id WU-XXX if truly obsolete, or add to backlog if still needed.';
16
+ /**
17
+ * Sections in backlog.md/status.md that indicate a WU is "active"
18
+ * (i.e., not done/completed - still requires action or attention)
19
+ * @type {readonly string[]}
20
+ */
21
+ const ACTIVE_SECTION_HEADERS = Object.freeze([
22
+ '## ready',
23
+ '## in progress',
24
+ '## blocked',
25
+ '## waiting',
26
+ ]);
27
+ /**
28
+ * Sections in backlog.md/status.md that indicate a WU is "done"
29
+ * (completed work - not considered "active" for lane validation)
30
+ * @type {readonly string[]}
31
+ */
32
+ const DONE_SECTION_HEADERS = Object.freeze(['## done', '## completed']);
33
+ /**
34
+ * Check if a line is a section header we care about
35
+ * @param {string} line - Line to check
36
+ * @param {readonly string[]} headers - Headers to match against
37
+ * @returns {boolean} True if line matches any header
38
+ */
39
+ function matchesSectionHeader(line, headers) {
40
+ const normalized = line.trim().toLowerCase();
41
+ return headers.some((header) => normalized.startsWith(header));
42
+ }
43
+ /**
44
+ * Extract WU IDs from a markdown content string (backlog.md or status.md)
45
+ * Only extracts from active sections (Ready, In Progress, Blocked, Waiting)
46
+ * NOT from Done/Completed sections
47
+ *
48
+ * @param {string} backlogContent - Content of backlog.md
49
+ * @param {string} statusContent - Content of status.md
50
+ * @param {string} [currentWuId] - Optional WU_ID env var to include
51
+ * @returns {Set<string>} Set of active WU IDs
52
+ */
53
+ export function extractActiveWuIds(backlogContent, statusContent, currentWuId = null) {
54
+ const activeIds = new Set();
55
+ // Process both backlog and status content
56
+ for (const content of [backlogContent, statusContent]) {
57
+ if (!content)
58
+ continue;
59
+ const lines = content.split(/\r?\n/);
60
+ let inActiveSection = false;
61
+ for (const line of lines) {
62
+ // Check if we're entering an active section
63
+ if (matchesSectionHeader(line, ACTIVE_SECTION_HEADERS)) {
64
+ inActiveSection = true;
65
+ continue;
66
+ }
67
+ // Check if we're entering a done section (stop collecting)
68
+ if (matchesSectionHeader(line, DONE_SECTION_HEADERS)) {
69
+ inActiveSection = false;
70
+ continue;
71
+ }
72
+ // Check if we're hitting another ## section (reset state)
73
+ if (line.trim().startsWith('## ')) {
74
+ inActiveSection = false;
75
+ continue;
76
+ }
77
+ // Extract WU IDs from links in active sections only
78
+ if (inActiveSection) {
79
+ // Reset regex state for each line (global flag)
80
+ WU_LINK_PATTERN.lastIndex = 0;
81
+ const matches = [...line.matchAll(WU_LINK_PATTERN)];
82
+ for (const match of matches) {
83
+ const wuId = match[1];
84
+ if (wuId) {
85
+ activeIds.add(wuId);
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ // Include WU_ID env var if provided (always validate the current WU)
92
+ if (currentWuId) {
93
+ activeIds.add(currentWuId);
94
+ }
95
+ return activeIds;
96
+ }
97
+ /**
98
+ * Check if a WU is an "orphan" (not referenced in backlog.md/status.md)
99
+ *
100
+ * @param {string} wuId - WU ID to check (e.g., "WU-123")
101
+ * @param {Set<string>} activeIds - Set of active WU IDs
102
+ * @returns {boolean} True if WU is orphan (not in active set)
103
+ */
104
+ export function isOrphanWu(wuId, activeIds) {
105
+ return !activeIds.has(wuId);
106
+ }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * FileSystem Metrics Collector Adapter
3
+ *
4
+ * Hexagonal Architecture - Adapter (Infrastructure Layer)
5
+ * Implements MetricsCollector port by reading from filesystem:
6
+ * - WU YAML files (docs/04-operations/tasks/wu/)
7
+ * - status.md (active/blocked WUs)
8
+ * - telemetry files (.beacon/telemetry/)
9
+ *
10
+ * Library-First Approach:
11
+ * - fast-glob: File discovery
12
+ * - yaml: YAML parsing
13
+ * - date-fns: Time calculations
14
+ *
15
+ * @module filesystem-metrics.adapter
16
+ * @see {@link ../ports/metrics-collector.port.ts} - Port interface
17
+ * @see {@link ../domain/orchestration.types.ts} - Return types
18
+ */
19
+ import type { IMetricsCollector } from '../ports/metrics-collector.port.js';
20
+ import type { GlobalStatus, AgentMetric, WUProgress, TimelineEvent, Alert } from '../domain/orchestration.types.js';
21
+ /**
22
+ * FileSystem implementation of MetricsCollector.
23
+ *
24
+ * Reads orchestration data from local filesystem.
25
+ * Suitable for development and single-machine deployments.
26
+ *
27
+ * @example
28
+ * const collector = new FileSystemMetricsCollector('/path/to/repo');
29
+ * const status = await collector.getGlobalStatus();
30
+ * console.log(`Active WUs: ${status.activeWUs}`);
31
+ */
32
+ export declare class FileSystemMetricsCollector implements IMetricsCollector {
33
+ private readonly baseDir;
34
+ /**
35
+ * Create a new FileSystemMetricsCollector.
36
+ *
37
+ * @param baseDir - Base directory of the repository (default: process.cwd())
38
+ */
39
+ constructor(baseDir?: string);
40
+ /**
41
+ * Get global orchestration status.
42
+ *
43
+ * Reads status.md to count active/blocked WUs.
44
+ * Reads stamp files to count completed WUs in last 24h.
45
+ * Reads WU YAMLs to check for failing gates and mandatory agents.
46
+ */
47
+ getGlobalStatus(): Promise<GlobalStatus>;
48
+ /**
49
+ * Get metrics for all known agents.
50
+ *
51
+ * Reads telemetry files to aggregate agent invocations.
52
+ */
53
+ getAgentMetrics(): Promise<Record<string, AgentMetric>>;
54
+ /**
55
+ * Get progress for all active WUs.
56
+ *
57
+ * Parses WU YAML files and calculates DoD progress.
58
+ */
59
+ getWUProgress(): Promise<WUProgress[]>;
60
+ /**
61
+ * Get timeline events since a given date.
62
+ *
63
+ * Reads and aggregates telemetry files.
64
+ */
65
+ getTimeline(since: Date): Promise<TimelineEvent[]>;
66
+ /**
67
+ * Get current alerts requiring attention.
68
+ *
69
+ * Generates alerts based on WU state and mandatory agents.
70
+ */
71
+ getAlerts(): Promise<Alert[]>;
72
+ private readStatusFile;
73
+ private readAllWUs;
74
+ private readStamps;
75
+ private readTelemetry;
76
+ private isTimelineEvent;
77
+ private hasAgentRun;
78
+ /**
79
+ * Match a path against a glob pattern.
80
+ * WU-1849: Replaced custom regex with minimatch library.
81
+ *
82
+ * @param path - Path to match
83
+ * @param pattern - Glob pattern
84
+ * @returns True if path matches pattern
85
+ */
86
+ private matchesPattern;
87
+ private calculateDoDProgress;
88
+ private generateHeadline;
89
+ /**
90
+ * Read active session from session file (WU-1438).
91
+ *
92
+ * Transforms snake_case session file format to camelCase TypeScript types.
93
+ *
94
+ * @private
95
+ * @returns Active session data or null if no session active
96
+ */
97
+ private readActiveSession;
98
+ /**
99
+ * Scan worktrees for uncommitted changes (WU-1748).
100
+ *
101
+ * Uses worktree-scanner module to detect abandoned WU work.
102
+ * Extracts WU ID from worktree path/branch name.
103
+ *
104
+ * @private
105
+ * @returns Array of worktrees with uncommitted changes
106
+ */
107
+ private scanWorktreesForUncommittedChanges;
108
+ }