@mc1global/opencode-jarvis 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +171 -0
  3. package/dist/application/context-memory/dtos.d.ts +100 -0
  4. package/dist/application/context-memory/dtos.d.ts.map +1 -0
  5. package/dist/application/context-memory/dtos.js +11 -0
  6. package/dist/application/context-memory/dtos.js.map +1 -0
  7. package/dist/application/context-memory/note-use-cases.d.ts +22 -0
  8. package/dist/application/context-memory/note-use-cases.d.ts.map +1 -0
  9. package/dist/application/context-memory/note-use-cases.js +76 -0
  10. package/dist/application/context-memory/note-use-cases.js.map +1 -0
  11. package/dist/application/context-memory/session-use-cases.d.ts +23 -0
  12. package/dist/application/context-memory/session-use-cases.d.ts.map +1 -0
  13. package/dist/application/context-memory/session-use-cases.js +63 -0
  14. package/dist/application/context-memory/session-use-cases.js.map +1 -0
  15. package/dist/application/context-memory/todo-use-cases.d.ts +25 -0
  16. package/dist/application/context-memory/todo-use-cases.d.ts.map +1 -0
  17. package/dist/application/context-memory/todo-use-cases.js +100 -0
  18. package/dist/application/context-memory/todo-use-cases.js.map +1 -0
  19. package/dist/application/domain-map/dtos.d.ts +58 -0
  20. package/dist/application/domain-map/dtos.d.ts.map +1 -0
  21. package/dist/application/domain-map/dtos.js +11 -0
  22. package/dist/application/domain-map/dtos.js.map +1 -0
  23. package/dist/application/domain-map/use-cases.d.ts +64 -0
  24. package/dist/application/domain-map/use-cases.d.ts.map +1 -0
  25. package/dist/application/domain-map/use-cases.js +217 -0
  26. package/dist/application/domain-map/use-cases.js.map +1 -0
  27. package/dist/application/environment/dtos.d.ts +74 -0
  28. package/dist/application/environment/dtos.d.ts.map +1 -0
  29. package/dist/application/environment/dtos.js +10 -0
  30. package/dist/application/environment/dtos.js.map +1 -0
  31. package/dist/application/environment/use-cases.d.ts +29 -0
  32. package/dist/application/environment/use-cases.d.ts.map +1 -0
  33. package/dist/application/environment/use-cases.js +232 -0
  34. package/dist/application/environment/use-cases.js.map +1 -0
  35. package/dist/application/governance/validation-use-cases.d.ts +45 -0
  36. package/dist/application/governance/validation-use-cases.d.ts.map +1 -0
  37. package/dist/application/governance/validation-use-cases.js +51 -0
  38. package/dist/application/governance/validation-use-cases.js.map +1 -0
  39. package/dist/application/kanban/board-use-cases.d.ts +45 -0
  40. package/dist/application/kanban/board-use-cases.d.ts.map +1 -0
  41. package/dist/application/kanban/board-use-cases.js +124 -0
  42. package/dist/application/kanban/board-use-cases.js.map +1 -0
  43. package/dist/application/kanban/card-use-cases.d.ts +32 -0
  44. package/dist/application/kanban/card-use-cases.d.ts.map +1 -0
  45. package/dist/application/kanban/card-use-cases.js +204 -0
  46. package/dist/application/kanban/card-use-cases.js.map +1 -0
  47. package/dist/application/kanban/dtos.d.ts +165 -0
  48. package/dist/application/kanban/dtos.d.ts.map +1 -0
  49. package/dist/application/kanban/dtos.js +11 -0
  50. package/dist/application/kanban/dtos.js.map +1 -0
  51. package/dist/application/kanban/sprint-use-cases.d.ts +34 -0
  52. package/dist/application/kanban/sprint-use-cases.d.ts.map +1 -0
  53. package/dist/application/kanban/sprint-use-cases.js +243 -0
  54. package/dist/application/kanban/sprint-use-cases.js.map +1 -0
  55. package/dist/application/rag/dtos.d.ts +113 -0
  56. package/dist/application/rag/dtos.d.ts.map +1 -0
  57. package/dist/application/rag/dtos.js +11 -0
  58. package/dist/application/rag/dtos.js.map +1 -0
  59. package/dist/application/rag/oracle-use-cases.d.ts +30 -0
  60. package/dist/application/rag/oracle-use-cases.d.ts.map +1 -0
  61. package/dist/application/rag/oracle-use-cases.js +91 -0
  62. package/dist/application/rag/oracle-use-cases.js.map +1 -0
  63. package/dist/application/rag/use-cases.d.ts +34 -0
  64. package/dist/application/rag/use-cases.d.ts.map +1 -0
  65. package/dist/application/rag/use-cases.js +234 -0
  66. package/dist/application/rag/use-cases.js.map +1 -0
  67. package/dist/application/token-metrics/dtos.d.ts +126 -0
  68. package/dist/application/token-metrics/dtos.d.ts.map +1 -0
  69. package/dist/application/token-metrics/dtos.js +11 -0
  70. package/dist/application/token-metrics/dtos.js.map +1 -0
  71. package/dist/application/token-metrics/tracking-use-cases.d.ts +33 -0
  72. package/dist/application/token-metrics/tracking-use-cases.d.ts.map +1 -0
  73. package/dist/application/token-metrics/tracking-use-cases.js +220 -0
  74. package/dist/application/token-metrics/tracking-use-cases.js.map +1 -0
  75. package/dist/application/vault/dtos.d.ts +91 -0
  76. package/dist/application/vault/dtos.d.ts.map +1 -0
  77. package/dist/application/vault/dtos.js +11 -0
  78. package/dist/application/vault/dtos.js.map +1 -0
  79. package/dist/application/vault/use-cases.d.ts +30 -0
  80. package/dist/application/vault/use-cases.d.ts.map +1 -0
  81. package/dist/application/vault/use-cases.js +307 -0
  82. package/dist/application/vault/use-cases.js.map +1 -0
  83. package/dist/application/vault/vault-manager.d.ts +47 -0
  84. package/dist/application/vault/vault-manager.d.ts.map +1 -0
  85. package/dist/application/vault/vault-manager.js +272 -0
  86. package/dist/application/vault/vault-manager.js.map +1 -0
  87. package/dist/application/workspace-registry/dtos.d.ts +91 -0
  88. package/dist/application/workspace-registry/dtos.d.ts.map +1 -0
  89. package/dist/application/workspace-registry/dtos.js +11 -0
  90. package/dist/application/workspace-registry/dtos.js.map +1 -0
  91. package/dist/application/workspace-registry/use-cases.d.ts +29 -0
  92. package/dist/application/workspace-registry/use-cases.d.ts.map +1 -0
  93. package/dist/application/workspace-registry/use-cases.js +249 -0
  94. package/dist/application/workspace-registry/use-cases.js.map +1 -0
  95. package/dist/domain/context-memory/entities.d.ts +123 -0
  96. package/dist/domain/context-memory/entities.d.ts.map +1 -0
  97. package/dist/domain/context-memory/entities.js +229 -0
  98. package/dist/domain/context-memory/entities.js.map +1 -0
  99. package/dist/domain/context-memory/repositories.d.ts +46 -0
  100. package/dist/domain/context-memory/repositories.d.ts.map +1 -0
  101. package/dist/domain/context-memory/repositories.js +2 -0
  102. package/dist/domain/context-memory/repositories.js.map +1 -0
  103. package/dist/domain/context-memory/services.d.ts +62 -0
  104. package/dist/domain/context-memory/services.d.ts.map +1 -0
  105. package/dist/domain/context-memory/services.js +162 -0
  106. package/dist/domain/context-memory/services.js.map +1 -0
  107. package/dist/domain/context-memory/value-objects.d.ts +65 -0
  108. package/dist/domain/context-memory/value-objects.d.ts.map +1 -0
  109. package/dist/domain/context-memory/value-objects.js +105 -0
  110. package/dist/domain/context-memory/value-objects.js.map +1 -0
  111. package/dist/domain/domain-map/repositories.d.ts +126 -0
  112. package/dist/domain/domain-map/repositories.d.ts.map +1 -0
  113. package/dist/domain/domain-map/repositories.js +2 -0
  114. package/dist/domain/domain-map/repositories.js.map +1 -0
  115. package/dist/domain/domain-map/services.d.ts +108 -0
  116. package/dist/domain/domain-map/services.d.ts.map +1 -0
  117. package/dist/domain/domain-map/services.js +335 -0
  118. package/dist/domain/domain-map/services.js.map +1 -0
  119. package/dist/domain/domain-map/value-objects.d.ts +186 -0
  120. package/dist/domain/domain-map/value-objects.d.ts.map +1 -0
  121. package/dist/domain/domain-map/value-objects.js +215 -0
  122. package/dist/domain/domain-map/value-objects.js.map +1 -0
  123. package/dist/domain/environment/entities.d.ts +93 -0
  124. package/dist/domain/environment/entities.d.ts.map +1 -0
  125. package/dist/domain/environment/entities.js +207 -0
  126. package/dist/domain/environment/entities.js.map +1 -0
  127. package/dist/domain/environment/renderers.d.ts +30 -0
  128. package/dist/domain/environment/renderers.d.ts.map +1 -0
  129. package/dist/domain/environment/renderers.js +139 -0
  130. package/dist/domain/environment/renderers.js.map +1 -0
  131. package/dist/domain/environment/repositories.d.ts +73 -0
  132. package/dist/domain/environment/repositories.d.ts.map +1 -0
  133. package/dist/domain/environment/repositories.js +16 -0
  134. package/dist/domain/environment/repositories.js.map +1 -0
  135. package/dist/domain/environment/services.d.ts +62 -0
  136. package/dist/domain/environment/services.d.ts.map +1 -0
  137. package/dist/domain/environment/services.js +282 -0
  138. package/dist/domain/environment/services.js.map +1 -0
  139. package/dist/domain/environment/value-objects.d.ts +127 -0
  140. package/dist/domain/environment/value-objects.d.ts.map +1 -0
  141. package/dist/domain/environment/value-objects.js +179 -0
  142. package/dist/domain/environment/value-objects.js.map +1 -0
  143. package/dist/domain/governance/policies.d.ts +42 -0
  144. package/dist/domain/governance/policies.d.ts.map +1 -0
  145. package/dist/domain/governance/policies.js +304 -0
  146. package/dist/domain/governance/policies.js.map +1 -0
  147. package/dist/domain/governance/services.d.ts +38 -0
  148. package/dist/domain/governance/services.d.ts.map +1 -0
  149. package/dist/domain/governance/services.js +42 -0
  150. package/dist/domain/governance/services.js.map +1 -0
  151. package/dist/domain/kanban/entities.d.ts +105 -0
  152. package/dist/domain/kanban/entities.d.ts.map +1 -0
  153. package/dist/domain/kanban/entities.js +211 -0
  154. package/dist/domain/kanban/entities.js.map +1 -0
  155. package/dist/domain/kanban/grooming.d.ts +40 -0
  156. package/dist/domain/kanban/grooming.d.ts.map +1 -0
  157. package/dist/domain/kanban/grooming.js +50 -0
  158. package/dist/domain/kanban/grooming.js.map +1 -0
  159. package/dist/domain/kanban/repositories.d.ts +41 -0
  160. package/dist/domain/kanban/repositories.d.ts.map +1 -0
  161. package/dist/domain/kanban/repositories.js +2 -0
  162. package/dist/domain/kanban/repositories.js.map +1 -0
  163. package/dist/domain/kanban/services.d.ts +49 -0
  164. package/dist/domain/kanban/services.d.ts.map +1 -0
  165. package/dist/domain/kanban/services.js +154 -0
  166. package/dist/domain/kanban/services.js.map +1 -0
  167. package/dist/domain/kanban/sprint.d.ts +103 -0
  168. package/dist/domain/kanban/sprint.d.ts.map +1 -0
  169. package/dist/domain/kanban/sprint.js +192 -0
  170. package/dist/domain/kanban/sprint.js.map +1 -0
  171. package/dist/domain/kanban/value-objects.d.ts +91 -0
  172. package/dist/domain/kanban/value-objects.d.ts.map +1 -0
  173. package/dist/domain/kanban/value-objects.js +167 -0
  174. package/dist/domain/kanban/value-objects.js.map +1 -0
  175. package/dist/domain/rag/repositories.d.ts +152 -0
  176. package/dist/domain/rag/repositories.d.ts.map +1 -0
  177. package/dist/domain/rag/repositories.js +2 -0
  178. package/dist/domain/rag/repositories.js.map +1 -0
  179. package/dist/domain/rag/services.d.ts +57 -0
  180. package/dist/domain/rag/services.d.ts.map +1 -0
  181. package/dist/domain/rag/services.js +224 -0
  182. package/dist/domain/rag/services.js.map +1 -0
  183. package/dist/domain/rag/value-objects.d.ts +118 -0
  184. package/dist/domain/rag/value-objects.d.ts.map +1 -0
  185. package/dist/domain/rag/value-objects.js +114 -0
  186. package/dist/domain/rag/value-objects.js.map +1 -0
  187. package/dist/domain/shared/value-objects.d.ts +56 -0
  188. package/dist/domain/shared/value-objects.d.ts.map +1 -0
  189. package/dist/domain/shared/value-objects.js +89 -0
  190. package/dist/domain/shared/value-objects.js.map +1 -0
  191. package/dist/domain/token-metrics/entities.d.ts +90 -0
  192. package/dist/domain/token-metrics/entities.d.ts.map +1 -0
  193. package/dist/domain/token-metrics/entities.js +115 -0
  194. package/dist/domain/token-metrics/entities.js.map +1 -0
  195. package/dist/domain/token-metrics/repositories.d.ts +93 -0
  196. package/dist/domain/token-metrics/repositories.d.ts.map +1 -0
  197. package/dist/domain/token-metrics/repositories.js +2 -0
  198. package/dist/domain/token-metrics/repositories.js.map +1 -0
  199. package/dist/domain/token-metrics/value-objects.d.ts +81 -0
  200. package/dist/domain/token-metrics/value-objects.d.ts.map +1 -0
  201. package/dist/domain/token-metrics/value-objects.js +144 -0
  202. package/dist/domain/token-metrics/value-objects.js.map +1 -0
  203. package/dist/domain/vault/canvas.d.ts +70 -0
  204. package/dist/domain/vault/canvas.d.ts.map +1 -0
  205. package/dist/domain/vault/canvas.js +70 -0
  206. package/dist/domain/vault/canvas.js.map +1 -0
  207. package/dist/domain/vault/document.d.ts +71 -0
  208. package/dist/domain/vault/document.d.ts.map +1 -0
  209. package/dist/domain/vault/document.js +244 -0
  210. package/dist/domain/vault/document.js.map +1 -0
  211. package/dist/domain/vault/repositories.d.ts +35 -0
  212. package/dist/domain/vault/repositories.d.ts.map +1 -0
  213. package/dist/domain/vault/repositories.js +2 -0
  214. package/dist/domain/vault/repositories.js.map +1 -0
  215. package/dist/domain/vault/section.d.ts +33 -0
  216. package/dist/domain/vault/section.d.ts.map +1 -0
  217. package/dist/domain/vault/section.js +39 -0
  218. package/dist/domain/vault/section.js.map +1 -0
  219. package/dist/domain/vault/services.d.ts +48 -0
  220. package/dist/domain/vault/services.d.ts.map +1 -0
  221. package/dist/domain/vault/services.js +249 -0
  222. package/dist/domain/vault/services.js.map +1 -0
  223. package/dist/domain/vault/table.d.ts +58 -0
  224. package/dist/domain/vault/table.d.ts.map +1 -0
  225. package/dist/domain/vault/table.js +204 -0
  226. package/dist/domain/vault/table.js.map +1 -0
  227. package/dist/domain/vault/timeline.d.ts +53 -0
  228. package/dist/domain/vault/timeline.d.ts.map +1 -0
  229. package/dist/domain/vault/timeline.js +214 -0
  230. package/dist/domain/vault/timeline.js.map +1 -0
  231. package/dist/domain/vault/value-objects.d.ts +45 -0
  232. package/dist/domain/vault/value-objects.d.ts.map +1 -0
  233. package/dist/domain/vault/value-objects.js +89 -0
  234. package/dist/domain/vault/value-objects.js.map +1 -0
  235. package/dist/domain/workspace-registry/entities.d.ts +57 -0
  236. package/dist/domain/workspace-registry/entities.d.ts.map +1 -0
  237. package/dist/domain/workspace-registry/entities.js +148 -0
  238. package/dist/domain/workspace-registry/entities.js.map +1 -0
  239. package/dist/domain/workspace-registry/repositories.d.ts +57 -0
  240. package/dist/domain/workspace-registry/repositories.d.ts.map +1 -0
  241. package/dist/domain/workspace-registry/repositories.js +12 -0
  242. package/dist/domain/workspace-registry/repositories.js.map +1 -0
  243. package/dist/domain/workspace-registry/services.d.ts +56 -0
  244. package/dist/domain/workspace-registry/services.d.ts.map +1 -0
  245. package/dist/domain/workspace-registry/services.js +283 -0
  246. package/dist/domain/workspace-registry/services.js.map +1 -0
  247. package/dist/domain/workspace-registry/value-objects.d.ts +113 -0
  248. package/dist/domain/workspace-registry/value-objects.d.ts.map +1 -0
  249. package/dist/domain/workspace-registry/value-objects.js +235 -0
  250. package/dist/domain/workspace-registry/value-objects.js.map +1 -0
  251. package/dist/hooks/context-compacting.d.ts +35 -0
  252. package/dist/hooks/context-compacting.d.ts.map +1 -0
  253. package/dist/hooks/context-compacting.js +48 -0
  254. package/dist/hooks/context-compacting.js.map +1 -0
  255. package/dist/hooks/event-handlers.d.ts +39 -0
  256. package/dist/hooks/event-handlers.d.ts.map +1 -0
  257. package/dist/hooks/event-handlers.js +75 -0
  258. package/dist/hooks/event-handlers.js.map +1 -0
  259. package/dist/hooks/guardrails.d.ts +33 -0
  260. package/dist/hooks/guardrails.d.ts.map +1 -0
  261. package/dist/hooks/guardrails.js +22 -0
  262. package/dist/hooks/guardrails.js.map +1 -0
  263. package/dist/hooks/shell-env.d.ts +28 -0
  264. package/dist/hooks/shell-env.d.ts.map +1 -0
  265. package/dist/hooks/shell-env.js +17 -0
  266. package/dist/hooks/shell-env.js.map +1 -0
  267. package/dist/index.d.ts +16 -0
  268. package/dist/index.d.ts.map +1 -0
  269. package/dist/index.js +349 -0
  270. package/dist/index.js.map +1 -0
  271. package/dist/infrastructure/context-memory/note-repository.d.ts +26 -0
  272. package/dist/infrastructure/context-memory/note-repository.d.ts.map +1 -0
  273. package/dist/infrastructure/context-memory/note-repository.js +87 -0
  274. package/dist/infrastructure/context-memory/note-repository.js.map +1 -0
  275. package/dist/infrastructure/context-memory/search-repository.d.ts +20 -0
  276. package/dist/infrastructure/context-memory/search-repository.d.ts.map +1 -0
  277. package/dist/infrastructure/context-memory/search-repository.js +44 -0
  278. package/dist/infrastructure/context-memory/search-repository.js.map +1 -0
  279. package/dist/infrastructure/context-memory/session-repository.d.ts +26 -0
  280. package/dist/infrastructure/context-memory/session-repository.d.ts.map +1 -0
  281. package/dist/infrastructure/context-memory/session-repository.js +79 -0
  282. package/dist/infrastructure/context-memory/session-repository.js.map +1 -0
  283. package/dist/infrastructure/context-memory/todo-repository.d.ts +26 -0
  284. package/dist/infrastructure/context-memory/todo-repository.d.ts.map +1 -0
  285. package/dist/infrastructure/context-memory/todo-repository.js +105 -0
  286. package/dist/infrastructure/context-memory/todo-repository.js.map +1 -0
  287. package/dist/infrastructure/database/sqlite-adapter.d.ts +60 -0
  288. package/dist/infrastructure/database/sqlite-adapter.d.ts.map +1 -0
  289. package/dist/infrastructure/database/sqlite-adapter.js +93 -0
  290. package/dist/infrastructure/database/sqlite-adapter.js.map +1 -0
  291. package/dist/infrastructure/domain-map/llm-analyzer.d.ts +60 -0
  292. package/dist/infrastructure/domain-map/llm-analyzer.d.ts.map +1 -0
  293. package/dist/infrastructure/domain-map/llm-analyzer.js +249 -0
  294. package/dist/infrastructure/domain-map/llm-analyzer.js.map +1 -0
  295. package/dist/infrastructure/domain-map/lsp-adapter.d.ts +61 -0
  296. package/dist/infrastructure/domain-map/lsp-adapter.d.ts.map +1 -0
  297. package/dist/infrastructure/domain-map/lsp-adapter.js +210 -0
  298. package/dist/infrastructure/domain-map/lsp-adapter.js.map +1 -0
  299. package/dist/infrastructure/domain-map/lsp-configs.d.ts +53 -0
  300. package/dist/infrastructure/domain-map/lsp-configs.d.ts.map +1 -0
  301. package/dist/infrastructure/domain-map/lsp-configs.js +274 -0
  302. package/dist/infrastructure/domain-map/lsp-configs.js.map +1 -0
  303. package/dist/infrastructure/domain-map/lsp-json-rpc.d.ts +132 -0
  304. package/dist/infrastructure/domain-map/lsp-json-rpc.d.ts.map +1 -0
  305. package/dist/infrastructure/domain-map/lsp-json-rpc.js +320 -0
  306. package/dist/infrastructure/domain-map/lsp-json-rpc.js.map +1 -0
  307. package/dist/infrastructure/domain-map/project-scanner.d.ts +43 -0
  308. package/dist/infrastructure/domain-map/project-scanner.d.ts.map +1 -0
  309. package/dist/infrastructure/domain-map/project-scanner.js +193 -0
  310. package/dist/infrastructure/domain-map/project-scanner.js.map +1 -0
  311. package/dist/infrastructure/environment/environment-repository.d.ts +33 -0
  312. package/dist/infrastructure/environment/environment-repository.d.ts.map +1 -0
  313. package/dist/infrastructure/environment/environment-repository.js +161 -0
  314. package/dist/infrastructure/environment/environment-repository.js.map +1 -0
  315. package/dist/infrastructure/environment/scanner-adapter.d.ts +23 -0
  316. package/dist/infrastructure/environment/scanner-adapter.d.ts.map +1 -0
  317. package/dist/infrastructure/environment/scanner-adapter.js +102 -0
  318. package/dist/infrastructure/environment/scanner-adapter.js.map +1 -0
  319. package/dist/infrastructure/kanban/card-repository.d.ts +41 -0
  320. package/dist/infrastructure/kanban/card-repository.d.ts.map +1 -0
  321. package/dist/infrastructure/kanban/card-repository.js +185 -0
  322. package/dist/infrastructure/kanban/card-repository.js.map +1 -0
  323. package/dist/infrastructure/kanban/sprint-repository.d.ts +40 -0
  324. package/dist/infrastructure/kanban/sprint-repository.d.ts.map +1 -0
  325. package/dist/infrastructure/kanban/sprint-repository.js +186 -0
  326. package/dist/infrastructure/kanban/sprint-repository.js.map +1 -0
  327. package/dist/infrastructure/rag/file-discovery.d.ts +19 -0
  328. package/dist/infrastructure/rag/file-discovery.d.ts.map +1 -0
  329. package/dist/infrastructure/rag/file-discovery.js +201 -0
  330. package/dist/infrastructure/rag/file-discovery.js.map +1 -0
  331. package/dist/infrastructure/rag/ollama-embeddings.d.ts +18 -0
  332. package/dist/infrastructure/rag/ollama-embeddings.d.ts.map +1 -0
  333. package/dist/infrastructure/rag/ollama-embeddings.js +54 -0
  334. package/dist/infrastructure/rag/ollama-embeddings.js.map +1 -0
  335. package/dist/infrastructure/rag/text-splitter.d.ts +19 -0
  336. package/dist/infrastructure/rag/text-splitter.d.ts.map +1 -0
  337. package/dist/infrastructure/rag/text-splitter.js +38 -0
  338. package/dist/infrastructure/rag/text-splitter.js.map +1 -0
  339. package/dist/infrastructure/rag/vectra-adapter.d.ts +38 -0
  340. package/dist/infrastructure/rag/vectra-adapter.d.ts.map +1 -0
  341. package/dist/infrastructure/rag/vectra-adapter.js +275 -0
  342. package/dist/infrastructure/rag/vectra-adapter.js.map +1 -0
  343. package/dist/infrastructure/token-metrics/token-metrics-repository.d.ts +29 -0
  344. package/dist/infrastructure/token-metrics/token-metrics-repository.d.ts.map +1 -0
  345. package/dist/infrastructure/token-metrics/token-metrics-repository.js +254 -0
  346. package/dist/infrastructure/token-metrics/token-metrics-repository.js.map +1 -0
  347. package/dist/infrastructure/vault/markdown-parser.d.ts +35 -0
  348. package/dist/infrastructure/vault/markdown-parser.d.ts.map +1 -0
  349. package/dist/infrastructure/vault/markdown-parser.js +145 -0
  350. package/dist/infrastructure/vault/markdown-parser.js.map +1 -0
  351. package/dist/infrastructure/vault/vault-fs-adapter.d.ts +17 -0
  352. package/dist/infrastructure/vault/vault-fs-adapter.d.ts.map +1 -0
  353. package/dist/infrastructure/vault/vault-fs-adapter.js +105 -0
  354. package/dist/infrastructure/vault/vault-fs-adapter.js.map +1 -0
  355. package/dist/infrastructure/workspace-registry/dependency-repository.d.ts +27 -0
  356. package/dist/infrastructure/workspace-registry/dependency-repository.d.ts.map +1 -0
  357. package/dist/infrastructure/workspace-registry/dependency-repository.js +89 -0
  358. package/dist/infrastructure/workspace-registry/dependency-repository.js.map +1 -0
  359. package/dist/infrastructure/workspace-registry/workspace-repository.d.ts +28 -0
  360. package/dist/infrastructure/workspace-registry/workspace-repository.d.ts.map +1 -0
  361. package/dist/infrastructure/workspace-registry/workspace-repository.js +108 -0
  362. package/dist/infrastructure/workspace-registry/workspace-repository.js.map +1 -0
  363. package/dist/tools/agent-tools.d.ts +14 -0
  364. package/dist/tools/agent-tools.d.ts.map +1 -0
  365. package/dist/tools/agent-tools.js +238 -0
  366. package/dist/tools/agent-tools.js.map +1 -0
  367. package/dist/tools/context-memory-tools.d.ts +16 -0
  368. package/dist/tools/context-memory-tools.d.ts.map +1 -0
  369. package/dist/tools/context-memory-tools.js +242 -0
  370. package/dist/tools/context-memory-tools.js.map +1 -0
  371. package/dist/tools/data-tools.d.ts +3 -0
  372. package/dist/tools/data-tools.d.ts.map +1 -0
  373. package/dist/tools/data-tools.js +383 -0
  374. package/dist/tools/data-tools.js.map +1 -0
  375. package/dist/tools/domain-map-tools.d.ts +41 -0
  376. package/dist/tools/domain-map-tools.d.ts.map +1 -0
  377. package/dist/tools/domain-map-tools.js +134 -0
  378. package/dist/tools/domain-map-tools.js.map +1 -0
  379. package/dist/tools/environment-tools.d.ts +85 -0
  380. package/dist/tools/environment-tools.d.ts.map +1 -0
  381. package/dist/tools/environment-tools.js +223 -0
  382. package/dist/tools/environment-tools.js.map +1 -0
  383. package/dist/tools/governance-tools.d.ts +7 -0
  384. package/dist/tools/governance-tools.d.ts.map +1 -0
  385. package/dist/tools/governance-tools.js +73 -0
  386. package/dist/tools/governance-tools.js.map +1 -0
  387. package/dist/tools/kanban-board-tools.d.ts +11 -0
  388. package/dist/tools/kanban-board-tools.d.ts.map +1 -0
  389. package/dist/tools/kanban-board-tools.js +354 -0
  390. package/dist/tools/kanban-board-tools.js.map +1 -0
  391. package/dist/tools/kanban-card-tools.d.ts +11 -0
  392. package/dist/tools/kanban-card-tools.d.ts.map +1 -0
  393. package/dist/tools/kanban-card-tools.js +407 -0
  394. package/dist/tools/kanban-card-tools.js.map +1 -0
  395. package/dist/tools/rag-tools.d.ts +10 -0
  396. package/dist/tools/rag-tools.d.ts.map +1 -0
  397. package/dist/tools/rag-tools.js +279 -0
  398. package/dist/tools/rag-tools.js.map +1 -0
  399. package/dist/tools/token-metrics-tools.d.ts +98 -0
  400. package/dist/tools/token-metrics-tools.d.ts.map +1 -0
  401. package/dist/tools/token-metrics-tools.js +287 -0
  402. package/dist/tools/token-metrics-tools.js.map +1 -0
  403. package/dist/tools/vault-manage-tool.d.ts +7 -0
  404. package/dist/tools/vault-manage-tool.d.ts.map +1 -0
  405. package/dist/tools/vault-manage-tool.js +193 -0
  406. package/dist/tools/vault-manage-tool.js.map +1 -0
  407. package/dist/tools/vault-tools.d.ts +7 -0
  408. package/dist/tools/vault-tools.d.ts.map +1 -0
  409. package/dist/tools/vault-tools.js +348 -0
  410. package/dist/tools/vault-tools.js.map +1 -0
  411. package/dist/tools/workspace-registry-tools.d.ts +93 -0
  412. package/dist/tools/workspace-registry-tools.d.ts.map +1 -0
  413. package/dist/tools/workspace-registry-tools.js +217 -0
  414. package/dist/tools/workspace-registry-tools.js.map +1 -0
  415. package/package.json +59 -0
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Environment Management - Value Objects
3
+ *
4
+ * Immutable value objects for the environment bounded context.
5
+ * Environments are isolated containerized workspaces powered by container-use.
6
+ * The plugin tracks metadata; the agent invokes container-use MCP tools directly.
7
+ *
8
+ * DDD: Value Objects (no identity, compared by value)
9
+ * SOLID: SRP - value definitions and validation only
10
+ */
11
+ import { EntityId, Timestamp } from "../shared/value-objects.js";
12
+ /**
13
+ * Unique identifier for an environment.
14
+ * Format: ENV-{NNN} (sequential, zero-padded).
15
+ */
16
+ export declare class EnvironmentId extends EntityId {
17
+ private constructor();
18
+ static create(sequence: number): EnvironmentId;
19
+ static from(value: string): EnvironmentId;
20
+ get sequence(): number;
21
+ }
22
+ /**
23
+ * Container-use environment name (e.g., "fancy-mallard").
24
+ * This is the name assigned by container-use when creating an environment.
25
+ * Validated: non-empty, lowercase with hyphens.
26
+ */
27
+ export declare class EnvironmentName {
28
+ readonly value: string;
29
+ private constructor();
30
+ static create(name: string): EnvironmentName;
31
+ static from(value: string): EnvironmentName;
32
+ /** Derives the git branch name used by container-use: cu-{name} */
33
+ toBranchName(): string;
34
+ equals(other: EnvironmentName): boolean;
35
+ toString(): string;
36
+ }
37
+ /**
38
+ * Lifecycle status of an environment.
39
+ *
40
+ * State machine:
41
+ * creating -> active (environment ready), failed (creation error)
42
+ * active -> merging (merge requested), deleting (cleanup)
43
+ * merging -> merged (success), active (merge conflict, needs resolution)
44
+ * merged -> deleting (cleanup), (terminal - can stay for audit)
45
+ * deleting -> deleted (success)
46
+ * failed -> deleting (cleanup)
47
+ * deleted -> (terminal)
48
+ */
49
+ export declare const ENVIRONMENT_STATUSES: readonly ["creating", "active", "merging", "merged", "deleting", "deleted", "failed"];
50
+ export type EnvironmentStatus = (typeof ENVIRONMENT_STATUSES)[number];
51
+ export declare function isValidEnvironmentStatus(value: string): value is EnvironmentStatus;
52
+ /** Valid environment status transitions. */
53
+ export declare const ENVIRONMENT_TRANSITIONS: Record<EnvironmentStatus, readonly EnvironmentStatus[]>;
54
+ /**
55
+ * Checks if a status transition is valid.
56
+ */
57
+ export declare function isValidTransition(from: EnvironmentStatus, to: EnvironmentStatus): boolean;
58
+ /**
59
+ * How environment changes should be merged back to the main branch.
60
+ */
61
+ export declare const MERGE_STRATEGIES: readonly ["merge-commit", "squash", "rebase"];
62
+ export type MergeStrategy = (typeof MERGE_STRATEGIES)[number];
63
+ export declare function isValidMergeStrategy(value: string): value is MergeStrategy;
64
+ /**
65
+ * Configuration for the container-use environment.
66
+ * Mirrors the config structure in .container-use/environment.json.
67
+ * All fields optional — container-use provides sensible defaults.
68
+ */
69
+ export interface ContainerConfig {
70
+ readonly baseImage: string | undefined;
71
+ readonly setupCommands: readonly string[];
72
+ readonly installCommands: readonly string[];
73
+ readonly envVars: Readonly<Record<string, string>>;
74
+ }
75
+ /**
76
+ * Creates a validated ContainerConfig.
77
+ * Provides sensible defaults for empty values.
78
+ */
79
+ export declare function createContainerConfig(params?: {
80
+ readonly baseImage?: string;
81
+ readonly setupCommands?: readonly string[];
82
+ readonly installCommands?: readonly string[];
83
+ readonly envVars?: Readonly<Record<string, string>>;
84
+ }): ContainerConfig;
85
+ /** Serializes a ContainerConfig to JSON string. */
86
+ export declare function containerConfigToJSON(config: ContainerConfig): string;
87
+ /** Deserializes a ContainerConfig from JSON string. */
88
+ export declare function containerConfigFromJSON(json: string): ContainerConfig;
89
+ /**
90
+ * Classification of what the environment is being used for.
91
+ * Helps with prioritization and resource management.
92
+ */
93
+ export declare const ENVIRONMENT_PURPOSES: readonly ["feature", "bugfix", "experiment", "refactor", "spike", "hotfix"];
94
+ export type EnvironmentPurpose = (typeof ENVIRONMENT_PURPOSES)[number];
95
+ export declare function isValidEnvironmentPurpose(value: string): value is EnvironmentPurpose;
96
+ /**
97
+ * Data required to create a new environment.
98
+ * Provided by the agent when requesting env-create.
99
+ */
100
+ export interface EnvironmentCreationData {
101
+ readonly id: EnvironmentId;
102
+ readonly name: EnvironmentName;
103
+ readonly cardId: string | undefined;
104
+ readonly purpose: EnvironmentPurpose;
105
+ readonly description: string;
106
+ readonly containerConfig: ContainerConfig;
107
+ readonly mergeStrategy: MergeStrategy;
108
+ }
109
+ /**
110
+ * Data required to reconstitute an Environment from persistence.
111
+ */
112
+ export interface EnvironmentData {
113
+ readonly id: EnvironmentId;
114
+ readonly name: EnvironmentName;
115
+ readonly cardId: string | undefined;
116
+ readonly purpose: EnvironmentPurpose;
117
+ readonly description: string;
118
+ readonly status: EnvironmentStatus;
119
+ readonly containerConfig: ContainerConfig;
120
+ readonly mergeStrategy: MergeStrategy;
121
+ readonly mergeCommitSha: string | undefined;
122
+ readonly errorMessage: string | undefined;
123
+ readonly metadata: Record<string, unknown>;
124
+ readonly createdAt: Timestamp;
125
+ readonly updatedAt: Timestamp;
126
+ }
127
+ //# sourceMappingURL=value-objects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-objects.d.ts","sourceRoot":"","sources":["../../../src/domain/environment/value-objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAIjE;;;GAGG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IACzC,OAAO;IAIP,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa;IAO9C,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;IAIzC,IAAI,QAAQ,IAAI,MAAM,CAGrB;CACF;AAID;;;;GAIG;AACH,qBAAa,eAAe;aACU,KAAK,EAAE,MAAM;IAAjD,OAAO;IAEP,MAAM,CAAC,MAAM,CAAC,IAAI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Q,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC/B"}
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Environment Management - Value Objects
3
+ *
4
+ * Immutable value objects for the environment bounded context.
5
+ * Environments are isolated containerized workspaces powered by container-use.
6
+ * The plugin tracks metadata; the agent invokes container-use MCP tools directly.
7
+ *
8
+ * DDD: Value Objects (no identity, compared by value)
9
+ * SOLID: SRP - value definitions and validation only
10
+ */
11
+ import { EntityId, Timestamp } from "../shared/value-objects.js";
12
+ // ── Environment Id ───────────────────────────────────────────────────
13
+ /**
14
+ * Unique identifier for an environment.
15
+ * Format: ENV-{NNN} (sequential, zero-padded).
16
+ */
17
+ export class EnvironmentId extends EntityId {
18
+ constructor(value) {
19
+ super(value);
20
+ }
21
+ static create(sequence) {
22
+ if (!Number.isInteger(sequence) || sequence <= 0) {
23
+ throw new Error("EnvironmentId: sequence must be a positive integer");
24
+ }
25
+ return new EnvironmentId(`ENV-${String(sequence).padStart(3, "0")}`);
26
+ }
27
+ static from(value) {
28
+ return new EnvironmentId(value);
29
+ }
30
+ get sequence() {
31
+ const parts = this.value.split("-");
32
+ return Number(parts[1] ?? 0);
33
+ }
34
+ }
35
+ // ── Environment Name ─────────────────────────────────────────────────
36
+ /**
37
+ * Container-use environment name (e.g., "fancy-mallard").
38
+ * This is the name assigned by container-use when creating an environment.
39
+ * Validated: non-empty, lowercase with hyphens.
40
+ */
41
+ export class EnvironmentName {
42
+ value;
43
+ constructor(value) {
44
+ this.value = value;
45
+ }
46
+ static create(name) {
47
+ const trimmed = name.trim().toLowerCase();
48
+ if (trimmed.length === 0) {
49
+ throw new Error("EnvironmentName: name cannot be empty");
50
+ }
51
+ if (!/^[a-z][a-z0-9-]*$/.test(trimmed)) {
52
+ throw new Error(`EnvironmentName: invalid format "${trimmed}" (must be lowercase alphanumeric with hyphens)`);
53
+ }
54
+ return new EnvironmentName(trimmed);
55
+ }
56
+ static from(value) {
57
+ return new EnvironmentName(value);
58
+ }
59
+ /** Derives the git branch name used by container-use: cu-{name} */
60
+ toBranchName() {
61
+ return `cu-${this.value}`;
62
+ }
63
+ equals(other) {
64
+ return this.value === other.value;
65
+ }
66
+ toString() {
67
+ return this.value;
68
+ }
69
+ }
70
+ // ── Environment Status ───────────────────────────────────────────────
71
+ /**
72
+ * Lifecycle status of an environment.
73
+ *
74
+ * State machine:
75
+ * creating -> active (environment ready), failed (creation error)
76
+ * active -> merging (merge requested), deleting (cleanup)
77
+ * merging -> merged (success), active (merge conflict, needs resolution)
78
+ * merged -> deleting (cleanup), (terminal - can stay for audit)
79
+ * deleting -> deleted (success)
80
+ * failed -> deleting (cleanup)
81
+ * deleted -> (terminal)
82
+ */
83
+ export const ENVIRONMENT_STATUSES = [
84
+ "creating",
85
+ "active",
86
+ "merging",
87
+ "merged",
88
+ "deleting",
89
+ "deleted",
90
+ "failed",
91
+ ];
92
+ export function isValidEnvironmentStatus(value) {
93
+ return ENVIRONMENT_STATUSES.includes(value);
94
+ }
95
+ /** Valid environment status transitions. */
96
+ export const ENVIRONMENT_TRANSITIONS = {
97
+ creating: ["active", "failed"],
98
+ active: ["merging", "deleting"],
99
+ merging: ["merged", "active"],
100
+ merged: ["deleting"],
101
+ deleting: ["deleted"],
102
+ deleted: [],
103
+ failed: ["deleting"],
104
+ };
105
+ /**
106
+ * Checks if a status transition is valid.
107
+ */
108
+ export function isValidTransition(from, to) {
109
+ const allowed = ENVIRONMENT_TRANSITIONS[from];
110
+ return allowed.includes(to);
111
+ }
112
+ // ── Merge Strategy ───────────────────────────────────────────────────
113
+ /**
114
+ * How environment changes should be merged back to the main branch.
115
+ */
116
+ export const MERGE_STRATEGIES = ["merge-commit", "squash", "rebase"];
117
+ export function isValidMergeStrategy(value) {
118
+ return MERGE_STRATEGIES.includes(value);
119
+ }
120
+ /**
121
+ * Creates a validated ContainerConfig.
122
+ * Provides sensible defaults for empty values.
123
+ */
124
+ export function createContainerConfig(params) {
125
+ return {
126
+ baseImage: params?.baseImage?.trim() || undefined,
127
+ setupCommands: params?.setupCommands ?? [],
128
+ installCommands: params?.installCommands ?? [],
129
+ envVars: params?.envVars ?? {},
130
+ };
131
+ }
132
+ /** Serializes a ContainerConfig to JSON string. */
133
+ export function containerConfigToJSON(config) {
134
+ return JSON.stringify({
135
+ ...(config.baseImage !== undefined ? { baseImage: config.baseImage } : {}),
136
+ setupCommands: config.setupCommands,
137
+ installCommands: config.installCommands,
138
+ envVars: config.envVars,
139
+ });
140
+ }
141
+ /** Deserializes a ContainerConfig from JSON string. */
142
+ export function containerConfigFromJSON(json) {
143
+ const parsed = JSON.parse(json);
144
+ if (typeof parsed !== "object" || parsed === null) {
145
+ throw new Error("ContainerConfig: expected JSON object");
146
+ }
147
+ const obj = parsed;
148
+ return createContainerConfig({
149
+ ...(typeof obj["baseImage"] === "string"
150
+ ? { baseImage: obj["baseImage"] }
151
+ : {}),
152
+ ...(Array.isArray(obj["setupCommands"])
153
+ ? { setupCommands: obj["setupCommands"] }
154
+ : {}),
155
+ ...(Array.isArray(obj["installCommands"])
156
+ ? { installCommands: obj["installCommands"] }
157
+ : {}),
158
+ ...(typeof obj["envVars"] === "object" && obj["envVars"] !== null
159
+ ? { envVars: obj["envVars"] }
160
+ : {}),
161
+ });
162
+ }
163
+ // ── Environment Purpose ──────────────────────────────────────────────
164
+ /**
165
+ * Classification of what the environment is being used for.
166
+ * Helps with prioritization and resource management.
167
+ */
168
+ export const ENVIRONMENT_PURPOSES = [
169
+ "feature",
170
+ "bugfix",
171
+ "experiment",
172
+ "refactor",
173
+ "spike",
174
+ "hotfix",
175
+ ];
176
+ export function isValidEnvironmentPurpose(value) {
177
+ return ENVIRONMENT_PURPOSES.includes(value);
178
+ }
179
+ //# sourceMappingURL=value-objects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-objects.js","sourceRoot":"","sources":["../../../src/domain/environment/value-objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEjE,wEAAwE;AAExE;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,QAAQ;IACzC,YAAoB,KAAa;QAC/B,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,QAAgB;QAC5B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;YACjD,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,IAAI,aAAa,CAAC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,KAAa;QACvB,OAAO,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,QAAQ;QACV,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/B,CAAC;CACF;AAED,wEAAwE;AA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AAG;IAClC,SAAS;IACT,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,OAAO;IACP,QAAQ;CACA,CAAC;AAIX,MAAM,UAAU,yBAAyB,CACvC,KAAa;IAEb,OAAO,oBAAoB,CAAC,QAAQ,CAAC,KAA2B,CAAC,CAAC;AACpE,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Governance Policies
3
+ *
4
+ * Defines the rules that govern tool execution at runtime.
5
+ * Policies are pure data + predicates with zero external dependencies.
6
+ *
7
+ * Three categories:
8
+ * 1. File access policies - block direct reads of data files
9
+ * 2. Shell command policies - block dangerous bash commands
10
+ * 3. Workflow policies - enforce kanban pipeline rules
11
+ *
12
+ * DDD: Value Objects (immutable policy rules)
13
+ * SOLID: OCP - new policies can be added without modifying existing ones
14
+ * SOLID: SRP - policy definition only (enforcement in services.ts)
15
+ */
16
+ /** Severity of a governance violation. */
17
+ export declare enum ViolationSeverity {
18
+ /** Blocks the operation entirely. */
19
+ Error = "error",
20
+ /** Allows the operation but logs a warning. */
21
+ Warning = "warning"
22
+ }
23
+ /** A single governance violation result. */
24
+ export interface Violation {
25
+ readonly rule: string;
26
+ readonly message: string;
27
+ readonly severity: ViolationSeverity;
28
+ }
29
+ /** Context for evaluating a policy against a tool invocation. */
30
+ export interface ToolInvocationContext {
31
+ readonly toolName: string;
32
+ readonly args: Record<string, unknown>;
33
+ }
34
+ /** A policy rule that can be evaluated against a tool invocation. */
35
+ export interface PolicyRule {
36
+ readonly id: string;
37
+ readonly description: string;
38
+ readonly evaluate: (ctx: ToolInvocationContext) => Violation | null;
39
+ }
40
+ /** All built-in governance policies. */
41
+ export declare const DEFAULT_POLICIES: readonly PolicyRule[];
42
+ //# sourceMappingURL=policies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../src/domain/governance/policies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,0CAA0C;AAC1C,oBAAY,iBAAiB;IAC3B,qCAAqC;IACrC,KAAK,UAAU;IACf,+CAA+C;IAC/C,OAAO,YAAY;CACpB;AAED,4CAA4C;AAC5C,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;CACtC;AAED,iEAAiE;AACjE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACxC;AAED,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,qBAAqB,KAAK,SAAS,GAAG,IAAI,CAAC;CACrE;AAuRD,wCAAwC;AACxC,eAAO,MAAM,gBAAgB,EAAE,SAAS,UAAU,EAcjD,CAAC"}
@@ -0,0 +1,304 @@
1
+ /**
2
+ * Governance Policies
3
+ *
4
+ * Defines the rules that govern tool execution at runtime.
5
+ * Policies are pure data + predicates with zero external dependencies.
6
+ *
7
+ * Three categories:
8
+ * 1. File access policies - block direct reads of data files
9
+ * 2. Shell command policies - block dangerous bash commands
10
+ * 3. Workflow policies - enforce kanban pipeline rules
11
+ *
12
+ * DDD: Value Objects (immutable policy rules)
13
+ * SOLID: OCP - new policies can be added without modifying existing ones
14
+ * SOLID: SRP - policy definition only (enforcement in services.ts)
15
+ */
16
+ /** Severity of a governance violation. */
17
+ export var ViolationSeverity;
18
+ (function (ViolationSeverity) {
19
+ /** Blocks the operation entirely. */
20
+ ViolationSeverity["Error"] = "error";
21
+ /** Allows the operation but logs a warning. */
22
+ ViolationSeverity["Warning"] = "warning";
23
+ })(ViolationSeverity || (ViolationSeverity = {}));
24
+ // ── File Access Policies ──────────────────────────────────────────────
25
+ function getFilePath(args) {
26
+ const fp = args["filePath"] ?? args["file_path"] ?? args["path"];
27
+ return typeof fp === "string" ? fp.toLowerCase() : null;
28
+ }
29
+ const blockCsvDirectRead = {
30
+ id: "file.block-csv-read",
31
+ description: "Block direct reading of CSV files; use csv-query tool instead",
32
+ evaluate(ctx) {
33
+ if (ctx.toolName !== "read")
34
+ return null;
35
+ const path = getFilePath(ctx.args);
36
+ if (path !== null && path.endsWith(".csv")) {
37
+ return {
38
+ rule: this.id,
39
+ message: "Use the csv-query tool instead of reading CSV files directly",
40
+ severity: ViolationSeverity.Error,
41
+ };
42
+ }
43
+ return null;
44
+ },
45
+ };
46
+ const blockYamlDirectRead = {
47
+ id: "file.block-yaml-read",
48
+ description: "Block direct reading of YAML files; use yaml-get tool instead",
49
+ evaluate(ctx) {
50
+ if (ctx.toolName !== "read")
51
+ return null;
52
+ const path = getFilePath(ctx.args);
53
+ if (path !== null && (path.endsWith(".yaml") || path.endsWith(".yml"))) {
54
+ return {
55
+ rule: this.id,
56
+ message: "Use the yaml-get tool instead of reading YAML files directly",
57
+ severity: ViolationSeverity.Error,
58
+ };
59
+ }
60
+ return null;
61
+ },
62
+ };
63
+ const blockEnvFileRead = {
64
+ id: "file.block-env-read",
65
+ description: "Block direct reading of .env files",
66
+ evaluate(ctx) {
67
+ if (ctx.toolName !== "read")
68
+ return null;
69
+ const path = getFilePath(ctx.args);
70
+ if (path !== null && (path.endsWith(".env") || path.includes(".env."))) {
71
+ return {
72
+ rule: this.id,
73
+ message: "Never read .env files directly -- they may contain secrets",
74
+ severity: ViolationSeverity.Error,
75
+ };
76
+ }
77
+ return null;
78
+ },
79
+ };
80
+ // ── Shell Command Policies ────────────────────────────────────────────
81
+ function getCommand(args) {
82
+ const cmd = args["command"];
83
+ return typeof cmd === "string" ? cmd.toLowerCase() : null;
84
+ }
85
+ const blockForcePush = {
86
+ id: "shell.block-force-push",
87
+ description: "Block git force push operations",
88
+ evaluate(ctx) {
89
+ if (ctx.toolName !== "bash")
90
+ return null;
91
+ const cmd = getCommand(ctx.args);
92
+ if (cmd !== null && cmd.includes("git push") && (cmd.includes("--force") || cmd.includes("-f"))) {
93
+ return {
94
+ rule: this.id,
95
+ message: "Force push is forbidden by governance policy",
96
+ severity: ViolationSeverity.Error,
97
+ };
98
+ }
99
+ return null;
100
+ },
101
+ };
102
+ const blockDirectSqlite = {
103
+ id: "shell.block-direct-sqlite",
104
+ description: "Block direct SQLite CLI access; use repository tools",
105
+ evaluate(ctx) {
106
+ if (ctx.toolName !== "bash")
107
+ return null;
108
+ const cmd = getCommand(ctx.args);
109
+ if (cmd !== null && cmd.includes("sqlite3")) {
110
+ return {
111
+ rule: this.id,
112
+ message: "Use repository tools instead of direct SQLite CLI access",
113
+ severity: ViolationSeverity.Error,
114
+ };
115
+ }
116
+ return null;
117
+ },
118
+ };
119
+ const warnDestructiveOps = {
120
+ id: "shell.warn-destructive",
121
+ description: "Warn on destructive file operations",
122
+ evaluate(ctx) {
123
+ if (ctx.toolName !== "bash")
124
+ return null;
125
+ const cmd = getCommand(ctx.args);
126
+ if (cmd !== null && cmd.includes("rm -rf")) {
127
+ return {
128
+ rule: this.id,
129
+ message: "Destructive operation detected (rm -rf). Proceed with caution.",
130
+ severity: ViolationSeverity.Warning,
131
+ };
132
+ }
133
+ return null;
134
+ },
135
+ };
136
+ // ── Security Policies: Secret Leakage Prevention ──────────────────────
137
+ /**
138
+ * Patterns that indicate a shell command is trying to read, echo, or
139
+ * expand environment variables that may contain secrets. These commands
140
+ * would send secret values to the AI provider via tool output.
141
+ */
142
+ const ENV_ACCESS_PATTERNS = [
143
+ /\benv\b(?!\s+[\w-]+=)/, // bare `env` (not `env VAR=val cmd`)
144
+ /\bprintenv\b/, // printenv (with or without args)
145
+ /\bexport\s+-p\b/, // export -p (dumps all exports)
146
+ /\bdeclare\s+-x\b/, // declare -x (dumps all exports)
147
+ /\bcompgen\s+-e\b/, // compgen -e (lists env var names)
148
+ /\becho\b.*\$\{?\w*(KEY|SECRET|TOKEN|PASSWORD|CREDENTIAL|AUTH)/i, // echo $*SECRET*
149
+ /\bprintf\b.*\$\{?\w*(KEY|SECRET|TOKEN|PASSWORD|CREDENTIAL|AUTH)/i,
150
+ /\bcat\b.*\/proc\/self\/environ/, // Linux proc environ
151
+ /\bnode\b.*process\.env/, // node -e "...process.env..."
152
+ /\bpython\b.*os\.\w*environ/, // python -c "...os.environ..."
153
+ ];
154
+ const blockEnvDump = {
155
+ id: "security.block-env-dump",
156
+ description: "Block shell commands that dump or leak environment variables",
157
+ evaluate(ctx) {
158
+ if (ctx.toolName !== "bash")
159
+ return null;
160
+ const cmd = getCommand(ctx.args);
161
+ if (cmd === null)
162
+ return null;
163
+ for (const pattern of ENV_ACCESS_PATTERNS) {
164
+ if (pattern.test(cmd)) {
165
+ return {
166
+ rule: this.id,
167
+ message: "Blocked: command would expose environment variables that may " +
168
+ "contain secrets. Environment variable values must never appear " +
169
+ "in tool outputs sent to AI providers.",
170
+ severity: ViolationSeverity.Error,
171
+ };
172
+ }
173
+ }
174
+ return null;
175
+ },
176
+ };
177
+ /**
178
+ * Block shell commands that read .env files via cat, grep, less, head,
179
+ * tail, strings, xxd, etc. The existing `file.block-env-read` policy
180
+ * only blocks the OpenCode `read` tool — this catches shell-level access.
181
+ */
182
+ const SHELL_ENV_FILE_PATTERNS = [
183
+ /\b(?:cat|less|more|head|tail|strings|xxd|od|bat)\b.*\.env\b/,
184
+ /\b(?:grep|rg|ag|ack)\b.*\.env\b/,
185
+ /\bsource\b.*\.env\b/,
186
+ /\b\.\s+.*\.env\b/, // `. .env` (source shorthand)
187
+ ];
188
+ const blockShellEnvFileRead = {
189
+ id: "security.block-shell-env-file",
190
+ description: "Block shell commands that read .env files",
191
+ evaluate(ctx) {
192
+ if (ctx.toolName !== "bash")
193
+ return null;
194
+ const cmd = getCommand(ctx.args);
195
+ if (cmd === null)
196
+ return null;
197
+ for (const pattern of SHELL_ENV_FILE_PATTERNS) {
198
+ if (pattern.test(cmd)) {
199
+ return {
200
+ rule: this.id,
201
+ message: "Blocked: command would read .env file contents that may " +
202
+ "contain secrets. Never read .env files via shell commands.",
203
+ severity: ViolationSeverity.Error,
204
+ };
205
+ }
206
+ }
207
+ return null;
208
+ },
209
+ };
210
+ /**
211
+ * Sensitive file extensions and patterns that should never be read
212
+ * directly — private keys, certificates, credential files, keystores.
213
+ */
214
+ const SENSITIVE_FILE_PATTERNS = [
215
+ /\.pem$/,
216
+ /\.key$/,
217
+ /\.p12$/,
218
+ /\.pfx$/,
219
+ /\.jks$/,
220
+ /\.keystore$/,
221
+ /\bid_rsa\b/,
222
+ /\bid_ecdsa\b/,
223
+ /\bid_ed25519\b/,
224
+ /\bcredentials\.\w+$/,
225
+ /\bsecrets\.\w+$/,
226
+ /\bservice[-_]?account.*\.json$/,
227
+ /\.kube\/config$/,
228
+ /\.docker\/config\.json$/,
229
+ /\.aws\/credentials$/,
230
+ /\.npmrc$/,
231
+ /\.pypirc$/,
232
+ /\.netrc$/,
233
+ ];
234
+ const blockSensitiveFileRead = {
235
+ id: "security.block-sensitive-file-read",
236
+ description: "Block reading of private keys, certificates, and credential files",
237
+ evaluate(ctx) {
238
+ if (ctx.toolName !== "read")
239
+ return null;
240
+ const path = getFilePath(ctx.args);
241
+ if (path === null)
242
+ return null;
243
+ for (const pattern of SENSITIVE_FILE_PATTERNS) {
244
+ if (pattern.test(path)) {
245
+ return {
246
+ rule: this.id,
247
+ message: "Blocked: file may contain private keys or credentials. " +
248
+ "Reading this file would send sensitive data to the AI provider.",
249
+ severity: ViolationSeverity.Error,
250
+ };
251
+ }
252
+ }
253
+ return null;
254
+ },
255
+ };
256
+ /**
257
+ * Block shell commands that attempt to read sensitive credential files.
258
+ * Complements `security.block-sensitive-file-read` which only covers
259
+ * the OpenCode `read` tool.
260
+ */
261
+ const blockShellSensitiveFileRead = {
262
+ id: "security.block-shell-sensitive-file",
263
+ description: "Block shell commands reading credential files",
264
+ evaluate(ctx) {
265
+ if (ctx.toolName !== "bash")
266
+ return null;
267
+ const cmd = getCommand(ctx.args);
268
+ if (cmd === null)
269
+ return null;
270
+ // Check for cat/less/head/etc. on sensitive file patterns
271
+ const readCmds = /\b(?:cat|less|more|head|tail|strings|xxd|od|bat|base64)\b/;
272
+ if (!readCmds.test(cmd))
273
+ return null;
274
+ for (const pattern of SENSITIVE_FILE_PATTERNS) {
275
+ if (pattern.test(cmd)) {
276
+ return {
277
+ rule: this.id,
278
+ message: "Blocked: command would read a file containing private keys " +
279
+ "or credentials. This data must never be sent to AI providers.",
280
+ severity: ViolationSeverity.Error,
281
+ };
282
+ }
283
+ }
284
+ return null;
285
+ },
286
+ };
287
+ // ── Default Policy Set ────────────────────────────────────────────────
288
+ /** All built-in governance policies. */
289
+ export const DEFAULT_POLICIES = [
290
+ // File access
291
+ blockCsvDirectRead,
292
+ blockYamlDirectRead,
293
+ blockEnvFileRead,
294
+ // Shell safety
295
+ blockForcePush,
296
+ blockDirectSqlite,
297
+ warnDestructiveOps,
298
+ // Security: secret leakage prevention
299
+ blockEnvDump,
300
+ blockShellEnvFileRead,
301
+ blockSensitiveFileRead,
302
+ blockShellSensitiveFileRead,
303
+ ];
304
+ //# sourceMappingURL=policies.js.map