@proletariat/cli 0.3.23 → 0.3.24

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 (171) hide show
  1. package/dist/commands/action/create.js +1 -1
  2. package/dist/commands/agent/{temp/cleanup.d.ts → cleanup.d.ts} +1 -1
  3. package/dist/commands/agent/{temp/cleanup.js → cleanup.js} +4 -4
  4. package/dist/commands/agent/index.js +8 -8
  5. package/dist/commands/branch/create.js +2 -2
  6. package/dist/commands/epic/create.d.ts +1 -0
  7. package/dist/commands/epic/create.js +39 -2
  8. package/dist/commands/epic/index.js +2 -2
  9. package/dist/commands/{epic/link/remove.d.ts → link/create.d.ts} +6 -7
  10. package/dist/commands/link/create.js +141 -0
  11. package/dist/commands/{epic/link/relates.d.ts → link/index.d.ts} +4 -5
  12. package/dist/commands/link/index.js +87 -0
  13. package/dist/commands/{epic/link/duplicates.d.ts → link/list.d.ts} +7 -4
  14. package/dist/commands/link/list.js +182 -0
  15. package/dist/commands/{spec/link → link}/remove.d.ts +4 -5
  16. package/dist/commands/link/remove.js +120 -0
  17. package/dist/commands/mcp-server.d.ts +22 -0
  18. package/dist/commands/mcp-server.js +98 -0
  19. package/dist/commands/phase/create.js +1 -1
  20. package/dist/commands/project/create.d.ts +1 -0
  21. package/dist/commands/project/create.js +38 -4
  22. package/dist/commands/spec/create.d.ts +1 -0
  23. package/dist/commands/spec/create.js +43 -2
  24. package/dist/commands/spec/index.js +2 -2
  25. package/dist/commands/{agent/staff → staff}/add.js +10 -10
  26. package/dist/commands/{agent/staff → staff}/index.d.ts +1 -1
  27. package/dist/commands/{agent/staff → staff}/index.js +7 -7
  28. package/dist/commands/{agent/staff → staff}/list.js +3 -3
  29. package/dist/commands/{agent/staff → staff}/remove.d.ts +1 -1
  30. package/dist/commands/{agent/staff → staff}/remove.js +8 -8
  31. package/dist/commands/{ticket/template → template}/apply.d.ts +8 -6
  32. package/dist/commands/template/apply.js +262 -0
  33. package/dist/commands/{ticket/template → template}/create.d.ts +5 -6
  34. package/dist/commands/template/create.js +238 -0
  35. package/dist/commands/template/index.js +48 -36
  36. package/dist/commands/{ticket/template → template}/save.d.ts +2 -2
  37. package/dist/commands/template/save.js +104 -0
  38. package/dist/commands/{phase/template → template}/update.d.ts +2 -2
  39. package/dist/commands/template/update.js +99 -0
  40. package/dist/commands/{agent/themes → theme}/add-names.d.ts +1 -1
  41. package/dist/commands/{agent/themes → theme}/add-names.js +6 -6
  42. package/dist/commands/{agent/themes → theme}/create.d.ts +1 -1
  43. package/dist/commands/{agent/themes → theme}/create.js +5 -5
  44. package/dist/commands/{agent/themes → theme}/index.d.ts +1 -1
  45. package/dist/commands/{agent/themes → theme}/index.js +10 -10
  46. package/dist/commands/{agent/themes → theme}/list.d.ts +1 -1
  47. package/dist/commands/{agent/themes → theme}/list.js +5 -5
  48. package/dist/commands/{agent/themes → theme}/set.d.ts +1 -1
  49. package/dist/commands/{agent/themes → theme}/set.js +7 -7
  50. package/dist/commands/ticket/create.d.ts +1 -0
  51. package/dist/commands/ticket/create.js +54 -2
  52. package/dist/commands/ticket/index.js +6 -6
  53. package/dist/commands/work/spawn.js +1 -1
  54. package/dist/lib/mcp/helpers.d.ts +43 -0
  55. package/dist/lib/mcp/helpers.js +57 -0
  56. package/dist/lib/mcp/index.d.ts +6 -0
  57. package/dist/lib/mcp/index.js +6 -0
  58. package/dist/lib/mcp/tools/action.d.ts +6 -0
  59. package/dist/lib/mcp/tools/action.js +88 -0
  60. package/dist/lib/mcp/tools/board.d.ts +6 -0
  61. package/dist/lib/mcp/tools/board.js +139 -0
  62. package/dist/lib/mcp/tools/category.d.ts +6 -0
  63. package/dist/lib/mcp/tools/category.js +84 -0
  64. package/dist/lib/mcp/tools/cli-passthrough.d.ts +15 -0
  65. package/dist/lib/mcp/tools/cli-passthrough.js +333 -0
  66. package/dist/lib/mcp/tools/epic.d.ts +6 -0
  67. package/dist/lib/mcp/tools/epic.js +178 -0
  68. package/dist/lib/mcp/tools/index.d.ts +18 -0
  69. package/dist/lib/mcp/tools/index.js +19 -0
  70. package/dist/lib/mcp/tools/phase.d.ts +6 -0
  71. package/dist/lib/mcp/tools/phase.js +131 -0
  72. package/dist/lib/mcp/tools/project.d.ts +6 -0
  73. package/dist/lib/mcp/tools/project.js +196 -0
  74. package/dist/lib/mcp/tools/roadmap.d.ts +6 -0
  75. package/dist/lib/mcp/tools/roadmap.js +123 -0
  76. package/dist/lib/mcp/tools/spec.d.ts +6 -0
  77. package/dist/lib/mcp/tools/spec.js +196 -0
  78. package/dist/lib/mcp/tools/status.d.ts +6 -0
  79. package/dist/lib/mcp/tools/status.js +109 -0
  80. package/dist/lib/mcp/tools/template.d.ts +6 -0
  81. package/dist/lib/mcp/tools/template.js +107 -0
  82. package/dist/lib/mcp/tools/ticket.d.ts +6 -0
  83. package/dist/lib/mcp/tools/ticket.js +393 -0
  84. package/dist/lib/mcp/tools/view.d.ts +6 -0
  85. package/dist/lib/mcp/tools/view.js +76 -0
  86. package/dist/lib/mcp/tools/work.d.ts +6 -0
  87. package/dist/lib/mcp/tools/work.js +132 -0
  88. package/dist/lib/mcp/tools/workflow.d.ts +6 -0
  89. package/dist/lib/mcp/tools/workflow.js +95 -0
  90. package/dist/lib/mcp/types.d.ts +17 -0
  91. package/dist/lib/mcp/types.js +4 -0
  92. package/dist/lib/prompt-json.d.ts +52 -1
  93. package/dist/lib/prompt-json.js +45 -0
  94. package/oclif.manifest.json +3660 -5564
  95. package/package.json +6 -4
  96. package/dist/commands/agent/temp/index.d.ts +0 -14
  97. package/dist/commands/agent/temp/index.js +0 -85
  98. package/dist/commands/agent/temp/list.d.ts +0 -7
  99. package/dist/commands/agent/temp/list.js +0 -108
  100. package/dist/commands/epic/link/block.d.ts +0 -14
  101. package/dist/commands/epic/link/block.js +0 -81
  102. package/dist/commands/epic/link/duplicates.js +0 -68
  103. package/dist/commands/epic/link/index.d.ts +0 -19
  104. package/dist/commands/epic/link/index.js +0 -272
  105. package/dist/commands/epic/link/relates.js +0 -68
  106. package/dist/commands/epic/link/remove.js +0 -93
  107. package/dist/commands/phase/template/apply.d.ts +0 -17
  108. package/dist/commands/phase/template/apply.js +0 -108
  109. package/dist/commands/phase/template/create.d.ts +0 -17
  110. package/dist/commands/phase/template/create.js +0 -104
  111. package/dist/commands/phase/template/delete.d.ts +0 -17
  112. package/dist/commands/phase/template/delete.js +0 -100
  113. package/dist/commands/phase/template/index.d.ts +0 -15
  114. package/dist/commands/phase/template/index.js +0 -130
  115. package/dist/commands/phase/template/list.d.ts +0 -16
  116. package/dist/commands/phase/template/list.js +0 -97
  117. package/dist/commands/phase/template/update.js +0 -89
  118. package/dist/commands/spec/link/depends.d.ts +0 -14
  119. package/dist/commands/spec/link/depends.js +0 -64
  120. package/dist/commands/spec/link/duplicates.d.ts +0 -14
  121. package/dist/commands/spec/link/duplicates.js +0 -63
  122. package/dist/commands/spec/link/index.d.ts +0 -19
  123. package/dist/commands/spec/link/index.js +0 -207
  124. package/dist/commands/spec/link/relates.d.ts +0 -14
  125. package/dist/commands/spec/link/relates.js +0 -63
  126. package/dist/commands/spec/link/remove.js +0 -96
  127. package/dist/commands/template/phase/apply.d.ts +0 -14
  128. package/dist/commands/template/phase/apply.js +0 -43
  129. package/dist/commands/template/phase/create.d.ts +0 -13
  130. package/dist/commands/template/phase/create.js +0 -38
  131. package/dist/commands/template/phase/delete.d.ts +0 -13
  132. package/dist/commands/template/phase/delete.js +0 -36
  133. package/dist/commands/template/phase/index.d.ts +0 -10
  134. package/dist/commands/template/phase/index.js +0 -63
  135. package/dist/commands/template/phase/list.d.ts +0 -11
  136. package/dist/commands/template/phase/list.js +0 -36
  137. package/dist/commands/template/phase/update.d.ts +0 -14
  138. package/dist/commands/template/phase/update.js +0 -43
  139. package/dist/commands/template/ticket/apply.d.ts +0 -17
  140. package/dist/commands/template/ticket/apply.js +0 -60
  141. package/dist/commands/template/ticket/create.d.ts +0 -20
  142. package/dist/commands/template/ticket/create.js +0 -89
  143. package/dist/commands/template/ticket/delete.d.ts +0 -13
  144. package/dist/commands/template/ticket/delete.js +0 -38
  145. package/dist/commands/template/ticket/index.d.ts +0 -10
  146. package/dist/commands/template/ticket/index.js +0 -63
  147. package/dist/commands/template/ticket/list.d.ts +0 -11
  148. package/dist/commands/template/ticket/list.js +0 -36
  149. package/dist/commands/template/ticket/save.d.ts +0 -15
  150. package/dist/commands/template/ticket/save.js +0 -46
  151. package/dist/commands/ticket/link/block.d.ts +0 -14
  152. package/dist/commands/ticket/link/block.js +0 -96
  153. package/dist/commands/ticket/link/duplicates.d.ts +0 -14
  154. package/dist/commands/ticket/link/duplicates.js +0 -95
  155. package/dist/commands/ticket/link/index.d.ts +0 -19
  156. package/dist/commands/ticket/link/index.js +0 -256
  157. package/dist/commands/ticket/link/relates.d.ts +0 -14
  158. package/dist/commands/ticket/link/relates.js +0 -95
  159. package/dist/commands/ticket/link/remove.d.ts +0 -16
  160. package/dist/commands/ticket/link/remove.js +0 -132
  161. package/dist/commands/ticket/template/apply.js +0 -252
  162. package/dist/commands/ticket/template/create.js +0 -386
  163. package/dist/commands/ticket/template/delete.d.ts +0 -17
  164. package/dist/commands/ticket/template/delete.js +0 -94
  165. package/dist/commands/ticket/template/index.d.ts +0 -15
  166. package/dist/commands/ticket/template/index.js +0 -120
  167. package/dist/commands/ticket/template/list.d.ts +0 -16
  168. package/dist/commands/ticket/template/list.js +0 -112
  169. package/dist/commands/ticket/template/save.js +0 -163
  170. /package/dist/commands/{agent/staff → staff}/add.d.ts +0 -0
  171. /package/dist/commands/{agent/staff → staff}/list.d.ts +0 -0
