@mc1global/opencode-jarvis 0.1.0 → 0.3.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 (295) hide show
  1. package/dist/application/agent-registry/dtos.d.ts +66 -0
  2. package/dist/application/agent-registry/dtos.d.ts.map +1 -0
  3. package/dist/application/agent-registry/dtos.js +11 -0
  4. package/dist/application/agent-registry/dtos.js.map +1 -0
  5. package/dist/application/agent-registry/use-cases.d.ts +39 -0
  6. package/dist/application/agent-registry/use-cases.d.ts.map +1 -0
  7. package/dist/application/agent-registry/use-cases.js +222 -0
  8. package/dist/application/agent-registry/use-cases.js.map +1 -0
  9. package/dist/application/azure-sync/dtos.d.ts +210 -0
  10. package/dist/application/azure-sync/dtos.d.ts.map +1 -0
  11. package/dist/application/azure-sync/dtos.js +11 -0
  12. package/dist/application/azure-sync/dtos.js.map +1 -0
  13. package/dist/application/azure-sync/field-builders.d.ts +54 -0
  14. package/dist/application/azure-sync/field-builders.d.ts.map +1 -0
  15. package/dist/application/azure-sync/field-builders.js +166 -0
  16. package/dist/application/azure-sync/field-builders.js.map +1 -0
  17. package/dist/application/azure-sync/index.d.ts +16 -0
  18. package/dist/application/azure-sync/index.d.ts.map +1 -0
  19. package/dist/application/azure-sync/index.js +10 -0
  20. package/dist/application/azure-sync/index.js.map +1 -0
  21. package/dist/application/azure-sync/pr-use-cases.d.ts +39 -0
  22. package/dist/application/azure-sync/pr-use-cases.d.ts.map +1 -0
  23. package/dist/application/azure-sync/pr-use-cases.js +192 -0
  24. package/dist/application/azure-sync/pr-use-cases.js.map +1 -0
  25. package/dist/application/azure-sync/pull-use-cases.d.ts +43 -0
  26. package/dist/application/azure-sync/pull-use-cases.d.ts.map +1 -0
  27. package/dist/application/azure-sync/pull-use-cases.js +322 -0
  28. package/dist/application/azure-sync/pull-use-cases.js.map +1 -0
  29. package/dist/application/azure-sync/push-use-cases.d.ts +53 -0
  30. package/dist/application/azure-sync/push-use-cases.d.ts.map +1 -0
  31. package/dist/application/azure-sync/push-use-cases.js +341 -0
  32. package/dist/application/azure-sync/push-use-cases.js.map +1 -0
  33. package/dist/application/azure-sync/reverse-field-builder.d.ts +52 -0
  34. package/dist/application/azure-sync/reverse-field-builder.d.ts.map +1 -0
  35. package/dist/application/azure-sync/reverse-field-builder.js +130 -0
  36. package/dist/application/azure-sync/reverse-field-builder.js.map +1 -0
  37. package/dist/application/azure-sync/task-push-use-cases.d.ts +68 -0
  38. package/dist/application/azure-sync/task-push-use-cases.d.ts.map +1 -0
  39. package/dist/application/azure-sync/task-push-use-cases.js +162 -0
  40. package/dist/application/azure-sync/task-push-use-cases.js.map +1 -0
  41. package/dist/application/config/config-service.d.ts +64 -0
  42. package/dist/application/config/config-service.d.ts.map +1 -0
  43. package/dist/application/config/config-service.js +110 -0
  44. package/dist/application/config/config-service.js.map +1 -0
  45. package/dist/application/config/index.d.ts +5 -0
  46. package/dist/application/config/index.d.ts.map +1 -0
  47. package/dist/application/config/index.js +5 -0
  48. package/dist/application/config/index.js.map +1 -0
  49. package/dist/application/kanban/board-use-cases.d.ts.map +1 -1
  50. package/dist/application/kanban/board-use-cases.js +14 -0
  51. package/dist/application/kanban/board-use-cases.js.map +1 -1
  52. package/dist/application/kanban/card-use-cases.d.ts +21 -2
  53. package/dist/application/kanban/card-use-cases.d.ts.map +1 -1
  54. package/dist/application/kanban/card-use-cases.js +180 -1
  55. package/dist/application/kanban/card-use-cases.js.map +1 -1
  56. package/dist/application/kanban/dtos.d.ts +59 -0
  57. package/dist/application/kanban/dtos.d.ts.map +1 -1
  58. package/dist/application/mcp/index.d.ts +10 -0
  59. package/dist/application/mcp/index.d.ts.map +1 -0
  60. package/dist/application/mcp/index.js +8 -0
  61. package/dist/application/mcp/index.js.map +1 -0
  62. package/dist/application/mcp/middleware.d.ts +91 -0
  63. package/dist/application/mcp/middleware.d.ts.map +1 -0
  64. package/dist/application/mcp/middleware.js +84 -0
  65. package/dist/application/mcp/middleware.js.map +1 -0
  66. package/dist/application/mcp/tool-adapter.d.ts +72 -0
  67. package/dist/application/mcp/tool-adapter.d.ts.map +1 -0
  68. package/dist/application/mcp/tool-adapter.js +132 -0
  69. package/dist/application/mcp/tool-adapter.js.map +1 -0
  70. package/dist/application/pipeline/dtos.d.ts +135 -0
  71. package/dist/application/pipeline/dtos.d.ts.map +1 -0
  72. package/dist/application/pipeline/dtos.js +11 -0
  73. package/dist/application/pipeline/dtos.js.map +1 -0
  74. package/dist/application/pipeline/index.d.ts +8 -0
  75. package/dist/application/pipeline/index.d.ts.map +1 -0
  76. package/dist/application/pipeline/index.js +7 -0
  77. package/dist/application/pipeline/index.js.map +1 -0
  78. package/dist/application/pipeline/use-cases.d.ts +67 -0
  79. package/dist/application/pipeline/use-cases.d.ts.map +1 -0
  80. package/dist/application/pipeline/use-cases.js +413 -0
  81. package/dist/application/pipeline/use-cases.js.map +1 -0
  82. package/dist/application/rag/use-cases.d.ts +3 -0
  83. package/dist/application/rag/use-cases.d.ts.map +1 -1
  84. package/dist/application/rag/use-cases.js +112 -34
  85. package/dist/application/rag/use-cases.js.map +1 -1
  86. package/dist/domain/agent-registry/entities.d.ts +68 -0
  87. package/dist/domain/agent-registry/entities.d.ts.map +1 -0
  88. package/dist/domain/agent-registry/entities.js +177 -0
  89. package/dist/domain/agent-registry/entities.js.map +1 -0
  90. package/dist/domain/agent-registry/repositories.d.ts +56 -0
  91. package/dist/domain/agent-registry/repositories.d.ts.map +1 -0
  92. package/dist/domain/agent-registry/repositories.js +12 -0
  93. package/dist/domain/agent-registry/repositories.js.map +1 -0
  94. package/dist/domain/agent-registry/services.d.ts +87 -0
  95. package/dist/domain/agent-registry/services.d.ts.map +1 -0
  96. package/dist/domain/agent-registry/services.js +188 -0
  97. package/dist/domain/agent-registry/services.js.map +1 -0
  98. package/dist/domain/agent-registry/value-objects.d.ts +145 -0
  99. package/dist/domain/agent-registry/value-objects.d.ts.map +1 -0
  100. package/dist/domain/agent-registry/value-objects.js +339 -0
  101. package/dist/domain/agent-registry/value-objects.js.map +1 -0
  102. package/dist/domain/azure-sync/entities.d.ts +165 -0
  103. package/dist/domain/azure-sync/entities.d.ts.map +1 -0
  104. package/dist/domain/azure-sync/entities.js +203 -0
  105. package/dist/domain/azure-sync/entities.js.map +1 -0
  106. package/dist/domain/azure-sync/index.d.ts +16 -0
  107. package/dist/domain/azure-sync/index.d.ts.map +1 -0
  108. package/dist/domain/azure-sync/index.js +14 -0
  109. package/dist/domain/azure-sync/index.js.map +1 -0
  110. package/dist/domain/azure-sync/ports.d.ts +117 -0
  111. package/dist/domain/azure-sync/ports.d.ts.map +1 -0
  112. package/dist/domain/azure-sync/ports.js +13 -0
  113. package/dist/domain/azure-sync/ports.js.map +1 -0
  114. package/dist/domain/azure-sync/repositories.d.ts +53 -0
  115. package/dist/domain/azure-sync/repositories.d.ts.map +1 -0
  116. package/dist/domain/azure-sync/repositories.js +11 -0
  117. package/dist/domain/azure-sync/repositories.js.map +1 -0
  118. package/dist/domain/azure-sync/services.d.ts +107 -0
  119. package/dist/domain/azure-sync/services.d.ts.map +1 -0
  120. package/dist/domain/azure-sync/services.js +316 -0
  121. package/dist/domain/azure-sync/services.js.map +1 -0
  122. package/dist/domain/azure-sync/value-objects.d.ts +129 -0
  123. package/dist/domain/azure-sync/value-objects.d.ts.map +1 -0
  124. package/dist/domain/azure-sync/value-objects.js +343 -0
  125. package/dist/domain/azure-sync/value-objects.js.map +1 -0
  126. package/dist/domain/config/index.d.ts +9 -0
  127. package/dist/domain/config/index.d.ts.map +1 -0
  128. package/dist/domain/config/index.js +7 -0
  129. package/dist/domain/config/index.js.map +1 -0
  130. package/dist/domain/config/repositories.d.ts +36 -0
  131. package/dist/domain/config/repositories.d.ts.map +1 -0
  132. package/dist/domain/config/repositories.js +12 -0
  133. package/dist/domain/config/repositories.js.map +1 -0
  134. package/dist/domain/config/value-objects.d.ts +112 -0
  135. package/dist/domain/config/value-objects.d.ts.map +1 -0
  136. package/dist/domain/config/value-objects.js +93 -0
  137. package/dist/domain/config/value-objects.js.map +1 -0
  138. package/dist/domain/governance/policies.d.ts.map +1 -1
  139. package/dist/domain/governance/policies.js +70 -0
  140. package/dist/domain/governance/policies.js.map +1 -1
  141. package/dist/domain/kanban/entities.d.ts +67 -15
  142. package/dist/domain/kanban/entities.d.ts.map +1 -1
  143. package/dist/domain/kanban/entities.js +177 -14
  144. package/dist/domain/kanban/entities.js.map +1 -1
  145. package/dist/domain/kanban/grooming.d.ts +27 -7
  146. package/dist/domain/kanban/grooming.d.ts.map +1 -1
  147. package/dist/domain/kanban/grooming.js +50 -12
  148. package/dist/domain/kanban/grooming.js.map +1 -1
  149. package/dist/domain/kanban/services.d.ts +16 -2
  150. package/dist/domain/kanban/services.d.ts.map +1 -1
  151. package/dist/domain/kanban/services.js +29 -2
  152. package/dist/domain/kanban/services.js.map +1 -1
  153. package/dist/domain/kanban/value-objects.d.ts +48 -0
  154. package/dist/domain/kanban/value-objects.d.ts.map +1 -1
  155. package/dist/domain/kanban/value-objects.js +53 -0
  156. package/dist/domain/kanban/value-objects.js.map +1 -1
  157. package/dist/domain/pipeline/gate.d.ts +75 -0
  158. package/dist/domain/pipeline/gate.d.ts.map +1 -0
  159. package/dist/domain/pipeline/gate.js +158 -0
  160. package/dist/domain/pipeline/gate.js.map +1 -0
  161. package/dist/domain/pipeline/index.d.ts +13 -0
  162. package/dist/domain/pipeline/index.d.ts.map +1 -0
  163. package/dist/domain/pipeline/index.js +14 -0
  164. package/dist/domain/pipeline/index.js.map +1 -0
  165. package/dist/domain/pipeline/pipeline.d.ts +99 -0
  166. package/dist/domain/pipeline/pipeline.d.ts.map +1 -0
  167. package/dist/domain/pipeline/pipeline.js +257 -0
  168. package/dist/domain/pipeline/pipeline.js.map +1 -0
  169. package/dist/domain/pipeline/ports.d.ts +120 -0
  170. package/dist/domain/pipeline/ports.d.ts.map +1 -0
  171. package/dist/domain/pipeline/ports.js +12 -0
  172. package/dist/domain/pipeline/ports.js.map +1 -0
  173. package/dist/domain/pipeline/repositories.d.ts +66 -0
  174. package/dist/domain/pipeline/repositories.d.ts.map +1 -0
  175. package/dist/domain/pipeline/repositories.js +11 -0
  176. package/dist/domain/pipeline/repositories.js.map +1 -0
  177. package/dist/domain/pipeline/services.d.ts +77 -0
  178. package/dist/domain/pipeline/services.d.ts.map +1 -0
  179. package/dist/domain/pipeline/services.js +156 -0
  180. package/dist/domain/pipeline/services.js.map +1 -0
  181. package/dist/domain/pipeline/value-objects.d.ts +117 -0
  182. package/dist/domain/pipeline/value-objects.d.ts.map +1 -0
  183. package/dist/domain/pipeline/value-objects.js +313 -0
  184. package/dist/domain/pipeline/value-objects.js.map +1 -0
  185. package/dist/domain/rag/value-objects.d.ts +9 -2
  186. package/dist/domain/rag/value-objects.d.ts.map +1 -1
  187. package/dist/domain/rag/value-objects.js +8 -2
  188. package/dist/domain/rag/value-objects.js.map +1 -1
  189. package/dist/index.d.ts.map +1 -1
  190. package/dist/index.js +113 -75
  191. package/dist/index.js.map +1 -1
  192. package/dist/infrastructure/agent-registry/agent-profile-repository.d.ts +29 -0
  193. package/dist/infrastructure/agent-registry/agent-profile-repository.d.ts.map +1 -0
  194. package/dist/infrastructure/agent-registry/agent-profile-repository.js +109 -0
  195. package/dist/infrastructure/agent-registry/agent-profile-repository.js.map +1 -0
  196. package/dist/infrastructure/agent-registry/agent-session-adapter.d.ts +28 -0
  197. package/dist/infrastructure/agent-registry/agent-session-adapter.d.ts.map +1 -0
  198. package/dist/infrastructure/agent-registry/agent-session-adapter.js +61 -0
  199. package/dist/infrastructure/agent-registry/agent-session-adapter.js.map +1 -0
  200. package/dist/infrastructure/agent-registry/built-in-profiles.d.ts +19 -0
  201. package/dist/infrastructure/agent-registry/built-in-profiles.d.ts.map +1 -0
  202. package/dist/infrastructure/agent-registry/built-in-profiles.js +210 -0
  203. package/dist/infrastructure/agent-registry/built-in-profiles.js.map +1 -0
  204. package/dist/infrastructure/azure-sync/azure-auth.d.ts +40 -0
  205. package/dist/infrastructure/azure-sync/azure-auth.d.ts.map +1 -0
  206. package/dist/infrastructure/azure-sync/azure-auth.js +94 -0
  207. package/dist/infrastructure/azure-sync/azure-auth.js.map +1 -0
  208. package/dist/infrastructure/azure-sync/azure-devops-client.d.ts +43 -0
  209. package/dist/infrastructure/azure-sync/azure-devops-client.d.ts.map +1 -0
  210. package/dist/infrastructure/azure-sync/azure-devops-client.js +296 -0
  211. package/dist/infrastructure/azure-sync/azure-devops-client.js.map +1 -0
  212. package/dist/infrastructure/azure-sync/index.d.ts +9 -0
  213. package/dist/infrastructure/azure-sync/index.d.ts.map +1 -0
  214. package/dist/infrastructure/azure-sync/index.js +12 -0
  215. package/dist/infrastructure/azure-sync/index.js.map +1 -0
  216. package/dist/infrastructure/azure-sync/sqlite-sync-repository.d.ts +39 -0
  217. package/dist/infrastructure/azure-sync/sqlite-sync-repository.d.ts.map +1 -0
  218. package/dist/infrastructure/azure-sync/sqlite-sync-repository.js +202 -0
  219. package/dist/infrastructure/azure-sync/sqlite-sync-repository.js.map +1 -0
  220. package/dist/infrastructure/config/index.d.ts +5 -0
  221. package/dist/infrastructure/config/index.d.ts.map +1 -0
  222. package/dist/infrastructure/config/index.js +5 -0
  223. package/dist/infrastructure/config/index.js.map +1 -0
  224. package/dist/infrastructure/config/yaml-config-repository.d.ts +22 -0
  225. package/dist/infrastructure/config/yaml-config-repository.d.ts.map +1 -0
  226. package/dist/infrastructure/config/yaml-config-repository.js +68 -0
  227. package/dist/infrastructure/config/yaml-config-repository.js.map +1 -0
  228. package/dist/infrastructure/database/sqlite-adapter.d.ts +13 -15
  229. package/dist/infrastructure/database/sqlite-adapter.d.ts.map +1 -1
  230. package/dist/infrastructure/database/sqlite-adapter.js +31 -17
  231. package/dist/infrastructure/database/sqlite-adapter.js.map +1 -1
  232. package/dist/infrastructure/domain-map/llm-prompt-factory.d.ts +21 -0
  233. package/dist/infrastructure/domain-map/llm-prompt-factory.d.ts.map +1 -0
  234. package/dist/infrastructure/domain-map/llm-prompt-factory.js +49 -0
  235. package/dist/infrastructure/domain-map/llm-prompt-factory.js.map +1 -0
  236. package/dist/infrastructure/kanban/card-repository.d.ts +6 -0
  237. package/dist/infrastructure/kanban/card-repository.d.ts.map +1 -1
  238. package/dist/infrastructure/kanban/card-repository.js +79 -7
  239. package/dist/infrastructure/kanban/card-repository.js.map +1 -1
  240. package/dist/infrastructure/pipeline/dagger-adapter.d.ts +50 -0
  241. package/dist/infrastructure/pipeline/dagger-adapter.d.ts.map +1 -0
  242. package/dist/infrastructure/pipeline/dagger-adapter.js +153 -0
  243. package/dist/infrastructure/pipeline/dagger-adapter.js.map +1 -0
  244. package/dist/infrastructure/pipeline/dagger-scaffold-generator.d.ts +35 -0
  245. package/dist/infrastructure/pipeline/dagger-scaffold-generator.d.ts.map +1 -0
  246. package/dist/infrastructure/pipeline/dagger-scaffold-generator.js +132 -0
  247. package/dist/infrastructure/pipeline/dagger-scaffold-generator.js.map +1 -0
  248. package/dist/infrastructure/pipeline/index.d.ts +20 -0
  249. package/dist/infrastructure/pipeline/index.d.ts.map +1 -0
  250. package/dist/infrastructure/pipeline/index.js +19 -0
  251. package/dist/infrastructure/pipeline/index.js.map +1 -0
  252. package/dist/infrastructure/pipeline/pipeline-template-registry.d.ts +23 -0
  253. package/dist/infrastructure/pipeline/pipeline-template-registry.d.ts.map +1 -0
  254. package/dist/infrastructure/pipeline/pipeline-template-registry.js +63 -0
  255. package/dist/infrastructure/pipeline/pipeline-template-registry.js.map +1 -0
  256. package/dist/infrastructure/pipeline/scaffold-templates-extra.d.ts +17 -0
  257. package/dist/infrastructure/pipeline/scaffold-templates-extra.d.ts.map +1 -0
  258. package/dist/infrastructure/pipeline/scaffold-templates-extra.js +467 -0
  259. package/dist/infrastructure/pipeline/scaffold-templates-extra.js.map +1 -0
  260. package/dist/infrastructure/pipeline/scaffold-templates.d.ts +23 -0
  261. package/dist/infrastructure/pipeline/scaffold-templates.d.ts.map +1 -0
  262. package/dist/infrastructure/pipeline/scaffold-templates.js +476 -0
  263. package/dist/infrastructure/pipeline/scaffold-templates.js.map +1 -0
  264. package/dist/infrastructure/pipeline/sqlite-pipeline-repository.d.ts +32 -0
  265. package/dist/infrastructure/pipeline/sqlite-pipeline-repository.d.ts.map +1 -0
  266. package/dist/infrastructure/pipeline/sqlite-pipeline-repository.js +197 -0
  267. package/dist/infrastructure/pipeline/sqlite-pipeline-repository.js.map +1 -0
  268. package/dist/mcp-server.d.ts +3 -0
  269. package/dist/mcp-server.d.ts.map +1 -0
  270. package/dist/mcp-server.js +300 -0
  271. package/dist/mcp-server.js.map +1 -0
  272. package/dist/tools/agent-registry-tools.d.ts +11 -0
  273. package/dist/tools/agent-registry-tools.d.ts.map +1 -0
  274. package/dist/tools/agent-registry-tools.js +208 -0
  275. package/dist/tools/agent-registry-tools.js.map +1 -0
  276. package/dist/tools/azure-sync-tools.d.ts +15 -0
  277. package/dist/tools/azure-sync-tools.d.ts.map +1 -0
  278. package/dist/tools/azure-sync-tools.js +332 -0
  279. package/dist/tools/azure-sync-tools.js.map +1 -0
  280. package/dist/tools/kanban-card-tools.d.ts.map +1 -1
  281. package/dist/tools/kanban-card-tools.js +41 -16
  282. package/dist/tools/kanban-card-tools.js.map +1 -1
  283. package/dist/tools/kanban-gate-tools.d.ts +7 -0
  284. package/dist/tools/kanban-gate-tools.d.ts.map +1 -0
  285. package/dist/tools/kanban-gate-tools.js +106 -0
  286. package/dist/tools/kanban-gate-tools.js.map +1 -0
  287. package/dist/tools/kanban-grooming-tools.d.ts +7 -0
  288. package/dist/tools/kanban-grooming-tools.d.ts.map +1 -0
  289. package/dist/tools/kanban-grooming-tools.js +180 -0
  290. package/dist/tools/kanban-grooming-tools.js.map +1 -0
  291. package/dist/tools/pipeline-tools.d.ts +15 -0
  292. package/dist/tools/pipeline-tools.d.ts.map +1 -0
  293. package/dist/tools/pipeline-tools.js +424 -0
  294. package/dist/tools/pipeline-tools.js.map +1 -0
  295. package/package.json +9 -3
