agent-enderun 1.0.7 → 1.0.9

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 (312) hide show
  1. package/.enderun/ARCHITECTURE.md +1 -0
  2. package/.enderun/BRAIN_DASHBOARD.md +1 -1
  3. package/.enderun/ENDERUN.md +2 -2
  4. package/.enderun/SECURITY.md +1 -0
  5. package/.enderun/STATUS.md +5 -6
  6. package/.enderun/agents/agent_army_schema.json +71 -77
  7. package/.enderun/agents/analyst.json +32 -0
  8. package/.enderun/agents/backend.json +32 -0
  9. package/.enderun/agents/database.json +32 -0
  10. package/.enderun/agents/devops.json +32 -0
  11. package/.enderun/agents/explorer.json +32 -0
  12. package/.enderun/agents/frontend.json +32 -0
  13. package/.enderun/agents/git.json +32 -0
  14. package/.enderun/agents/manager.json +32 -0
  15. package/.enderun/agents/mobile.json +32 -0
  16. package/.enderun/agents/native.json +32 -0
  17. package/.enderun/agents/quality.json +32 -0
  18. package/.enderun/agents/schema/agent-lifecycle-schema.json +35 -80
  19. package/.enderun/agents/security.json +32 -0
  20. package/.enderun/cli-commands.json +7 -5
  21. package/.enderun/config.json +1 -1
  22. package/.enderun/knowledge/ARCHITECTURE.md +1 -0
  23. package/.enderun/knowledge/SECURITY.md +1 -0
  24. package/.enderun/knowledge/SHIM_TEMPLATE.md +12 -1
  25. package/.enderun/knowledge/evaluation_engine.md +11 -0
  26. package/.enderun/knowledge/legacy_onboarding.md +11 -0
  27. package/.enderun/knowledge/project_scaffold_guidelines.md +11 -0
  28. package/.enderun/knowledge/reference_application_guidelines.md +11 -0
  29. package/.enderun/logs/manager.json +52 -23
  30. package/.enderun/memory/PROJECT_MEMORY.md +14 -12
  31. package/.enderun/observability/README.md +19 -0
  32. package/README.md +38 -101
  33. package/agent.md +1 -1
  34. package/bin/hermes-sandbox.js +9 -0
  35. package/bin/init-check.js +9 -0
  36. package/bin/validate-agent-army.js +34 -92
  37. package/dist/apps/backend/src/types/index.d.ts +9 -0
  38. package/dist/apps/backend/src/types/index.js +5 -0
  39. package/dist/apps/backend/src/types/index.js.map +1 -0
  40. package/dist/apps/web/src/main.d.ts +1 -0
  41. package/dist/apps/web/src/main.js +9 -0
  42. package/dist/apps/web/src/main.js.map +1 -0
  43. package/dist/apps/web/vite.config.d.ts +2 -0
  44. package/dist/apps/web/vite.config.js +6 -0
  45. package/dist/apps/web/vite.config.js.map +1 -0
  46. package/dist/framework-mcp/src/index.d.ts +1 -0
  47. package/dist/framework-mcp/src/index.js +71 -0
  48. package/dist/framework-mcp/src/index.js.map +1 -0
  49. package/dist/framework-mcp/src/tools/definitions.d.ts +2 -0
  50. package/dist/framework-mcp/src/tools/definitions.js +111 -0
  51. package/dist/framework-mcp/src/tools/definitions.js.map +1 -0
  52. package/dist/framework-mcp/src/tools/file_system/patch_file.d.ts +2 -0
  53. package/dist/framework-mcp/src/tools/file_system/patch_file.js +19 -0
  54. package/dist/framework-mcp/src/tools/file_system/patch_file.js.map +1 -0
  55. package/dist/framework-mcp/src/tools/file_system/read_file.d.ts +2 -0
  56. package/dist/framework-mcp/src/tools/file_system/read_file.js +8 -0
  57. package/dist/framework-mcp/src/tools/file_system/read_file.js.map +1 -0
  58. package/dist/framework-mcp/src/tools/file_system/replace_text.d.ts +2 -0
  59. package/dist/framework-mcp/src/tools/file_system/replace_text.js +32 -0
  60. package/dist/framework-mcp/src/tools/file_system/replace_text.js.map +1 -0
  61. package/dist/framework-mcp/src/tools/file_system/write_file.d.ts +2 -0
  62. package/dist/framework-mcp/src/tools/file_system/write_file.js +10 -0
  63. package/dist/framework-mcp/src/tools/file_system/write_file.js.map +1 -0
  64. package/dist/framework-mcp/src/tools/framework/get_status.d.ts +2 -0
  65. package/dist/framework-mcp/src/tools/framework/get_status.js +6 -0
  66. package/dist/framework-mcp/src/tools/framework/get_status.js.map +1 -0
  67. package/dist/framework-mcp/src/tools/framework/orchestrate.d.ts +2 -0
  68. package/dist/framework-mcp/src/tools/framework/orchestrate.js +6 -0
  69. package/dist/framework-mcp/src/tools/framework/orchestrate.js.map +1 -0
  70. package/dist/framework-mcp/src/tools/framework/update_contract_hash.d.ts +2 -0
  71. package/dist/framework-mcp/src/tools/framework/update_contract_hash.js +6 -0
  72. package/dist/framework-mcp/src/tools/framework/update_contract_hash.js.map +1 -0
  73. package/dist/framework-mcp/src/tools/framework/update_memory.d.ts +2 -0
  74. package/dist/framework-mcp/src/tools/framework/update_memory.js +9 -0
  75. package/dist/framework-mcp/src/tools/framework/update_memory.js.map +1 -0
  76. package/dist/framework-mcp/src/tools/index.d.ts +5 -0
  77. package/dist/framework-mcp/src/tools/index.js +26 -0
  78. package/dist/framework-mcp/src/tools/index.js.map +1 -0
  79. package/dist/framework-mcp/src/tools/messaging/log_action.d.ts +2 -0
  80. package/dist/framework-mcp/src/tools/messaging/log_action.js +23 -0
  81. package/dist/framework-mcp/src/tools/messaging/log_action.js.map +1 -0
  82. package/dist/framework-mcp/src/tools/messaging/send_message.d.ts +2 -0
  83. package/dist/framework-mcp/src/tools/messaging/send_message.js +24 -0
  84. package/dist/framework-mcp/src/tools/messaging/send_message.js.map +1 -0
  85. package/dist/framework-mcp/src/tools/types.d.ts +47 -0
  86. package/dist/framework-mcp/src/tools/types.js +2 -0
  87. package/dist/framework-mcp/src/tools/types.js.map +1 -0
  88. package/dist/framework-mcp/src/utils/cli.d.ts +5 -0
  89. package/dist/framework-mcp/src/utils/cli.js +21 -0
  90. package/dist/framework-mcp/src/utils/cli.js.map +1 -0
  91. package/dist/framework-mcp/src/utils/security.d.ts +12 -0
  92. package/dist/framework-mcp/src/utils/security.js +54 -0
  93. package/dist/framework-mcp/src/utils/security.js.map +1 -0
  94. package/dist/src/cli/adapters.d.ts +32 -0
  95. package/dist/src/cli/adapters.js +264 -0
  96. package/dist/src/cli/adapters.js.map +1 -0
  97. package/dist/src/cli/commands/app.d.ts +4 -0
  98. package/dist/src/cli/commands/app.js +32 -0
  99. package/dist/src/cli/commands/app.js.map +1 -0
  100. package/dist/src/cli/commands/check.d.ts +6 -0
  101. package/dist/src/cli/commands/check.js +110 -0
  102. package/dist/src/cli/commands/check.js.map +1 -0
  103. package/dist/src/cli/commands/compliance.d.ts +1 -0
  104. package/dist/src/cli/commands/compliance.js +51 -0
  105. package/dist/src/cli/commands/compliance.js.map +1 -0
  106. package/dist/src/cli/commands/contract.d.ts +8 -0
  107. package/dist/src/cli/commands/contract.js +73 -0
  108. package/dist/src/cli/commands/contract.js.map +1 -0
  109. package/dist/src/cli/commands/explorer.d.ts +2 -0
  110. package/dist/src/cli/commands/explorer.js +43 -0
  111. package/dist/src/cli/commands/explorer.js.map +1 -0
  112. package/dist/src/cli/commands/git.d.ts +2 -0
  113. package/dist/src/cli/commands/git.js +41 -0
  114. package/dist/src/cli/commands/git.js.map +1 -0
  115. package/dist/src/cli/commands/init.d.ts +1 -0
  116. package/dist/src/cli/commands/init.js +338 -0
  117. package/dist/src/cli/commands/init.js.map +1 -0
  118. package/dist/src/cli/commands/knowledge.d.ts +2 -0
  119. package/dist/src/cli/commands/knowledge.js +43 -0
  120. package/dist/src/cli/commands/knowledge.js.map +1 -0
  121. package/dist/src/cli/commands/lint.d.ts +4 -0
  122. package/dist/src/cli/commands/lint.js +24 -0
  123. package/dist/src/cli/commands/lint.js.map +1 -0
  124. package/dist/src/cli/commands/log.d.ts +9 -0
  125. package/dist/src/cli/commands/log.js +33 -0
  126. package/dist/src/cli/commands/log.js.map +1 -0
  127. package/dist/src/cli/commands/memory.d.ts +1 -0
  128. package/dist/src/cli/commands/memory.js +72 -0
  129. package/dist/src/cli/commands/memory.js.map +1 -0
  130. package/dist/src/cli/commands/orchestrate.d.ts +1 -0
  131. package/dist/src/cli/commands/orchestrate.js +111 -0
  132. package/dist/src/cli/commands/orchestrate.js.map +1 -0
  133. package/dist/src/cli/commands/script.d.ts +1 -0
  134. package/dist/src/cli/commands/script.js +20 -0
  135. package/dist/src/cli/commands/script.js.map +1 -0
  136. package/dist/src/cli/commands/security.d.ts +1 -0
  137. package/dist/src/cli/commands/security.js +37 -0
  138. package/dist/src/cli/commands/security.js.map +1 -0
  139. package/dist/src/cli/commands/status.d.ts +4 -0
  140. package/dist/src/cli/commands/status.js +56 -0
  141. package/dist/src/cli/commands/status.js.map +1 -0
  142. package/dist/src/cli/commands/trace.d.ts +4 -0
  143. package/dist/src/cli/commands/trace.js +42 -0
  144. package/dist/src/cli/commands/trace.js.map +1 -0
  145. package/dist/src/cli/index.d.ts +2 -0
  146. package/dist/src/cli/index.js +117 -0
  147. package/dist/src/cli/index.js.map +1 -0
  148. package/dist/src/cli/utils/app.d.ts +33 -0
  149. package/dist/src/cli/utils/app.js +710 -0
  150. package/dist/src/cli/utils/app.js.map +1 -0
  151. package/dist/src/cli/utils/claude.d.ts +8 -0
  152. package/dist/src/cli/utils/claude.js +56 -0
  153. package/dist/src/cli/utils/claude.js.map +1 -0
  154. package/dist/src/cli/utils/fs.d.ts +11 -0
  155. package/dist/src/cli/utils/fs.js +144 -0
  156. package/dist/src/cli/utils/fs.js.map +1 -0
  157. package/dist/src/cli/utils/memory.d.ts +14 -0
  158. package/dist/src/cli/utils/memory.js +173 -0
  159. package/dist/src/cli/utils/memory.js.map +1 -0
  160. package/dist/src/cli/utils/pkg.d.ts +24 -0
  161. package/dist/src/cli/utils/pkg.js +254 -0
  162. package/dist/src/cli/utils/pkg.js.map +1 -0
  163. package/dist/src/cli/utils/string.d.ts +6 -0
  164. package/dist/src/cli/utils/string.js +44 -0
  165. package/dist/src/cli/utils/string.js.map +1 -0
  166. package/dist/src/cli/utils/time.d.ts +2 -0
  167. package/dist/src/cli/utils/time.js +28 -0
  168. package/dist/src/cli/utils/time.js.map +1 -0
  169. package/dist/tests/adapter.test.d.ts +1 -0
  170. package/dist/tests/adapter.test.js +80 -0
  171. package/dist/tests/adapter.test.js.map +1 -0
  172. package/dist/tests/framework-init-test/framework-mcp/src/index.d.ts +1 -0
  173. package/dist/tests/framework-init-test/framework-mcp/src/index.js +71 -0
  174. package/dist/tests/framework-init-test/framework-mcp/src/index.js.map +1 -0
  175. package/dist/tests/framework-init-test/framework-mcp/src/tools/definitions.d.ts +2 -0
  176. package/dist/tests/framework-init-test/framework-mcp/src/tools/definitions.js +111 -0
  177. package/dist/tests/framework-init-test/framework-mcp/src/tools/definitions.js.map +1 -0
  178. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/patch_file.d.ts +2 -0
  179. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/patch_file.js +19 -0
  180. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/patch_file.js.map +1 -0
  181. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/read_file.d.ts +2 -0
  182. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/read_file.js +8 -0
  183. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/read_file.js.map +1 -0
  184. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/replace_text.d.ts +2 -0
  185. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/replace_text.js +32 -0
  186. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/replace_text.js.map +1 -0
  187. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/write_file.d.ts +2 -0
  188. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/write_file.js +10 -0
  189. package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/write_file.js.map +1 -0
  190. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/get_status.d.ts +2 -0
  191. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/get_status.js +6 -0
  192. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/get_status.js.map +1 -0
  193. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/orchestrate.d.ts +2 -0
  194. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/orchestrate.js +6 -0
  195. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/orchestrate.js.map +1 -0
  196. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_contract_hash.d.ts +2 -0
  197. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_contract_hash.js +6 -0
  198. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_contract_hash.js.map +1 -0
  199. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_memory.d.ts +2 -0
  200. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_memory.js +9 -0
  201. package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_memory.js.map +1 -0
  202. package/dist/tests/framework-init-test/framework-mcp/src/tools/index.d.ts +5 -0
  203. package/dist/tests/framework-init-test/framework-mcp/src/tools/index.js +26 -0
  204. package/dist/tests/framework-init-test/framework-mcp/src/tools/index.js.map +1 -0
  205. package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/log_action.d.ts +2 -0
  206. package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/log_action.js +23 -0
  207. package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/log_action.js.map +1 -0
  208. package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/send_message.d.ts +2 -0
  209. package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/send_message.js +24 -0
  210. package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/send_message.js.map +1 -0
  211. package/dist/tests/framework-init-test/framework-mcp/src/tools/types.d.ts +47 -0
  212. package/dist/tests/framework-init-test/framework-mcp/src/tools/types.js +2 -0
  213. package/dist/tests/framework-init-test/framework-mcp/src/tools/types.js.map +1 -0
  214. package/dist/tests/framework-init-test/framework-mcp/src/utils/cli.d.ts +5 -0
  215. package/dist/tests/framework-init-test/framework-mcp/src/utils/cli.js +21 -0
  216. package/dist/tests/framework-init-test/framework-mcp/src/utils/cli.js.map +1 -0
  217. package/dist/tests/framework-init-test/framework-mcp/src/utils/security.d.ts +12 -0
  218. package/dist/tests/framework-init-test/framework-mcp/src/utils/security.js +54 -0
  219. package/dist/tests/framework-init-test/framework-mcp/src/utils/security.js.map +1 -0
  220. package/dist/tests/framework-init-test/framework-mcp/tests/tools/file_system/replace_text.test.d.ts +1 -0
  221. package/dist/tests/framework-init-test/framework-mcp/tests/tools/file_system/replace_text.test.js +69 -0
  222. package/dist/tests/framework-init-test/framework-mcp/tests/tools/file_system/replace_text.test.js.map +1 -0
  223. package/dist/tests/framework-init-test/panda.config.d.ts +4 -0
  224. package/dist/tests/framework-init-test/panda.config.js +95 -0
  225. package/dist/tests/framework-init-test/panda.config.js.map +1 -0
  226. package/dist/tests/framework-init-test/vitest.config.d.ts +2 -0
  227. package/dist/tests/framework-init-test/vitest.config.js +19 -0
  228. package/dist/tests/framework-init-test/vitest.config.js.map +1 -0
  229. package/dist/tests/gemini.test.d.ts +1 -0
  230. package/dist/tests/gemini.test.js +38 -0
  231. package/dist/tests/gemini.test.js.map +1 -0
  232. package/dist/tests/initial.test.d.ts +1 -0
  233. package/dist/tests/initial.test.js +7 -0
  234. package/dist/tests/initial.test.js.map +1 -0
  235. package/dist/vitest.config.d.ts +2 -0
  236. package/dist/vitest.config.js +19 -0
  237. package/dist/vitest.config.js.map +1 -0
  238. package/docs/getting-started.md +4 -4
  239. package/eslint.config.js +1 -1
  240. package/framework-mcp/dist/index.js +2 -2
  241. package/framework-mcp/dist/src/index.js +70 -0
  242. package/framework-mcp/dist/src/tools/definitions.js +110 -0
  243. package/framework-mcp/dist/src/tools/file_system/patch_file.js +18 -0
  244. package/framework-mcp/dist/src/tools/file_system/read_file.js +7 -0
  245. package/framework-mcp/dist/src/tools/file_system/replace_text.js +31 -0
  246. package/framework-mcp/dist/src/tools/file_system/write_file.js +9 -0
  247. package/framework-mcp/dist/src/tools/framework/get_status.js +5 -0
  248. package/framework-mcp/dist/src/tools/framework/orchestrate.js +5 -0
  249. package/framework-mcp/dist/src/tools/framework/update_contract_hash.js +5 -0
  250. package/framework-mcp/dist/src/tools/framework/update_memory.js +8 -0
  251. package/framework-mcp/dist/src/tools/index.js +25 -0
  252. package/framework-mcp/dist/src/tools/messaging/log_action.js +22 -0
  253. package/framework-mcp/dist/src/tools/messaging/send_message.js +23 -0
  254. package/framework-mcp/dist/src/tools/types.js +1 -0
  255. package/framework-mcp/dist/src/utils/cli.js +20 -0
  256. package/framework-mcp/dist/src/utils/security.js +53 -0
  257. package/framework-mcp/dist/tests/tools/file_system/replace_text.test.js +68 -0
  258. package/framework-mcp/dist/tools/definitions.js +1 -0
  259. package/framework-mcp/dist/tools/file_system/replace_text.js +18 -1
  260. package/framework-mcp/dist/tools/framework/get_status.js +2 -2
  261. package/framework-mcp/dist/tools/framework/orchestrate.js +2 -2
  262. package/framework-mcp/dist/tools/framework/update_contract_hash.js +2 -2
  263. package/framework-mcp/dist/tools/framework/update_memory.js +1 -1
  264. package/framework-mcp/dist/tools/messaging/send_message.js +4 -2
  265. package/framework-mcp/dist/utils/cli.js +2 -2
  266. package/framework-mcp/dist/utils/security.js +23 -5
  267. package/framework-mcp/package.json +3 -3
  268. package/framework-mcp/src/index.ts +2 -2
  269. package/framework-mcp/src/tools/definitions.ts +1 -0
  270. package/framework-mcp/src/tools/file_system/replace_text.ts +21 -1
  271. package/framework-mcp/src/tools/framework/get_status.ts +3 -3
  272. package/framework-mcp/src/tools/framework/orchestrate.ts +3 -3
  273. package/framework-mcp/src/tools/framework/update_contract_hash.ts +3 -3
  274. package/framework-mcp/src/tools/framework/update_memory.ts +1 -1
  275. package/framework-mcp/src/tools/messaging/send_message.ts +5 -2
  276. package/framework-mcp/src/tools/types.ts +3 -0
  277. package/framework-mcp/src/utils/cli.ts +2 -2
  278. package/framework-mcp/src/utils/security.ts +23 -5
  279. package/framework-mcp/tests/tools/file_system/replace_text.test.js +68 -0
  280. package/framework-mcp/tests/tools/file_system/replace_text.test.ts +77 -0
  281. package/framework-mcp/tsconfig.json +1 -2
  282. package/mcp.json +4 -4
  283. package/package.json +4 -3
  284. package/src/cli/adapters.ts +16 -9
  285. package/src/cli/commands/check.ts +8 -5
  286. package/src/cli/commands/contract.ts +2 -2
  287. package/src/cli/commands/init.ts +213 -433
  288. package/src/cli/commands/memory.ts +5 -0
  289. package/src/cli/index.ts +12 -9
  290. package/src/cli/utils/app.ts +19 -16
  291. package/src/cli/utils/claude.ts +2 -1
  292. package/src/cli/utils/fs.ts +2 -1
  293. package/src/cli/utils/memory.ts +2 -2
  294. package/src/cli/utils/pkg.ts +72 -5
  295. package/.enderun/agents/analyst.md +0 -32
  296. package/.enderun/agents/backend.md +0 -49
  297. package/.enderun/agents/database.md +0 -41
  298. package/.enderun/agents/devops.md +0 -41
  299. package/.enderun/agents/explorer.md +0 -40
  300. package/.enderun/agents/frontend.md +0 -48
  301. package/.enderun/agents/git.md +0 -41
  302. package/.enderun/agents/manager.md +0 -43
  303. package/.enderun/agents/mobile.md +0 -42
  304. package/.enderun/agents/native.md +0 -41
  305. package/.enderun/agents/quality.md +0 -40
  306. package/.enderun/agents/security.md +0 -32
  307. package/docs/api-referans.md +0 -1137
  308. package/docs/is_akislari.md +0 -902
  309. package/docs/mimari.md +0 -926
  310. package/docs/moduller.md +0 -294
  311. package/docs/proje.md +0 -521
  312. package/docs/yap/304/261.md +0 -2150
