@generacy-ai/generacy 0.3.3 → 0.4.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 (219) hide show
  1. package/README.md +153 -0
  2. package/dist/cli/commands/cluster/scaffolder.d.ts.map +1 -1
  3. package/dist/cli/commands/cluster/scaffolder.js +2 -0
  4. package/dist/cli/commands/cluster/scaffolder.js.map +1 -1
  5. package/dist/cli/commands/cockpit/advance.d.ts +42 -0
  6. package/dist/cli/commands/cockpit/advance.d.ts.map +1 -0
  7. package/dist/cli/commands/cockpit/advance.js +136 -0
  8. package/dist/cli/commands/cockpit/advance.js.map +1 -0
  9. package/dist/cli/commands/cockpit/clarification-comment-finder.d.ts +13 -0
  10. package/dist/cli/commands/cockpit/clarification-comment-finder.d.ts.map +1 -0
  11. package/dist/cli/commands/cockpit/clarification-comment-finder.js +31 -0
  12. package/dist/cli/commands/cockpit/clarification-comment-finder.js.map +1 -0
  13. package/dist/cli/commands/cockpit/code-references.d.ts +27 -0
  14. package/dist/cli/commands/cockpit/code-references.d.ts.map +1 -0
  15. package/dist/cli/commands/cockpit/code-references.js +48 -0
  16. package/dist/cli/commands/cockpit/code-references.js.map +1 -0
  17. package/dist/cli/commands/cockpit/context.d.ts +90 -0
  18. package/dist/cli/commands/cockpit/context.d.ts.map +1 -0
  19. package/dist/cli/commands/cockpit/context.js +280 -0
  20. package/dist/cli/commands/cockpit/context.js.map +1 -0
  21. package/dist/cli/commands/cockpit/exit.d.ts +12 -0
  22. package/dist/cli/commands/cockpit/exit.d.ts.map +1 -0
  23. package/dist/cli/commands/cockpit/exit.js +18 -0
  24. package/dist/cli/commands/cockpit/exit.js.map +1 -0
  25. package/dist/cli/commands/cockpit/gate-vocabulary.d.ts +48 -0
  26. package/dist/cli/commands/cockpit/gate-vocabulary.d.ts.map +1 -0
  27. package/dist/cli/commands/cockpit/gate-vocabulary.js +96 -0
  28. package/dist/cli/commands/cockpit/gate-vocabulary.js.map +1 -0
  29. package/dist/cli/commands/cockpit/index.d.ts +20 -0
  30. package/dist/cli/commands/cockpit/index.d.ts.map +1 -0
  31. package/dist/cli/commands/cockpit/index.js +40 -0
  32. package/dist/cli/commands/cockpit/index.js.map +1 -0
  33. package/dist/cli/commands/cockpit/manual-advance-marker.d.ts +18 -0
  34. package/dist/cli/commands/cockpit/manual-advance-marker.d.ts.map +1 -0
  35. package/dist/cli/commands/cockpit/manual-advance-marker.js +43 -0
  36. package/dist/cli/commands/cockpit/manual-advance-marker.js.map +1 -0
  37. package/dist/cli/commands/cockpit/mcp/errors.d.ts +54 -0
  38. package/dist/cli/commands/cockpit/mcp/errors.d.ts.map +1 -0
  39. package/dist/cli/commands/cockpit/mcp/errors.js +190 -0
  40. package/dist/cli/commands/cockpit/mcp/errors.js.map +1 -0
  41. package/dist/cli/commands/cockpit/mcp/event-bus-registry.d.ts +59 -0
  42. package/dist/cli/commands/cockpit/mcp/event-bus-registry.d.ts.map +1 -0
  43. package/dist/cli/commands/cockpit/mcp/event-bus-registry.js +305 -0
  44. package/dist/cli/commands/cockpit/mcp/event-bus-registry.js.map +1 -0
  45. package/dist/cli/commands/cockpit/mcp/event-bus.d.ts +82 -0
  46. package/dist/cli/commands/cockpit/mcp/event-bus.d.ts.map +1 -0
  47. package/dist/cli/commands/cockpit/mcp/event-bus.js +230 -0
  48. package/dist/cli/commands/cockpit/mcp/event-bus.js.map +1 -0
  49. package/dist/cli/commands/cockpit/mcp/index.d.ts +17 -0
  50. package/dist/cli/commands/cockpit/mcp/index.d.ts.map +1 -0
  51. package/dist/cli/commands/cockpit/mcp/index.js +37 -0
  52. package/dist/cli/commands/cockpit/mcp/index.js.map +1 -0
  53. package/dist/cli/commands/cockpit/mcp/ref-input.d.ts +52 -0
  54. package/dist/cli/commands/cockpit/mcp/ref-input.d.ts.map +1 -0
  55. package/dist/cli/commands/cockpit/mcp/ref-input.js +132 -0
  56. package/dist/cli/commands/cockpit/mcp/ref-input.js.map +1 -0
  57. package/dist/cli/commands/cockpit/mcp/schemas.d.ts +287 -0
  58. package/dist/cli/commands/cockpit/mcp/schemas.d.ts.map +1 -0
  59. package/dist/cli/commands/cockpit/mcp/schemas.js +84 -0
  60. package/dist/cli/commands/cockpit/mcp/schemas.js.map +1 -0
  61. package/dist/cli/commands/cockpit/mcp/server.d.ts +17 -0
  62. package/dist/cli/commands/cockpit/mcp/server.d.ts.map +1 -0
  63. package/dist/cli/commands/cockpit/mcp/server.js +62 -0
  64. package/dist/cli/commands/cockpit/mcp/server.js.map +1 -0
  65. package/dist/cli/commands/cockpit/mcp/tools/cockpit_advance.d.ts +42 -0
  66. package/dist/cli/commands/cockpit/mcp/tools/cockpit_advance.d.ts.map +1 -0
  67. package/dist/cli/commands/cockpit/mcp/tools/cockpit_advance.js +73 -0
  68. package/dist/cli/commands/cockpit/mcp/tools/cockpit_advance.js.map +1 -0
  69. package/dist/cli/commands/cockpit/mcp/tools/cockpit_await_events.d.ts +34 -0
  70. package/dist/cli/commands/cockpit/mcp/tools/cockpit_await_events.d.ts.map +1 -0
  71. package/dist/cli/commands/cockpit/mcp/tools/cockpit_await_events.js +115 -0
  72. package/dist/cli/commands/cockpit/mcp/tools/cockpit_await_events.js.map +1 -0
  73. package/dist/cli/commands/cockpit/mcp/tools/cockpit_context.d.ts +21 -0
  74. package/dist/cli/commands/cockpit/mcp/tools/cockpit_context.d.ts.map +1 -0
  75. package/dist/cli/commands/cockpit/mcp/tools/cockpit_context.js +35 -0
  76. package/dist/cli/commands/cockpit/mcp/tools/cockpit_context.js.map +1 -0
  77. package/dist/cli/commands/cockpit/mcp/tools/cockpit_merge.d.ts +43 -0
  78. package/dist/cli/commands/cockpit/mcp/tools/cockpit_merge.d.ts.map +1 -0
  79. package/dist/cli/commands/cockpit/mcp/tools/cockpit_merge.js +99 -0
  80. package/dist/cli/commands/cockpit/mcp/tools/cockpit_merge.js.map +1 -0
  81. package/dist/cli/commands/cockpit/mcp/tools/cockpit_queue.d.ts +43 -0
  82. package/dist/cli/commands/cockpit/mcp/tools/cockpit_queue.d.ts.map +1 -0
  83. package/dist/cli/commands/cockpit/mcp/tools/cockpit_queue.js +68 -0
  84. package/dist/cli/commands/cockpit/mcp/tools/cockpit_queue.js.map +1 -0
  85. package/dist/cli/commands/cockpit/mcp/tools/cockpit_resume.d.ts +38 -0
  86. package/dist/cli/commands/cockpit/mcp/tools/cockpit_resume.d.ts.map +1 -0
  87. package/dist/cli/commands/cockpit/mcp/tools/cockpit_resume.js +79 -0
  88. package/dist/cli/commands/cockpit/mcp/tools/cockpit_resume.js.map +1 -0
  89. package/dist/cli/commands/cockpit/mcp/tools/cockpit_status.d.ts +21 -0
  90. package/dist/cli/commands/cockpit/mcp/tools/cockpit_status.d.ts.map +1 -0
  91. package/dist/cli/commands/cockpit/mcp/tools/cockpit_status.js +59 -0
  92. package/dist/cli/commands/cockpit/mcp/tools/cockpit_status.js.map +1 -0
  93. package/dist/cli/commands/cockpit/merge.d.ts +42 -0
  94. package/dist/cli/commands/cockpit/merge.d.ts.map +1 -0
  95. package/dist/cli/commands/cockpit/merge.js +360 -0
  96. package/dist/cli/commands/cockpit/merge.js.map +1 -0
  97. package/dist/cli/commands/cockpit/plan-dependency-extractor.d.ts +30 -0
  98. package/dist/cli/commands/cockpit/plan-dependency-extractor.d.ts.map +1 -0
  99. package/dist/cli/commands/cockpit/plan-dependency-extractor.js +135 -0
  100. package/dist/cli/commands/cockpit/plan-dependency-extractor.js.map +1 -0
  101. package/dist/cli/commands/cockpit/queue.d.ts +85 -0
  102. package/dist/cli/commands/cockpit/queue.d.ts.map +1 -0
  103. package/dist/cli/commands/cockpit/queue.js +438 -0
  104. package/dist/cli/commands/cockpit/queue.js.map +1 -0
  105. package/dist/cli/commands/cockpit/resolver.d.ts +70 -0
  106. package/dist/cli/commands/cockpit/resolver.d.ts.map +1 -0
  107. package/dist/cli/commands/cockpit/resolver.js +117 -0
  108. package/dist/cli/commands/cockpit/resolver.js.map +1 -0
  109. package/dist/cli/commands/cockpit/resume.d.ts +38 -0
  110. package/dist/cli/commands/cockpit/resume.d.ts.map +1 -0
  111. package/dist/cli/commands/cockpit/resume.js +167 -0
  112. package/dist/cli/commands/cockpit/resume.js.map +1 -0
  113. package/dist/cli/commands/cockpit/shared/classify-issue.d.ts +12 -0
  114. package/dist/cli/commands/cockpit/shared/classify-issue.d.ts.map +1 -0
  115. package/dist/cli/commands/cockpit/shared/classify-issue.js +10 -0
  116. package/dist/cli/commands/cockpit/shared/classify-issue.js.map +1 -0
  117. package/dist/cli/commands/cockpit/shared/failing-check-json.d.ts +53 -0
  118. package/dist/cli/commands/cockpit/shared/failing-check-json.d.ts.map +1 -0
  119. package/dist/cli/commands/cockpit/shared/failing-check-json.js +170 -0
  120. package/dist/cli/commands/cockpit/shared/failing-check-json.js.map +1 -0
  121. package/dist/cli/commands/cockpit/shared/identity.d.ts +54 -0
  122. package/dist/cli/commands/cockpit/shared/identity.d.ts.map +1 -0
  123. package/dist/cli/commands/cockpit/shared/identity.js +65 -0
  124. package/dist/cli/commands/cockpit/shared/identity.js.map +1 -0
  125. package/dist/cli/commands/cockpit/shared/is-done-snapshot.d.ts +16 -0
  126. package/dist/cli/commands/cockpit/shared/is-done-snapshot.d.ts.map +1 -0
  127. package/dist/cli/commands/cockpit/shared/is-done-snapshot.js +17 -0
  128. package/dist/cli/commands/cockpit/shared/is-done-snapshot.js.map +1 -0
  129. package/dist/cli/commands/cockpit/shared/pagination.d.ts +17 -0
  130. package/dist/cli/commands/cockpit/shared/pagination.d.ts.map +1 -0
  131. package/dist/cli/commands/cockpit/shared/pagination.js +50 -0
  132. package/dist/cli/commands/cockpit/shared/pagination.js.map +1 -0
  133. package/dist/cli/commands/cockpit/shared/pr-link.d.ts +8 -0
  134. package/dist/cli/commands/cockpit/shared/pr-link.d.ts.map +1 -0
  135. package/dist/cli/commands/cockpit/shared/pr-link.js +15 -0
  136. package/dist/cli/commands/cockpit/shared/pr-link.js.map +1 -0
  137. package/dist/cli/commands/cockpit/shared/required-checks.d.ts +17 -0
  138. package/dist/cli/commands/cockpit/shared/required-checks.d.ts.map +1 -0
  139. package/dist/cli/commands/cockpit/shared/required-checks.js +38 -0
  140. package/dist/cli/commands/cockpit/shared/required-checks.js.map +1 -0
  141. package/dist/cli/commands/cockpit/shared/review-context-json.d.ts +29 -0
  142. package/dist/cli/commands/cockpit/shared/review-context-json.d.ts.map +1 -0
  143. package/dist/cli/commands/cockpit/shared/review-context-json.js +28 -0
  144. package/dist/cli/commands/cockpit/shared/review-context-json.js.map +1 -0
  145. package/dist/cli/commands/cockpit/status/color.d.ts +11 -0
  146. package/dist/cli/commands/cockpit/status/color.d.ts.map +1 -0
  147. package/dist/cli/commands/cockpit/status/color.js +33 -0
  148. package/dist/cli/commands/cockpit/status/color.js.map +1 -0
  149. package/dist/cli/commands/cockpit/status/group.d.ts +8 -0
  150. package/dist/cli/commands/cockpit/status/group.d.ts.map +1 -0
  151. package/dist/cli/commands/cockpit/status/group.js +35 -0
  152. package/dist/cli/commands/cockpit/status/group.js.map +1 -0
  153. package/dist/cli/commands/cockpit/status/render-table.d.ts +24 -0
  154. package/dist/cli/commands/cockpit/status/render-table.d.ts.map +1 -0
  155. package/dist/cli/commands/cockpit/status/render-table.js +71 -0
  156. package/dist/cli/commands/cockpit/status/render-table.js.map +1 -0
  157. package/dist/cli/commands/cockpit/status/row.d.ts +18 -0
  158. package/dist/cli/commands/cockpit/status/row.d.ts.map +1 -0
  159. package/dist/cli/commands/cockpit/status/row.js +17 -0
  160. package/dist/cli/commands/cockpit/status/row.js.map +1 -0
  161. package/dist/cli/commands/cockpit/status.d.ts +18 -0
  162. package/dist/cli/commands/cockpit/status.d.ts.map +1 -0
  163. package/dist/cli/commands/cockpit/status.js +138 -0
  164. package/dist/cli/commands/cockpit/status.js.map +1 -0
  165. package/dist/cli/commands/cockpit/watch/actionable.d.ts +15 -0
  166. package/dist/cli/commands/cockpit/watch/actionable.d.ts.map +1 -0
  167. package/dist/cli/commands/cockpit/watch/actionable.js +32 -0
  168. package/dist/cli/commands/cockpit/watch/actionable.js.map +1 -0
  169. package/dist/cli/commands/cockpit/watch/aggregate-emit.d.ts +107 -0
  170. package/dist/cli/commands/cockpit/watch/aggregate-emit.d.ts.map +1 -0
  171. package/dist/cli/commands/cockpit/watch/aggregate-emit.js +41 -0
  172. package/dist/cli/commands/cockpit/watch/aggregate-emit.js.map +1 -0
  173. package/dist/cli/commands/cockpit/watch/aggregate.d.ts +25 -0
  174. package/dist/cli/commands/cockpit/watch/aggregate.d.ts.map +1 -0
  175. package/dist/cli/commands/cockpit/watch/aggregate.js +67 -0
  176. package/dist/cli/commands/cockpit/watch/aggregate.js.map +1 -0
  177. package/dist/cli/commands/cockpit/watch/check-rollup.d.ts +9 -0
  178. package/dist/cli/commands/cockpit/watch/check-rollup.d.ts.map +1 -0
  179. package/dist/cli/commands/cockpit/watch/check-rollup.js +22 -0
  180. package/dist/cli/commands/cockpit/watch/check-rollup.js.map +1 -0
  181. package/dist/cli/commands/cockpit/watch/diff.d.ts +29 -0
  182. package/dist/cli/commands/cockpit/watch/diff.d.ts.map +1 -0
  183. package/dist/cli/commands/cockpit/watch/diff.js +85 -0
  184. package/dist/cli/commands/cockpit/watch/diff.js.map +1 -0
  185. package/dist/cli/commands/cockpit/watch/emit.d.ts +58 -0
  186. package/dist/cli/commands/cockpit/watch/emit.d.ts.map +1 -0
  187. package/dist/cli/commands/cockpit/watch/emit.js +30 -0
  188. package/dist/cli/commands/cockpit/watch/emit.js.map +1 -0
  189. package/dist/cli/commands/cockpit/watch/poll-loop.d.ts +29 -0
  190. package/dist/cli/commands/cockpit/watch/poll-loop.d.ts.map +1 -0
  191. package/dist/cli/commands/cockpit/watch/poll-loop.js +81 -0
  192. package/dist/cli/commands/cockpit/watch/poll-loop.js.map +1 -0
  193. package/dist/cli/commands/cockpit/watch/pr-state.d.ts +17 -0
  194. package/dist/cli/commands/cockpit/watch/pr-state.d.ts.map +1 -0
  195. package/dist/cli/commands/cockpit/watch/pr-state.js +33 -0
  196. package/dist/cli/commands/cockpit/watch/pr-state.js.map +1 -0
  197. package/dist/cli/commands/cockpit/watch/snapshot.d.ts +33 -0
  198. package/dist/cli/commands/cockpit/watch/snapshot.d.ts.map +1 -0
  199. package/dist/cli/commands/cockpit/watch/snapshot.js +30 -0
  200. package/dist/cli/commands/cockpit/watch/snapshot.js.map +1 -0
  201. package/dist/cli/commands/cockpit/watch/stream-event.d.ts +82 -0
  202. package/dist/cli/commands/cockpit/watch/stream-event.d.ts.map +1 -0
  203. package/dist/cli/commands/cockpit/watch/stream-event.js +9 -0
  204. package/dist/cli/commands/cockpit/watch/stream-event.js.map +1 -0
  205. package/dist/cli/commands/cockpit/watch.d.ts +22 -0
  206. package/dist/cli/commands/cockpit/watch.d.ts.map +1 -0
  207. package/dist/cli/commands/cockpit/watch.js +186 -0
  208. package/dist/cli/commands/cockpit/watch.js.map +1 -0
  209. package/dist/cli/commands/setup/build.d.ts.map +1 -1
  210. package/dist/cli/commands/setup/build.js +59 -0
  211. package/dist/cli/commands/setup/build.js.map +1 -1
  212. package/dist/cli/index.d.ts.map +1 -1
  213. package/dist/cli/index.js +2 -0
  214. package/dist/cli/index.js.map +1 -1
  215. package/dist/index.d.ts +2 -0
  216. package/dist/index.d.ts.map +1 -1
  217. package/dist/index.js +2 -0
  218. package/dist/index.js.map +1 -1
  219. package/package.json +11 -5