@@ -0,0 +1,72 @@
1
+ /**
2
+ * MCP Tool Adapter
3
+ *
4
+ * Generic adapter that converts OpenCode plugin ToolDefinition records into
5
+ * MCP server tool registrations. Maps Zod raw shapes directly (the MCP SDK
6
+ * handles Zod-to-JSON-Schema conversion internally).
7
+ *
8
+ * Supports optional middleware for governance enforcement (before) and
9
+ * metrics recording (after) on every tool invocation.
10
+ *
11
+ * SOLID: SRP - adapter logic only, no server lifecycle
12
+ * SOLID: OCP - works with any ToolDefinition without modification
13
+ * SOLID: DIP - depends on ToolDefinition abstraction, not concrete tools
14
+ */
15
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
16
+ import type { ToolDefinition } from "@opencode-ai/plugin";
17
+ import type { McpMiddleware } from "./middleware.js";
18
+ /** Synthetic ToolContext for MCP invocations (no OpenCode session) */
19
+ interface McpToolContext {
20
+ readonly sessionID: string;
21
+ readonly messageID: string;
22
+ readonly agent: string;
23
+ readonly directory: string;
24
+ readonly worktree: string;
25
+ readonly abort: AbortSignal;
26
+ readonly metadata: (input: {
27
+ title?: string;
28
+ metadata?: Record<string, unknown>;
29
+ }) => void;
30
+ readonly ask: (input: {
31
+ permission: string;
32
+ patterns: string[];
33
+ always: string[];
34
+ metadata: Record<string, unknown>;
35
+ }) => Promise<void>;
36
+ }
37
+ /** Options for creating a synthetic ToolContext */
38
+ export interface McpContextOptions {
39
+ /** Working directory for tool execution */
40
+ readonly directory: string;
41
+ /** Worktree root (defaults to directory) */
42
+ readonly worktree?: string;
43
+ }
44
+ /**
45
+ * Creates a synthetic ToolContext for MCP tool execution.
46
+ * MCP has no session/message/agent concepts, so defaults are provided.
47
+ */
48
+ export declare function createMcpToolContext(options: McpContextOptions, signal: AbortSignal): McpToolContext;
49
+ /** Result of registering tools with the MCP server */
50
+ export interface AdapterResult {
51
+ /** Number of tools successfully registered */
52
+ readonly registered: number;
53
+ /** Tool names that were registered */
54
+ readonly toolNames: readonly string[];
55
+ }
56
+ /**
57
+ * Registers all tools from a ToolDefinition record with an MCP server.
58
+ *
59
+ * Each tool's Zod raw shape (args) is passed directly to McpServer.tool(),
60
+ * which handles Zod-to-JSON-Schema conversion internally. The execute
61
+ * function is wrapped to create a synthetic ToolContext, apply middleware,
62
+ * and format results as MCP text content.
63
+ *
64
+ * @param server - The McpServer instance to register tools on
65
+ * @param tools - Record of tool name to ToolDefinition
66
+ * @param contextOptions - Options for creating synthetic ToolContext
67
+ * @param middleware - Optional governance and metrics middleware
68
+ * @returns Number of tools registered and their names
69
+ */
70
+ export declare function registerToolsWithMcp(server: McpServer, tools: Record<string, ToolDefinition>, contextOptions: McpContextOptions, middleware?: McpMiddleware): AdapterResult;
71
+ export {};
72
+ //# sourceMappingURL=tool-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-adapter.d.ts","sourceRoot":"","sources":["../../../src/application/mcp/tool-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,sEAAsE;AACtE,UAAU,cAAc;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE;QACzB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,KAAK,IAAI,CAAC;IACX,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACnC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrB;AAED,mDAAmD;AACnD,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,WAAW,GAClB,cAAc,CAehB;AAED,sDAAsD;AACtD,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,sCAAsC;IACtC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAkFD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,EACrC,cAAc,EAAE,iBAAiB,EACjC,UAAU,CAAC,EAAE,aAAa,GACzB,aAAa,CAuCf"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Creates a synthetic ToolContext for MCP tool execution.
3
+ * MCP has no session/message/agent concepts, so defaults are provided.
4
+ */
5
+ export function createMcpToolContext(options, signal) {
6
+ return {
7
+ sessionID: "mcp-session",
8
+ messageID: "mcp-request",
9
+ agent: "mcp-client",
10
+ directory: options.directory,
11
+ worktree: options.worktree ?? options.directory,
12
+ abort: signal,
13
+ metadata: () => {
14
+ /* MCP has no metadata channel */
15
+ },
16
+ ask: async () => {
17
+ /* MCP has no interactive ask — auto-approve */
18
+ },
19
+ };
20
+ }
21
+ /**
22
+ * Executes a tool with middleware wrapping.
23
+ * Runs before-middleware, then execute, then after-middleware.
24
+ * Governance violations from before-middleware are returned as errors.
25
+ * After-middleware errors are silenced.
26
+ */
27
+ async function executeWithMiddleware(toolName, args, execute, middleware) {
28
+ const start = Date.now();
29
+ // Before middleware (governance)
30
+ if (middleware?.before) {
31
+ try {
32
+ await middleware.before({ toolName, args });
33
+ }
34
+ catch (err) {
35
+ const message = err instanceof Error ? err.message : String(err);
36
+ // Record the blocked invocation in after middleware
37
+ if (middleware.after) {
38
+ try {
39
+ await middleware.after({
40
+ toolName,
41
+ success: false,
42
+ durationMs: Date.now() - start,
43
+ result: message,
44
+ });
45
+ }
46
+ catch {
47
+ /* silent */
48
+ }
49
+ }
50
+ return {
51
+ content: [{ type: "text", text: message }],
52
+ isError: true,
53
+ };
54
+ }
55
+ }
56
+ // Execute the tool
57
+ try {
58
+ const result = await execute();
59
+ const durationMs = Date.now() - start;
60
+ // After middleware (metrics)
61
+ if (middleware?.after) {
62
+ try {
63
+ await middleware.after({ toolName, success: true, durationMs, result });
64
+ }
65
+ catch {
66
+ /* silent */
67
+ }
68
+ }
69
+ return { content: [{ type: "text", text: result }] };
70
+ }
71
+ catch (err) {
72
+ const message = err instanceof Error ? err.message : String(err);
73
+ const durationMs = Date.now() - start;
74
+ // After middleware (metrics)
75
+ if (middleware?.after) {
76
+ try {
77
+ await middleware.after({
78
+ toolName,
79
+ success: false,
80
+ durationMs,
81
+ result: message,
82
+ });
83
+ }
84
+ catch {
85
+ /* silent */
86
+ }
87
+ }
88
+ return {
89
+ content: [{ type: "text", text: message }],
90
+ isError: true,
91
+ };
92
+ }
93
+ }
94
+ /**
95
+ * Registers all tools from a ToolDefinition record with an MCP server.
96
+ *
97
+ * Each tool's Zod raw shape (args) is passed directly to McpServer.tool(),
98
+ * which handles Zod-to-JSON-Schema conversion internally. The execute
99
+ * function is wrapped to create a synthetic ToolContext, apply middleware,
100
+ * and format results as MCP text content.
101
+ *
102
+ * @param server - The McpServer instance to register tools on
103
+ * @param tools - Record of tool name to ToolDefinition
104
+ * @param contextOptions - Options for creating synthetic ToolContext
105
+ * @param middleware - Optional governance and metrics middleware
106
+ * @returns Number of tools registered and their names
107
+ */
108
+ export function registerToolsWithMcp(server, tools, contextOptions, middleware) {
109
+ const toolNames = [];
110
+ for (const [name, definition] of Object.entries(tools)) {
111
+ const hasArgs = Object.keys(definition.args).length > 0;
112
+ if (hasArgs) {
113
+ server.tool(name, definition.description, definition.args, async (args, extra) => {
114
+ const ctx = createMcpToolContext(contextOptions, extra.signal);
115
+ return executeWithMiddleware(name, args,
116
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
117
+ () => definition.execute(args, ctx), middleware);
118
+ });
119
+ }
120
+ else {
121
+ server.tool(name, definition.description, async (_extra) => {
122
+ const ctx = createMcpToolContext(contextOptions, _extra.signal);
123
+ return executeWithMiddleware(name, {},
124
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
125
+ () => definition.execute({}, ctx), middleware);
126
+ });
127
+ }
128
+ toolNames.push(name);
129
+ }
130
+ return { registered: toolNames.length, toolNames };
131
+ }
132
+ //# sourceMappingURL=tool-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-adapter.js","sourceRoot":"","sources":["../../../src/application/mcp/tool-adapter.ts"],"names":[],"mappings":"AAgDA;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAA0B,EAC1B,MAAmB;IAEnB,OAAO;QACL,SAAS,EAAE,aAAa;QACxB,SAAS,EAAE,aAAa;QACxB,KAAK,EAAE,YAAY;QACnB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,SAAS;QAC/C,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,GAAG,EAAE;YACb,iCAAiC;QACnC,CAAC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AAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAExD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,CAAC,IAAI,CACT,IAAI,EACJ,UAAU,CAAC,WAAW,EACtB,UAAU,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;gBACpB,MAAM,GAAG,GAAG,oBAAoB,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBAC/D,OAAO,qBAAqB,CAC1B,IAAI,EACJ,IAA+B;gBAC/B,qGAAqG;gBACrG,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,IAAW,EAAE,GAAU,CAAC,EACjD,UAAU,CACX,CAAC;YACJ,CAAC,CACF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;gBACzD,MAAM,GAAG,GAAG,oBAAoB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;gBAChE,OAAO,qBAAqB,CAC1B,IAAI,EACJ,EAAE;gBACF,qGAAqG;gBACrG,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAS,EAAE,GAAU,CAAC,EAC/C,UAAU,CACX,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;QAED,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;AACrD,CAAC"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Pipeline DTOs (Data Transfer Objects)
3
+ *
4
+ * Plain objects for crossing layer boundaries in the pipeline context.
5
+ * Tools -> Use Cases (request DTOs), Use Cases -> Tools (response DTOs).
6
+ *
7
+ * SOLID: SRP - DTOs carry data, no logic
8
+ * DDD: Application layer boundary objects
9
+ */
10
+ export interface InitPipelineRequest {
11
+ readonly workspace: string;
12
+ readonly stack: string;
13
+ readonly scope: string;
14
+ readonly version: string;
15
+ readonly cardId?: string;
16
+ }
17
+ export interface ActivatePipelineRequest {
18
+ readonly pipelineId: string;
19
+ }
20
+ export interface CancelPipelineRequest {
21
+ readonly pipelineId: string;
22
+ }
23
+ export interface RetryPipelineRequest {
24
+ readonly pipelineId: string;
25
+ }
26
+ export interface RunGateRequest {
27
+ readonly pipelineId: string;
28
+ readonly gateId: string;
29
+ readonly moduleDir: string;
30
+ readonly args?: readonly string[];
31
+ readonly timeoutMs?: number;
32
+ }
33
+ export interface PassGateRequest {
34
+ readonly pipelineId: string;
35
+ readonly gateId: string;
36
+ readonly output?: string;
37
+ }
38
+ export interface FailGateRequest {
39
+ readonly pipelineId: string;
40
+ readonly gateId: string;
41
+ readonly output?: string;
42
+ }
43
+ export interface SkipGateRequest {
44
+ readonly pipelineId: string;
45
+ readonly gateId: string;
46
+ readonly reason: string;
47
+ readonly approvedBy?: string;
48
+ }
49
+ export interface RetryGateRequest {
50
+ readonly pipelineId: string;
51
+ readonly gateId: string;
52
+ }
53
+ export interface GenerateScaffoldRequest {
54
+ readonly stack: string;
55
+ }
56
+ export interface ScaffoldFileResponse {
57
+ readonly path: string;
58
+ readonly content: string;
59
+ }
60
+ export interface ScaffoldResponse {
61
+ readonly stack: string;
62
+ readonly sdk: string;
63
+ readonly moduleName: string;
64
+ readonly files: readonly ScaffoldFileResponse[];
65
+ }
66
+ export interface SupportedStacksResponse {
67
+ readonly stacks: readonly string[];
68
+ }
69
+ export interface GetPipelineRequest {
70
+ readonly pipelineId: string;
71
+ }
72
+ export interface ListPipelinesRequest {
73
+ readonly workspace: string;
74
+ readonly status?: string;
75
+ readonly scope?: string;
76
+ }
77
+ export interface GetTemplateRequest {
78
+ readonly stack: string;
79
+ readonly scope: string;
80
+ }
81
+ export interface GateResponse {
82
+ readonly id: string;
83
+ readonly type: string;
84
+ readonly status: string;
85
+ readonly order: number;
86
+ readonly daggerFunction: string;
87
+ readonly skipPolicy: string;
88
+ readonly command?: string;
89
+ readonly output?: string;
90
+ readonly skippedReason?: string;
91
+ readonly approvedBy?: string;
92
+ readonly startedAt?: string;
93
+ readonly completedAt?: string;
94
+ }
95
+ export interface PipelineResponse {
96
+ readonly id: string;
97
+ readonly workspaceId: string;
98
+ readonly templateId: string;
99
+ readonly scope: string;
100
+ readonly status: string;
101
+ readonly version: string;
102
+ readonly gates: readonly GateResponse[];
103
+ readonly gateCount: number;
104
+ readonly currentGate?: string;
105
+ readonly nextGate?: string;
106
+ readonly createdAt: string;
107
+ readonly activatedAt?: string;
108
+ readonly completedAt?: string;
109
+ readonly cardId?: string;
110
+ }
111
+ export interface GateTemplateResponse {
112
+ readonly type: string;
113
+ readonly daggerFunction: string;
114
+ readonly skipPolicy: string;
115
+ readonly command?: string;
116
+ }
117
+ export interface PipelineTemplateResponse {
118
+ readonly stack: string;
119
+ readonly scope: string;
120
+ readonly gates: readonly GateTemplateResponse[];
121
+ }
122
+ export interface TemplateListResponse {
123
+ readonly templates: readonly string[];
124
+ }
125
+ export interface RunGateResultResponse {
126
+ readonly pipeline: PipelineResponse;
127
+ readonly gateId: string;
128
+ readonly daggerResult: {
129
+ readonly success: boolean;
130
+ readonly output: string;
131
+ readonly exitCode: number;
132
+ readonly durationMs: number;
133
+ };
134
+ }
135
+ //# sourceMappingURL=dtos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dtos.d.ts","sourceRoot":"","sources":["../../../src/application/pipeline/dtos.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,Q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AC;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACjD;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE;QACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;QAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Pipeline DTOs (Data Transfer Objects)
3
+ *
4
+ * Plain objects for crossing layer boundaries in the pipeline context.
5
+ * Tools -> Use Cases (request DTOs), Use Cases -> Tools (response DTOs).
6
+ *
7
+ * SOLID: SRP - DTOs carry data, no logic
8
+ * DDD: Application layer boundary objects
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=dtos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dtos.js","sourceRoot":"","sources":["../../../src/application/pipeline/dtos.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Pipeline Bounded Context — Application Layer
3
+ *
4
+ * Exports use cases and DTOs for pipeline lifecycle and gate operations.
5
+ */
6
+ export { PipelineUseCases } from "./use-cases.js";
7
+ export type { InitPipelineRequest, ActivatePipelineRequest, CancelPipelineRequest, RetryPipelineRequest, RunGateRequest, PassGateRequest, FailGateRequest, SkipGateRequest, RetryGateRequest, GetPipelineRequest, ListPipelinesRequest, GetTemplateRequest, GateResponse, PipelineResponse, GateTemplateResponse, PipelineTemplateResponse, TemplateListResponse, RunGateResultResponse, GenerateScaffoldRequest, ScaffoldFileResponse, ScaffoldResponse, SupportedStacksResponse, } from "./dtos.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/application/pipeline/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,YAAY,EACV,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Pipeline Bounded Context — Application Layer
3
+ *
4
+ * Exports use cases and DTOs for pipeline lifecycle and gate operations.
5
+ */
6
+ export { PipelineUseCases } from "./use-cases.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/application/pipeline/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Pipeline Use Cases — Application layer orchestration for pipeline lifecycle
3
+ * and gate operations. Converts DTOs <-> domain types, delegates to services.
4
+ */
5
+ import type { Result } from "../../domain/shared/value-objects.js";
6
+ import type { PipelineRepository, PipelineTemplateRepository } from "../../domain/pipeline/repositories.js";
7
+ import type { PipelineFactory, GateEnforcer } from "../../domain/pipeline/services.js";
8
+ import type { DaggerPort, ScaffoldPort } from "../../domain/pipeline/ports.js";
9
+ import type { InitPipelineRequest, ActivatePipelineRequest, CancelPipelineRequest, RetryPipelineRequest, RunGateRequest, PassGateRequest, FailGateRequest, SkipGateRequest, RetryGateRequest, GetPipelineRequest, ListPipelinesRequest, GetTemplateRequest, PipelineResponse, PipelineTemplateResponse, TemplateListResponse, RunGateResultResponse, GenerateScaffoldRequest, ScaffoldResponse, SupportedStacksResponse } from "./dtos.js";
10
+ /** Callback to record gate execution metrics (cross-context, no direct import). */
11
+ export type GateMetricsRecorder = (event: {
12
+ readonly pipelineId: string;
13
+ readonly gateId: string;
14
+ readonly success: boolean;
15
+ readonly durationMs: number;
16
+ readonly cardId?: string;
17
+ }) => Promise<void>;
18
+ /**
19
+ * Pipeline application use cases.
20
+ *
21
+ * Orchestrates pipeline lifecycle (init, activate, cancel, retry),
22
+ * gate operations (run, pass, fail, skip, retry), queries, and
23
+ * template browsing.
24
+ */
25
+ export declare class PipelineUseCases {
26
+ private readonly pipelineRepo;
27
+ private readonly templateRepo;
28
+ private readonly pipelineFactory;
29
+ private readonly gateEnforcer;
30
+ private readonly daggerPort;
31
+ private readonly scaffoldPort?;
32
+ private readonly gateMetricsRecorder?;
33
+ constructor(pipelineRepo: PipelineRepository, templateRepo: PipelineTemplateRepository, pipelineFactory: PipelineFactory, gateEnforcer: GateEnforcer, daggerPort: DaggerPort, scaffoldPort?: ScaffoldPort | undefined, gateMetricsRecorder?: GateMetricsRecorder | undefined);
34
+ /** Create a new pipeline from a stack template. Returns pipeline in draft status. */
35
+ initPipeline(request: InitPipelineRequest): Promise<Result<PipelineResponse>>;
36
+ /** Activate a draft pipeline, making it runnable. */
37
+ activatePipeline(request: ActivatePipelineRequest): Promise<Result<PipelineResponse>>;
38
+ /** Cancel a draft or active pipeline. */
39
+ cancelPipeline(request: CancelPipelineRequest): Promise<Result<PipelineResponse>>;
40
+ /** Retry a failed pipeline (resets to active, retries the failed gate). */
41
+ retryPipeline(request: RetryPipelineRequest): Promise<Result<PipelineResponse>>;
42
+ /** Execute a gate via Dagger. Starts the gate, runs the Dagger function, then passes/fails. */
43
+ runGate(request: RunGateRequest): Promise<Result<RunGateResultResponse>>;
44
+ /** Manually mark a gate as passed. */
45
+ passGate(request: PassGateRequest): Promise<Result<PipelineResponse>>;
46
+ /** Manually mark a gate as failed. */
47
+ failGate(request: FailGateRequest): Promise<Result<PipelineResponse>>;
48
+ /** Skip a gate with justification (enforces skip policy from domain). */
49
+ skipGate(request: SkipGateRequest): Promise<Result<PipelineResponse>>;
50
+ /** Retry a failed gate (resets to pending). */
51
+ retryGate(request: RetryGateRequest): Promise<Result<PipelineResponse>>;
52
+ /** Get a pipeline by ID with all gate details. */
53
+ getPipeline(request: GetPipelineRequest): Promise<Result<PipelineResponse | null>>;
54
+ /** List pipelines for a workspace, optionally filtered by status or scope. */
55
+ listPipelines(request: ListPipelinesRequest): Promise<Result<readonly PipelineResponse[]>>;
56
+ /** List available stack templates. */
57
+ getTemplates(): Promise<Result<TemplateListResponse>>;
58
+ /** Get template details for a specific stack + scope. */
59
+ getTemplate(request: GetTemplateRequest): Promise<Result<PipelineTemplateResponse | null>>;
60
+ /** Generate Dagger module scaffold files for a stack template. */
61
+ generateScaffold(request: GenerateScaffoldRequest): Promise<Result<ScaffoldResponse>>;
62
+ /** List stacks that have Dagger scaffold support. */
63
+ getSupportedStacks(): Promise<Result<SupportedStacksResponse>>;
64
+ /** Record gate execution metrics via optional callback (fire-and-forget). */
65
+ private recordGateMetrics;
66
+ }
67
+ //# sourceMappingURL=use-cases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-cases.d.ts","sourceRoot":"","sources":["../../../src/application/pipeline/use-cases.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAmBnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAC5G,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mCAAmC,CA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