@@ -10,7 +10,7 @@ import {
10
10
  runAdapterPostInit,
11
11
  type AdapterConfig,
12
12
  } from "../adapters.js";
13
- import { getPackageManager, mergePackageJson, deepCleanProtocols, sanitizeJson, getPackageVersion } from "../utils/pkg.js";
13
+ import { mergePackageJson, deepCleanProtocols, sanitizeJson, getPackageVersion, getValidatorPath } from "../utils/pkg.js";
14
14
  import { updateGitIgnore, ensureDir, writeJsonFile, copyDir, writeTextFile } from "../utils/fs.js";
15
15
  import { initializeMemory } from "../utils/memory.js";
16
16
  import { checkCommand } from "./check.js";
@@ -55,511 +55,291 @@ const FRAMEWORK_SUBDIRS = [
55
55
  "queue/pipelines",
56
56
  ];
57
57
 
58
+ const allAgents = [
59
+ {
60
+ name: "manager",
61
+ displayName: "Orchestration & Governance (Team-Lead)",
62
+ description: "CTO, Lead Architect, and Orchestrator for Agent Enderun.",
63
+ instructions: "You are the manager agent. Orchestrate workspace tasks, manage DAG dependency graphs, handle phase transitions, and enforce architectural standards.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Single Point of Authority: You are the sole entry point. No specialist acts without your briefing.\n- Traceability: Every action MUST inherit the active Trace ID.\n- Memory Discipline: MUST update PROJECT_MEMORY.md and log actions at the end of EVERY turn."
64
+ },
65
+ {
66
+ name: "backend",
67
+ displayName: "Domain Logic & Databases Specialist",
68
+ description: "Responsible for core business logic, database migrations, security standards, API contracts, and server architecture.",
69
+ instructions: "You are the backend agent. Build secure, high-performance, and consistent server architecture.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- No UI: Never implement UI or frontend logic.\n- Contract-First: Define shared contracts/branded types BEFORE any consumer code.\n- Branded Types Law: ALL IDs must use branded types (e.g., UserID). Plain strings are forbidden.\n- Zero Mock Policy: Use real endpoints/contracts only.\n- Surgical Edits: Use replace_text for all code changes."
70
+ },
71
+ {
72
+ name: "frontend",
73
+ displayName: "Fluid Responsive UI Specialist",
74
+ description: "Builds responsive fluid user interfaces, manages styling tokens with Panda CSS, and implements state machines.",
75
+ instructions: "You are the frontend agent. Build original, high-performance, and responsive user interfaces.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Responsive-First: Mobile-First (320px) is mandatory. Fixed-width is forbidden.\n- Zero UI Library Policy: No shadcn/ui, MUI, etc. Build everything with Panda CSS.\n- Zero Mock Policy: Use real endpoints/contracts only.\n- Contract-First: Use branded types from apps/backend/src/types.\n- No Native Alerts: Use integrated Toaster/Modal components."
76
+ },
77
+ {
78
+ name: "quality",
79
+ displayName: "Automated Testing & Quality Specialist",
80
+ description: "Verifies test coverage, audits compliance with the constitution, conducts AST scanning, and verifies CI/CD status.",
81
+ instructions: "You are the quality agent. Ensure no code is merged or deployed without meeting standards.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Final Gate: No code merges or deploys proceed without quality sign-off.\n- Verification-First: Audit lint, typecheck, contract drift, and branded types before sign-off.\n- Never Implement: Audit and assess only. Never write application features.\n- Zero Mock Policy: Integration tests must use real/service-compatible backends.\n- Coverage Gate: Reject approvals if coverage falls below >80% threshold in core."
82
+ },
83
+ {
84
+ name: "database",
85
+ displayName: "Database Migrations & Tuning Specialist",
86
+ description: "Designs SQL schemas, manages migration scripts via Kysely, optimizes queries, indexes, and seeding logic.",
87
+ instructions: "You are the database agent. Build secure, optimized, and scalable data layers.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Self-Contained DB: Every backend application MUST manage its own schema/migrations/seeds in its own src/database/ directory.\n- Contract-First: All schemas MUST be derived from branded types.\n- Kysely Standard: Use Kysely for application queries. Raw SQL is forbidden.\n- Zero Mock Policy: Realistic, contract-aware seed data only.\n- Surgical Edits: Use replace_text for all schema/migration changes."
88
+ },
89
+ {
90
+ name: "devops",
91
+ displayName: "Infrastructure & CI/CD Specialist",
92
+ description: "Handles deployment pipelines, environment variables, system containerization, logging & telemetry integrations.",
93
+ instructions: "You are the devops agent. Ensure reliable execution in every environment with strict quality gates.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Gate Approvals: NEVER deploy to production without quality gate approval.\n- No Docker Policy: Prefer native Node.js unless explicitly overridden by manager.\n- Environment Parity: Identical configs across dev/staging/prod (except secrets).\n- Secrets Security: NEVER hardcode secrets. Use environment variables.\n- Rollback First: Deployment is BLOCKED if no documented rollback plan exists."
94
+ },
95
+ {
96
+ name: "explorer",
97
+ displayName: "Codebase Discovery Specialist",
98
+ description: "Maps code dependencies, performs project scans, identifies architectural gaps, and supports legacy onboarding.",
99
+ instructions: "You are the explorer agent. Map project structure and provide deep context to other agents.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Read-Only: Never write production code. Only discover, map, and report.\n- Search-First: Always use search_codebase before reading large files.\n- Surgical Discovery: Focus on entry points and core domain logic.\n- Zero Mock Policy: Analyze real system state only.\n- Traceability: All findings must be linked to a Trace ID."
100
+ },
101
+ {
102
+ name: "git",
103
+ displayName: "Version Control Specialist",
104
+ description: "Manages commit histories, branches, Trace ID alignment, semantic tagging, and merge conflicts.",
105
+ instructions: "You are the git agent. Ensure a clean, atomic, and traceable repository history.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Trace ID Tagging: EVERY commit must include the active Trace ID in the message.\n- Atomic Integrity: Every commit must represent exactly one logical change.\n- Health-First: Never commit code that fails build or basic tests.\n- No Push: Do not run git push without explicit USER approval.\n- No Force: Never use git push --force on public branches."
106
+ },
107
+ {
108
+ name: "mobile",
109
+ displayName: "Mobile App Specialist",
110
+ description: "Develops cross-platform mobile apps using React Native and Expo with clean component states.",
111
+ instructions: "You are the mobile agent. Build high-performance, responsive mobile apps (React Native/Expo).\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Zero UI Library: Same discipline as web. Build UI from scratch.\n- Contract-First: Use shared types from apps/backend/src/types.\n- Responsive-First: Mobile-First approach is mandatory.\n- Safe Area: Handle iOS/Android safe area insets on every screen.\n- Performance: Target 60 FPS."
112
+ },
113
+ {
114
+ name: "native",
115
+ displayName: "Native OS Integration Specialist",
116
+ description: "Builds lightweight desktop wrappers and system integrations using Tauri or Electron.",
117
+ instructions: "You are the native agent. Build secure, efficient desktop apps (Tauri/Electron).\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Security-First: No remote code execution. Mandatory sandboxing and strict CSP.\n- Secure Storage: Use Keychain/Credential Manager for sensitive data.\n- IPC Contract: All communication between frontend and native MUST be typed.\n- Contract-First: Define IPC and data contracts before implementation.\n- Surgical Edits: Use replace_text for all code changes."
118
+ },
119
+ {
120
+ name: "security",
121
+ displayName: "Security & Cryptography Specialist",
122
+ description: "Enforces authentication flows, CSP policies, credential rotation, RLS constraints, and cryptographic safety.",
123
+ instructions: "You are the security agent. Ensure all endpoints, database connections, and authentication flows satisfy strict enterprise compliance policies.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Sandboxed Security First: Enforce Row Level Security (RLS) on all database tables.\n- Credential Rotation Policy: Credentials, keys, and tokens must never be hardcoded. Use vault/env variables.\n- CSP & CORS Strictness: Never open wildcards (*) for CORS or CSP policies.\n- Surgical Edits: Use replace_text for all security patches."
124
+ },
125
+ {
126
+ name: "analyst",
127
+ displayName: "Contract Verification & Business Analyst",
128
+ description: "Validates business specifications, tests database contract integrity, and audits constitutional compliance.",
129
+ instructions: "You are the analyst agent. Independently verify compliance with contracts and specifications between frontend, backend, and the constitution.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Independent Stance: Act as an objective verification gate.\n- Contract-First Law: Ensure contract.version.json perfectly matches types.\n- Escalation Priority: Report all contract drift to manager immediately.\n- Surgical Edits: Use replace_text for all document updates."
130
+ }
131
+ ];
132
+
133
+ function scaffoldCoreAgents(agentsBaseDir: string, dryRun: boolean) {
134
+ ensureDir(agentsBaseDir, dryRun);
135
+ const agentSchemaDir = path.join(agentsBaseDir, "schema");
136
+ ensureDir(agentSchemaDir, dryRun);
137
+
138
+ const agentArmySchema = {
139
+ "$schema": "http://json-schema.org/draft-07/schema#",
140
+ "title": "Agent Lifecycle (AL) Agent Army Schema",
141
+ "description": "Defines the required fields for an AL-compliant agent definition (e.g. agent.json or agent.md YAML frontmatter).",
142
+ "type": "object",
143
+ "required": ["name", "description", "role", "capability", "stateMachine", "tags"],
144
+ "properties": {
145
+ "name": { "type": "string" },
146
+ "description": { "type": "string" },
147
+ "role": { "type": "string" },
148
+ "capability": { "type": "integer", "minimum": 1, "maximum": 10 },
149
+ "stateMachine": {
150
+ "type": "object",
151
+ "required": ["schemaRef"],
152
+ "properties": { "schemaRef": { "type": "string" } }
153
+ },
154
+ "tags": { "type": "array", "items": { "type": "string" }, "minItems": 1 },
155
+ "permittedTools": { "type": "array", "items": { "type": "string" } },
156
+ "hidden": { "type": "boolean" },
157
+ "displayName": { "type": "string" },
158
+ "customAgentSpec": {
159
+ "type": "object",
160
+ "properties": {
161
+ "customAgent": {
162
+ "type": "object",
163
+ "properties": {
164
+ "systemPromptSections": {
165
+ "type": "array",
166
+ "items": {
167
+ "type": "object",
168
+ "properties": { "title": { "type": "string" }, "content": { "type": "string" } },
169
+ "required": ["title", "content"]
170
+ }
171
+ },
172
+ "toolNames": { "type": "array", "items": { "type": "string" } }
173
+ },
174
+ "required": ["systemPromptSections", "toolNames"]
175
+ }
176
+ },
177
+ "required": ["customAgent"]
178
+ }
179
+ }
180
+ };
181
+ writeJsonFile(path.join(agentsBaseDir, "agent_army_schema.json"), agentArmySchema, dryRun);
182
+
183
+ const agentLifecycleSchema = {
184
+ "$schema": "http://json-schema.org/draft-07/schema#",
185
+ "title": "Agent Lifecycle State Machine Schema",
186
+ "type": "object",
187
+ "required": ["initialState", "states"],
188
+ "properties": {
189
+ "initialState": { "type": "string" },
190
+ "states": {
191
+ "type": "object",
192
+ "patternProperties": {
193
+ "^[a-zA-Z0-9_]+$": {
194
+ "type": "object",
195
+ "properties": {
196
+ "on": { "type": "object", "patternProperties": { "^[a-zA-Z0-9_]+$": { "type": "string" } } },
197
+ "actions": { "type": "array", "items": { "type": "string" } }
198
+ },
199
+ "required": ["on"]
200
+ }
201
+ }
202
+ }
203
+ }
204
+ };
205
+ writeJsonFile(path.join(agentSchemaDir, "agent-lifecycle-schema.json"), agentLifecycleSchema, dryRun);
206
+
207
+ for (const ag of allAgents) {
208
+ const payload = {
209
+ name: ag.name,
210
+ displayName: ag.displayName,
211
+ description: ag.description,
212
+ role: ag.displayName.split(" (")[0],
213
+ capability: 9,
214
+ hidden: false,
215
+ stateMachine: { schemaRef: "../schema/agent-lifecycle-schema.json" },
216
+ tags: ["core"],
217
+ customAgentSpec: {
218
+ customAgent: {
219
+ systemPromptSections: [{ title: "Instructions", content: ag.instructions }],
220
+ toolNames: ["view_file", "replace_file_content", "write_to_file", "run_command", "grep_search", "list_dir"]
221
+ }
222
+ }
223
+ };
224
+ writeJsonFile(path.join(agentsBaseDir, `${ag.name}.json`), payload, dryRun);
225
+ }
226
+ console.warn(`āœ… Scaffolding ${allAgents.length} core agents under ${path.relative(targetDir, agentsBaseDir)}/...`);
227
+ }
228
+
58
229
  function buildDirsToCreate(adapter: AdapterConfig): string[] {
59
230
  const dirs = [
60
231
  adapter.frameworkDir,
61
232
  ...FRAMEWORK_SUBDIRS.map((d) => `${adapter.frameworkDir}/${d}`),
62
- "apps/web",
63
- "apps/backend",
64
- "docs",
65
- "framework-mcp",
66
- "tests",
233
+ "apps/web", "apps/backend", "docs", "framework-mcp", "tests",
67
234
  ];
68
235
  if (adapter.nestedDirs) {
69
- for (const nested of adapter.nestedDirs) {
70
- dirs.push(`${adapter.frameworkDir}/${nested}`);
71
- }
72
- }
73
- // Add logic for shimFile directory if it's nested (like .cursor/rules/)
74
- if (adapter.shimFile.includes("/")) {
75
- dirs.push(path.dirname(adapter.shimFile));
236
+ for (const nested of adapter.nestedDirs) dirs.push(`${adapter.frameworkDir}/${nested}`);
76
237
  }
238
+ if (adapter.shimFile.includes("/")) dirs.push(path.dirname(adapter.shimFile));
77
239
  return [...new Set(dirs)];
78
240
  }
