agent-enderun 0.9.0 → 0.9.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.
Files changed (341) hide show
  1. package/.enderun/BRAIN_DASHBOARD.md +2 -2
  2. package/.enderun/PROJECT_MEMORY.md +28 -4
  3. package/.enderun/STATUS.md +24 -28
  4. package/.enderun/agents/backend.md +37 -8
  5. package/.enderun/agents/database.md +55 -0
  6. package/.enderun/agents/devops.md +28 -14
  7. package/.enderun/agents/explorer.md +1 -1
  8. package/.enderun/agents/frontend.md +21 -7
  9. package/.enderun/agents/git.md +1 -1
  10. package/.enderun/agents/manager.md +41 -20
  11. package/.enderun/agents/mobile.md +1 -1
  12. package/.enderun/agents/native.md +1 -1
  13. package/.enderun/agents/quality.md +122 -0
  14. package/.enderun/cli-commands.json +3 -3
  15. package/.enderun/config.json +7 -1
  16. package/.enderun/knowledge/context_boundary_rules.md +57 -0
  17. package/.enderun/knowledge/corporate-governance/high-risk-action-approval-flow.md +29 -0
  18. package/.enderun/knowledge/documentation_ownership.md +53 -0
  19. package/.enderun/knowledge/frontend_professionalization_guidelines.md +7 -7
  20. package/.enderun/knowledge/hermes_live_test_guidelines.md +5 -5
  21. package/.enderun/knowledge/lessons-learned.md +14 -0
  22. package/.enderun/knowledge/manager_authority_audit_enforcement.md +8 -8
  23. package/.enderun/knowledge/project_scaffold_guidelines.md +4 -4
  24. package/.enderun/knowledge/reference_application_guidelines.md +6 -6
  25. package/.enderun/memory-graph/agent-contexts/quality.json +1 -0
  26. package/.enderun/queue/README.md +13 -13
  27. package/README.md +204 -102
  28. package/bin/cli.js +1 -1
  29. package/bin/init-check.js +69 -0
  30. package/bin/update-contract.js +24 -2
  31. package/docs/README.md +21 -32
  32. package/docs/architecture/README.md +9 -0
  33. package/docs/architecture/standards/data-fetching-patterns.md +13 -0
  34. package/docs/architecture/standards/design-system.md +31 -0
  35. package/docs/architecture/standards/logging.md +7 -0
  36. package/docs/architecture/standards/tech-stack.md +9 -0
  37. package/docs/getting-started.md +9 -259
  38. package/docs/user/README.md +35 -0
  39. package/docs/user/action-plan-2026.md +9 -0
  40. package/docs/user/getting-started.md +13 -0
  41. package/docs/user/roadmap.md +13 -0
  42. package/eslint.config.js +1 -1
  43. package/framework-mcp/dist/index.js +7 -13
  44. package/framework-mcp/node_modules/@types/node/LICENSE +21 -0
  45. package/framework-mcp/node_modules/@types/node/README.md +15 -0
  46. package/framework-mcp/node_modules/@types/node/assert/strict.d.ts +111 -0
  47. package/framework-mcp/node_modules/@types/node/assert.d.ts +1078 -0
  48. package/framework-mcp/node_modules/@types/node/async_hooks.d.ts +603 -0
  49. package/framework-mcp/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  50. package/framework-mcp/node_modules/@types/node/buffer.d.ts +1934 -0
  51. package/framework-mcp/node_modules/@types/node/child_process.d.ts +1476 -0
  52. package/framework-mcp/node_modules/@types/node/cluster.d.ts +578 -0
  53. package/framework-mcp/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
  54. package/framework-mcp/node_modules/@types/node/compatibility/index.d.ts +9 -0
  55. package/framework-mcp/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  56. package/framework-mcp/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
  57. package/framework-mcp/node_modules/@types/node/console.d.ts +452 -0
  58. package/framework-mcp/node_modules/@types/node/constants.d.ts +21 -0
  59. package/framework-mcp/node_modules/@types/node/crypto.d.ts +4545 -0
  60. package/framework-mcp/node_modules/@types/node/dgram.d.ts +600 -0
  61. package/framework-mcp/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
  62. package/framework-mcp/node_modules/@types/node/dns/promises.d.ts +503 -0
  63. package/framework-mcp/node_modules/@types/node/dns.d.ts +923 -0
  64. package/framework-mcp/node_modules/@types/node/domain.d.ts +170 -0
  65. package/framework-mcp/node_modules/@types/node/events.d.ts +976 -0
  66. package/framework-mcp/node_modules/@types/node/fs/promises.d.ts +1295 -0
  67. package/framework-mcp/node_modules/@types/node/fs.d.ts +4461 -0
  68. package/framework-mcp/node_modules/@types/node/globals.d.ts +172 -0
  69. package/framework-mcp/node_modules/@types/node/globals.typedarray.d.ts +38 -0
  70. package/framework-mcp/node_modules/@types/node/http.d.ts +2089 -0
  71. package/framework-mcp/node_modules/@types/node/http2.d.ts +2721 -0
  72. package/framework-mcp/node_modules/@types/node/https.d.ts +579 -0
  73. package/framework-mcp/node_modules/@types/node/index.d.ts +97 -0
  74. package/framework-mcp/node_modules/@types/node/inspector.d.ts +253 -0
  75. package/framework-mcp/node_modules/@types/node/inspector.generated.d.ts +4052 -0
  76. package/framework-mcp/node_modules/@types/node/module.d.ts +891 -0
  77. package/framework-mcp/node_modules/@types/node/net.d.ts +1076 -0
  78. package/framework-mcp/node_modules/@types/node/os.d.ts +506 -0
  79. package/framework-mcp/node_modules/@types/node/package.json +145 -0
  80. package/framework-mcp/node_modules/@types/node/path.d.ts +200 -0
  81. package/framework-mcp/node_modules/@types/node/perf_hooks.d.ts +968 -0
  82. package/framework-mcp/node_modules/@types/node/process.d.ts +2084 -0
  83. package/framework-mcp/node_modules/@types/node/punycode.d.ts +117 -0
  84. package/framework-mcp/node_modules/@types/node/querystring.d.ts +152 -0
  85. package/framework-mcp/node_modules/@types/node/readline/promises.d.ts +161 -0
  86. package/framework-mcp/node_modules/@types/node/readline.d.ts +594 -0
  87. package/framework-mcp/node_modules/@types/node/repl.d.ts +428 -0
  88. package/framework-mcp/node_modules/@types/node/sea.d.ts +153 -0
  89. package/framework-mcp/node_modules/@types/node/sqlite.d.ts +721 -0
  90. package/framework-mcp/node_modules/@types/node/stream/consumers.d.ts +38 -0
  91. package/framework-mcp/node_modules/@types/node/stream/promises.d.ts +90 -0
  92. package/framework-mcp/node_modules/@types/node/stream/web.d.ts +622 -0
  93. package/framework-mcp/node_modules/@types/node/stream.d.ts +1687 -0
  94. package/framework-mcp/node_modules/@types/node/string_decoder.d.ts +67 -0
  95. package/framework-mcp/node_modules/@types/node/test.d.ts +2163 -0
  96. package/framework-mcp/node_modules/@types/node/timers/promises.d.ts +108 -0
  97. package/framework-mcp/node_modules/@types/node/timers.d.ts +287 -0
  98. package/framework-mcp/node_modules/@types/node/tls.d.ts +1319 -0
  99. package/framework-mcp/node_modules/@types/node/trace_events.d.ts +197 -0
  100. package/framework-mcp/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  101. package/framework-mcp/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
  102. package/framework-mcp/node_modules/@types/node/ts5.6/index.d.ts +97 -0
  103. package/framework-mcp/node_modules/@types/node/tty.d.ts +208 -0
  104. package/framework-mcp/node_modules/@types/node/url.d.ts +984 -0
  105. package/framework-mcp/node_modules/@types/node/util.d.ts +2606 -0
  106. package/framework-mcp/node_modules/@types/node/v8.d.ts +920 -0
  107. package/framework-mcp/node_modules/@types/node/vm.d.ts +1000 -0
  108. package/framework-mcp/node_modules/@types/node/wasi.d.ts +181 -0
  109. package/framework-mcp/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  110. package/framework-mcp/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  111. package/framework-mcp/node_modules/@types/node/web-globals/events.d.ts +97 -0
  112. package/framework-mcp/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
  113. package/framework-mcp/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
  114. package/framework-mcp/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  115. package/framework-mcp/node_modules/@types/node/worker_threads.d.ts +784 -0
  116. package/framework-mcp/node_modules/@types/node/zlib.d.ts +747 -0
  117. package/framework-mcp/node_modules/typescript/LICENSE.txt +55 -0
  118. package/framework-mcp/node_modules/typescript/README.md +50 -0
  119. package/framework-mcp/node_modules/typescript/SECURITY.md +41 -0
  120. package/framework-mcp/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  121. package/framework-mcp/node_modules/typescript/bin/tsc +2 -0
  122. package/framework-mcp/node_modules/typescript/bin/tsserver +2 -0
  123. package/framework-mcp/node_modules/typescript/lib/_tsc.js +133818 -0
  124. package/framework-mcp/node_modules/typescript/lib/_tsserver.js +659 -0
  125. package/framework-mcp/node_modules/typescript/lib/_typingsInstaller.js +222 -0
  126. package/framework-mcp/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
  127. package/framework-mcp/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
  128. package/framework-mcp/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
  129. package/framework-mcp/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
  130. package/framework-mcp/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
  131. package/framework-mcp/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
  132. package/framework-mcp/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
  133. package/framework-mcp/node_modules/typescript/lib/lib.d.ts +22 -0
  134. package/framework-mcp/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
  135. package/framework-mcp/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  136. package/framework-mcp/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  137. package/framework-mcp/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
  138. package/framework-mcp/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
  139. package/framework-mcp/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  140. package/framework-mcp/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  141. package/framework-mcp/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  142. package/framework-mcp/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  143. package/framework-mcp/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
  144. package/framework-mcp/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  145. package/framework-mcp/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  146. package/framework-mcp/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  147. package/framework-mcp/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  148. package/framework-mcp/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  149. package/framework-mcp/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  150. package/framework-mcp/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  151. package/framework-mcp/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  152. package/framework-mcp/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  153. package/framework-mcp/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
  154. package/framework-mcp/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
  155. package/framework-mcp/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  156. package/framework-mcp/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  157. package/framework-mcp/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  158. package/framework-mcp/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  159. package/framework-mcp/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  160. package/framework-mcp/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  161. package/framework-mcp/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  162. package/framework-mcp/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  163. package/framework-mcp/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  164. package/framework-mcp/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  165. package/framework-mcp/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  166. package/framework-mcp/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  167. package/framework-mcp/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  168. package/framework-mcp/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  169. package/framework-mcp/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  170. package/framework-mcp/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  171. package/framework-mcp/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  172. package/framework-mcp/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  173. package/framework-mcp/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  174. package/framework-mcp/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  175. package/framework-mcp/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  176. package/framework-mcp/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
  177. package/framework-mcp/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  178. package/framework-mcp/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  179. package/framework-mcp/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  180. package/framework-mcp/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  181. package/framework-mcp/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  182. package/framework-mcp/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  183. package/framework-mcp/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
  184. package/framework-mcp/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
  185. package/framework-mcp/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  186. package/framework-mcp/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  187. package/framework-mcp/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  188. package/framework-mcp/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  189. package/framework-mcp/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  190. package/framework-mcp/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  191. package/framework-mcp/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
  192. package/framework-mcp/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  193. package/framework-mcp/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
  194. package/framework-mcp/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
  195. package/framework-mcp/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  196. package/framework-mcp/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
  197. package/framework-mcp/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  198. package/framework-mcp/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  199. package/framework-mcp/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  200. package/framework-mcp/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  201. package/framework-mcp/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  202. package/framework-mcp/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  203. package/framework-mcp/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  204. package/framework-mcp/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  205. package/framework-mcp/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
  206. package/framework-mcp/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
  207. package/framework-mcp/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
  208. package/framework-mcp/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
  209. package/framework-mcp/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
  210. package/framework-mcp/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
  211. package/framework-mcp/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
  212. package/framework-mcp/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
  213. package/framework-mcp/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
  214. package/framework-mcp/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
  215. package/framework-mcp/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  216. package/framework-mcp/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  217. package/framework-mcp/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
  218. package/framework-mcp/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
  219. package/framework-mcp/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  220. package/framework-mcp/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  221. package/framework-mcp/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
  222. package/framework-mcp/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
  223. package/framework-mcp/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  224. package/framework-mcp/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  225. package/framework-mcp/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  226. package/framework-mcp/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
  227. package/framework-mcp/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
  228. package/framework-mcp/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  229. package/framework-mcp/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  230. package/framework-mcp/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
  231. package/framework-mcp/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  232. package/framework-mcp/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
  233. package/framework-mcp/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
  234. package/framework-mcp/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
  235. package/framework-mcp/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
  236. package/framework-mcp/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
  237. package/framework-mcp/node_modules/typescript/lib/tsc.js +8 -0
  238. package/framework-mcp/node_modules/typescript/lib/tsserver.js +8 -0
  239. package/framework-mcp/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  240. package/framework-mcp/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  241. package/framework-mcp/node_modules/typescript/lib/typesMap.json +497 -0
  242. package/framework-mcp/node_modules/typescript/lib/typescript.d.ts +11437 -0
  243. package/framework-mcp/node_modules/typescript/lib/typescript.js +200276 -0
  244. package/framework-mcp/node_modules/typescript/lib/typingsInstaller.js +8 -0
  245. package/framework-mcp/node_modules/typescript/lib/watchGuard.js +53 -0
  246. package/framework-mcp/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
  247. package/framework-mcp/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
  248. package/framework-mcp/node_modules/typescript/package.json +120 -0
  249. package/framework-mcp/node_modules/undici-types/LICENSE +21 -0
  250. package/framework-mcp/node_modules/undici-types/README.md +6 -0
  251. package/framework-mcp/node_modules/undici-types/agent.d.ts +31 -0
  252. package/framework-mcp/node_modules/undici-types/api.d.ts +43 -0
  253. package/framework-mcp/node_modules/undici-types/balanced-pool.d.ts +29 -0
  254. package/framework-mcp/node_modules/undici-types/cache.d.ts +36 -0
  255. package/framework-mcp/node_modules/undici-types/client.d.ts +108 -0
  256. package/framework-mcp/node_modules/undici-types/connector.d.ts +34 -0
  257. package/framework-mcp/node_modules/undici-types/content-type.d.ts +21 -0
  258. package/framework-mcp/node_modules/undici-types/cookies.d.ts +28 -0
  259. package/framework-mcp/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  260. package/framework-mcp/node_modules/undici-types/dispatcher.d.ts +256 -0
  261. package/framework-mcp/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  262. package/framework-mcp/node_modules/undici-types/errors.d.ts +149 -0
  263. package/framework-mcp/node_modules/undici-types/eventsource.d.ts +61 -0
  264. package/framework-mcp/node_modules/undici-types/fetch.d.ts +209 -0
  265. package/framework-mcp/node_modules/undici-types/file.d.ts +39 -0
  266. package/framework-mcp/node_modules/undici-types/filereader.d.ts +54 -0
  267. package/framework-mcp/node_modules/undici-types/formdata.d.ts +108 -0
  268. package/framework-mcp/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  269. package/framework-mcp/node_modules/undici-types/global-origin.d.ts +7 -0
  270. package/framework-mcp/node_modules/undici-types/handlers.d.ts +15 -0
  271. package/framework-mcp/node_modules/undici-types/header.d.ts +4 -0
  272. package/framework-mcp/node_modules/undici-types/index.d.ts +71 -0
  273. package/framework-mcp/node_modules/undici-types/interceptors.d.ts +17 -0
  274. package/framework-mcp/node_modules/undici-types/mock-agent.d.ts +50 -0
  275. package/framework-mcp/node_modules/undici-types/mock-client.d.ts +25 -0
  276. package/framework-mcp/node_modules/undici-types/mock-errors.d.ts +12 -0
  277. package/framework-mcp/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  278. package/framework-mcp/node_modules/undici-types/mock-pool.d.ts +25 -0
  279. package/framework-mcp/node_modules/undici-types/package.json +55 -0
  280. package/framework-mcp/node_modules/undici-types/patch.d.ts +33 -0
  281. package/framework-mcp/node_modules/undici-types/pool-stats.d.ts +19 -0
  282. package/framework-mcp/node_modules/undici-types/pool.d.ts +39 -0
  283. package/framework-mcp/node_modules/undici-types/proxy-agent.d.ts +28 -0
  284. package/framework-mcp/node_modules/undici-types/readable.d.ts +65 -0
  285. package/framework-mcp/node_modules/undici-types/retry-agent.d.ts +8 -0
  286. package/framework-mcp/node_modules/undici-types/retry-handler.d.ts +116 -0
  287. package/framework-mcp/node_modules/undici-types/util.d.ts +18 -0
  288. package/framework-mcp/node_modules/undici-types/webidl.d.ts +228 -0
  289. package/framework-mcp/node_modules/undici-types/websocket.d.ts +150 -0
  290. package/framework-mcp/src/declarations.d.ts +3 -0
  291. package/framework-mcp/src/index.ts +228 -0
  292. package/package.json +4 -3
  293. package/src/cli/adapters.ts +208 -0
  294. package/src/cli/commands/app.ts +38 -0
  295. package/src/cli/commands/check.ts +87 -0
  296. package/src/cli/commands/compliance.ts +55 -0
  297. package/src/cli/commands/contract.ts +45 -0
  298. package/src/cli/commands/explorer.ts +45 -0
  299. package/src/cli/commands/git.ts +39 -0
  300. package/src/cli/commands/init.ts +272 -0
  301. package/src/cli/commands/knowledge.ts +44 -0
  302. package/src/cli/commands/lint.ts +25 -0
  303. package/src/cli/commands/log.ts +37 -0
  304. package/src/cli/commands/memory.ts +78 -0
  305. package/src/cli/commands/orchestrate.ts +111 -0
  306. package/src/cli/commands/script.ts +20 -0
  307. package/src/cli/commands/security.ts +38 -0
  308. package/src/cli/commands/status.ts +59 -0
  309. package/src/cli/commands/trace.ts +46 -0
  310. package/src/cli/index.ts +107 -0
  311. package/src/cli/utils/app.ts +764 -0
  312. package/src/cli/utils/claude.ts +56 -0
  313. package/src/cli/utils/fs.ts +139 -0
  314. package/src/cli/utils/memory.ts +141 -0
  315. package/src/cli/utils/pkg.ts +215 -0
  316. package/src/cli/utils/string.ts +48 -0
  317. package/src/cli/utils/time.ts +27 -0
  318. package/.enderun/agents/analyst.md +0 -236
  319. package/.enderun/agents/orchestrator.md +0 -172
  320. package/.enderun/agents/qa.md +0 -121
  321. package/.enderun/agents/security.md +0 -202
  322. package/.enderun/knowledge/api_design_rules.md +0 -6
  323. package/.enderun/knowledge/branded_types_pattern.md +0 -8
  324. package/.enderun/knowledge/code_review_checklist.md +0 -7
  325. package/.enderun/knowledge/contract_versioning.md +0 -7
  326. package/.enderun/knowledge/database_migration.md +0 -6
  327. package/.enderun/knowledge/deployment_checklist.md +0 -7
  328. package/.enderun/knowledge/git_commit_strategy.md +0 -10
  329. package/.enderun/knowledge/monitoring_setup.md +0 -5
  330. package/.enderun/knowledge/performance_guidelines.md +0 -11
  331. package/.enderun/knowledge/repository_patterns.md +0 -9
  332. package/.enderun/knowledge/security_scanning.md +0 -6
  333. package/.enderun/knowledge/testing_standards.md +0 -7
  334. package/.enderun/knowledge/troubleshooting_guide.md +0 -5
  335. package/.enderun/memory-graph/agent-contexts/analyst.json +0 -1
  336. package/.enderun/memory-graph/agent-contexts/orchestrator.json +0 -1
  337. package/.enderun/memory-graph/agent-contexts/qa.json +0 -1
  338. package/.enderun/memory-graph/agent-contexts/security.json +0 -1
  339. package/docs/action-plan-2026.md +0 -119
  340. package/docs/roadmap.md +0 -142
  341. package/docs/tech-stack.md +0 -30