@@ -0,0 +1,76 @@
1
+ /**
2
+ * MCP View Tools
3
+ */
4
+ import { z } from 'zod';
5
+ import { errorResponse } from '../helpers.js';
6
+ export function registerViewTools(server, ctx) {
7
+ server.tool('view_list', 'List board views for a project', { project: z.string().optional() }, async (params) => {
8
+ try {
9
+ const views = await ctx.storage.listBoardViews({ projectId: params.project });
10
+ return {
11
+ content: [{
12
+ type: 'text',
13
+ text: JSON.stringify({
14
+ success: true,
15
+ views: views.map((v) => ({
16
+ id: v.id,
17
+ name: v.name,
18
+ description: v.description,
19
+ projectId: v.projectId,
20
+ isDefault: v.isDefault,
21
+ })),
22
+ }, null, 2),
23
+ }],
24
+ };
25
+ }
26
+ catch (error) {
27
+ return errorResponse(error);
28
+ }
29
+ });
30
+ server.tool('view_create', 'Create a board view', {
31
+ project: z.string().describe('Project ID'),
32
+ name: z.string().describe('View name'),
33
+ description: z.string().optional(),
34
+ filters: z.object({
35
+ assignee: z.string().optional(),
36
+ owner: z.string().optional(),
37
+ priority: z.string().optional(),
38
+ epicId: z.string().optional(),
39
+ search: z.string().optional(),
40
+ }).optional(),
41
+ is_default: z.boolean().optional(),
42
+ }, async (params) => {
43
+ try {
44
+ const view = await ctx.storage.createBoardView({
45
+ projectId: params.project,
46
+ name: params.name,
47
+ description: params.description,
48
+ filters: params.filters || {},
49
+ isDefault: params.is_default,
50
+ });
51
+ return {
52
+ content: [{
53
+ type: 'text',
54
+ text: JSON.stringify({ success: true, view: { id: view.id, name: view.name } }, null, 2),
55
+ }],
56
+ };
57
+ }
58
+ catch (error) {
59
+ return errorResponse(error);
60
+ }
61
+ });
62
+ server.tool('view_delete', 'Delete a board view', { id: z.string().describe('View ID') }, async (params) => {
63
+ try {
64
+ await ctx.storage.deleteBoardView(params.id);
65
+ return {
66
+ content: [{
67
+ type: 'text',
68
+ text: JSON.stringify({ success: true, message: 'View deleted' }, null, 2),
69
+ }],
70
+ };
71
+ }
72
+ catch (error) {
73
+ return errorResponse(error);
74
+ }
75
+ });
76
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * MCP Work Tools (Agent workflow)
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import type { McpToolContext } from '../types.js';
6
+ export declare function registerWorkTools(server: McpServer, ctx: McpToolContext): void;
@@ -0,0 +1,132 @@
1
+ /**
2
+ * MCP Work Tools (Agent workflow)
3
+ */
4
+ import { z } from 'zod';
5
+ import { formatTicket, errorResponse } from '../helpers.js';
6
+ export function registerWorkTools(server, ctx) {
7
+ server.tool('work_status', 'Get current work status (in-progress tickets)', {}, async () => {
8
+ try {
9
+ const tickets = await ctx.storage.listTickets(undefined, { allProjects: true });
10
+ const inProgress = tickets.filter((t) => t.statusCategory === 'started' && t.assignee);
11
+ return {
12
+ content: [{
13
+ type: 'text',
14
+ text: JSON.stringify({
15
+ success: true,
16
+ inProgressCount: inProgress.length,
17
+ tickets: inProgress.map((t) => ({
18
+ id: t.id,
19
+ title: t.title,
20
+ assignee: t.assignee,
21
+ statusName: t.statusName,
22
+ priority: t.priority,
23
+ projectId: t.projectId,
24
+ branch: t.branch,
25
+ })),
26
+ }, null, 2),
27
+ }],
28
+ };
29
+ }
30
+ catch (error) {
31
+ return errorResponse(error);
32
+ }
33
+ });
34
+ server.tool('work_start', 'Start working on a ticket (moves to In Progress)', {
35
+ ticket_id: z.string().describe('Ticket ID'),
36
+ assignee: z.string().optional().describe('Who is working'),
37
+ }, async (params) => {
38
+ try {
39
+ const ticket = await ctx.storage.getTicket(params.ticket_id);
40
+ if (!ticket)
41
+ throw new Error(`Ticket not found: ${params.ticket_id}`);
42
+ if (params.assignee) {
43
+ await ctx.storage.updateTicket(params.ticket_id, { assignee: params.assignee });
44
+ }
45
+ const columns = ctx.storage.getColumnNames(ticket.projectId);
46
+ const progressCol = columns.find((c) => c.toLowerCase().includes('progress') || c.toLowerCase().includes('doing')) || columns[Math.min(1, columns.length - 1)];
47
+ const moved = await ctx.storage.moveTicket(ticket.projectId, params.ticket_id, progressCol);
48
+ return {
49
+ content: [{
50
+ type: 'text',
51
+ text: JSON.stringify({
52
+ success: true,
53
+ ticket: formatTicket(moved),
54
+ message: `Started ${moved.id}: ${moved.title}`,
55
+ }, null, 2),
56
+ }],
57
+ };
58
+ }
59
+ catch (error) {
60
+ return errorResponse(error);
61
+ }
62
+ });
63
+ server.tool('work_complete', 'Mark ticket complete (moves to Done)', { ticket_id: z.string().describe('Ticket ID') }, async (params) => {
64
+ try {
65
+ const ticket = await ctx.storage.getTicket(params.ticket_id);
66
+ if (!ticket)
67
+ throw new Error(`Ticket not found: ${params.ticket_id}`);
68
+ const columns = ctx.storage.getColumnNames(ticket.projectId);
69
+ const doneCol = columns.find((c) => c.toLowerCase().includes('done') || c.toLowerCase().includes('complete')) || columns[columns.length - 1];
70
+ const moved = await ctx.storage.moveTicket(ticket.projectId, params.ticket_id, doneCol);
71
+ return {
72
+ content: [{
73
+ type: 'text',
74
+ text: JSON.stringify({
75
+ success: true,
76
+ ticket: formatTicket(moved),
77
+ message: `Completed ${moved.id}`,
78
+ }, null, 2),
79
+ }],
80
+ };
81
+ }
82
+ catch (error) {
83
+ return errorResponse(error);
84
+ }
85
+ });
86
+ server.tool('work_ready', 'Mark ticket ready for review', { ticket_id: z.string().describe('Ticket ID') }, async (params) => {
87
+ try {
88
+ const ticket = await ctx.storage.getTicket(params.ticket_id);
89
+ if (!ticket)
90
+ throw new Error(`Ticket not found: ${params.ticket_id}`);
91
+ const columns = ctx.storage.getColumnNames(ticket.projectId);
92
+ const reviewCol = columns.find((c) => c.toLowerCase().includes('review'));
93
+ if (reviewCol) {
94
+ const moved = await ctx.storage.moveTicket(ticket.projectId, params.ticket_id, reviewCol);
95
+ return {
96
+ content: [{
97
+ type: 'text',
98
+ text: JSON.stringify({ success: true, ticket: formatTicket(moved), message: `${moved.id} ready for review` }, null, 2),
99
+ }],
100
+ };
101
+ }
102
+ return {
103
+ content: [{
104
+ type: 'text',
105
+ text: JSON.stringify({ success: true, message: 'No review column found', ticket: formatTicket(ticket) }, null, 2),
106
+ }],
107
+ };
108
+ }
109
+ catch (error) {
110
+ return errorResponse(error);
111
+ }
112
+ });
113
+ server.tool('work_revise', 'Send ticket back for revision', { ticket_id: z.string().describe('Ticket ID') }, async (params) => {
114
+ try {
115
+ const ticket = await ctx.storage.getTicket(params.ticket_id);
116
+ if (!ticket)
117
+ throw new Error(`Ticket not found: ${params.ticket_id}`);
118
+ const columns = ctx.storage.getColumnNames(ticket.projectId);
119
+ const progressCol = columns.find((c) => c.toLowerCase().includes('progress')) || columns[1];
120
+ const moved = await ctx.storage.moveTicket(ticket.projectId, params.ticket_id, progressCol);
121
+ return {
122
+ content: [{
123
+ type: 'text',
124
+ text: JSON.stringify({ success: true, ticket: formatTicket(moved), message: `${moved.id} sent back for revision` }, null, 2),
125
+ }],
126
+ };
127
+ }
128
+ catch (error) {
129
+ return errorResponse(error);
130
+ }
131
+ });
132
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * MCP Workflow Tools
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import type { McpToolContext } from '../types.js';
6
+ export declare function registerWorkflowTools(server: McpServer, ctx: McpToolContext): void;
@@ -0,0 +1,95 @@
1
+ /**
2
+ * MCP Workflow Tools
3
+ */
4
+ import { z } from 'zod';
5
+ import { errorResponse } from '../helpers.js';
6
+ export function registerWorkflowTools(server, ctx) {
7
+ server.tool('workflow_list', 'List all workflows', { include_builtin: z.boolean().optional() }, async (params) => {
8
+ try {
9
+ const workflows = await ctx.storage.listWorkflows({
10
+ isBuiltin: params.include_builtin ? undefined : false,
11
+ });
12
+ return {
13
+ content: [{
14
+ type: 'text',
15
+ text: JSON.stringify({
16
+ success: true,
17
+ workflows: workflows.map((w) => ({
18
+ id: w.id,
19
+ name: w.name,
20
+ description: w.description,
21
+ isBuiltin: w.isBuiltin,
22
+ })),
23
+ }, null, 2),
24
+ }],
25
+ };
26
+ }
27
+ catch (error) {
28
+ return errorResponse(error);
29
+ }
30
+ });
31
+ server.tool('workflow_show', 'Get workflow details with statuses', { id: z.string().describe('Workflow ID') }, async (params) => {
32
+ try {
33
+ const workflow = await ctx.storage.getWorkflow(params.id);
34
+ if (!workflow)
35
+ throw new Error(`Workflow not found: ${params.id}`);
36
+ const statuses = await ctx.storage.listStatuses(params.id);
37
+ return {
38
+ content: [{
39
+ type: 'text',
40
+ text: JSON.stringify({
41
+ success: true,
42
+ workflow: {
43
+ ...workflow,
44
+ statuses: statuses.map((s) => ({
45
+ id: s.id,
46
+ name: s.name,
47
+ category: s.category,
48
+ position: s.position,
49
+ isDefault: s.isDefault,
50
+ })),
51
+ },
52
+ }, null, 2),
53
+ }],
54
+ };
55
+ }
56
+ catch (error) {
57
+ return errorResponse(error);
58
+ }
59
+ });
60
+ server.tool('workflow_create', 'Create a new workflow', {
61
+ name: z.string().describe('Workflow name'),
62
+ description: z.string().optional(),
63
+ statuses: z.array(z.string()).optional().describe('Status names'),
64
+ }, async (params) => {
65
+ try {
66
+ const workflow = await ctx.storage.createWorkflow({
67
+ name: params.name,
68
+ description: params.description,
69
+ });
70
+ return {
71
+ content: [{
72
+ type: 'text',
73
+ text: JSON.stringify({ success: true, workflow: { id: workflow.id, name: workflow.name } }, null, 2),
74
+ }],
75
+ };
76
+ }
77
+ catch (error) {
78
+ return errorResponse(error);
79
+ }
80
+ });
81
+ server.tool('workflow_delete', 'Delete a workflow', { id: z.string().describe('Workflow ID') }, async (params) => {
82
+ try {
83
+ await ctx.storage.deleteWorkflow(params.id);
84
+ return {
85
+ content: [{
86
+ type: 'text',
87
+ text: JSON.stringify({ success: true, message: `Deleted workflow ${params.id}` }, null, 2),
88
+ }],
89
+ };
90
+ }
91
+ catch (error) {
92
+ return errorResponse(error);
93
+ }
94
+ });
95
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * MCP Types and Interfaces
3
+ */
4
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import type { SQLiteStorage } from '../pmo/storage/index.js';
6
+ export interface McpToolContext {
7
+ storage: SQLiteStorage;
8
+ runCommand: (cmd: string) => string;
9
+ }
10
+ export type McpToolResult = {
11
+ content: Array<{
12
+ type: 'text';
13
+ text: string;
14
+ }>;
15
+ isError?: boolean;
16
+ };
17
+ export type ToolRegistrar = (server: McpServer, ctx: McpToolContext) => void;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * MCP Types and Interfaces
3
+ */
4
+ export {};
@@ -91,6 +91,8 @@ export interface OutputMetadata {
91
91
  * JSON output when a prompt would be shown
92
92
  */
93
93
  export interface PromptJsonOutput {
94
+ /** Output type discriminator */
95
+ type: 'prompt';
94
96
  /** Prompt configuration, or null if no prompt needed */
95
97
  prompt: PromptConfig | null;
96
98
  /** Command metadata */
@@ -100,6 +102,8 @@ export interface PromptJsonOutput {
100
102
  * JSON output for successful command execution (no prompt needed)
101
103
  */
102
104
  export interface SuccessJsonOutput {
105
+ /** Output type discriminator */
106
+ type: 'success';
103
107
  /** Always null when success output */
104
108
  prompt: null;
105
109
  /** Indicates successful execution */
@@ -113,6 +117,8 @@ export interface SuccessJsonOutput {
113
117
  * JSON output for error conditions
114
118
  */
115
119
  export interface ErrorJsonOutput {
120
+ /** Output type discriminator */
121
+ type: 'error';
116
122
  /** Error details */
117
123
  error: {
118
124
  /** Machine-readable error code (e.g., "NO_TICKETS_AVAILABLE") */
@@ -123,10 +129,31 @@ export interface ErrorJsonOutput {
123
129
  /** Command metadata */
124
130
  metadata: OutputMetadata;
125
131
  }
132
+ /**
133
+ * JSON output for dry-run validation (what would happen)
134
+ */
135
+ export interface DryRunJsonOutput {
136
+ /** Indicates this is a dry-run result */
137
+ type: 'dry-run';
138
+ /** Whether the inputs are valid */
139
+ valid: boolean;
140
+ /** What would be created if valid */
141
+ wouldCreate?: {
142
+ type: string;
143
+ [key: string]: unknown;
144
+ };
145
+ /** Validation errors if invalid */
146
+ errors?: Array<{
147
+ field: string;
148
+ error: string;
149
+ }>;
150
+ /** Command metadata */
151
+ metadata: OutputMetadata;
152
+ }
126
153
  /**
127
154
  * Union type for all JSON output types
128
155
  */
129
- export type JsonOutput = PromptJsonOutput | SuccessJsonOutput | ErrorJsonOutput;
156
+ export type JsonOutput = PromptJsonOutput | SuccessJsonOutput | ErrorJsonOutput | DryRunJsonOutput;
130
157
  /**
131
158
  * Flags interface for JSON mode detection
132
159
  */
@@ -253,3 +280,27 @@ export declare function buildPromptConfig(type: 'list' | 'checkbox' | 'confirm'
253
280
  * @returns PromptConfig object with type 'form'
254
281
  */
255
282
  export declare function buildFormPromptConfig(fields: FormField[]): PromptConfig;
283
+ /**
284
+ * Output a successful dry-run result as JSON and exit
285
+ *
286
+ * Use this when --dry-run is set and all validation passes.
287
+ * Shows what would be created without actually creating it.
288
+ *
289
+ * @param entityType - Type of entity that would be created (e.g., "ticket", "project")
290
+ * @param wouldCreate - Data about what would be created
291
+ * @param metadata - Command metadata
292
+ */
293
+ export declare function outputDryRunSuccessAsJson(entityType: string, wouldCreate: Record<string, unknown>, metadata: OutputMetadata): never;
294
+ /**
295
+ * Output a dry-run validation failure as JSON and exit
296
+ *
297
+ * Use this when --dry-run is set and validation fails.
298
+ * Shows the validation errors without attempting to create.
299
+ *
300
+ * @param errors - Array of validation errors
301
+ * @param metadata - Command metadata
302
+ */
303
+ export declare function outputDryRunErrorsAsJson(errors: Array<{
304
+ field: string;
305
+ error: string;
306
+ }>, metadata: OutputMetadata): never;
@@ -111,6 +111,7 @@ export function createMetadata(command, flags) {
111
111
  */
112
112
  export function outputPromptAsJson(config, metadata) {
113
113
  const output = {
114
+ type: 'prompt',
114
115
  prompt: config,
115
116
  metadata,
116
117
  };
@@ -129,6 +130,7 @@ export function outputPromptAsJson(config, metadata) {
129
130
  */
130
131
  export function outputSuccessAsJson(result, metadata) {
131
132
  const output = {
133
+ type: 'success',
132
134
  prompt: null,
133
135
  success: true,
134
136
  result,
@@ -150,6 +152,7 @@ export function outputSuccessAsJson(result, metadata) {
150
152
  */
151
153
  export function outputErrorAsJson(code, message, metadata) {
152
154
  const output = {
155
+ type: 'error',
153
156
  error: {
154
157
  code,
155
158
  message,
@@ -235,3 +238,45 @@ export function buildFormPromptConfig(fields) {
235
238
  fields,
236
239
  };
237
240
  }
241
+ /**
242
+ * Output a successful dry-run result as JSON and exit
243
+ *
244
+ * Use this when --dry-run is set and all validation passes.
245
+ * Shows what would be created without actually creating it.
246
+ *
247
+ * @param entityType - Type of entity that would be created (e.g., "ticket", "project")
248
+ * @param wouldCreate - Data about what would be created
249
+ * @param metadata - Command metadata
250
+ */
251
+ export function outputDryRunSuccessAsJson(entityType, wouldCreate, metadata) {
252
+ const output = {
253
+ type: 'dry-run',
254
+ valid: true,
255
+ wouldCreate: {
256
+ type: entityType,
257
+ ...wouldCreate,
258
+ },
259
+ metadata,
260
+ };
261
+ console.log(JSON.stringify(output, null, 2));
262
+ process.exit(EXIT_SUCCESS);
263
+ }
264
+ /**
265
+ * Output a dry-run validation failure as JSON and exit
266
+ *
267
+ * Use this when --dry-run is set and validation fails.
268
+ * Shows the validation errors without attempting to create.
269
+ *
270
+ * @param errors - Array of validation errors
271
+ * @param metadata - Command metadata
272
+ */
273
+ export function outputDryRunErrorsAsJson(errors, metadata) {
274
+ const output = {
275
+ type: 'dry-run',
276
+ valid: false,
277
+ errors,
278
+ metadata,
279
+ };
280
+ console.log(JSON.stringify(output, null, 2));
281
+ process.exit(EXIT_ERROR);
282
+ }