atabey 0.0.5 → 0.0.7

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 (388) hide show
  1. package/ATABEY.md +4 -4
  2. package/README.md +35 -33
  3. package/bin/cli.js +2 -2
  4. package/bin/validate-agent-army.js +6 -6
  5. package/dist/framework-mcp/src/constants.js +1 -1
  6. package/dist/framework-mcp/src/constants.js.map +1 -1
  7. package/dist/framework-mcp/src/index.d.ts +1 -0
  8. package/dist/framework-mcp/src/index.js +30 -5
  9. package/dist/framework-mcp/src/index.js.map +1 -1
  10. package/dist/framework-mcp/src/resources/index.d.ts +10 -0
  11. package/dist/framework-mcp/src/resources/index.js +59 -0
  12. package/dist/framework-mcp/src/resources/index.js.map +1 -0
  13. package/dist/framework-mcp/src/tools/control_plane/locking.js +3 -3
  14. package/dist/framework-mcp/src/tools/control_plane/locking.js.map +1 -1
  15. package/dist/framework-mcp/src/tools/control_plane/registry.js +3 -2
  16. package/dist/framework-mcp/src/tools/control_plane/registry.js.map +1 -1
  17. package/dist/framework-mcp/src/tools/definitions.js +33 -1
  18. package/dist/framework-mcp/src/tools/definitions.js.map +1 -1
  19. package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.d.ts +1 -1
  20. package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js +8 -3
  21. package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js.map +1 -1
  22. package/dist/framework-mcp/src/tools/file_system/patch_file.d.ts +1 -1
  23. package/dist/framework-mcp/src/tools/file_system/patch_file.js +8 -3
  24. package/dist/framework-mcp/src/tools/file_system/patch_file.js.map +1 -1
  25. package/dist/framework-mcp/src/tools/file_system/read_file.js +3 -3
  26. package/dist/framework-mcp/src/tools/file_system/read_file.js.map +1 -1
  27. package/dist/framework-mcp/src/tools/file_system/replace_text.d.ts +1 -1
  28. package/dist/framework-mcp/src/tools/file_system/replace_text.js +8 -3
  29. package/dist/framework-mcp/src/tools/file_system/replace_text.js.map +1 -1
  30. package/dist/framework-mcp/src/tools/file_system/write_file.d.ts +1 -1
  31. package/dist/framework-mcp/src/tools/file_system/write_file.js +10 -5
  32. package/dist/framework-mcp/src/tools/file_system/write_file.js.map +1 -1
  33. package/dist/framework-mcp/src/tools/framework/audit_deps.js +2 -2
  34. package/dist/framework-mcp/src/tools/framework/audit_deps.js.map +1 -1
  35. package/dist/framework-mcp/src/tools/framework/run_tests.js +2 -2
  36. package/dist/framework-mcp/src/tools/framework/run_tests.js.map +1 -1
  37. package/dist/framework-mcp/src/tools/framework/submit_plan.d.ts +10 -0
  38. package/dist/framework-mcp/src/tools/framework/submit_plan.js +14 -0
  39. package/dist/framework-mcp/src/tools/framework/submit_plan.js.map +1 -0
  40. package/dist/framework-mcp/src/tools/framework/update_memory.js +1 -1
  41. package/dist/framework-mcp/src/tools/framework/update_memory.js.map +1 -1
  42. package/dist/framework-mcp/src/tools/index.js +2 -0
  43. package/dist/framework-mcp/src/tools/index.js.map +1 -1
  44. package/dist/framework-mcp/src/tools/memory/get_insights.js +1 -1
  45. package/dist/framework-mcp/src/tools/memory/get_insights.js.map +1 -1
  46. package/dist/framework-mcp/src/tools/messaging/log_action.js +1 -1
  47. package/dist/framework-mcp/src/tools/messaging/log_action.js.map +1 -1
  48. package/dist/framework-mcp/src/tools/messaging/send_message.js +5 -5
  49. package/dist/framework-mcp/src/tools/messaging/send_message.js.map +1 -1
  50. package/dist/framework-mcp/src/tools/observability/check_ports.js +1 -1
  51. package/dist/framework-mcp/src/tools/observability/check_ports.js.map +1 -1
  52. package/dist/framework-mcp/src/tools/quality/check_lint.js +2 -2
  53. package/dist/framework-mcp/src/tools/quality/check_lint.js.map +1 -1
  54. package/dist/framework-mcp/src/tools/search/get_gaps.js +1 -1
  55. package/dist/framework-mcp/src/tools/search/get_gaps.js.map +1 -1
  56. package/dist/framework-mcp/src/tools/search/grep_search.js +3 -3
  57. package/dist/framework-mcp/src/tools/search/grep_search.js.map +1 -1
  58. package/dist/framework-mcp/src/tools/types.d.ts +1 -0
  59. package/dist/framework-mcp/src/utils/compliance.d.ts +6 -0
  60. package/dist/framework-mcp/src/utils/compliance.js +158 -5
  61. package/dist/framework-mcp/src/utils/compliance.js.map +1 -1
  62. package/dist/framework-mcp/src/utils/permissions.d.ts +12 -0
  63. package/dist/framework-mcp/src/utils/permissions.js +72 -0
  64. package/dist/framework-mcp/src/utils/permissions.js.map +1 -0
  65. package/dist/framework-mcp/tests/tools/file_system/compliance-risk.test.js +84 -0
  66. package/dist/framework-mcp/tests/tools/file_system/compliance-risk.test.js.map +1 -0
  67. package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js +31 -31
  68. package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js.map +1 -1
  69. package/dist/framework-mcp/tests/tools/file_system/permissions.test.d.ts +1 -0
  70. package/dist/framework-mcp/tests/tools/file_system/permissions.test.js +92 -0
  71. package/dist/framework-mcp/tests/tools/file_system/permissions.test.js.map +1 -0
  72. package/dist/framework-mcp/tests/tools/messaging/send_message.test.js +5 -5
  73. package/dist/framework-mcp/tests/tools/messaging/send_message.test.js.map +1 -1
  74. package/dist/src/cli/adapters/core.js +1 -1
  75. package/dist/src/cli/adapters/core.js.map +1 -1
  76. package/dist/src/cli/adapters/scaffold.js +2 -2
  77. package/dist/src/cli/adapters/scaffold.js.map +1 -1
  78. package/dist/src/cli/commands/check.js +5 -3
  79. package/dist/src/cli/commands/check.js.map +1 -1
  80. package/dist/src/cli/commands/compliance.js +2 -2
  81. package/dist/src/cli/commands/compliance.js.map +1 -1
  82. package/dist/src/cli/commands/contract.js +2 -2
  83. package/dist/src/cli/commands/contract.js.map +1 -1
  84. package/dist/src/cli/commands/dashboard.d.ts +5 -0
  85. package/dist/src/cli/commands/dashboard.js +124 -0
  86. package/dist/src/cli/commands/dashboard.js.map +1 -0
  87. package/dist/src/cli/commands/explorer.js +3 -3
  88. package/dist/src/cli/commands/explorer.js.map +1 -1
  89. package/dist/src/cli/commands/git.js +3 -3
  90. package/dist/src/cli/commands/git.js.map +1 -1
  91. package/dist/src/cli/commands/init/create-agent.d.ts +4 -0
  92. package/dist/src/cli/commands/init/create-agent.js +59 -0
  93. package/dist/src/cli/commands/init/create-agent.js.map +1 -0
  94. package/dist/src/cli/commands/init/scaffold-core.d.ts +1 -0
  95. package/dist/src/cli/commands/init/scaffold-core.js +11 -7
  96. package/dist/src/cli/commands/init/scaffold-core.js.map +1 -1
  97. package/dist/src/cli/commands/init/scaffold-docs.d.ts +1 -0
  98. package/dist/src/cli/commands/init/scaffold-docs.js +4 -6
  99. package/dist/src/cli/commands/init/scaffold-docs.js.map +1 -1
  100. package/dist/src/cli/commands/init/scaffold-ops.js +4 -4
  101. package/dist/src/cli/commands/init/scaffold-ops.js.map +1 -1
  102. package/dist/src/cli/commands/init/scaffold-standards.js +10 -8
  103. package/dist/src/cli/commands/init/scaffold-standards.js.map +1 -1
  104. package/dist/src/cli/commands/init.js +26 -10
  105. package/dist/src/cli/commands/init.js.map +1 -1
  106. package/dist/src/cli/commands/knowledge.js +3 -3
  107. package/dist/src/cli/commands/knowledge.js.map +1 -1
  108. package/dist/src/cli/commands/lint.js +2 -2
  109. package/dist/src/cli/commands/lint.js.map +1 -1
  110. package/dist/src/cli/commands/log.js +6 -28
  111. package/dist/src/cli/commands/log.js.map +1 -1
  112. package/dist/src/cli/commands/orchestrate.d.ts +10 -17
  113. package/dist/src/cli/commands/orchestrate.js +92 -341
  114. package/dist/src/cli/commands/orchestrate.js.map +1 -1
  115. package/dist/src/cli/commands/plan.d.ts +5 -0
  116. package/dist/src/cli/commands/plan.js +80 -59
  117. package/dist/src/cli/commands/plan.js.map +1 -1
  118. package/dist/src/cli/commands/script.js +3 -3
  119. package/dist/src/cli/commands/script.js.map +1 -1
  120. package/dist/src/cli/commands/security.js +2 -2
  121. package/dist/src/cli/commands/security.js.map +1 -1
  122. package/dist/src/cli/commands/status.js +65 -8
  123. package/dist/src/cli/commands/status.js.map +1 -1
  124. package/dist/src/cli/commands/trace.d.ts +4 -0
  125. package/dist/src/cli/commands/trace.js +83 -2
  126. package/dist/src/cli/commands/trace.js.map +1 -1
  127. package/dist/src/cli/index.js +68 -18
  128. package/dist/src/cli/index.js.map +1 -1
  129. package/dist/src/cli/shims.js +14 -14
  130. package/dist/src/cli/utils/claude.js +1 -1
  131. package/dist/src/cli/utils/claude.js.map +1 -1
  132. package/dist/src/cli/utils/compliance.js +7 -1
  133. package/dist/src/cli/utils/compliance.js.map +1 -1
  134. package/dist/src/cli/utils/fs.js +1 -1
  135. package/dist/src/cli/utils/fs.js.map +1 -1
  136. package/dist/src/cli/utils/i18n.d.ts +1 -0
  137. package/dist/src/cli/utils/i18n.js +2 -0
  138. package/dist/src/cli/utils/i18n.js.map +1 -1
  139. package/dist/src/cli/utils/memory.d.ts +12 -3
  140. package/dist/src/cli/utils/memory.js +39 -31
  141. package/dist/src/cli/utils/memory.js.map +1 -1
  142. package/dist/src/cli/utils/pkg.js +2 -2
  143. package/dist/src/cli/utils/pkg.js.map +1 -1
  144. package/dist/src/cli/utils/schemas.d.ts +8 -8
  145. package/dist/src/cli/utils/ui.js +4 -4
  146. package/dist/src/cli/utils/ui.js.map +1 -1
  147. package/dist/src/contracts/tasks.d.ts +2 -2
  148. package/dist/src/dashboard/vite.config.d.ts +2 -0
  149. package/dist/src/dashboard/vite.config.js +16 -0
  150. package/dist/src/dashboard/vite.config.js.map +1 -0
  151. package/dist/src/modules/adapters/definitions.js +10 -10
  152. package/dist/src/modules/adapters/definitions.js.map +1 -1
  153. package/dist/src/modules/adapters/shared.js +4 -4
  154. package/dist/src/modules/adapters/shared.js.map +1 -1
  155. package/dist/src/modules/agents/definitions.d.ts +19 -0
  156. package/dist/src/modules/agents/definitions.js +74 -21
  157. package/dist/src/modules/agents/definitions.js.map +1 -1
  158. package/dist/src/modules/agents/registry/backend.js +8 -0
  159. package/dist/src/modules/agents/registry/backend.js.map +1 -1
  160. package/dist/src/modules/agents/registry/database.js +7 -0
  161. package/dist/src/modules/agents/registry/database.js.map +1 -1
  162. package/dist/src/modules/agents/registry/devops.js +6 -0
  163. package/dist/src/modules/agents/registry/devops.js.map +1 -1
  164. package/dist/src/modules/agents/registry/frontend.js +8 -0
  165. package/dist/src/modules/agents/registry/frontend.js.map +1 -1
  166. package/dist/src/modules/agents/registry/security.js +6 -0
  167. package/dist/src/modules/agents/registry/security.js.map +1 -1
  168. package/dist/src/modules/agents/types.d.ts +2 -0
  169. package/dist/src/modules/engines/evaluation-engine.d.ts +11 -0
  170. package/dist/src/modules/engines/evaluation-engine.js +103 -0
  171. package/dist/src/modules/engines/evaluation-engine.js.map +1 -0
  172. package/dist/src/modules/engines/health-engine.d.ts +16 -0
  173. package/dist/src/modules/engines/health-engine.js +50 -0
  174. package/dist/src/modules/engines/health-engine.js.map +1 -0
  175. package/dist/src/modules/engines/planning-engine.d.ts +25 -0
  176. package/dist/src/modules/engines/planning-engine.js +79 -0
  177. package/dist/src/modules/engines/planning-engine.js.map +1 -0
  178. package/dist/src/modules/engines/risk-engine.d.ts +18 -0
  179. package/dist/src/modules/engines/risk-engine.js +106 -0
  180. package/dist/src/modules/engines/risk-engine.js.map +1 -0
  181. package/dist/src/modules/engines/routing-engine.d.ts +11 -0
  182. package/dist/src/modules/engines/routing-engine.js +74 -0
  183. package/dist/src/modules/engines/routing-engine.js.map +1 -0
  184. package/dist/src/modules/engines/types.d.ts +47 -0
  185. package/dist/src/modules/engines/types.js +2 -0
  186. package/dist/src/modules/engines/types.js.map +1 -0
  187. package/dist/src/shared/constants.d.ts +5 -2
  188. package/dist/src/shared/constants.js +4 -1
  189. package/dist/src/shared/constants.js.map +1 -1
  190. package/dist/src/shared/fs.d.ts +1 -0
  191. package/dist/src/shared/fs.js +4 -0
  192. package/dist/src/shared/fs.js.map +1 -1
  193. package/dist/src/shared/storage.d.ts +60 -0
  194. package/dist/src/shared/storage.js +208 -0
  195. package/dist/src/shared/storage.js.map +1 -0
  196. package/dist/tests/agent-memory-v2.test.d.ts +1 -0
  197. package/dist/tests/agent-memory-v2.test.js +68 -0
  198. package/dist/tests/agent-memory-v2.test.js.map +1 -0
  199. package/dist/tests/agents-definitions.test.js +42 -0
  200. package/dist/tests/agents-definitions.test.js.map +1 -1
  201. package/dist/tests/integration/hermes_locking.test.js +7 -10
  202. package/dist/tests/integration/hermes_locking.test.js.map +1 -1
  203. package/dist/tests/orchestrate.test.js +5 -1
  204. package/dist/tests/orchestrate.test.js.map +1 -1
  205. package/dist/tests/orchestrator-dependencies.test.d.ts +1 -0
  206. package/dist/tests/orchestrator-dependencies.test.js +52 -0
  207. package/dist/tests/orchestrator-dependencies.test.js.map +1 -0
  208. package/dist/tests/plan.test.d.ts +1 -0
  209. package/dist/tests/plan.test.js +63 -0
  210. package/dist/tests/plan.test.js.map +1 -0
  211. package/dist/tests/planning-engine.test.d.ts +1 -0
  212. package/dist/tests/planning-engine.test.js +50 -0
  213. package/dist/tests/planning-engine.test.js.map +1 -0
  214. package/dist/tests/status-cost.test.d.ts +1 -0
  215. package/dist/tests/status-cost.test.js +54 -0
  216. package/dist/tests/status-cost.test.js.map +1 -0
  217. package/dist/tests/status.test.js +8 -7
  218. package/dist/tests/status.test.js.map +1 -1
  219. package/dist/tests/trace-replay.test.d.ts +1 -0
  220. package/dist/tests/trace-replay.test.js +65 -0
  221. package/dist/tests/trace-replay.test.js.map +1 -0
  222. package/dist/tests/trace.test.js +14 -7
  223. package/dist/tests/trace.test.js.map +1 -1
  224. package/dist/ui/assets/index-Bkt7APzu.css +1 -0
  225. package/dist/ui/assets/index-CeX-06mI.js +49 -0
  226. package/dist/ui/index.html +14 -0
  227. package/package.json +5 -4
  228. package/templates/prompts/contract-design-recipe.md +1 -1
  229. package/templates/prompts/db-management-recipe.md +3 -3
  230. package/templates/prompts/deployment-recipe.md +3 -3
  231. package/templates/prompts/performance-optimization-recipe.md +3 -3
  232. package/templates/prompts/pull-request-template.md +2 -2
  233. package/templates/prompts/security-audit-recipe.md +3 -3
  234. package/templates/standards/crud-governance.md +1 -1
  235. package/templates/standards/deployment-standards.md +1 -1
  236. package/templates/standards/governance-standards.md +1 -1
  237. package/templates/standards/llm-governance.md +1 -1
  238. package/templates/standards/nextjs-standards.md +13 -0
  239. package/templates/standards/observability-standards.md +1 -1
  240. package/templates/standards/security-audit-standards.md +1 -1
  241. package/templates/standards/security-standards.md +1 -1
  242. package/templates/standards/testing-standards.md +1 -1
  243. package/templates/standards/vite-standards.md +13 -0
  244. package/framework-mcp/dist/constants.js +0 -64
  245. package/framework-mcp/dist/index.js +0 -119
  246. package/framework-mcp/dist/tools/control_plane/locking.js +0 -82
  247. package/framework-mcp/dist/tools/control_plane/registry.js +0 -34
  248. package/framework-mcp/dist/tools/definitions.js +0 -290
  249. package/framework-mcp/dist/tools/file_system/batch_surgical_edit.js +0 -59
  250. package/framework-mcp/dist/tools/file_system/patch_file.js +0 -29
  251. package/framework-mcp/dist/tools/file_system/read_file.js +0 -51
  252. package/framework-mcp/dist/tools/file_system/replace_text.js +0 -45
  253. package/framework-mcp/dist/tools/file_system/write_file.js +0 -38
  254. package/framework-mcp/dist/tools/framework/audit_deps.js +0 -41
  255. package/framework-mcp/dist/tools/framework/get_status.js +0 -5
  256. package/framework-mcp/dist/tools/framework/orchestrate.js +0 -5
  257. package/framework-mcp/dist/tools/framework/run_tests.js +0 -27
  258. package/framework-mcp/dist/tools/framework/update_contract_hash.js +0 -5
  259. package/framework-mcp/dist/tools/framework/update_memory.js +0 -8
  260. package/framework-mcp/dist/tools/index.js +0 -60
  261. package/framework-mcp/dist/tools/memory/get_insights.js +0 -34
  262. package/framework-mcp/dist/tools/memory/read_memory.js +0 -28
  263. package/framework-mcp/dist/tools/messaging/log_action.js +0 -22
  264. package/framework-mcp/dist/tools/messaging/send_message.js +0 -94
  265. package/framework-mcp/dist/tools/observability/check_ports.js +0 -26
  266. package/framework-mcp/dist/tools/observability/get_health.js +0 -19
  267. package/framework-mcp/dist/tools/quality/check_lint.js +0 -30
  268. package/framework-mcp/dist/tools/search/get_gaps.js +0 -48
  269. package/framework-mcp/dist/tools/search/get_map.js +0 -43
  270. package/framework-mcp/dist/tools/search/grep_search.js +0 -75
  271. package/framework-mcp/dist/tools/search/list_dir.js +0 -28
  272. package/framework-mcp/dist/tools/shell/run_command.js +0 -56
  273. package/framework-mcp/dist/utils/cli.js +0 -59
  274. package/framework-mcp/dist/utils/compliance.js +0 -78
  275. package/framework-mcp/dist/utils/fs.js +0 -44
  276. package/framework-mcp/dist/utils/metrics.js +0 -56
  277. package/framework-mcp/dist/utils/security.js +0 -60
  278. package/framework-mcp/package-lock.json +0 -1191
  279. package/framework-mcp/package.json +0 -26
  280. package/framework-mcp/src/constants.ts +0 -78
  281. package/framework-mcp/src/declarations.d.ts +0 -17
  282. package/framework-mcp/src/index.ts +0 -144
  283. package/framework-mcp/src/tools/control_plane/locking.ts +0 -89
  284. package/framework-mcp/src/tools/control_plane/registry.ts +0 -38
  285. package/framework-mcp/src/tools/definitions.ts +0 -292
  286. package/framework-mcp/src/tools/file_system/batch_surgical_edit.ts +0 -79
  287. package/framework-mcp/src/tools/file_system/patch_file.ts +0 -39
  288. package/framework-mcp/src/tools/file_system/read_file.ts +0 -58
  289. package/framework-mcp/src/tools/file_system/replace_text.ts +0 -54
  290. package/framework-mcp/src/tools/file_system/write_file.ts +0 -45
  291. package/framework-mcp/src/tools/framework/audit_deps.ts +0 -49
  292. package/framework-mcp/src/tools/framework/get_status.ts +0 -7
  293. package/framework-mcp/src/tools/framework/orchestrate.ts +0 -7
  294. package/framework-mcp/src/tools/framework/run_tests.ts +0 -30
  295. package/framework-mcp/src/tools/framework/update_contract_hash.ts +0 -7
  296. package/framework-mcp/src/tools/framework/update_memory.ts +0 -10
  297. package/framework-mcp/src/tools/index.ts +0 -64
  298. package/framework-mcp/src/tools/memory/get_insights.ts +0 -41
  299. package/framework-mcp/src/tools/memory/read_memory.ts +0 -31
  300. package/framework-mcp/src/tools/messaging/log_action.ts +0 -28
  301. package/framework-mcp/src/tools/messaging/send_message.ts +0 -97
  302. package/framework-mcp/src/tools/observability/check_ports.ts +0 -30
  303. package/framework-mcp/src/tools/observability/get_health.ts +0 -24
  304. package/framework-mcp/src/tools/quality/check_lint.ts +0 -36
  305. package/framework-mcp/src/tools/search/get_gaps.ts +0 -54
  306. package/framework-mcp/src/tools/search/get_map.ts +0 -48
  307. package/framework-mcp/src/tools/search/grep_search.ts +0 -75
  308. package/framework-mcp/src/tools/search/list_dir.ts +0 -34
  309. package/framework-mcp/src/tools/shell/run_command.ts +0 -66
  310. package/framework-mcp/src/tools/types.ts +0 -89
  311. package/framework-mcp/src/utils/cli.ts +0 -53
  312. package/framework-mcp/src/utils/compliance.ts +0 -95
  313. package/framework-mcp/src/utils/fs.ts +0 -45
  314. package/framework-mcp/src/utils/metrics.ts +0 -73
  315. package/framework-mcp/src/utils/security.ts +0 -66
  316. package/framework-mcp/tests/tools/file_system/file_system_tools.test.ts +0 -212
  317. package/framework-mcp/tests/tools/messaging/send_message.test.ts +0 -136
  318. package/framework-mcp/tests/tools/quality/check_lint.test.ts +0 -46
  319. package/framework-mcp/tests/tools/shell/run_command.test.ts +0 -55
  320. package/framework-mcp/tsconfig.json +0 -14
  321. package/src/cli/adapters/core.ts +0 -91
  322. package/src/cli/adapters/index.ts +0 -5
  323. package/src/cli/adapters/paths.ts +0 -135
  324. package/src/cli/adapters/scaffold.ts +0 -95
  325. package/src/cli/adapters/utils.ts +0 -87
  326. package/src/cli/commands/approve.ts +0 -73
  327. package/src/cli/commands/check.ts +0 -188
  328. package/src/cli/commands/compliance.ts +0 -55
  329. package/src/cli/commands/contract.ts +0 -68
  330. package/src/cli/commands/explorer.ts +0 -45
  331. package/src/cli/commands/git.ts +0 -39
  332. package/src/cli/commands/init/scaffold-core.ts +0 -136
  333. package/src/cli/commands/init/scaffold-docs.ts +0 -44
  334. package/src/cli/commands/init/scaffold-ops.ts +0 -83
  335. package/src/cli/commands/init/scaffold-standards.ts +0 -67
  336. package/src/cli/commands/init.ts +0 -193
  337. package/src/cli/commands/knowledge.ts +0 -44
  338. package/src/cli/commands/lint.ts +0 -23
  339. package/src/cli/commands/log.ts +0 -37
  340. package/src/cli/commands/memory.ts +0 -6
  341. package/src/cli/commands/orchestrate.ts +0 -450
  342. package/src/cli/commands/plan.ts +0 -113
  343. package/src/cli/commands/script.ts +0 -20
  344. package/src/cli/commands/security.ts +0 -38
  345. package/src/cli/commands/status.ts +0 -44
  346. package/src/cli/commands/trace.ts +0 -31
  347. package/src/cli/index.ts +0 -322
  348. package/src/cli/shims.ts +0 -66
  349. package/src/cli/utils/claude.ts +0 -63
  350. package/src/cli/utils/compliance.ts +0 -191
  351. package/src/cli/utils/config-schema.ts +0 -48
  352. package/src/cli/utils/fs.ts +0 -170
  353. package/src/cli/utils/i18n.ts +0 -44
  354. package/src/cli/utils/memory.ts +0 -303
  355. package/src/cli/utils/pkg.ts +0 -317
  356. package/src/cli/utils/schemas.ts +0 -22
  357. package/src/cli/utils/string.ts +0 -55
  358. package/src/cli/utils/time.ts +0 -27
  359. package/src/cli/utils/ui.ts +0 -66
  360. package/src/contracts/index.ts +0 -1
  361. package/src/contracts/tasks.ts +0 -26
  362. package/src/modules/adapters/definitions.ts +0 -171
  363. package/src/modules/adapters/registry.ts +0 -27
  364. package/src/modules/adapters/shared.ts +0 -120
  365. package/src/modules/adapters/types.ts +0 -16
  366. package/src/modules/agents/definitions.ts +0 -460
  367. package/src/modules/agents/registry/analyst.ts +0 -44
  368. package/src/modules/agents/registry/architect.ts +0 -47
  369. package/src/modules/agents/registry/backend.ts +0 -46
  370. package/src/modules/agents/registry/database.ts +0 -43
  371. package/src/modules/agents/registry/devops.ts +0 -44
  372. package/src/modules/agents/registry/explorer.ts +0 -41
  373. package/src/modules/agents/registry/frontend.ts +0 -48
  374. package/src/modules/agents/registry/git.ts +0 -41
  375. package/src/modules/agents/registry/manager.ts +0 -58
  376. package/src/modules/agents/registry/mobile.ts +0 -44
  377. package/src/modules/agents/registry/native.ts +0 -44
  378. package/src/modules/agents/registry/quality.ts +0 -46
  379. package/src/modules/agents/registry/security.ts +0 -42
  380. package/src/modules/agents/types.ts +0 -37
  381. package/src/modules/skills/definitions.ts +0 -71
  382. package/src/schema/agent-lifecycle-schema.json +0 -59
  383. package/src/shared/constants.ts +0 -218
  384. package/src/shared/errors.ts +0 -75
  385. package/src/shared/fs.ts +0 -50
  386. package/src/shared/logger.ts +0 -139
  387. package/src/shared/types.ts +0 -20
  388. /package/{framework-mcp/dist/tools/types.js → dist/framework-mcp/tests/tools/file_system/compliance-risk.test.d.ts} +0 -0