@@ -0,0 +1,37 @@
1
+ /**
2
+ * `generacy cockpit mcp` command — Commander factory. Refuses to start on
3
+ * worker containers via `GENERACY_CLUSTER_ROLE` (Q2-A defense-in-depth).
4
+ * On orchestrator (or missing env), builds the MCP server and connects a
5
+ * stdio transport.
6
+ */
7
+ import { Command } from 'commander';
8
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
9
+ import { buildMcpServer } from './server.js';
10
+ export function cockpitMcpCommand(deps = {}) {
11
+ const cmd = new Command('mcp');
12
+ cmd
13
+ .description('Run the cockpit stdio MCP server (orchestrator container only; refuses on workers).')
14
+ .action(async () => {
15
+ await runCockpitMcp(deps);
16
+ });
17
+ return cmd;
18
+ }
19
+ export async function runCockpitMcp(deps = {}) {
20
+ const env = deps.env ?? process.env;
21
+ const stderr = deps.stderr ?? ((line) => process.stderr.write(`${line}\n`));
22
+ const exit = deps.exit ??
23
+ ((code) => {
24
+ process.exit(code);
25
+ });
26
+ if (env['GENERACY_CLUSTER_ROLE'] === 'worker') {
27
+ stderr('Error: cockpit mcp: refusing to start on a worker container ' +
28
+ '(GENERACY_CLUSTER_ROLE=worker). Register this server user-scope in the ' +
29
+ 'orchestrator container only.');
30
+ exit(2);
31
+ return;
32
+ }
33
+ const server = buildMcpServer();
34
+ const transport = (deps.makeTransport?.() ?? new StdioServerTransport());
35
+ await server.connect(transport);
36
+ }
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAU7C,MAAM,UAAU,iBAAiB,CAAC,OAAuB,EAAE;IACzD,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/B,GAAG;SACA,WAAW,CACV,qFAAqF,CACtF;SACA,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;IACL,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAuB,EAAE;IAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACpC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC;IACpF,MAAM,IAAI,GACR,IAAI,CAAC,IAAI;QACT,CAAC,CAAC,IAAY,EAAE,EAAE;YAChB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IAEL,IAAI,GAAG,CAAC,uBAAuB,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC9C,MAAM,CACJ,8DAA8D;YAC5D,yEAAyE;YACzE,8BAA8B,CACjC,CAAC;QACF,IAAI,CAAC,CAAC,CAAC,CAAC;QACR,OAAO;IACT,CAAC;IAED,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,MAAM,SAAS,GAAG,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,IAAI,oBAAoB,EAAE,CAEtE,CAAC;IACF,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Normalize `IssueRefInput` (object | string) into a resolved
3
+ * `{ ref, gh }` bundle for the tool handlers.
4
+ *
5
+ * Object form is validated via `IssueRefObjectSchema`; string form is passed
6
+ * through `resolveIssueContext` — inherits bare-number cwd-inference (#850),
7
+ * qualified `owner/repo#N`, and URL forms.
8
+ *
9
+ * PR-kind gate (subsumes generacy#906): when `expects === 'issue'`, the
10
+ * resolved number must NOT resolve to a PR. Inspected via `gh.getIssue()`'s
11
+ * URL — a `/pull/<n>` path is a pull request. Symmetric enforcement in
12
+ * `cockpit_merge`, which expects a PR and rejects issues.
13
+ */
14
+ import type { CommandRunner, GhWrapper } from '@generacy-ai/cockpit';
15
+ import { type IssueRef } from '../resolver.js';
16
+ import type { ToolErrorResult } from './errors.js';
17
+ import { type IssueRefInput } from './schemas.js';
18
+ export interface AssertQualifiedOk {
19
+ ok: true;
20
+ form: 'short' | 'url';
21
+ }
22
+ export interface AssertQualifiedError {
23
+ ok: false;
24
+ error: string;
25
+ }
26
+ /**
27
+ * Verify that a string ref is in one of the MCP-accepted qualified forms
28
+ * (owner/repo#N or a github.com issue/pull URL). Bare digits are rejected
29
+ * with a typed message. Shared across the seven MCP tools.
30
+ */
31
+ export declare function assertQualifiedString(value: string): AssertQualifiedOk | AssertQualifiedError;
32
+ export interface NormalizedRef {
33
+ ref: IssueRef;
34
+ gh: GhWrapper;
35
+ }
36
+ export type NormalizeResult = {
37
+ ok: true;
38
+ value: NormalizedRef;
39
+ } | {
40
+ ok: false;
41
+ error: ToolErrorResult;
42
+ };
43
+ export type RefKind = 'issue' | 'pr';
44
+ export interface NormalizeOptions {
45
+ /** What the tool expects. Used to gate the PR-vs-issue kind check. */
46
+ expects: RefKind;
47
+ /** Optional injected wrapper — used by tests to short-circuit the kind check. */
48
+ gh?: GhWrapper;
49
+ runner?: CommandRunner;
50
+ }
51
+ export declare function normalizeIssueRef(input: IssueRefInput, options: NormalizeOptions): Promise<NormalizeResult>;
52
+ //# sourceMappingURL=ref-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ref-input.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/mcp/ref-input.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAS,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAuB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAUxE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,IAAI,CAAC;IACT,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;CACvB;AACD,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,GACZ,iBAAiB,GAAG,oBAAoB,CAc1C;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,QAAQ,CAAC;IACd,EAAE,EAAE,SAAS,CAAC;CACf;AAED,MAAM,MAAM,eAAe,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,aAAa,CAAA;CAAE,GAClC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,CAAC;AAE1C,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;AAErC,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,OAAO,EAAE,OAAO,CAAC;IACjB,iFAAiF;IACjF,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AA2BD,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,CAoE1B"}
@@ -0,0 +1,132 @@
1
+ import { resolveIssueContext } from '../resolver.js';
2
+ import { IssueRefObjectSchema } from './schemas.js';
3
+ import { GhCliWrapper } from '@generacy-ai/cockpit';
4
+ /** #928 Q1 — MCP transport accepts only qualified refs; bare digits and
5
+ * numeric shortcuts are rejected at the tool boundary with a typed message
6
+ * naming the accepted forms. cwd-based inference at the MCP layer would
7
+ * depend on the accident of the entrypoint's spawn cwd (per #850). */
8
+ const QUALIFIED_SHORT_FORM = /^([^/\s]+)\/([^/\s#]+)#(\d+)$/;
9
+ const ISSUE_OR_PR_URL = /^https?:\/\/github\.com\/([^/\s]+)\/([^/\s]+)\/(?:issues|pull)\/(\d+)(?:[/?#].*)?$/;
10
+ /**
11
+ * Verify that a string ref is in one of the MCP-accepted qualified forms
12
+ * (owner/repo#N or a github.com issue/pull URL). Bare digits are rejected
13
+ * with a typed message. Shared across the seven MCP tools.
14
+ */
15
+ export function assertQualifiedString(value) {
16
+ const trimmed = value.trim();
17
+ if (trimmed.length === 0) {
18
+ return { ok: false, error: 'ref must not be empty' };
19
+ }
20
+ if (QUALIFIED_SHORT_FORM.test(trimmed))
21
+ return { ok: true, form: 'short' };
22
+ if (ISSUE_OR_PR_URL.test(trimmed))
23
+ return { ok: true, form: 'url' };
24
+ return {
25
+ ok: false,
26
+ error: `MCP requires a qualified ref, got: "${value}". ` +
27
+ `Accepted forms: "<owner>/<repo>#<n>", a full GitHub issue/PR URL, ` +
28
+ `or the structured object { owner, repo, number }.`,
29
+ };
30
+ }
31
+ /**
32
+ * Detect PR vs issue from an `Issue` object. Mirrors `isPullRequest` in
33
+ * status.ts — the `/pull/<n>` URL segment is the authoritative marker.
34
+ */
35
+ function isPullRequest(issue) {
36
+ if (issue.url != null && /\/pull\/\d+/.test(issue.url))
37
+ return true;
38
+ return issue.labels.includes('type:pr');
39
+ }
40
+ /** Convert an object form into a live `{ ref, gh }` bundle. */
41
+ function fromObject(input, runner) {
42
+ const ref = {
43
+ owner: input.owner,
44
+ repo: input.repo,
45
+ number: input.number,
46
+ nwo: `${input.owner}/${input.repo}`,
47
+ };
48
+ const gh = runner ? new GhCliWrapper(runner) : new GhCliWrapper();
49
+ return { ref, gh };
50
+ }
51
+ export async function normalizeIssueRef(input, options) {
52
+ let normalized;
53
+ if (typeof input === 'string') {
54
+ try {
55
+ const resolved = await resolveIssueContext({
56
+ issue: input,
57
+ ...(options.runner != null ? { runner: options.runner } : {}),
58
+ });
59
+ normalized = { ref: resolved.ref, gh: options.gh ?? resolved.gh };
60
+ }
61
+ catch (err) {
62
+ return {
63
+ ok: false,
64
+ error: {
65
+ status: 'error',
66
+ class: 'invalid-args',
67
+ detail: err instanceof Error ? err.message : String(err),
68
+ },
69
+ };
70
+ }
71
+ }
72
+ else {
73
+ const parsed = IssueRefObjectSchema.safeParse(input);
74
+ if (!parsed.success) {
75
+ return {
76
+ ok: false,
77
+ error: {
78
+ status: 'error',
79
+ class: 'invalid-args',
80
+ detail: parsed.error.issues.map((i) => i.message).join('; '),
81
+ },
82
+ };
83
+ }
84
+ const built = fromObject(parsed.data, options.runner);
85
+ normalized = { ref: built.ref, gh: options.gh ?? built.gh };
86
+ }
87
+ const kindCheck = await classifyRefKind(normalized);
88
+ if (kindCheck.kind === 'error') {
89
+ return { ok: false, error: kindCheck.error };
90
+ }
91
+ if (options.expects === 'issue' && kindCheck.kind === 'pr') {
92
+ return {
93
+ ok: false,
94
+ error: {
95
+ status: 'error',
96
+ class: 'wrong-kind',
97
+ detail: `expected an issue, but ${normalized.ref.nwo}#${normalized.ref.number} is a pull request`,
98
+ hint: 'pass a PR ref to `cockpit_merge`; issue tools require an issue number',
99
+ },
100
+ };
101
+ }
102
+ if (options.expects === 'pr' && kindCheck.kind === 'issue') {
103
+ return {
104
+ ok: false,
105
+ error: {
106
+ status: 'error',
107
+ class: 'wrong-kind',
108
+ detail: `expected a pull request, but ${normalized.ref.nwo}#${normalized.ref.number} is an issue`,
109
+ hint: 'pass an issue ref to `cockpit_context`/`cockpit_advance`; `cockpit_merge` requires a PR number',
110
+ },
111
+ };
112
+ }
113
+ return { ok: true, value: normalized };
114
+ }
115
+ /** Classify a resolved ref as issue or PR via `gh.getIssue()`. */
116
+ async function classifyRefKind(normalized) {
117
+ try {
118
+ const issue = await normalized.gh.getIssue(normalized.ref.nwo, normalized.ref.number);
119
+ return { kind: isPullRequest(issue) ? 'pr' : 'issue' };
120
+ }
121
+ catch (err) {
122
+ return {
123
+ kind: 'error',
124
+ error: {
125
+ status: 'error',
126
+ class: 'transport',
127
+ detail: `gh issue view: ${err instanceof Error ? err.message : String(err)}`,
128
+ },
129
+ };
130
+ }
131
+ }
132
+ //# sourceMappingURL=ref-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ref-input.js","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/mcp/ref-input.ts"],"names":[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D,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE;gBACL,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,YAAY;gBACnB,MAAM,EACJ,gCAAgC,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,cAAc;gBAC3F,IAAI,EAAE,gGAAgG;aACvG;SACF,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACzC,CAAC;AAUD,kEAAkE;AAClE,KAAK,UAAU,eAAe,CAAC,UAAyB;IACtD,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACtF,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACzD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,WAAW;gBAClB,MAAM,EAAE,kBAAkB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;aAC7E;SACF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,287 @@
1
+ /**
2
+ * Zod input schemas for the seven cockpit MCP tools.
3
+ *
4
+ * `AWAIT_EVENTS_DEFAULTS` is the single source of truth for the long-poll /
5
+ * coalesce / batch-size defaults — referenced by Zod defaults on
6
+ * `AwaitEventsInputSchema` AND by the SC-006 fixture assertion. Do not fork.
7
+ */
8
+ import { z } from 'zod';
9
+ /** Structured issue/epic reference. */
10
+ export declare const IssueRefObjectSchema: z.ZodObject<{
11
+ owner: z.ZodString;
12
+ repo: z.ZodString;
13
+ number: z.ZodNumber;
14
+ }, "strict", z.ZodTypeAny, {
15
+ number: number;
16
+ owner: string;
17
+ repo: string;
18
+ }, {
19
+ number: number;
20
+ owner: string;
21
+ repo: string;
22
+ }>;
23
+ export type IssueRefObject = z.infer<typeof IssueRefObjectSchema>;
24
+ /** String form of the ref — passed to `resolveIssueContext` for normalization. */
25
+ export declare const IssueRefStringSchema: z.ZodString;
26
+ /** Accepted `issue` input for every mutation tool. */
27
+ export declare const IssueRefInputSchema: z.ZodUnion<[z.ZodObject<{
28
+ owner: z.ZodString;
29
+ repo: z.ZodString;
30
+ number: z.ZodNumber;
31
+ }, "strict", z.ZodTypeAny, {
32
+ number: number;
33
+ owner: string;
34
+ repo: string;
35
+ }, {
36
+ number: number;
37
+ owner: string;
38
+ repo: string;
39
+ }>, z.ZodString]>;
40
+ export type IssueRefInput = z.infer<typeof IssueRefInputSchema>;
41
+ /** Alias — `EpicRefInput` is shape-identical to `IssueRefInput`. */
42
+ export declare const EpicRefInputSchema: z.ZodUnion<[z.ZodObject<{
43
+ owner: z.ZodString;
44
+ repo: z.ZodString;
45
+ number: z.ZodNumber;
46
+ }, "strict", z.ZodTypeAny, {
47
+ number: number;
48
+ owner: string;
49
+ repo: string;
50
+ }, {
51
+ number: number;
52
+ owner: string;
53
+ repo: string;
54
+ }>, z.ZodString]>;
55
+ export type EpicRefInput = IssueRefInput;
56
+ /**
57
+ * Gate-name schema built at import time from the gate vocabulary. Unknown
58
+ * gate names are rejected at the MCP boundary with `class: "unknown-gate"`.
59
+ */
60
+ export declare const GateNameInputSchema: z.ZodEnum<[string, ...string[]]>;
61
+ export type GateNameInput = z.infer<typeof GateNameInputSchema>;
62
+ /** Concrete defaults for the long-poll event tool. Locked by SC-006 fixture. */
63
+ export declare const AWAIT_EVENTS_DEFAULTS: Readonly<{
64
+ maxWaitMs: 55000;
65
+ coalesceWindowMs: 3000;
66
+ maxBatchSize: 256;
67
+ }>;
68
+ export declare const AwaitEventsInputSchema: z.ZodObject<{
69
+ epic: z.ZodUnion<[z.ZodObject<{
70
+ owner: z.ZodString;
71
+ repo: z.ZodString;
72
+ number: z.ZodNumber;
73
+ }, "strict", z.ZodTypeAny, {
74
+ number: number;
75
+ owner: string;
76
+ repo: string;
77
+ }, {
78
+ number: number;
79
+ owner: string;
80
+ repo: string;
81
+ }>, z.ZodString]>;
82
+ cursor: z.ZodOptional<z.ZodString>;
83
+ maxWaitMs: z.ZodDefault<z.ZodNumber>;
84
+ coalesceWindowMs: z.ZodDefault<z.ZodNumber>;
85
+ maxBatchSize: z.ZodDefault<z.ZodNumber>;
86
+ }, "strict", z.ZodTypeAny, {
87
+ epic: string | {
88
+ number: number;
89
+ owner: string;
90
+ repo: string;
91
+ };
92
+ maxWaitMs: number;
93
+ coalesceWindowMs: number;
94
+ maxBatchSize: number;
95
+ cursor?: string | undefined;
96
+ }, {
97
+ epic: string | {
98
+ number: number;
99
+ owner: string;
100
+ repo: string;
101
+ };
102
+ maxWaitMs?: number | undefined;
103
+ coalesceWindowMs?: number | undefined;
104
+ maxBatchSize?: number | undefined;
105
+ cursor?: string | undefined;
106
+ }>;
107
+ export type AwaitEventsInput = z.infer<typeof AwaitEventsInputSchema>;
108
+ /** Per-tool input schemas — thin wrappers around the primitives. */
109
+ export declare const CockpitStatusInputSchema: z.ZodObject<{
110
+ epic: z.ZodUnion<[z.ZodObject<{
111
+ owner: z.ZodString;
112
+ repo: z.ZodString;
113
+ number: z.ZodNumber;
114
+ }, "strict", z.ZodTypeAny, {
115
+ number: number;
116
+ owner: string;
117
+ repo: string;
118
+ }, {
119
+ number: number;
120
+ owner: string;
121
+ repo: string;
122
+ }>, z.ZodString]>;
123
+ }, "strict", z.ZodTypeAny, {
124
+ epic: string | {
125
+ number: number;
126
+ owner: string;
127
+ repo: string;
128
+ };
129
+ }, {
130
+ epic: string | {
131
+ number: number;
132
+ owner: string;
133
+ repo: string;
134
+ };
135
+ }>;
136
+ export declare const CockpitContextInputSchema: z.ZodObject<{
137
+ issue: z.ZodUnion<[z.ZodObject<{
138
+ owner: z.ZodString;
139
+ repo: z.ZodString;
140
+ number: z.ZodNumber;
141
+ }, "strict", z.ZodTypeAny, {
142
+ number: number;
143
+ owner: string;
144
+ repo: string;
145
+ }, {
146
+ number: number;
147
+ owner: string;
148
+ repo: string;
149
+ }>, z.ZodString]>;
150
+ }, "strict", z.ZodTypeAny, {
151
+ issue: string | {
152
+ number: number;
153
+ owner: string;
154
+ repo: string;
155
+ };
156
+ }, {
157
+ issue: string | {
158
+ number: number;
159
+ owner: string;
160
+ repo: string;
161
+ };
162
+ }>;
163
+ export declare const CockpitAdvanceInputSchema: z.ZodObject<{
164
+ issue: z.ZodUnion<[z.ZodObject<{
165
+ owner: z.ZodString;
166
+ repo: z.ZodString;
167
+ number: z.ZodNumber;
168
+ }, "strict", z.ZodTypeAny, {
169
+ number: number;
170
+ owner: string;
171
+ repo: string;
172
+ }, {
173
+ number: number;
174
+ owner: string;
175
+ repo: string;
176
+ }>, z.ZodString]>;
177
+ gate: z.ZodEnum<[string, ...string[]]>;
178
+ }, "strict", z.ZodTypeAny, {
179
+ issue: string | {
180
+ number: number;
181
+ owner: string;
182
+ repo: string;
183
+ };
184
+ gate: string;
185
+ }, {
186
+ issue: string | {
187
+ number: number;
188
+ owner: string;
189
+ repo: string;
190
+ };
191
+ gate: string;
192
+ }>;
193
+ export declare const CockpitResumeInputSchema: z.ZodObject<{
194
+ issue: z.ZodUnion<[z.ZodObject<{
195
+ owner: z.ZodString;
196
+ repo: z.ZodString;
197
+ number: z.ZodNumber;
198
+ }, "strict", z.ZodTypeAny, {
199
+ number: number;
200
+ owner: string;
201
+ repo: string;
202
+ }, {
203
+ number: number;
204
+ owner: string;
205
+ repo: string;
206
+ }>, z.ZodString]>;
207
+ }, "strict", z.ZodTypeAny, {
208
+ issue: string | {
209
+ number: number;
210
+ owner: string;
211
+ repo: string;
212
+ };
213
+ }, {
214
+ issue: string | {
215
+ number: number;
216
+ owner: string;
217
+ repo: string;
218
+ };
219
+ }>;
220
+ export declare const CockpitQueueInputSchema: z.ZodObject<{
221
+ epic: z.ZodUnion<[z.ZodObject<{
222
+ owner: z.ZodString;
223
+ repo: z.ZodString;
224
+ number: z.ZodNumber;
225
+ }, "strict", z.ZodTypeAny, {
226
+ number: number;
227
+ owner: string;
228
+ repo: string;
229
+ }, {
230
+ number: number;
231
+ owner: string;
232
+ repo: string;
233
+ }>, z.ZodString]>;
234
+ phase: z.ZodString;
235
+ }, "strict", z.ZodTypeAny, {
236
+ phase: string;
237
+ epic: string | {
238
+ number: number;
239
+ owner: string;
240
+ repo: string;
241
+ };
242
+ }, {
243
+ phase: string;
244
+ epic: string | {
245
+ number: number;
246
+ owner: string;
247
+ repo: string;
248
+ };
249
+ }>;
250
+ /**
251
+ * #928 — `cockpit_merge` accepts an **issue ref** (matching the CLI verb),
252
+ * with an optional `pr: <number>` escape hatch mirroring CLI `--pr <number>`.
253
+ * Field name change from `pr` (old, inverted) to `issue`; the old-field-name
254
+ * redirection message is emitted at the tool handler when a `pr` key with a
255
+ * non-numeric value is seen (per clarifications Q5 → B).
256
+ */
257
+ export declare const CockpitMergeInputSchema: z.ZodObject<{
258
+ issue: z.ZodUnion<[z.ZodObject<{
259
+ owner: z.ZodString;
260
+ repo: z.ZodString;
261
+ number: z.ZodNumber;
262
+ }, "strict", z.ZodTypeAny, {
263
+ number: number;
264
+ owner: string;
265
+ repo: string;
266
+ }, {
267
+ number: number;
268
+ owner: string;
269
+ repo: string;
270
+ }>, z.ZodString]>;
271
+ pr: z.ZodOptional<z.ZodNumber>;
272
+ }, "strict", z.ZodTypeAny, {
273
+ issue: string | {
274
+ number: number;
275
+ owner: string;
276
+ repo: string;
277
+ };
278
+ pr?: number | undefined;
279
+ }, {
280
+ issue: string | {
281
+ number: number;
282
+ owner: string;
283
+ repo: string;
284
+ };
285
+ pr?: number | undefined;
286
+ }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;;;;;;;;;;;;;;;;;;;;;EAE3B,CAAC;AACZ,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;EAAoD,CAAC;AAC1F,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEzB,CAAC;AACZ;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKzB,CAAC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Zod input schemas for the seven cockpit MCP tools.
3
+ *
4
+ * `AWAIT_EVENTS_DEFAULTS` is the single source of truth for the long-poll /
5
+ * coalesce / batch-size defaults — referenced by Zod defaults on
6
+ * `AwaitEventsInputSchema` AND by the SC-006 fixture assertion. Do not fork.
7
+ */
8
+ import { z } from 'zod';
9
+ import { listGates } from '../gate-vocabulary.js';
10
+ /** Structured issue/epic reference. */
11
+ export const IssueRefObjectSchema = z
12
+ .object({
13
+ owner: z
14
+ .string()
15
+ .min(1)
16
+ .regex(/^[^/\s]+$/),
17
+ repo: z
18
+ .string()
19
+ .min(1)
20
+ .regex(/^[^/\s#]+$/),
21
+ number: z.number().int().positive(),
22
+ })
23
+ .strict();
24
+ /** String form of the ref — passed to `resolveIssueContext` for normalization. */
25
+ export const IssueRefStringSchema = z.string().min(1);
26
+ /** Accepted `issue` input for every mutation tool. */
27
+ export const IssueRefInputSchema = z.union([IssueRefObjectSchema, IssueRefStringSchema]);
28
+ /** Alias — `EpicRefInput` is shape-identical to `IssueRefInput`. */
29
+ export const EpicRefInputSchema = IssueRefInputSchema;
30
+ const gateNames = listGates();
31
+ /**
32
+ * Gate-name schema built at import time from the gate vocabulary. Unknown
33
+ * gate names are rejected at the MCP boundary with `class: "unknown-gate"`.
34
+ */
35
+ export const GateNameInputSchema = z.enum(gateNames);
36
+ /** Concrete defaults for the long-poll event tool. Locked by SC-006 fixture. */
37
+ export const AWAIT_EVENTS_DEFAULTS = Object.freeze({
38
+ maxWaitMs: 55_000,
39
+ coalesceWindowMs: 3_000,
40
+ maxBatchSize: 256,
41
+ });
42
+ export const AwaitEventsInputSchema = z
43
+ .object({
44
+ epic: EpicRefInputSchema,
45
+ cursor: z.string().optional(),
46
+ maxWaitMs: z.number().int().min(0).max(300_000).default(AWAIT_EVENTS_DEFAULTS.maxWaitMs),
47
+ coalesceWindowMs: z
48
+ .number()
49
+ .int()
50
+ .min(0)
51
+ .max(60_000)
52
+ .default(AWAIT_EVENTS_DEFAULTS.coalesceWindowMs),
53
+ maxBatchSize: z
54
+ .number()
55
+ .int()
56
+ .positive()
57
+ .max(4_096)
58
+ .default(AWAIT_EVENTS_DEFAULTS.maxBatchSize),
59
+ })
60
+ .strict();
61
+ /** Per-tool input schemas — thin wrappers around the primitives. */
62
+ export const CockpitStatusInputSchema = z.object({ epic: EpicRefInputSchema }).strict();
63
+ export const CockpitContextInputSchema = z.object({ issue: IssueRefInputSchema }).strict();
64
+ export const CockpitAdvanceInputSchema = z
65
+ .object({ issue: IssueRefInputSchema, gate: GateNameInputSchema })
66
+ .strict();
67
+ export const CockpitResumeInputSchema = z.object({ issue: IssueRefInputSchema }).strict();
68
+ export const CockpitQueueInputSchema = z
69
+ .object({ epic: EpicRefInputSchema, phase: z.string().min(1) })
70
+ .strict();
71
+ /**
72
+ * #928 — `cockpit_merge` accepts an **issue ref** (matching the CLI verb),
73
+ * with an optional `pr: <number>` escape hatch mirroring CLI `--pr <number>`.
74
+ * Field name change from `pr` (old, inverted) to `issue`; the old-field-name
75
+ * redirection message is emitted at the tool handler when a `pr` key with a
76
+ * non-numeric value is seen (per clarifications Q5 → B).
77
+ */
78
+ export const CockpitMergeInputSchema = z
79
+ .object({
80
+ issue: IssueRefInputSchema,
81
+ pr: z.number().int().positive().optional(),
82
+ })
83
+ .strict();
84
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/mcp/schemas.ts"],"names":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AM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9D,MAAM,EAAE,CAAC;AACZ;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACrC,MAAM,CAAC;IACN,KAAK,EAAE,mBAAmB;IAC1B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Build the `@modelcontextprotocol/sdk` MCP server exposing the seven cockpit
3
+ * tools over stdio. Tools call the same internal `run<Verb>()` functions the
4
+ * CLI uses (spec § Design invariant #1).
5
+ *
6
+ * Each handler returns `ToolResult<T>` — either `{status:"ok", data}` or
7
+ * `{status:"error", class, detail}`. That envelope is serialized as
8
+ * `structuredContent` so callers can dispatch on `status` without parsing
9
+ * text.
10
+ */
11
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
12
+ import type { CommandRunner } from '@generacy-ai/cockpit';
13
+ export interface BuildMcpServerDeps {
14
+ runner?: CommandRunner;
15
+ }
16
+ export declare function buildMcpServer(deps?: BuildMcpServerDeps): McpServer;
17
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/cockpit/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAoB1D,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAUD,wBAAgB,cAAc,CAAC,IAAI,GAAE,kBAAuB,GAAG,SAAS,CA4EvE"}