@@ -0,0 +1,56 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ /**
5
+ * Finds the Claude config file path (if it exists).
6
+ */
7
+ export function findClaudeConfigPath(): string | null {
8
+ const home = process.env.HOME || process.env.USERPROFILE;
9
+ if (!home) return null;
10
+
11
+ const possiblePaths = [
12
+ path.join(home, ".config", "claude", "config.json"),
13
+ path.join(home, ".claude", "config.json"),
14
+ path.join(home, "Library", "Application Support", "Claude", "config.json"), // macOS Claude Desktop
15
+ path.join(home, "Library", "Application Support", "Claude Code", "config.json"), // macOS Claude Code
16
+ path.join(home, ".config", "Claude", "config.json"), // some Linux setups
17
+ ];
18
+
19
+ for (const p of possiblePaths) {
20
+ if (fs.existsSync(p)) {
21
+ return p;
22
+ }
23
+ }
24
+ return null;
25
+ }
26
+
27
+ /**
28
+ * Adds or updates an MCP server entry in Claude's config file.
29
+ */
30
+ export function addMcpServerToClaude(configPath: string, serverName: string, serverConfig: Record<string, unknown>): boolean {
31
+ try {
32
+ let config: { mcpServers?: Record<string, Record<string, unknown>> } = { mcpServers: {} };
33
+
34
+ if (fs.existsSync(configPath)) {
35
+ const content = fs.readFileSync(configPath, "utf8");
36
+ config = JSON.parse(content);
37
+ }
38
+
39
+ if (!config.mcpServers) {
40
+ config.mcpServers = {};
41
+ }
42
+
43
+ config.mcpServers[serverName] = serverConfig;
44
+
45
+ // Ensure parent directory exists
46
+ const dir = path.dirname(configPath);
47
+ if (!fs.existsSync(dir)) {
48
+ fs.mkdirSync(dir, { recursive: true });
49
+ }
50
+
51
+ fs.writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`);
52
+ return true;
53
+ } catch {
54
+ return false;
55
+ }
56
+ }
@@ -0,0 +1,139 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ import { remapFrameworkContent } from "../adapters.js"; // Import from the new adapters.js
5
+ import type { AdapterId } from "../adapters.js";
6
+
7
+ export function updateGitIgnore(targetPath: string, frameworkDir = ".gemini"): void {
8
+ const IGNORE_LINES = [
9
+ "# AI-Enderun",
10
+ `${frameworkDir}/logs/*.json`,
11
+ `${frameworkDir}/*.lock`,
12
+ ".env",
13
+ ".DS_Store",
14
+ ];
15
+
16
+ let content = "";
17
+ if (fs.existsSync(targetPath)) {
18
+ content = fs.readFileSync(targetPath, "utf8");
19
+ }
20
+
21
+ const lines = content.split("\n").map((l) => l.trim());
22
+ let added = false;
23
+
24
+ for (const line of IGNORE_LINES) {
25
+ if (!lines.includes(line)) {
26
+ content += (content.endsWith("\n") || content === "" ? "" : "\n") + line + "\n";
27
+ added = true;
28
+ }
29
+ }
30
+
31
+ if (added) {
32
+ fs.writeFileSync(targetPath, content);
33
+ console.warn("✅ .gitignore updated.");
34
+ }
35
+ }
36
+
37
+ export function ensureDir(dirPath: string): void {
38
+ if (!fs.existsSync(dirPath)) {
39
+ fs.mkdirSync(dirPath, { recursive: true });
40
+ }
41
+ }
42
+
43
+ export function writeTextFile(filePath: string, content: string): void {
44
+ ensureDir(path.dirname(filePath));
45
+ // Use template literal for content handling to avoid issues with raw newlines
46
+ fs.writeFileSync(filePath, content.endsWith("\n") ? content : `${content}\n`);
47
+ }
48
+
49
+ export function writeJsonFile(filePath: string, value: unknown): void {
50
+ writeTextFile(filePath, JSON.stringify(value, null, 2));
51
+ }
52
+
53
+ interface SanitizeJsonFunction {
54
+ (obj: any, targetScope?: string): any;
55
+ }
56
+
57
+ export function copyDir(
58
+ src: string,
59
+ dest: string,
60
+ skipSet = new Set<string>(),
61
+ nonDestructive = false,
62
+ frameworkDir = ".gemini",
63
+ targetScope = "",
64
+ sanitizeJson: SanitizeJsonFunction,
65
+ adapterId: AdapterId = "gemini",
66
+ ): void {
67
+ const DEFAULT_SKIP = new Set(["node_modules", ".git", ".DS_Store", "package-lock.json"]);
68
+ const actualSkip = new Set([...DEFAULT_SKIP, ...skipSet]);
69
+
70
+ if (!fs.existsSync(dest)) {
71
+ fs.mkdirSync(dest, { recursive: true });
72
+ }
73
+
74
+ fs.readdirSync(src, { withFileTypes: true }).forEach((entry) => {
75
+ if (actualSkip.has(entry.name)) return;
76
+
77
+ const srcPath = path.join(src, entry.name);
78
+ const destPath = path.join(dest, entry.name);
79
+
80
+ if (entry.isDirectory()) {
81
+ copyDir(
82
+ srcPath,
83
+ destPath,
84
+ skipSet,
85
+ nonDestructive,
86
+ frameworkDir,
87
+ targetScope,
88
+ sanitizeJson,
89
+ adapterId,
90
+ );
91
+ } else {
92
+ if (nonDestructive && fs.existsSync(destPath)) {
93
+ return;
94
+ }
95
+
96
+ const ext = path.extname(entry.name);
97
+ const textExtensions = [".md", ".json", ".js", ".ts", ".txt", ""];
98
+
99
+ if (textExtensions.includes(ext)) {
100
+ let content = fs.readFileSync(srcPath, "utf8");
101
+ content = remapFrameworkContent(content, frameworkDir, adapterId); // Use the new remap function
102
+
103
+ if (ext === ".json") {
104
+ try {
105
+ const json = JSON.parse(content);
106
+ content = JSON.stringify(sanitizeJson(json, targetScope), null, 2);
107
+ content = remapFrameworkContent(content, frameworkDir, adapterId); // Remap again after JSON.stringify for any placeholders
108
+ } catch {
109
+ content = content.replace(/workspace:[^"'\s]*/g, "*");
110
+ }
111
+ } else {
112
+ content = content.replace(/workspace:[^"'\s]*/g, "*");
113
+ }
114
+
115
+ fs.writeFileSync(destPath, content);
116
+ } else {
117
+ fs.copyFileSync(srcPath, destPath);
118
+ }
119
+ }
120
+ });
121
+ }
122
+
123
+ export function collectFiles(dir: string, extensions: string[]): string[] {
124
+ let results: string[] = [];
125
+ if (!fs.existsSync(dir)) return results;
126
+ const list = fs.readdirSync(dir);
127
+ list.forEach((file) => {
128
+ file = path.join(dir, file);
129
+ const stat = fs.statSync(file);
130
+ if (stat && stat.isDirectory()) {
131
+ if (!file.includes("node_modules") && !file.includes(".git")) {
132
+ results = results.concat(collectFiles(file, extensions));
133
+ }
134
+ } else if (extensions.includes(path.extname(file))) {
135
+ results.push(file);
136
+ }
137
+ });
138
+ return results;
139
+ }
@@ -0,0 +1,141 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { sleep } from "./time.js";
4
+ import { generateULID } from "./time.js";
5
+ import { FRAMEWORK_DIR_CANDIDATES } from "../adapters.js";
6
+
7
+ const targetDir = process.cwd();
8
+
9
+ export function getFrameworkDir(): string {
10
+ for (const dir of FRAMEWORK_DIR_CANDIDATES) {
11
+ const dirPath = path.join(targetDir, dir);
12
+ if (!fs.existsSync(dirPath)) continue;
13
+ const hasMemory = fs.existsSync(path.join(dirPath, "PROJECT_MEMORY.md"));
14
+ const hasAgents = fs.existsSync(path.join(dirPath, "agents"));
15
+ if (hasMemory || hasAgents) {
16
+ return dir;
17
+ }
18
+ }
19
+ for (const dir of FRAMEWORK_DIR_CANDIDATES) {
20
+ if (fs.existsSync(path.join(targetDir, dir))) {
21
+ return dir;
22
+ }
23
+ }
24
+ return ".gemini";
25
+ }
26
+
27
+ export function getMemoryPath() {
28
+ return path.join(targetDir, getFrameworkDir(), "PROJECT_MEMORY.md");
29
+ }
30
+
31
+ export function getConfiguredPaths(): { backend: string; frontend: string; docs: string; tests: string } {
32
+ let backend = "apps/backend";
33
+ let frontend = "apps/web";
34
+ let docs = "docs";
35
+ let tests = "tests";
36
+
37
+ try {
38
+ const frameworkDir = getFrameworkDir();
39
+ const configPath = path.join(targetDir, frameworkDir, "config.json");
40
+ if (fs.existsSync(configPath)) {
41
+ const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
42
+ if (config.paths) {
43
+ if (config.paths.backend) backend = config.paths.backend;
44
+ if (config.paths.frontend) frontend = config.paths.frontend;
45
+ if (config.paths.docs) docs = config.paths.docs;
46
+ if (config.paths.tests) tests = config.paths.tests;
47
+ }
48
+ }
49
+ } catch {
50
+ // ignore
51
+ }
52
+ return { backend, frontend, docs, tests };
53
+ }
54
+
55
+ export function acquireMemoryLock(lockPath: string, maxRetries = 5): boolean {
56
+ for (let attempt = 0; attempt < maxRetries; attempt += 1) {
57
+ try {
58
+ const fd = fs.openSync(lockPath, "wx");
59
+ fs.closeSync(fd);
60
+ return true;
61
+ } catch (error: unknown) {
62
+ const err = error as NodeJS.ErrnoException;
63
+ if (err?.code !== "EEXIST") throw error;
64
+ if (attempt < maxRetries - 1) sleep(1000);
65
+ }
66
+ }
67
+ return false;
68
+ }
69
+
70
+ export function releaseMemoryLock(lockPath: string): void {
71
+ if (fs.existsSync(lockPath)) fs.unlinkSync(lockPath);
72
+ }
73
+
74
+ /**
75
+ * Create initial PROJECT_MEMORY.md if missing.
76
+ */
77
+ export function initializeMemory(memoryPath: string, targetBase: string): void {
78
+ if (fs.existsSync(memoryPath)) return;
79
+
80
+ const traceId = generateULID();
81
+ const date = new Date().toISOString().split("T")[0];
82
+ const template = `# PROJECT MEMORY — Agent Enderun
83
+
84
+ This file is the Single Source of Truth (SSOT) and the persistent memory of the project.
85
+
86
+ ## CURRENT STATUS
87
+
88
+ | Active Phase | Profile | Last Update | Active Trace ID | Blockers |
89
+ | :----------- | :------ | :---------- | :-------------- | :------- |
90
+ | PHASE_0 | Lightweight | ${date} | ${traceId} | NONE |
91
+
92
+ ## PROJECT DEFINITION
93
+
94
+ | Field | Value |
95
+ | :--- | :--- |
96
+ | Project Name | ${path.basename(process.cwd())} |
97
+ | Platform | Not defined |
98
+ | Frontend | React 19 + Vite + Panda CSS |
99
+ | Backend | Node.js 20+ + Fastify |
100
+ | DB | PostgreSQL |
101
+
102
+ ## DOD STATUS
103
+
104
+ | Phase | Status | Note |
105
+ | :--- | :--- | :--- |
106
+ | PHASE_0 | IN_PROGRESS | Initializing project structure |
107
+ | PHASE_1 | PENDING | |
108
+ | PHASE_2 | PENDING | |
109
+ | PHASE_3 | PENDING | |
110
+ | PHASE_4 | PENDING | |
111
+
112
+ ## CRITICAL DECISIONS
113
+
114
+ | Date | Decision | Rationale | Agent |
115
+ | :--- | :--- | :--- | :--- |
116
+ | ${date} | Project Initialized | Framework setup via CLI | @manager |
117
+
118
+ ## DELIVERABLES
119
+
120
+ | Module | Status | Agent | Date |
121
+ | :--- | :--- | :--- | :--- |
122
+
123
+ ## ACTIVE TASKS
124
+
125
+ | Trace ID | Task | Agent | Priority | Status |
126
+ | :--- | :--- | :--- | :--- | :--- |
127
+ | ${traceId} | Framework setup and architecture alignment | @manager | P1 | IN_PROGRESS |
128
+
129
+ ## HISTORY (Persistent Memory)
130
+
131
+ ### ${date} — Framework Initialization
132
+
133
+ - **Agent:** @manager
134
+ - **Trace ID:** ${traceId}
135
+ - **Action:** Initialized Agent Enderun framework and project structure.
136
+ `;
137
+
138
+ const finalTemplate = template.replace(/\{\{FRAMEWORK_DIR\}\}/g, targetBase);
139
+ fs.writeFileSync(memoryPath, finalTemplate);
140
+ console.warn(`✅ PROJECT_MEMORY.md initialized in ${targetBase}`);
141
+ }
@@ -0,0 +1,215 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ const __filename = new URL(import.meta.url).pathname;
5
+ const __dirname = path.dirname(__filename);
6
+ const sourceDir = path.join(__dirname, "../../.."); // Adjust path as necessary to reach project root
7
+
8
+ export function getPackageVersion() {
9
+ const pkg = JSON.parse(fs.readFileSync(path.join(sourceDir, "package.json"), "utf8"));
10
+ return pkg.version;
11
+ }
12
+
13
+ export function getPackageManager() {
14
+ const override = process.env.AGENT_ENDERUN_PACKAGE_MANAGER || process.env.AGENT_ENDERUN_PM || process.env.AI_ENDERUN_PACKAGE_MANAGER || process.env.AI_ENDERUN_PM;
15
+ if (override) return override.toLowerCase();
16
+
17
+ const userAgent = process.env.npm_config_user_agent || "";
18
+ const npmExecPath = process.env.npm_execpath || "";
19
+
20
+ if (userAgent.includes("pnpm") || npmExecPath.includes("pnpm")) return "pnpm";
21
+ if (userAgent.includes("yarn") || npmExecPath.includes("yarn")) return "yarn";
22
+
23
+ // Check for lockfiles in target directory
24
+ if (fs.existsSync(path.join(process.cwd(), "pnpm-lock.yaml")) || fs.existsSync(path.join(process.cwd(), "pnpm-workspace.yaml"))) return "pnpm";
25
+ if (fs.existsSync(path.join(process.cwd(), "yarn.lock"))) return "yarn";
26
+
27
+ return "npm";
28
+ }
29
+
30
+ interface PackageJson {
31
+ name?: string;
32
+ version?: string;
33
+ type?: string;
34
+ workspaces?: string[];
35
+ dependencies?: Record<string, string>;
36
+ devDependencies?: Record<string, string>;
37
+ peerDependencies?: Record<string, string>;
38
+ optionalDependencies?: Record<string, string>;
39
+ scripts?: Record<string, string>;
40
+ enderun?: Record<string, unknown>;
41
+ }
42
+
43
+ export function mergePackageJson(targetPath: string, sourcePath: string): void {
44
+ let targetPkg: PackageJson = {};
45
+ if (fs.existsSync(targetPath)) {
46
+ try {
47
+ targetPkg = JSON.parse(fs.readFileSync(targetPath, "utf8"));
48
+ } catch {
49
+ console.warn("⚠️ Could not parse existing package.json, creating a new one.");
50
+ }
51
+ }
52
+
53
+ const sourcePkg: PackageJson = JSON.parse(fs.readFileSync(sourcePath, "utf8"));
54
+
55
+ type PackageMap = Record<string, string>;
56
+ const sanitizeDeps = (deps: PackageMap | Record<string, unknown> | undefined): Record<string, string> | undefined => {
57
+ if (!deps) return deps as undefined;
58
+ const cleaned: Record<string, string> = {};
59
+ for (const [name, version] of Object.entries(deps)) {
60
+ cleaned[name] = (typeof version === "string" && version.startsWith("workspace:")) ? "*" : String(version || "");
61
+ }
62
+ return cleaned;
63
+ };
64
+
65
+ const actualTargetScope = targetPkg.name && targetPkg.name.startsWith("@")
66
+ ? targetPkg.name.split("/")[0]
67
+ : (targetPkg.name ? `@${targetPkg.name}` : "");
68
+
69
+ // Cleanup potential leftovers from previous bugged runs where agent-enderun was renamed to target name
70
+ if (actualTargetScope) {
71
+ const scopeName = actualTargetScope.startsWith("@") ? actualTargetScope.slice(1) : actualTargetScope;
72
+ const cleanup = (obj: Record<string, string> | undefined): void => {
73
+ if (!obj) return;
74
+ delete obj[scopeName];
75
+ delete obj[actualTargetScope];
76
+ delete obj["agent-enderun"]; // Will be re-added correctly
77
+ };
78
+ cleanup(targetPkg.devDependencies);
79
+ cleanup(targetPkg.dependencies);
80
+ }
81
+
82
+ targetPkg.dependencies = sanitizeDeps({
83
+ ...targetPkg.dependencies,
84
+ ...sourcePkg.dependencies
85
+ });
86
+
87
+ // Merge scripts
88
+ const pkgMgr = getPackageManager();
89
+ const runCmd = pkgMgr === "yarn" ? "yarn" : (pkgMgr === "pnpm" ? "pnpm" : "npm run");
90
+
91
+ targetPkg.scripts = {
92
+ ...targetPkg.scripts,
93
+ "enderun:status": "agent-enderun status",
94
+ "enderun:trace": "agent-enderun trace:new",
95
+ "enderun:verify": "agent-enderun verify-contract",
96
+ "enderun:check": "agent-enderun check",
97
+ "enderun:test": "vitest run",
98
+ "enderun:test:watch": "vitest",
99
+ "enderun:build": `${runCmd} build --prefix framework-mcp`,
100
+ };
101
+
102
+ const sourceDevDeps = sourcePkg.devDependencies || {};
103
+ targetPkg.devDependencies = sanitizeDeps({
104
+ ...targetPkg.devDependencies,
105
+ "agent-enderun": `^${sourcePkg.version}`,
106
+ ...(sourceDevDeps["@modelcontextprotocol/sdk"] ? {"@modelcontextprotocol/sdk": sourceDevDeps["@modelcontextprotocol/sdk"]} : {}),
107
+ ...(sourceDevDeps["zod"] ? {"zod": sourceDevDeps["zod"]} : {}),
108
+ ...(sourceDevDeps["ts-morph"] ? {"ts-morph": sourceDevDeps["ts-morph"]} : {}),
109
+ ...(sourceDevDeps["typescript"] ? {"typescript": sourceDevDeps["typescript"]} : {}),
110
+ ...(sourceDevDeps["@types/node"] ? {"@types/node": sourceDevDeps["@types/node"]} : {}),
111
+ ...(sourceDevDeps["tsx"] ? {"tsx": sourceDevDeps["tsx"]} : {}),
112
+ ...(sourceDevDeps["vitest"] ? {"vitest": sourceDevDeps["vitest"]} : {}),
113
+ "@pandacss/dev": sourceDevDeps["@pandacss/dev"] || "^1.11.1"
114
+ });
115
+
116
+ if (targetPkg.peerDependencies) {
117
+ targetPkg.peerDependencies = sanitizeDeps(targetPkg.peerDependencies);
118
+ }
119
+ if (targetPkg.optionalDependencies) {
120
+ targetPkg.optionalDependencies = sanitizeDeps(targetPkg.optionalDependencies);
121
+ }
122
+
123
+ // Ensure basic fields
124
+ if (!targetPkg.name) targetPkg.name = path.basename(process.cwd());
125
+ if (!targetPkg.version) targetPkg.version = "0.1.0";
126
+ if (!targetPkg.type) targetPkg.type = "module";
127
+ if (!targetPkg.workspaces) targetPkg.workspaces = ["apps/*", "framework-mcp"];
128
+
129
+ // Add metadata
130
+ targetPkg.enderun = {
131
+ version: sourcePkg.version || "0.0.0",
132
+ initializedAt: new Date().toISOString(),
133
+ };
134
+
135
+ fs.writeFileSync(targetPath, JSON.stringify(targetPkg, null, 2));
136
+ console.warn("✅ package.json updated with Enderun scripts and dependencies.");
137
+ }
138
+
139
+ export function sanitizeJson(obj: Record<string, unknown>, targetScope = ""): Record<string, unknown> {
140
+ if (typeof obj !== "object" || obj === null) return obj;
141
+ if (Array.isArray(obj)) return obj.map(item => sanitizeJson(item as Record<string, unknown>, targetScope)) as unknown as Record<string, unknown>;
142
+ const cleaned: Record<string, unknown> = {};
143
+ for (const [key, value] of Object.entries(obj)) {
144
+ let finalKey = key;
145
+ let finalValue = value;
146
+
147
+ // Remove UnoCSS related keys or values
148
+ if (typeof key === "string" && key.includes("unocss")) continue;
149
+ if (typeof value === "string" && value.includes("unocss")) {
150
+ continue; // Skip this script/field
151
+ }
152
+
153
+ // Replace scope if needed
154
+ if (targetScope) {
155
+ const scopeName = targetScope.startsWith("@") ? targetScope.slice(1) : targetScope;
156
+
157
+ // Handle scoped: @ai-enderun/foo -> @target/foo
158
+ if (typeof key === "string" && key.startsWith("@ai-enderun/")) {
159
+ finalKey = key.replace("@ai-enderun/", `${targetScope}/`);
160
+ }
161
+ if (typeof value === "string" && value.startsWith("@ai-enderun/")) {
162
+ finalValue = value.replace("@ai-enderun/", `${targetScope}/`);
163
+ }
164
+
165
+ // Handle unscoped: ai-enderun-foo -> target-foo
166
+ if (typeof key === "string" && key.startsWith("ai-enderun-")) {
167
+ finalKey = key.replace("ai-enderun-", `${scopeName}-`);
168
+ }
169
+ if (typeof value === "string" && value.startsWith("ai-enderun-")) {
170
+ finalValue = value.replace("ai-enderun-", `${scopeName}-`);
171
+ }
172
+
173
+ // Handle agent-enderun -> target (ONLY for the package name)
174
+ if (key === "name" && value === "agent-enderun") {
175
+ finalValue = scopeName;
176
+ }
177
+
178
+ // Preserve agent-enderun in dependencies and bin
179
+ // (No action needed as finalKey/finalValue default to original)
180
+
181
+ if (typeof value === "string" && value.startsWith("workspace:")) {
182
+ finalValue = "*";
183
+ }
184
+ } else if (typeof value === "string" && value.startsWith("workspace:")) {
185
+ finalValue = "*";
186
+ }
187
+
188
+ cleaned[finalKey] = (typeof finalValue === "object" && finalValue !== null) ? sanitizeJson(finalValue as Record<string, unknown>, targetScope) : finalValue;
189
+ }
190
+ return cleaned;
191
+ }
192
+
193
+ export function deepCleanProtocols(dir: string, targetScope = ""): void {
194
+ if (!fs.existsSync(dir)) return;
195
+
196
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
197
+ for (const entry of entries) {
198
+ const fullPath = path.join(dir, entry.name);
199
+ if (entry.isDirectory()) {
200
+ if (entry.name === "node_modules" || entry.name === ".git") continue;
201
+ deepCleanProtocols(fullPath, targetScope);
202
+ } else if (entry.name === "package.json") {
203
+ try {
204
+ const content = fs.readFileSync(fullPath, "utf8");
205
+ const json = JSON.parse(content);
206
+ const cleaned = JSON.stringify(sanitizeJson(json, targetScope), null, 2);
207
+ fs.writeFileSync(fullPath, cleaned);
208
+ } catch {
209
+ // ignore malformed json
210
+ }
211
+ } else if (entry.name === "package-lock.json") {
212
+ fs.unlinkSync(fullPath);
213
+ }
214
+ }
215
+ }
@@ -0,0 +1,48 @@
1
+ export function insertTaskRow(memoryContent: string, row: string): string | null {
2
+ const sectionHeader = "## ACTIVE TASKS";
3
+ const tableDivider = "| :--- | :--- | :--- | :--- | :--- |";
4
+ const sectionIndex = memoryContent.indexOf(sectionHeader);
5
+ if (sectionIndex === -1) return null;
6
+ const dividerIndex = memoryContent.indexOf(tableDivider, sectionIndex);
7
+ if (dividerIndex === -1) return null;
8
+ const dividerLineEnd = memoryContent.indexOf("\n", dividerIndex);
9
+ if (dividerLineEnd === -1) return null;
10
+
11
+ return (
12
+ memoryContent.slice(0, dividerLineEnd + 1) +
13
+ `${row}\n` +
14
+ memoryContent.slice(dividerLineEnd + 1)
15
+ );
16
+ }
17
+
18
+ export function sanitizeTableCell(value: unknown): string {
19
+ return String(value)
20
+ .replace(/\|/g, "\\|")
21
+ .replace(/\r?\n/g, " ")
22
+ .trim();
23
+ }
24
+
25
+ export function normalizeAgentName(agent?: unknown): string {
26
+ return String(agent || "manager").replace(/^@+/, "").trim() || "manager";
27
+ }
28
+
29
+ export function normalizePriority(priority?: unknown): string {
30
+ const normalized = String(priority || "P2").toUpperCase().trim();
31
+ return /^P[0-3]$/.test(normalized) ? normalized : "P2";
32
+ }
33
+
34
+ export function slugifyName(value: string): string {
35
+ const slug = String(value || "enderun-app")
36
+ .toLowerCase()
37
+ .replace(/[^a-z0-9]+/g, "-")
38
+ .replace(/^-+|-+$/g, "");
39
+ return slug || "enderun-app";
40
+ }
41
+
42
+ export function titleCase(value: string): string {
43
+ return String(value || "Enderun App")
44
+ .replace(/[-_]+/g, " ")
45
+ .replace(/\s+/g, " ")
46
+ .trim()
47
+ .replace(/\b\w/g, (char) => char.toUpperCase());
48
+ }
@@ -0,0 +1,27 @@
1
+ export function generateULID(seedTime = Date.now(), seed?: number) {
2
+ const ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
3
+ const ENCODING_LEN = ENCODING.length;
4
+ let time = seedTime;
5
+ const timeChars = new Array(10);
6
+ for (let i = 9; i >= 0; i--) {
7
+ timeChars[i] = ENCODING.charAt(time % ENCODING_LEN);
8
+ time = Math.floor(time / ENCODING_LEN);
9
+ }
10
+ const randomChars = new Array(16);
11
+ if (seed) {
12
+ let pseudoRandom = seed;
13
+ for (let i = 0; i < 16; i++) {
14
+ pseudoRandom = (pseudoRandom * 16807) % 2147483647;
15
+ randomChars[i] = ENCODING.charAt(pseudoRandom % ENCODING_LEN);
16
+ }
17
+ } else {
18
+ for (let i = 0; i < 16; i++) {
19
+ randomChars[i] = ENCODING.charAt(Math.floor(Math.random() * ENCODING_LEN));
20
+ }
21
+ }
22
+ return timeChars.join("") + randomChars.join("");
23
+ }
24
+
25
+ export function sleep(ms: number): void {
26
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
27
+ }