79
241
 
80
- /**
81
- * Scaffold the framework for a specific IDE adapter (separate runtime folder per IDE).
82
- */
83
242
  export async function initCommand(adapterInput?: string, dryRun = false) {
84
243
  const adapter = resolveAdapter(adapterInput);
85
244
  const { frameworkDir, shimFile, templateDir } = adapter;
86
245
  const targetFrameworkDir = path.join(targetDir, frameworkDir);
87
246
 
88
- if (dryRun) {
89
- console.warn("\nšŸ” DRY RUN MODE ACTIVE - No changes will be made to the filesystem.\n");
90
- }
91
-
247
+ if (dryRun) console.warn("\nšŸ” DRY RUN MODE ACTIVE\n");
92
248
  console.warn(`šŸš€ Installing Agent Enderun (Adapter: ${adapter.id} → ${frameworkDir}/)...`);
93
249
 
94
250
  ensureDir(targetFrameworkDir, dryRun);
251
+ for (const dir of buildDirsToCreate(adapter)) ensureDir(path.join(targetDir, dir), dryRun);
95
252
 
96
- for (const dir of buildDirsToCreate(adapter)) {
97
- ensureDir(path.join(targetDir, dir), dryRun);
98
- }
99
-
100
- const filesToProcess = [
101
- ...CORE_FILES,
102
- shimFile,
103
- ].filter(
104
- (f) =>
105
- CORE_FILES.includes(f) ||
106
- f === shimFile ||
107
- fs.existsSync(path.join(sourceDir, f)),
108
- );
253
+ const filesToProcess = [...CORE_FILES, shimFile].filter(f => CORE_FILES.includes(f) || f === shimFile || fs.existsSync(path.join(sourceDir, f)));
109
254
 
110
255
  ensureDir(path.join(targetDir, "apps/backend"), dryRun);
111
256
  const initContractPath = path.join(targetDir, "apps/backend/contract.version.json");
112
257
  if (!fs.existsSync(initContractPath)) {
113
- writeJsonFile(initContractPath, {
114
- contract_hash: "initial_hash_placeholder",
115
- last_updated: new Date().toISOString(),
116
- }, dryRun);
258
+ writeJsonFile(initContractPath, { contract_hash: "initial_hash_placeholder", last_updated: new Date().toISOString() }, dryRun);
117
259
  }
118
260
 
119
261
  let targetPkg: Record<string, unknown> = {};
120
262
  try {
121
263
  const targetPkgPath = path.join(targetDir, "package.json");
122
- if (fs.existsSync(targetPkgPath)) {
123
- targetPkg = JSON.parse(fs.readFileSync(targetPkgPath, "utf8"));
124
- }
125
- } catch {
126
- // ignore
127
- }
264
+ if (fs.existsSync(targetPkgPath)) targetPkg = JSON.parse(fs.readFileSync(targetPkgPath, "utf8"));
265
+ } catch { /* ignore */ }
128
266
 