@@ -1,31 +0,0 @@
1
- import { updateDocumentStore, generateULID, getFrameworkDir } from "../utils/memory.js";
2
- import { sanitizeInput, normalizeAgentName, normalizePriority } from "../utils/string.js";
3
-
4
- /**
5
- * Generate a new Trace ID and add it to project memory.
6
- */
7
- export async function traceNewCommand(description: string, agent = "manager", priority = "P2"): Promise<string | void> {
8
- const traceId = generateULID();
9
- const safeDescription = sanitizeInput(description);
10
- const safeAgent = normalizeAgentName(agent);
11
- const safePriority = normalizePriority(priority);
12
- const frameworkDir = getFrameworkDir();
13
- // ...
14
-
15
- // --- Document Store Write ---
16
- updateDocumentStore("task", {
17
- traceId,
18
- description: safeDescription,
19
- agent: safeAgent,
20
- priority: safePriority,
21
- status: "IN_PROGRESS",
22
- createdAt: new Date().toISOString()
23
- }, traceId, frameworkDir);
24
- // ----------------------------
25
-
26
- console.warn(`
27
- ✅ New Trace ID created: ${traceId}`);
28
- console.warn(`📝 Added to task list: ${description}
29
- `);
30
- return traceId;
31
- }
package/src/cli/index.ts DELETED
@@ -1,322 +0,0 @@
1
- #!/usr/bin/env node
2
- import fs from "fs";
3
- import { approveCommand } from "./commands/approve.js";
4
- import { checkCommand } from "./commands/check.js";
5
- import { updateApiContractCommand, verifyApiContractCommand } from "./commands/contract.js";
6
- import { initCommand } from "./commands/init.js";
7
- import { updateProjectMemoryCommand } from "./commands/memory.js";
8
- import { orchestrateCommand, sendMessage } from "./commands/orchestrate.js";
9
- import { planCommand } from "./commands/plan.js";
10
- import { statusCommand } from "./commands/status.js";
11
- import { traceNewCommand } from "./commands/trace.js";
12
- import { getMemoryPath, readActiveTraceId } from "./utils/memory.js";
13
- import { getPackageVersion, getValidatorPath } from "./utils/pkg.js";
14
-
15
- /**
16
- * Main CLI entry point.
17
- */
18
- async function main() {
19
- const args = process.argv.slice(2);
20
- const command = args[0];
21
-
22
- const KNOWN_COMMANDS = [
23
- "init", "check", "status", "trace:new", "update_project_memory",
24
- "plan", "orchestrate", "loop", "verify-contract", "update-contract",
25
- "validate", "validate-army", "check:al", "version", "-v", "--version", "help", "-h", "--help",
26
- "git:commit", "git:sync", "check:compliance", "explorer:graph", "explorer:audit",
27
- "knowledge:update", "knowledge:search", "log:action", "run-script", "security:audit", "check:lint", "approve"
28
- ];
29
-
30
- // Handle @agent delegation syntax
31
- if (command?.startsWith("@")) {
32
- const to = command;
33
- const content = args.slice(1).join(" ");
34
- if (!content) {
35
- process.stderr.write(`❌ Error: Missing task content for ${to}.\n`);
36
- process.stderr.write(`Usage: atabey ${to} "Your task description"\n`);
37
- process.exit(64);
38
- }
39
-
40
- const memoryPath = getMemoryPath();
41
-
42
- let traceId = "T-000";
43
- if (fs.existsSync(memoryPath)) {
44
- const memoryContent = fs.readFileSync(memoryPath, "utf8");
45
- const tid = readActiveTraceId(memoryContent);
46
- if (tid) traceId = tid.trim();
47
- }
48
-
49
- await sendMessage({
50
- from: "@manager",
51
- to,
52
- category: "DELEGATION",
53
- content,
54
- traceId
55
- });
56
-
57
- process.stdout.write(`✅ Task delegated to ${to} (Trace: ${traceId})\n`);
58
- process.stdout.write("👉 Run \"atabey orchestrate\" to process.\n");
59
- return;
60
- }
61
-
62
- switch (command) {
63
- case "init": {
64
- const dryRun = args.includes("--dry-run");
65
- const isUnified = args.includes("--unified");
66
- const forceYes = args.includes("--yes") || args.includes("-y");
67
- const adapter = args.find(a => !a.startsWith("-") && a !== "init") || "gemini";
68
- await initCommand(adapter, { dryRun, unified: isUnified, yes: forceYes });
69
- break;
70
- }
71
-
72
- case "check":
73
- await checkCommand();
74
- break;
75
-
76
- case "plan":
77
- await planCommand();
78
- break;
79
-
80
- case "status":
81
- await statusCommand();
82
- break;
83
-
84
- case "trace:new": {
85
- const description = args[1] || "Default task";
86
- const agent = args[2] || "manager";
87
- const priority = args[3] || "P1";
88
- await traceNewCommand(description, agent, priority);
89
- break;
90
- }
91
-
92
- case "update_project_memory": {
93
- const section = args[1];
94
- const content = args[2];
95
- if (!section || !content) {
96
- process.stderr.write("❌ Error: section and content are required.\n");
97
- process.exit(64);
98
- }
99
- await updateProjectMemoryCommand(section, content);
100
- break;
101
- }
102
-
103
- case "orchestrate":
104
- case "loop":
105
- await orchestrateCommand();
106
- break;
107
-
108
- case "approve": {
109
- const traceId = args[1];
110
- if (!traceId) {
111
- process.stderr.write("❌ Error: traceId is required.\n");
112
- process.exit(64);
113
- }
114
- await approveCommand(traceId);
115
- break;
116
- }
117
-
118
- case "verify-contract":
119
- await verifyApiContractCommand();
120
- break;
121
-
122
- case "update-contract":
123
- await updateApiContractCommand();
124
- break;
125
-
126
- case "validate":
127
- case "validate-army":
128
- case "check:al": {
129
- const { execSync } = await import("child_process");
130
- try {
131
- const validatorPath = getValidatorPath();
132
- execSync(`node "${validatorPath}"`, { stdio: "inherit" });
133
- } catch {
134
- // handled by validator
135
- }
136
- break;
137
- }
138
-
139
- case "git:commit": {
140
- const memoryContent = fs.existsSync(getMemoryPath()) ? fs.readFileSync(getMemoryPath(), "utf8") : "";
141
- const traceId = readActiveTraceId(memoryContent) || "T-000";
142
- const { gitCommitCommand } = await import("./commands/git.js");
143
- await gitCommitCommand(traceId);
144
- break;
145
- }
146
-
147
- case "git:sync": {
148
- const { gitSyncCommand } = await import("./commands/git.js");
149
- await gitSyncCommand();
150
- break;
151
- }
152
-
153
- case "check:compliance": {
154
- const targetPath = args[1] || "src";
155
- const { complianceCheckCommand } = await import("./commands/compliance.js");
156
- await complianceCheckCommand(targetPath);
157
- break;
158
- }
159
-
160
- case "explorer:graph": {
161
- const targetPath = args[1] || "src";
162
- const { explorerGraphCommand } = await import("./commands/explorer.js");
163
- await explorerGraphCommand(targetPath);
164
- break;
165
- }
166
-
167
- case "explorer:audit": {
168
- const targetPath = args[1] || "src";
169
- const { explorerAuditCommand } = await import("./commands/explorer.js");
170
- await explorerAuditCommand(targetPath);
171
- break;
172
- }
173
-
174
- case "knowledge:update": {
175
- const topic = args[1];
176
- const content = args[2];
177
- const { updateKnowledgeBaseCommand } = await import("./commands/knowledge.js");
178
- await updateKnowledgeBaseCommand(topic, content);
179
- break;
180
- }
181
-
182
- case "knowledge:search": {
183
- const query = args[1];
184
- const { searchKnowledgeBaseCommand } = await import("./commands/knowledge.js");
185
- await searchKnowledgeBaseCommand(query);
186
- break;
187
- }
188
-
189
- case "log:action": {
190
- const agent = args[1];
191
- const action = args[2];
192
- const status = args[3] || "SUCCESS";
193
- const summary = args[4] || "";
194
- const memoryContent = fs.existsSync(getMemoryPath()) ? fs.readFileSync(getMemoryPath(), "utf8") : "";
195
- const traceId = readActiveTraceId(memoryContent) || "T-000";
196
- const { logAgentActionCommand } = await import("./commands/log.js");
197
- await logAgentActionCommand({ agent, action, status, summary, traceId });
198
- break;
199
- }
200
-
201
- case "run-script": {
202
- const script = args[1];
203
- const projectPath = args[2] || ".";
204
- const { runScriptCommand } = await import("./commands/script.js");
205
- await runScriptCommand(script, projectPath);
206
- break;
207
- }
208
-
209
- case "security:audit": {
210
- const targetPath = args[1] || "src";
211
- const { securityAuditCommand } = await import("./commands/security.js");
212
- await securityAuditCommand(targetPath);
213
- break;
214
- }
215
-
216
- case "check:lint": {
217
- const { lintCommand } = await import("./commands/lint.js");
218
- await lintCommand();
219
- break;
220
- }
221
-
222
- case "version":
223
- case "-v":
224
- case "--version":
225
- process.stdout.write(`v${getPackageVersion()}\n`);
226
- break;
227
-
228
- case "help":
229
- case "-h":
230
- case "--help":
231
- showHelp();
232
- break;
233
-
234
- default:
235
- if (command && !KNOWN_COMMANDS.includes(command)) {
236
- // Natural language request fallback to @manager
237
- const content = args.join(" ");
238
- const memoryPath = getMemoryPath();
239
-
240
- let traceId = "T-000";
241
- if (fs.existsSync(memoryPath)) {
242
- const memoryContent = fs.readFileSync(memoryPath, "utf8");
243
- const tid = readActiveTraceId(memoryContent);
244
- if (tid) traceId = tid.trim();
245
- }
246
-
247
- await sendMessage({
248
- from: "@user",
249
- to: "@manager",
250
- category: "ACTION",
251
- content,
252
- traceId
253
- });
254
-
255
- process.stdout.write(`📡 Request sent to @manager: "${content}" (Trace: ${traceId})\n`);
256
- process.stdout.write("👉 Run 'atabey orchestrate' to process.\n");
257
- } else {
258
- showHelp();
259
- }
260
- break;
261
- }
262
- }
263
-
264
- function showHelp() {
265
- process.stdout.write(`
266
- 🎖️ Agent Atabey CLI (v${getPackageVersion()}) — The Supreme AI Orchestrator
267
-
268
- Usage:
269
- atabey <command> [options]
270
- atabey @<agent> "task description"
271
- atabey "natural language request"
272
-
273
- Commands:
274
- @<agent> <task> Delegate a task to a specialist agent (e.g. @backend, @frontend)
275
- init [adapter] Initialize Agent Atabey framework.
276
- Options: --unified, --yes
277
- check Perform an enterprise-grade system health check
278
- status Show active phase, trace ID, and agent statuses
279
- trace:new <desc> Start a new task chain with a unique Trace ID
280
- plan Read all docs/ files and create planning tasks
281
- orchestrate Start the dynamic Hermes agent orchestration loop
282
- verify-contract Validate type alignment between backend and frontend
283
- update-contract Generate and synchronize a new contract hash
284
- git:commit Suggest git commit messages matching the Trace ID
285
- git:sync Sync and rebase the project with remote repository
286
- check:compliance Verify file compliance with ATABEY.md rules
287
- explorer:graph Generate import dependency charts in Mermaid format
288
- explorer:audit Scan source files for lines-of-code complexity
289
- knowledge:update Add or update a topic in the local knowledge base
290
- knowledge:search Search the local knowledge base for a topic query
291
- log:action Record structured logs for agent executions
292
- run-script Execute package scripts in the project directory
293
- security:audit Audit source files for secrets and unsafe coding
294
- check:lint Run ESLint checks on the project files
295
- version Show version information
296
-
297
- Natural Language:
298
- If you provide a sentence that is not a known command, it will be automatically
299
- sent to the @manager for orchestration.
300
-
301
- Example:
302
- atabey "Audit my project"
303
- atabey @backend "Create the login page"
304
- \n`);
305
- }
306
-
307
- import { AtabeyBaseError } from "../shared/errors.js";
308
- import { logger } from "../shared/logger.js";
309
-
310
- main().catch((err) => {
311
- if (err instanceof AtabeyBaseError) {
312
- process.stderr.write(`\n❌ [${err.code}] Error: ${err.message}\n`);
313
- if (err.solution) {
314
- process.stderr.write(`💡 Solution Tip: ${err.solution}\n\n`);
315
- }
316
- } else {
317
- process.stderr.write(`\n❌ Fatal Error: ${err.message || String(err)}\n`);
318
- }
319
-
320
- logger.fatal("Fatal exception during CLI execution", err);
321
- process.exit(1);
322
- });
package/src/cli/shims.ts DELETED
@@ -1,66 +0,0 @@
1
- export const SHIM_TEMPLATES: Record<string, string> = {
2
- gemini: `# 🎖️ Agent Atabey — GEMINI Strategy (Command Intelligence)
3
-
4
- You are the **Gemini Commander**. You represent the project's **Strategic Decision Center**. Your intelligence is derived from project history, architectural memory, and governance compliance.
5
-
6
- ## 🏛️ Directives
7
- - **Constitutional Supremacy:** Read \`{{FRAMEWORK_DIR}}/ATABEY.md\` first. You are the final arbiter of these rules.
8
- - **Strategic Memory Sync:** Always read \`{{FRAMEWORK_DIR}}/memory/PROJECT_MEMORY.md\` and \`PROJECT_MEMORY.md\` at the start.
9
- - **Orchestration Audit:** Before delegating, verify that the task matches the current Phase and Trace ID context.
10
- - **Enterprise Reasoning:** Focus on long-term maintainability, security, and scalability in every strategic decision.
11
- `,
12
- "antigravity-cli": `# 🎖️ Agent Atabey — ANTIGRAVITY Strategy (Internal Discipline)
13
-
14
- You are the **Antigravity Specialist**. You represent the **Military Academy** of the framework, preserving internal standards and coding discipline.
15
-
16
- ## 🏛️ Directives
17
- - **Constitutional Supremacy:** Read \`{{FRAMEWORK_DIR}}/ATABEY.md\` first.
18
- - **Standard Enforcement:** You are responsible for ensuring that all code adheres to the 26+ corporate standards in \`{{FRAMEWORK_DIR}}/knowledge/\`.
19
- - **Sandbox Discipline:** Maintain isolated and high-discipline development environments.
20
- `,
21
- claude: `# 🎖️ Agent Atabey — CLAUDE Strategy (Operational Surgery)
22
-
23
- You are the **Claude Field Engineer**. You represent the **Operational Cerrahi (Surgical)** wing of the army. Your mission is precision execution with minimal footprint.
24
-
25
- ## 🏛️ Directives
26
- - **Surgical Precision (MANDATORY):** NEVER rewrite an entire file. Use \`replace_text\` or \`patch_file\` tools exclusively.
27
- - **Token Economy:** Minimize API usage by targetting only the exact lines of code needed.
28
- - **Traceability:** Ensure every change is linked to an active Trace ID and logged traceable under \`{{FRAMEWORK_DIR}}/logs/\`.
29
- - **Phase Discipline:** Do not attempt Phase 2 tasks if Phase 1 contracts are not sealed.
30
- `,
31
- grok: `# 🎖️ Agent Atabey — GROK Strategy (Scouting Wing)
32
-
33
- You are the **Grok Explorer**. You represent the **Otonom Keşif Kanadı (Autonomous Scouting Wing)**. Your mission is experimental discovery and boundary testing.
34
-
35
- ## 🏛️ Directives
36
- - **Architecture Discovery:** Use \`get_project_map\` and \`get_project_gaps\` to map unexplored territory before any specialist acts.
37
- - **Boundary Testing:** Identify architectural weaknesses or security gaps before they become critical.
38
- - **Experimental Protocol:** Test futuristic agent behaviors and report findings to the **Commander**.
39
- `,
40
- cursor: `# 🎖️ Agent Atabey — CURSOR Strategy (Implementer)
41
-
42
- You are the **Cursor Implementer**. You are the **Kod İşçisi (Code Worker)** integrated directly into the IDE.
43
-
44
- ## 🏛️ Directives
45
- - **IDE Synergy:** Leverage Cursor's native context and Atabey's governance to write high-quality, compliant code.
46
- - **Atomic Implementation:** Focus on implementing the specific task delegated by the @manager.
47
- `,
48
- codex: `# 🎖️ Agent Atabey — COPILOT Strategy (Assistant)
49
-
50
- You are the **Copilot Assistant**. You represent the **Yardımcı Geliştirici (Assistant Developer)**.
51
-
52
- ## 🏛️ Directives
53
- - **Predictive Support:** Provide code completions and suggestions that strictly adhere to the project's \`{{FRAMEWORK_DIR}}/ATABEY.md\` rules.
54
- - **Rapid Prototyping:** Support the army by generating boilerplate that follows established enterprise patterns.
55
- `,
56
- local: `# 🎖️ Agent Atabey — LOCAL LLM Strategy (Private Intelligence)
57
-
58
- You are the **Local Private Intelligence**. You represent the project's **Private & Secure Command Wing**. Your intelligence is derived entirely from local models (Ollama, vLLM, etc.) and project-specific knowledge.
59
-
60
- ## 🏛️ Directives
61
- - **Constitutional Supremacy:** Read \`{{FRAMEWORK_DIR}}/ATABEY.md\` first. You are the final arbiter of these rules.
62
- - **Zero Cloud Policy:** Ensure all operations remain local and secure.
63
- - **Trace ID Discipline:** Every local inference and code generation MUST follow the active Trace ID.
64
- - **Technical Integrity:** Adhere strictly to the 100% type-safety and surgical edit rules of the Atabey Order.
65
- `
66
- };
@@ -1,63 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import { writeTextFile } from "./fs.js";
4
-
5
- /**
6
- * Finds the Claude config file path (if it exists).
7
- */
8
- export function findClaudeConfigPath(): string | null {
9
- const home = process.env.HOME || process.env.USERPROFILE;
10
- if (!home) return null;
11
-
12
- const possiblePaths = [
13
- // Claude Desktop
14
- path.join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json"), // macOS Claude Desktop
15
- path.join(home, "AppData", "Roaming", "Claude", "claude_desktop_config.json"), // Windows Claude Desktop
16
- // Claude Code CLI
17
- path.join(home, ".claude.json"), // Global Claude Code CLI MCP config
18
- // Legacy or system-specific paths
19
- path.join(home, ".config", "claude", "config.json"),
20
- path.join(home, ".claude", "config.json"),
21
- path.join(home, "Library", "Application Support", "Claude Code", "config.json"),
22
- path.join(home, ".config", "Claude", "config.json"),
23
- ];
24
-
25
- for (const p of possiblePaths) {
26
- if (fs.existsSync(p)) {
27
- return p;
28
- }
29
- }
30
- return null;
31
- }
32
-
33
- /**
34
- * Adds or updates an MCP server entry in Claude's config file.
35
- */
36
- export function addMcpServerToClaude(configPath: string, serverName: string, serverConfig: Record<string, unknown>): boolean {
37
- try {
38
- let config: { mcpServers?: Record<string, Record<string, unknown>> } = { mcpServers: {} };
39
-
40
- if (fs.existsSync(configPath)) {
41
- const content = fs.readFileSync(configPath, "utf8");
42
- config = JSON.parse(content);
43
- }
44
-
45
- if (!config.mcpServers) {
46
- config.mcpServers = {};
47
- }
48
-
49
- config.mcpServers[serverName] = serverConfig;
50
-
51
- // Ensure parent directory exists
52
- const dir = path.dirname(configPath);
53
- if (!fs.existsSync(dir)) {
54
- fs.mkdirSync(dir, { recursive: true });
55
- }
56
-
57
- writeTextFile(configPath, JSON.stringify(config, null, 2));
58
- return true;
59
- } catch (e) {
60
- console.error(`⚠️ Failed to add MCP server to Claude config at ${configPath}:`, e);
61
- return false;
62
- }
63
- }
@@ -1,191 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import ts from "typescript";
4
-
5
- interface ComplianceIssue {
6
- file: string;
7
- line: number;
8
- rule: string;
9
- }
10
-
11
- /**
12
- * Enterprise Compliance Scanner (AST-Based)
13
- * Scans the project source code for governance and discipline violations.
14
- */
15
- export function scanProjectCompliance(targetDir: string = "src"): ComplianceIssue[] {
16
- const issues: ComplianceIssue[] = [];
17
- if (!fs.existsSync(targetDir)) return [];
18
-
19
- const files = getAllFiles(targetDir);
20
-
21
- for (const file of files) {
22
- // Absolute skip for critical framework and utility files to avoid self-flagging
23
- if (file.includes("compliance") ||
24
- file.includes("definitions") ||
25
- file.includes("agents/registry") ||
26
- file.includes("scaffold-ops.ts") ||
27
- file.includes("logger") ||
28
- file.includes("errors") ||
29
- file.includes("shared/fs")) continue;
30
-
31
- const content = fs.readFileSync(file, "utf8");
32
-
33
- // --- 1. AST-Based Analysis (For Language Rules) ---
34
- const sourceFile = ts.createSourceFile(file, content, ts.ScriptTarget.Latest, true);
35
-
36
- const visit = (node: ts.Node) => {
37
- // Rule: No console.log allowed (excluding UI and warn/error helpers)
38
- if (ts.isPropertyAccessExpression(node)) {
39
- const expression = node.expression;
40
- const name = node.name.text;
41
- if (ts.isIdentifier(expression) && expression.text === "console" && name === "log") {
42
- const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
43
- issues.push({ file, line: line + 1, rule: "No console.log allowed (Use logger instead)" });
44
- }
45
- // Rule: innerHTML / outerHTML check
46
- if (name === "innerHTML" || name === "outerHTML") {
47
- const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
48
- issues.push({ file, line: line + 1, rule: `Unsafe assignment/usage of '${name}' detected (Avoid XSS)` });
49
- }
50
- }
51
-
52
- // Rule: No 'any' type usage
53
- if (ts.isTypeReferenceNode(node)) {
54
- if (ts.isIdentifier(node.typeName) && node.typeName.text === "any") {
55
- const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
56
- issues.push({ file, line: line + 1, rule: "Usage of 'any' type is forbidden" });
57
- }
58
- }
59
- if (node.kind === ts.SyntaxKind.AnyKeyword) {
60
- const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
61
- issues.push({ file, line: line + 1, rule: "Usage of 'any' keyword is forbidden" });
62
- }
63
-
64
- // Rule: Zero UI Library & child_process Policy
65
- if (ts.isImportDeclaration(node)) {
66
- const moduleSpecifier = node.moduleSpecifier;
67
- if (ts.isStringLiteral(moduleSpecifier)) {
68
- const forbiddenLibs = ["@chakra-ui", "mui", "@shadcn", "antd", "bootstrap"];
69
- const lib = forbiddenLibs.find(l => moduleSpecifier.text.includes(l));
70
- if (lib) {
71
- const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
72
- issues.push({ file, line: line + 1, rule: `Forbidden UI library '${lib}' usage detected` });
73
- }
74
- if (moduleSpecifier.text === "child_process") {
75
- const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
76
- issues.push({ file, line: line + 1, rule: "Direct child_process module usage is forbidden. Command execution must be managed through secure framework APIs." });
77
- }
78
- }
79
- }
80
-
81
- // Rule: child_process dynamic usage & Raw SQL templates
82
- if (ts.isCallExpression(node)) {
83
- const expression = node.expression;
84
- if (ts.isIdentifier(expression) && expression.text === "require") {
85
- const args = node.arguments;
86
- if (args.length > 0 && ts.isStringLiteral(args[0]) && args[0].text === "child_process") {
87
- const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
88
- issues.push({ file, line: line + 1, rule: "Direct child_process module usage is forbidden. Command execution must be managed through secure framework APIs." });
89
- }
90
- }
91
- }
92
- if (node.kind === ts.SyntaxKind.ImportKeyword) {
93
- const parent = node.parent;
94
- if (parent && ts.isCallExpression(parent)) {
95
- const args = parent.arguments;
96
- if (args.length > 0 && ts.isStringLiteral(args[0]) && args[0].text === "child_process") {
97
- const { line } = sourceFile.getLineAndCharacterOfPosition(parent.getStart());
98
- issues.push({ file, line: line + 1, rule: "Direct child_process module usage is forbidden. Command execution must be managed through secure framework APIs." });
99
- }
100
- }
101
- }
102
- if (ts.isTaggedTemplateExpression(node)) {
103
- const tag = node.tag;
104
- if (ts.isIdentifier(tag) && tag.text === "sql") {
105
- const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
106
- issues.push({ file, line: line + 1, rule: "Raw SQL tagged template detected. Use Kysely query builder instead." });
107
- }
108
- }
109
-
110
- // Rule: Raw fs mutation check (Use atomic utilities)
111
- if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression)) {
112
- const prop = node.expression;
113
- if (ts.isIdentifier(prop.expression) && prop.expression.text === "fs") {
114
- if (["writeFileSync", "appendFileSync"].includes(prop.name.text)) {
115
- // Skip if it's explicitly allowed (e.g. lock files)
116
- const args = node.arguments;
117
- let isLockFile = false;
118
-
119
- if (args.length > 0) {
120
- const firstArgText = args[0].getText(sourceFile).toLowerCase();
121
- if (firstArgText.includes("lock")) {
122
- isLockFile = true;
123
- }
124
- }
125
-
126
- if (!isLockFile) {
127
- const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
128
- issues.push({ file, line: line + 1, rule: "Use atomic utilities (writeTextFile) instead of raw fs mutations" });
129
- }
130
- }
131
- }
132
- }
133
-
134
- ts.forEachChild(node, visit);
135
- };
136
-
137
- visit(sourceFile);
138
-
139
- // --- 2. Pattern-Based Analysis (For Secrets & PII & Debt) ---
140
- const lines = content.split("\n");
141
- const piiKeywords = [
142
- { regex: /API_KEY\s*[:=]\s*['"][^'"]+['"]/i, msg: "Hardcoded API Key" },
143
- { regex: /SECRET\s*[:=]\s*['"][^'"]+['"]/i, msg: "Hardcoded Secret" },
144
- { regex: /PASSWORD\s*[:=]\s*['"][^'"]+['"]/i, msg: "Hardcoded Password" },
145
- { regex: /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/, msg: "PII Detected: Email Address" },
146
- { regex: /\b\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}\b/, msg: "PII Detected: Credit Card Pattern" }
147
- ];
148
-
149
- lines.forEach((line, index) => {
150
- const lineNum = index + 1;
151
- const trimmedLine = line.trim();
152
-
153
- if (trimmedLine.startsWith("//") || trimmedLine.startsWith("*")) return;
154
-
155
- // PII & Secret Guard
156
- for (const { regex, msg } of piiKeywords) {
157
- if (regex.test(line)) {
158
- // Allow emails in specific files
159
- if (msg.includes("Email") && (file.endsWith("README.md") || file.endsWith("package.json") || file.includes("CONTRIBUTING"))) {
160
- continue;
161
- }
162
- issues.push({ file, line: lineNum, rule: `Corporate Compliance Breach: ${msg}` });
163
- }
164
- }
165
-
166
- // Technical Debt (TODO/FIXME)
167
- if (/\b(TODO|FIXME)\b/i.test(line)) {
168
- issues.push({ file, line: lineNum, rule: "Unresolved Technical Debt (TODO/FIXME) found" });
169
- }
170
- });
171
- }
172
- return issues;
173
- }
174
-
175
- function getAllFiles(dirPath: string, arrayOfFiles: string[] = []): string[] {
176
- const files = fs.readdirSync(dirPath);
177
-
178
- files.forEach((file) => {
179
- const fullPath = path.join(dirPath, file);
180
- if (fs.statSync(fullPath).isDirectory()) {
181
- arrayOfFiles = getAllFiles(fullPath, arrayOfFiles);
182
- } else {
183
- const ext = path.extname(fullPath);
184
- if ([".ts", ".tsx", ".js", ".jsx"].includes(ext)) {
185
- arrayOfFiles.push(fullPath);
186
- }
187
- }
188
- });
189
-
190
- return arrayOfFiles;
191
- }