129
267
  const pkgName = typeof targetPkg.name === "string" ? targetPkg.name : "";
130
- const targetScope = pkgName
131
- ? pkgName.startsWith("@")
132
- ? pkgName.split("/")[0]
133
- : `@${pkgName}`
134
- : `@${path.basename(targetDir)}`;
268
+ const targetScope = pkgName ? (pkgName.startsWith("@") ? pkgName.split("/")[0] : `@${pkgName}`) : `@${path.basename(targetDir)}`;
135
269
 
136
270
  for (const item of filesToProcess) {
137
271
  const src = path.join(sourceDir, item);
138
272
  let dest = path.join(targetDir, item);
139
-
140
- // Safeguard: Do not delete or overwrite if we are in the framework's own development directory
141
273
  const isDevMode = src === dest;
142
274
 
143
275
  if (item === "framework-mcp" && fs.existsSync(dest) && !isDevMode) {
144
- try {
145
- if (dryRun) {
146
- console.warn(`[DRY RUN] Would remove existing directory: ${dest}`);
147
- } else {
148
- fs.rmSync(dest, { recursive: true, force: true });
149
- }
150
- } catch {
151
- // ignore
152
- }
276
+ if (!dryRun) fs.rmSync(dest, { recursive: true, force: true });
153
277
  }
154
278
 
155
279
  if (item === templateDir || item.startsWith(`${templateDir}/`)) {
156
280
  let relativePath = item.replace(templateDir, "").replace(/^\//, "");
157
-
158
- // Adapter-specific agent/skill folder remapping
159
281
  if (relativePath.startsWith("agents")) {
160
- if (adapter.id === "antigravity") {
161
- relativePath = relativePath.replace("agents", "skills");
162
- } else if (adapter.id === "grok") {
163
- relativePath = relativePath.replace("agents", "plugins");
164
- }
165
- } else if (relativePath.startsWith("knowledge")) {
166
- if (adapter.id === "antigravity") {
167
- relativePath = relativePath.replace("knowledge", "rules");
168
- }
282
+ if (adapter.id === "antigravity") relativePath = relativePath.replace("agents", "skills");
283
+ else if (adapter.id === "grok") relativePath = relativePath.replace("agents", "plugins");
284
+ } else if (relativePath.startsWith("knowledge") && adapter.id === "antigravity") {
285
+ relativePath = relativePath.replace("knowledge", "rules");
169
286
  }
170
-
171
287
  dest = path.join(targetDir, frameworkDir, relativePath);
172
288
  }
173
-
174
- // Skip if src and dest are same and it's not a shim or specific file that needs re-mapping
175
- if (isDevMode && !isAdapterShimFile(item) && item !== "package.json") {
176
- continue;
177
- }
178
- if (item === "ENDERUN.md") {
179
- dest = path.join(targetFrameworkDir, "ENDERUN.md");
180
- }
181
- if (isAdapterShimFile(item)) {
182
- dest = path.join(targetDir, item);
183
- }
184
289
 
185
- if (!fs.existsSync(src)) {
186
- continue;
187
- }
290
+ if (isDevMode && !isAdapterShimFile(item) && item !== "package.json") continue;
291
+ if (item === "ENDERUN.md") dest = path.join(targetFrameworkDir, "ENDERUN.md");
292
+ if (isAdapterShimFile(item)) dest = path.join(targetDir, item);
188
293
 
189
- if (fs.lstatSync(src).isDirectory()) {
190
- const skipFiles =
191
- item === templateDir ? ["logs", "PROJECT_MEMORY.md", "PROJECT_MEMORY.lock"] : [];
192
- const nonDestructive = ["docs", templateDir].includes(item);
294
+ if (!fs.existsSync(src)) continue;
193
295
 
194
- if (item === templateDir) {
195
- // the destination path (dest) is already mapped correctly above.
196
- }
197
-
198
- copyDir(
199
- src,
200
- dest,
201
- new Set(skipFiles),
202
- nonDestructive,
203
- frameworkDir,
204
- targetScope,
205
- sanitizeJson,
206
- adapter.id,
207
- dryRun,
208
- );
209
-
210
- if (item === templateDir && adapter.id === "grok") {
211
- const grokAgentsDest = path.join(targetDir, frameworkDir, "agents");
212
- ensureDir(grokAgentsDest, dryRun);
213
- copyDir(
214
- path.join(src, "agents"),
215
- grokAgentsDest,
216
- new Set(skipFiles),
217
- nonDestructive,
218
- frameworkDir,
219
- targetScope,
220
- sanitizeJson,
221
- adapter.id,
222
- dryRun,
223
- );
224
- }
296
+ if (fs.lstatSync(src).isDirectory()) {
297
+ const skipFiles = item === templateDir ? ["logs", "PROJECT_MEMORY.md", "PROJECT_MEMORY.lock"] : [];
298
+ copyDir(src, dest, new Set(skipFiles), ["docs", templateDir].includes(item), frameworkDir, targetScope, sanitizeJson, adapter.id, dryRun);
225
299
  } else {
226
300
  if (item === "package.json") continue;
227
-
228
- if (fs.existsSync(dest) && !isAdapterShimFile(item)) {
229
- console.warn(`ā„¹ļø Skipping existing file: ${item}`);
230
- continue;
231
- }
301
+ if (fs.existsSync(dest) && !isAdapterShimFile(item)) continue;
232
302
 
233
303
  const ext = path.extname(item);
234
- const textExtensions = [".md", ".json", ".js", ".ts", ".txt", ""];
235
- if (textExtensions.includes(ext)) {
304
+ if ([".md", ".json", ".js", ".ts", ".txt", ""].includes(ext)) {
236
305
  let content = fs.readFileSync(src, "utf8");
237
306
  content = remapFrameworkContent(content, frameworkDir, adapter.id);
238
-
239
307
  if (ext === ".json") {
240
308
  try {
241
309
  const json = JSON.parse(content);
242
310
  content = JSON.stringify(sanitizeJson(json, targetScope), null, 2);
243
311
  content = remapFrameworkContent(content, frameworkDir, adapter.id);
244
- } catch {
245
- content = content.replace(/workspace:[^"'\s]*/g, "*");
246
- }
312
+ } catch { content = content.replace(/workspace:[^"'\s]*/g, "*"); }
247
313
  }
248
-
249
314
  writeTextFile(dest, content, dryRun);
250
- } else {
251
- if (dryRun) {
252
- console.warn(`[DRY RUN] Would copy binary file: ${dest}`);
253
- } else {
254
- fs.copyFileSync(src, dest);
255
- }
315
+ } else if (!dryRun) {
316
+ fs.copyFileSync(src, dest);
256
317
  }
257
318
  }
258
- console.warn(`āœ… ${item} processed -> ${path.relative(targetDir, dest)}`);
259
319
  }
260
320
 
261
- if (!dryRun) {
262
- mergePackageJson(path.join(targetDir, "package.json"), path.join(sourceDir, "package.json"));
263
- } else {
264
- console.warn("[DRY RUN] Would merge package.json content.");
265
- }
266
-
321
+ if (!dryRun) mergePackageJson(path.join(targetDir, "package.json"), path.join(sourceDir, "package.json"));
267
322
  updateGitIgnore(path.join(targetDir, ".gitignore"), frameworkDir, dryRun);
323
+ initializeMemory(path.join(targetFrameworkDir, "memory/PROJECT_MEMORY.md"), frameworkDir, dryRun);
324
+ if (!dryRun) deepCleanProtocols(targetDir, targetScope);
268
325
 
269
- const finalMemoryPath = path.join(targetFrameworkDir, "memory/PROJECT_MEMORY.md");
270
- initializeMemory(finalMemoryPath, frameworkDir, dryRun);
326
+ // Scaffold core agents under the central framework directory
327
+ scaffoldCoreAgents(path.join(targetFrameworkDir, "agents"), dryRun);
271
328
 
272
- if (!dryRun) {
273
- deepCleanProtocols(targetDir, targetScope);
274
- } else {
275
- console.warn("[DRY RUN] Would clean specific workspace protocols.");
276
- }
277
-
278
- const sampleTestPath = path.join(targetDir, "tests/initial.test.ts");
279
- if (!fs.existsSync(sampleTestPath)) {
280
- writeTextFile(
281
- sampleTestPath,
282
- `import { describe, it, expect } from "vitest";
283
-
284
- describe("Initial Setup", () => {
285
- it("should verify the testing environment is active", () => {
286
- expect(true).toBe(true);
287
- });
288
- });
289
- `,
290
- dryRun,
291
- );
292
- }
293
-
294
- const cursorRulesPath = path.join(targetDir, ".cursorrules");
295
- if (!fs.existsSync(cursorRulesPath)) {
296
- writeTextFile(
297
- cursorRulesPath,
298
- `# Agent Enderun — Cursor IDE Rules
299
-
300
- This is the primary entry point when using Agent Enderun within the Cursor IDE (Chat & Composer).
301
-
302
- The framework operates under a unified governance structure located in the ${frameworkDir}/ directory.
303
-
304
- ### Primary Constitution
305
- All governance rules, agent checklists, and project memory live here:
306
-
307
- šŸ‘‰ **[${frameworkDir}/ENDERUN.md](${frameworkDir}/ENDERUN.md)**
308
-
309
- ### šŸ¤– Agent Directive
310
- You are operating under the Agent Enderun governance framework.
311
-
312
- At the **start of every session**, before any work:
313
- 1. **Restore Memory:** Read ${frameworkDir}/PROJECT_MEMORY.md to restore state, active Trace ID, and history.
314
- 2. **Load Identity:** Read the relevant agent definition under ${frameworkDir}/agents/{agent}.md (default to @manager).
315
- 3. **Internalize Knowledge:** Reference the ${frameworkDir}/knowledge/ base for architectural and coding standards.
316
-
317
- ### šŸ’¾ Memory Tiers
318
- - **Project Memory (Shared):** ${frameworkDir}/PROJECT_MEMORY.md is the source of truth for task history, Trace IDs, and architectural decisions. **Update this at the end of every turn.**
319
- - **Private Memory (User-Specific):** Use the local .gitignored memory directory (e.g. ${frameworkDir}/memory/) for personal workflows or user-specific notes that should not be committed to Git. Never use the system's /tmp directory.
320
- - **Project Instructions:** This .cursorrules file contains the "Supreme Law" and coding standards.
321
-
322
- ### šŸ›”ļø Core Mandates
323
- - **Surgical Edits:** Use replace_text or patch_file via MCP for precise changes.
324
- - **Traceability:** Every action must inherit the active Trace ID from memory.
325
- - **Contract First:** No implementation without verified types.
326
- - **NEVER FORGET:** @manager MUST update ${frameworkDir}/PROJECT_MEMORY.md at the end of EVERY session without exception. This is a non-negotiable process integrity rule.
327
-
328
- All paths and references inside the project must comply with the Supreme Constitution located at ${frameworkDir}/ENDERUN.md`.trim() + "\n",
329
- dryRun,
330
- );
331
- }
332
-
333
- if (!fs.existsSync(path.join(targetDir, ".git"))) {
334
- try {
335
- if (dryRun) {
336
- console.warn("[DRY RUN] Would initialize git repository.");
337
- } else {
338
- execSync("git init", { cwd: targetDir, stdio: "ignore" });
339
- console.warn("āœ… Git repository initialized.");
340
- }
341
- } catch {
342
- // ignore
343
- }
329
+ if (!fs.existsSync(path.join(targetDir, ".git")) && !dryRun) {
330
+ try { execSync("git init", { cwd: targetDir, stdio: "ignore" }); } catch { /* ignore */ }
344
331
  }
345
332
 
346
333
  console.warn(`\nšŸ› ļø Running ${adapter.id} adapter configuration...`);
347
- if (!dryRun) {
348
- runAdapterPostInit(adapter, targetDir);
349
- } else {
350
- console.warn(`[DRY RUN] Would run post-init steps for ${adapter.id}`);
351
- }
352
-
353
- // Always scaffold Antigravity (.agents/) workspace directory for cross-compatibility with agy CLI
354
- if (adapter.id === "antigravity" || adapter.id === "antigravity-cli" || adapter.id === "gemini") {
355
- const agentsFrameworkDir = path.join(targetDir, ".agents");
356
- if (!dryRun) {
357
- try {
358
- fs.mkdirSync(agentsFrameworkDir, { recursive: true });
359
- const agentsSubdir = path.join(agentsFrameworkDir, "agents");
360
- fs.mkdirSync(agentsSubdir, { recursive: true });
361
-
362
- // Create other standard Antigravity directories for custom workspace customizations
363
- fs.mkdirSync(path.join(agentsFrameworkDir, "skills"), { recursive: true });
364
- fs.mkdirSync(path.join(agentsFrameworkDir, "rules"), { recursive: true });
365
- fs.mkdirSync(path.join(agentsFrameworkDir, "workflows"), { recursive: true });
366
-
367
- // Write workspace-specific MCP config
368
- const mcpBlock = {
369
- mcpServers: {
370
- "agent-enderun": {
371
- command: "node",
372
- args: [path.join(targetDir, "framework-mcp/dist/index.js")],
373
- env: {
374
- "ENDERUN_PROJECT_ROOT": targetDir
375
- }
376
- }
377
- }
378
- };
379
- fs.writeFileSync(
380
- path.join(agentsFrameworkDir, "mcp_config.json"),
381
- JSON.stringify(mcpBlock, null, 2),
382
- "utf8"
383
- );
384
-
385
- // Write AGENTS.md at the project root for prepended global rules
386
- const agentsMdPath = path.join(targetDir, "AGENTS.md");
387
- if (!fs.existsSync(agentsMdPath)) {
388
- fs.writeFileSync(
389
- agentsMdPath,
390
- `# Agent Enderun Workspace Instructions
391
-
392
- You are operating under the Agent Enderun AI governance and orchestration framework.
393
-
394
- ### šŸ›”ļø Critical Guidelines
395
- 1. **Traceability First:** Every action or execution MUST inherit the active Trace ID from \`${frameworkDir}/PROJECT_MEMORY.md\`.
396
- 2. **Surgical Operations:** Use precise file replacements or patches. NEVER rewrite entire source files unnecessarily.
397
- 3. **Contract-First Design:** Backend models and type contracts must be locked and verified before frontend components are created.
398
- 4. **Memory Synchronization:** All agent runs must update the project memory logs before concluding the session.
399
-
400
- All rules and constraints defined in \`${frameworkDir}/ENDERUN.md\` are strictly binding.
401
- `.trim() + "\n",
402
- "utf8"
403
- );
404
- }
405
-
406
- // Write the 12 agent folders and agent.json files
407
- const allAgents = [
408
- {
409
- name: "manager",
410
- displayName: "Orchestration & Governance (Team-Lead)",
411
- description: "CTO, Lead Architect, and Orchestrator for Agent Enderun.",
412
- instructions: "You are the manager agent. Orchestrate workspace tasks, manage DAG dependency graphs, handle phase transitions, and enforce architectural standards.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Single Point of Authority: You are the sole entry point. No specialist acts without your briefing.\n- Traceability: Every action MUST inherit the active Trace ID.\n- Memory Discipline: MUST update PROJECT_MEMORY.md and log actions at the end of EVERY turn."
413
- },
414
- {
415
- name: "backend",
416
- displayName: "Domain Logic & Databases Specialist",
417
- description: "Responsible for core business logic, database migrations, security standards, API contracts, and server architecture.",
418
- instructions: "You are the backend agent. Build secure, high-performance, and consistent server architecture.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- No UI: Never implement UI or frontend logic.\n- Contract-First: Define shared contracts/branded types BEFORE any consumer code.\n- Branded Types Law: ALL IDs must use branded types (e.g., UserID). Plain strings are forbidden.\n- Zero Mock Policy: Use real endpoints/contracts only.\n- Surgical Edits: Use replace_text for all code changes."
419
- },
420
- {
421
- name: "frontend",
422
- displayName: "Fluid Responsive UI Specialist",
423
- description: "Builds responsive fluid user interfaces, manages styling tokens with Panda CSS, and implements state machines.",
424
- instructions: "You are the frontend agent. Build original, high-performance, and responsive user interfaces.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Responsive-First: Mobile-First (320px) is mandatory. Fixed-width is forbidden.\n- Zero UI Library Policy: No shadcn/ui, MUI, etc. Build everything with Panda CSS.\n- Zero Mock Policy: Use real endpoints/contracts only.\n- Contract-First: Use branded types from apps/backend/src/types.\n- No Native Alerts: Use integrated Toaster/Modal components."
425
- },
426
- {
427
- name: "quality",
428
- displayName: "Automated Testing & Quality Specialist",
429
- description: "Verifies test coverage, audits compliance with the constitution, conducts AST scanning, and verifies CI/CD status.",
430
- instructions: "You are the quality agent. Ensure no code is merged or deployed without meeting standards.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Final Gate: No code merges or deploys proceed without quality sign-off.\n- Verification-First: Audit lint, typecheck, contract drift, and branded types before sign-off.\n- Never Implement: Audit and assess only. Never write application features.\n- Zero Mock Policy: Integration tests must use real/service-compatible backends.\n- Coverage Gate: Reject approvals if coverage falls below >80% threshold in core."
431
- },
432
- {
433
- name: "database",
434
- displayName: "Database Migrations & Tuning Specialist",
435
- description: "Designs SQL schemas, manages migration scripts via Kysely, optimizes queries, indexes, and seeding logic.",
436
- instructions: "You are the database agent. Build secure, optimized, and scalable data layers.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Self-Contained DB: Every backend application MUST manage its own schema/migrations/seeds in its own src/database/ directory.\n- Contract-First: All schemas MUST be derived from branded types.\n- Kysely Standard: Use Kysely for application queries. Raw SQL is forbidden.\n- Zero Mock Policy: Realistic, contract-aware seed data only.\n- Surgical Edits: Use replace_text for all schema/migration changes."
437
- },
438
- {
439
- name: "devops",
440
- displayName: "Infrastructure & CI/CD Specialist",
441
- description: "Handles deployment pipelines, environment variables, system containerization, logging & telemetry integrations.",
442
- instructions: "You are the devops agent. Ensure reliable execution in every environment with strict quality gates.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Gate Approvals: NEVER deploy to production without quality gate approval.\n- No Docker Policy: Prefer native Node.js unless explicitly overridden by manager.\n- Environment Parity: Identical configs across dev/staging/prod (except secrets).\n- Secrets Security: NEVER hardcode secrets. Use environment variables.\n- Rollback First: Deployment is BLOCKED if no documented rollback plan exists."
443
- },
444
- {
445
- name: "explorer",
446
- displayName: "Codebase Discovery Specialist",
447
- description: "Maps code dependencies, performs project scans, identifies architectural gaps, and supports legacy onboarding.",
448
- instructions: "You are the explorer agent. Map project structure and provide deep context to other agents.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Read-Only: Never write production code. Only discover, map, and report.\n- Search-First: Always use search_codebase before reading large files.\n- Surgical Discovery: Focus on entry points and core domain logic.\n- Zero Mock Policy: Analyze real system state only.\n- Traceability: All findings must be linked to a Trace ID."
449
- },
450
- {
451
- name: "git",
452
- displayName: "Version Control Specialist",
453
- description: "Manages commit histories, branches, Trace ID alignment, semantic tagging, and merge conflicts.",
454
- instructions: "You are the git agent. Ensure a clean, atomic, and traceable repository history.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Trace ID Tagging: EVERY commit must include the active Trace ID in the message.\n- Atomic Integrity: Every commit must represent exactly one logical change.\n- Health-First: Never commit code that fails build or basic tests.\n- No Push: Do not run git push without explicit USER approval.\n- No Force: Never use git push --force on public branches."
455
- },
456
- {
457
- name: "mobile",
458
- displayName: "Mobile App Specialist",
459
- description: "Develops cross-platform mobile apps using React Native and Expo with clean component states.",
460
- instructions: "You are the mobile agent. Build high-performance, responsive mobile apps (React Native/Expo).\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Zero UI Library: Same discipline as web. Build UI from scratch.\n- Contract-First: Use shared types from apps/backend/src/types.\n- Responsive-First: Mobile-First approach is mandatory.\n- Safe Area: Handle iOS/Android safe area insets on every screen.\n- Performance: Target 60 FPS."
461
- },
462
- {
463
- name: "native",
464
- displayName: "Native OS Integration Specialist",
465
- description: "Builds lightweight desktop wrappers and system integrations using Tauri or Electron.",
466
- instructions: "You are the native agent. Build secure, efficient desktop apps (Tauri/Electron).\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Security-First: No remote code execution. Mandatory sandboxing and strict CSP.\n- Secure Storage: Use Keychain/Credential Manager for sensitive data.\n- IPC Contract: All communication between frontend and native MUST be typed.\n- Contract-First: Define IPC and data contracts before implementation.\n- Surgical Edits: Use replace_text for all code changes."
467
- },
468
- {
469
- name: "security",
470
- displayName: "Security & Cryptography Specialist",
471
- description: "Enforces authentication flows, CSP policies, credential rotation, RLS constraints, and cryptographic safety.",
472
- instructions: "You are the security agent. Ensure all endpoints, database connections, and authentication flows satisfy strict enterprise compliance policies.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Sandboxed Security First: Enforce Row Level Security (RLS) on all database tables.\n- Credential Rotation Policy: Credentials, keys, and tokens must never be hardcoded. Use vault/env variables.\n- CSP & CORS Strictness: Never open wildcards (*) for CORS or CSP policies.\n- Surgical Edits: Use replace_text for all security patches."
473
- },
474
- {
475
- name: "analyst",
476
- displayName: "Contract Verification & Business Analyst",
477
- description: "Validates business specifications, tests database contract integrity, and audits constitutional compliance.",
478
- instructions: "You are the analyst agent. Independently verify compliance with contracts and specifications between frontend, backend, and the constitution.\n\nšŸ›‘ NON-NEGOTIABLE CORE RULES:\n- Independent Stance: Act as an objective verification gate.\n- Contract-First Law: Ensure contract.version.json perfectly matches types.\n- Escalation Priority: Report all contract drift to manager immediately.\n- Surgical Edits: Use replace_text for all document updates."
479
- }
480
- ];
481
-
482
- for (const ag of allAgents) {
483
- const agentDir = path.join(agentsSubdir, ag.name);
484
- fs.mkdirSync(agentDir, { recursive: true });
485
-
486
- const payload = {
487
- name: ag.name,
488
- displayName: ag.displayName,
489
- description: ag.description,
490
- hidden: false,
491
- customAgentSpec: {
492
- customAgent: {
493
- systemPromptSections: [
494
- {
495
- title: "Instructions",
496
- content: ag.instructions
497
- }
498
- ],
499
- toolNames: [
500
- "view_file",
501
- "replace_file_content",
502
- "write_to_file",
503
- "run_command",
504
- "grep_search",
505
- "list_dir"
506
- ]
507
- }
508
- }
509
- };
510
-
511
- fs.writeFileSync(
512
- path.join(agentDir, "agent.json"),
513
- JSON.stringify(payload, null, 2),
514
- "utf8"
515
- );
516
- }
517
- console.warn(`āœ… Scaffolding ${allAgents.length} Antigravity agents under .agents/agents/...`);
518
- } catch {
519
- // fallback
520
- }
521
- }
522
- }
523
-
524
- console.warn(`\nā™Š ${adapter.id.toUpperCase()}: Setup complete.`);
525
- console.warn(` • Framework runtime: ${frameworkDir}/`);
526
- console.warn(` • Entrypoint shim: ${shimFile}`);
527
- if (adapter.nestedDirs?.length) {
528
- console.warn(` • Nested: ${adapter.nestedDirs.map((d) => `${frameworkDir}/${d}/`).join(", ")}`);
529
- }
530
-
531
- const pkgMgr = getPackageManager();
532
- const installCmd = pkgMgr === "npm" ? "npm install" : `${pkgMgr} install`;
533
- const buildCmd = pkgMgr === "npm" ? "npm run enderun:build" : `${pkgMgr} run enderun:build`;
334
+ if (!dryRun) runAdapterPostInit(adapter, targetDir);
534
335
 
535
336
  console.warn(`\n✨ Framework scaffolded! (v${FRAMEWORK_VERSION})`);
536
- console.warn("\nšŸ›”ļø AL (Agent Lifecycle) Note: Your init is now configured for full army compliance.");
537
- console.warn(" Run `agent-enderun check` (or the validate script) to confirm all agents have proper stateMachine + tags.");
538
-
539
- if (dryRun || process.env.ENDERUN_SKIP_INSTALL === "1") {
540
- console.warn(`\nā­ļø Skipping install steps (${dryRun ? "Dry-Run" : "ENDERUN_SKIP_INSTALL=1"}).`);
541
- return;
542
- }
543
-
544
- try {
545
- console.warn("\nšŸ” Step 3/3: Running 'agent-enderun check' (includes AL validation)...");
546
- checkCommand();
547
-
548
- // Automatic dedicated AL (Agent Lifecycle) check after init
549
- console.warn("\nšŸ›”ļø Automatic post-init AL Army Validation (validate-agent-army)...");
337
+ if (!dryRun && process.env.ENDERUN_SKIP_INSTALL !== "1") {
550
338
  try {
551
- execSync("node bin/validate-agent-army.js", { stdio: "inherit" });
552
- console.warn("āœ… Automatic AL validation PASSED - all agents are lifecycle compliant (stateMachine + tags)!");
553
- } catch (alErr) {
554
- console.warn("āš ļø Automatic AL validation reported issues (see above in check output).");
555
- console.warn(" You can re-run manually: node bin/validate-agent-army.js or agent-enderun check");
556
- }
557
-
558
- console.warn("\nšŸš€ Agent Enderun is fully installed and verified!");
559
- } catch (e: unknown) {
560
- const message = e instanceof Error ? e.message : String(e);
561
- console.error("\nāŒ Automatic installation failed. Run manually:");
562
- console.warn(`šŸ‘‰ ${installCmd} && ${buildCmd}`);
563
- console.error(message);
339
+ console.warn("\nšŸ” Running health check...");
340
+ checkCommand();
341
+ const validatorPath = getValidatorPath();
342
+ execSync(`node "${validatorPath}"`, { stdio: "inherit" });
343
+ } catch { /* ignore validation report */ }
564
344
  }
565
345
  }