@proletariat/cli 0.3.23 → 0.3.25

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 (235) hide show
  1. package/dist/commands/action/create.js +4 -4
  2. package/dist/commands/action/update.js +3 -3
  3. package/dist/commands/agent/{temp/cleanup.d.ts → cleanup.d.ts} +1 -1
  4. package/dist/commands/agent/{temp/cleanup.js → cleanup.js} +4 -4
  5. package/dist/commands/agent/index.js +8 -8
  6. package/dist/commands/branch/create.js +2 -2
  7. package/dist/commands/epic/activate.js +9 -17
  8. package/dist/commands/epic/archive.js +13 -24
  9. package/dist/commands/epic/create.d.ts +1 -0
  10. package/dist/commands/epic/create.js +46 -8
  11. package/dist/commands/epic/index.js +2 -2
  12. package/dist/commands/epic/move.js +28 -47
  13. package/dist/commands/epic/progress.js +10 -14
  14. package/dist/commands/epic/project.js +42 -59
  15. package/dist/commands/epic/reorder.js +25 -30
  16. package/dist/commands/epic/spec.d.ts +1 -0
  17. package/dist/commands/epic/spec.js +39 -40
  18. package/dist/commands/epic/ticket.d.ts +2 -0
  19. package/dist/commands/epic/ticket.js +63 -37
  20. package/dist/commands/feedback/index.d.ts +10 -0
  21. package/dist/commands/feedback/index.js +60 -0
  22. package/dist/commands/feedback/list.d.ts +12 -0
  23. package/dist/commands/feedback/list.js +126 -0
  24. package/dist/commands/feedback/submit.d.ts +16 -0
  25. package/dist/commands/feedback/submit.js +220 -0
  26. package/dist/commands/{template/phase/delete.d.ts → feedback/view.d.ts} +7 -5
  27. package/dist/commands/feedback/view.js +109 -0
  28. package/dist/commands/gh/index.js +4 -0
  29. package/dist/commands/{epic/link/remove.d.ts → link/create.d.ts} +6 -7
  30. package/dist/commands/link/create.js +141 -0
  31. package/dist/commands/{epic/link/relates.d.ts → link/index.d.ts} +4 -5
  32. package/dist/commands/link/index.js +87 -0
  33. package/dist/commands/{epic/link/duplicates.d.ts → link/list.d.ts} +7 -4
  34. package/dist/commands/link/list.js +182 -0
  35. package/dist/commands/{spec/link → link}/remove.d.ts +4 -5
  36. package/dist/commands/link/remove.js +120 -0
  37. package/dist/commands/mcp-server.d.ts +22 -0
  38. package/dist/commands/mcp-server.js +98 -0
  39. package/dist/commands/phase/create.js +1 -1
  40. package/dist/commands/project/create.d.ts +1 -0
  41. package/dist/commands/project/create.js +38 -4
  42. package/dist/commands/repo/create.d.ts +38 -0
  43. package/dist/commands/repo/create.js +283 -0
  44. package/dist/commands/repo/index.js +7 -0
  45. package/dist/commands/roadmap/add-project.js +9 -22
  46. package/dist/commands/roadmap/create.d.ts +0 -1
  47. package/dist/commands/roadmap/create.js +46 -40
  48. package/dist/commands/roadmap/delete.js +10 -24
  49. package/dist/commands/roadmap/generate.d.ts +1 -0
  50. package/dist/commands/roadmap/generate.js +21 -22
  51. package/dist/commands/roadmap/remove-project.js +14 -34
  52. package/dist/commands/roadmap/reorder.js +19 -26
  53. package/dist/commands/roadmap/update.js +27 -26
  54. package/dist/commands/roadmap/view.js +5 -12
  55. package/dist/commands/session/attach.d.ts +1 -8
  56. package/dist/commands/session/attach.js +93 -59
  57. package/dist/commands/session/list.d.ts +0 -8
  58. package/dist/commands/session/list.js +130 -81
  59. package/dist/commands/spec/create.d.ts +1 -0
  60. package/dist/commands/spec/create.js +44 -3
  61. package/dist/commands/spec/edit.js +63 -33
  62. package/dist/commands/spec/index.js +2 -2
  63. package/dist/commands/{agent/staff → staff}/add.js +10 -10
  64. package/dist/commands/{agent/staff → staff}/index.d.ts +1 -1
  65. package/dist/commands/{agent/staff → staff}/index.js +7 -7
  66. package/dist/commands/{agent/staff → staff}/list.js +3 -3
  67. package/dist/commands/{agent/staff → staff}/remove.d.ts +1 -1
  68. package/dist/commands/{agent/staff → staff}/remove.js +8 -8
  69. package/dist/commands/{template/phase/index.d.ts → support/book.d.ts} +2 -2
  70. package/dist/commands/support/book.js +54 -0
  71. package/dist/commands/{template/ticket/index.d.ts → support/discord.d.ts} +2 -2
  72. package/dist/commands/support/discord.js +54 -0
  73. package/dist/commands/support/docs.d.ts +10 -0
  74. package/dist/commands/support/docs.js +54 -0
  75. package/dist/commands/support/index.d.ts +19 -0
  76. package/dist/commands/support/index.js +81 -0
  77. package/dist/commands/support/issues.d.ts +11 -0
  78. package/dist/commands/support/issues.js +77 -0
  79. package/dist/commands/support/logs.d.ts +18 -0
  80. package/dist/commands/support/logs.js +247 -0
  81. package/dist/commands/{ticket/template → template}/apply.d.ts +8 -6
  82. package/dist/commands/template/apply.js +262 -0
  83. package/dist/commands/{ticket/template → template}/create.d.ts +5 -6
  84. package/dist/commands/template/create.js +238 -0
  85. package/dist/commands/template/index.js +48 -36
  86. package/dist/commands/{ticket/template → template}/save.d.ts +2 -2
  87. package/dist/commands/template/save.js +104 -0
  88. package/dist/commands/{phase/template → template}/update.d.ts +2 -2
  89. package/dist/commands/template/update.js +99 -0
  90. package/dist/commands/{agent/themes → theme}/add-names.d.ts +1 -1
  91. package/dist/commands/{agent/themes → theme}/add-names.js +6 -6
  92. package/dist/commands/{agent/themes → theme}/create.d.ts +1 -1
  93. package/dist/commands/{agent/themes → theme}/create.js +5 -5
  94. package/dist/commands/{agent/themes → theme}/index.d.ts +1 -1
  95. package/dist/commands/{agent/themes → theme}/index.js +10 -10
  96. package/dist/commands/{agent/themes → theme}/list.d.ts +1 -1
  97. package/dist/commands/{agent/themes → theme}/list.js +5 -5
  98. package/dist/commands/{agent/themes → theme}/set.d.ts +1 -1
  99. package/dist/commands/{agent/themes → theme}/set.js +7 -7
  100. package/dist/commands/ticket/create.d.ts +1 -0
  101. package/dist/commands/ticket/create.js +75 -15
  102. package/dist/commands/ticket/edit.js +44 -13
  103. package/dist/commands/ticket/index.js +6 -6
  104. package/dist/commands/ticket/move.d.ts +7 -0
  105. package/dist/commands/ticket/move.js +132 -0
  106. package/dist/commands/work/spawn.d.ts +1 -0
  107. package/dist/commands/work/spawn.js +72 -8
  108. package/dist/commands/work/start.js +6 -0
  109. package/dist/lib/execution/runners.js +21 -17
  110. package/dist/lib/execution/session-utils.d.ts +60 -0
  111. package/dist/lib/execution/session-utils.js +162 -0
  112. package/dist/lib/execution/spawner.d.ts +2 -0
  113. package/dist/lib/execution/spawner.js +42 -0
  114. package/dist/lib/flags/resolver.d.ts +2 -2
  115. package/dist/lib/flags/resolver.js +15 -0
  116. package/dist/lib/init/index.js +18 -0
  117. package/dist/lib/mcp/helpers.d.ts +43 -0
  118. package/dist/lib/mcp/helpers.js +57 -0
  119. package/dist/lib/mcp/index.d.ts +6 -0
  120. package/dist/lib/mcp/index.js +6 -0
  121. package/dist/lib/mcp/tools/action.d.ts +6 -0
  122. package/dist/lib/mcp/tools/action.js +88 -0
  123. package/dist/lib/mcp/tools/board.d.ts +6 -0
  124. package/dist/lib/mcp/tools/board.js +139 -0
  125. package/dist/lib/mcp/tools/category.d.ts +6 -0
  126. package/dist/lib/mcp/tools/category.js +84 -0
  127. package/dist/lib/mcp/tools/cli-passthrough.d.ts +15 -0
  128. package/dist/lib/mcp/tools/cli-passthrough.js +333 -0
  129. package/dist/lib/mcp/tools/epic.d.ts +6 -0
  130. package/dist/lib/mcp/tools/epic.js +178 -0
  131. package/dist/lib/mcp/tools/index.d.ts +18 -0
  132. package/dist/lib/mcp/tools/index.js +19 -0
  133. package/dist/lib/mcp/tools/phase.d.ts +6 -0
  134. package/dist/lib/mcp/tools/phase.js +131 -0
  135. package/dist/lib/mcp/tools/project.d.ts +6 -0
  136. package/dist/lib/mcp/tools/project.js +196 -0
  137. package/dist/lib/mcp/tools/roadmap.d.ts +6 -0
  138. package/dist/lib/mcp/tools/roadmap.js +123 -0
  139. package/dist/lib/mcp/tools/spec.d.ts +6 -0
  140. package/dist/lib/mcp/tools/spec.js +196 -0
  141. package/dist/lib/mcp/tools/status.d.ts +6 -0
  142. package/dist/lib/mcp/tools/status.js +109 -0
  143. package/dist/lib/mcp/tools/template.d.ts +6 -0
  144. package/dist/lib/mcp/tools/template.js +107 -0
  145. package/dist/lib/mcp/tools/ticket.d.ts +6 -0
  146. package/dist/lib/mcp/tools/ticket.js +393 -0
  147. package/dist/lib/mcp/tools/view.d.ts +6 -0
  148. package/dist/lib/mcp/tools/view.js +76 -0
  149. package/dist/lib/mcp/tools/work.d.ts +6 -0
  150. package/dist/lib/mcp/tools/work.js +132 -0
  151. package/dist/lib/mcp/tools/workflow.d.ts +6 -0
  152. package/dist/lib/mcp/tools/workflow.js +95 -0
  153. package/dist/lib/mcp/types.d.ts +17 -0
  154. package/dist/lib/mcp/types.js +4 -0
  155. package/dist/lib/multiline-input.d.ts +63 -0
  156. package/dist/lib/multiline-input.js +360 -0
  157. package/dist/lib/prompt-json.d.ts +57 -6
  158. package/dist/lib/prompt-json.js +45 -0
  159. package/dist/lib/repos/git.d.ts +7 -0
  160. package/dist/lib/repos/git.js +20 -0
  161. package/oclif.manifest.json +3690 -4995
  162. package/package.json +6 -4
  163. package/dist/commands/agent/temp/index.d.ts +0 -14
  164. package/dist/commands/agent/temp/index.js +0 -85
  165. package/dist/commands/agent/temp/list.d.ts +0 -7
  166. package/dist/commands/agent/temp/list.js +0 -108
  167. package/dist/commands/epic/link/block.d.ts +0 -14
  168. package/dist/commands/epic/link/block.js +0 -81
  169. package/dist/commands/epic/link/duplicates.js +0 -68
  170. package/dist/commands/epic/link/index.d.ts +0 -19
  171. package/dist/commands/epic/link/index.js +0 -272
  172. package/dist/commands/epic/link/relates.js +0 -68
  173. package/dist/commands/epic/link/remove.js +0 -93
  174. package/dist/commands/phase/template/apply.d.ts +0 -17
  175. package/dist/commands/phase/template/apply.js +0 -108
  176. package/dist/commands/phase/template/create.d.ts +0 -17
  177. package/dist/commands/phase/template/create.js +0 -104
  178. package/dist/commands/phase/template/delete.d.ts +0 -17
  179. package/dist/commands/phase/template/delete.js +0 -100
  180. package/dist/commands/phase/template/index.d.ts +0 -15
  181. package/dist/commands/phase/template/index.js +0 -130
  182. package/dist/commands/phase/template/list.d.ts +0 -16
  183. package/dist/commands/phase/template/list.js +0 -97
  184. package/dist/commands/phase/template/update.js +0 -89
  185. package/dist/commands/spec/link/depends.d.ts +0 -14
  186. package/dist/commands/spec/link/depends.js +0 -64
  187. package/dist/commands/spec/link/duplicates.d.ts +0 -14
  188. package/dist/commands/spec/link/duplicates.js +0 -63
  189. package/dist/commands/spec/link/index.d.ts +0 -19
  190. package/dist/commands/spec/link/index.js +0 -207
  191. package/dist/commands/spec/link/relates.d.ts +0 -14
  192. package/dist/commands/spec/link/relates.js +0 -63
  193. package/dist/commands/spec/link/remove.js +0 -96
  194. package/dist/commands/template/phase/apply.d.ts +0 -14
  195. package/dist/commands/template/phase/apply.js +0 -43
  196. package/dist/commands/template/phase/create.d.ts +0 -13
  197. package/dist/commands/template/phase/create.js +0 -38
  198. package/dist/commands/template/phase/delete.js +0 -36
  199. package/dist/commands/template/phase/index.js +0 -63
  200. package/dist/commands/template/phase/list.d.ts +0 -11
  201. package/dist/commands/template/phase/list.js +0 -36
  202. package/dist/commands/template/phase/update.d.ts +0 -14
  203. package/dist/commands/template/phase/update.js +0 -43
  204. package/dist/commands/template/ticket/apply.d.ts +0 -17
  205. package/dist/commands/template/ticket/apply.js +0 -60
  206. package/dist/commands/template/ticket/create.d.ts +0 -20
  207. package/dist/commands/template/ticket/create.js +0 -89
  208. package/dist/commands/template/ticket/delete.d.ts +0 -13
  209. package/dist/commands/template/ticket/delete.js +0 -38
  210. package/dist/commands/template/ticket/index.js +0 -63
  211. package/dist/commands/template/ticket/list.d.ts +0 -11
  212. package/dist/commands/template/ticket/list.js +0 -36
  213. package/dist/commands/template/ticket/save.d.ts +0 -15
  214. package/dist/commands/template/ticket/save.js +0 -46
  215. package/dist/commands/ticket/link/block.d.ts +0 -14
  216. package/dist/commands/ticket/link/block.js +0 -96
  217. package/dist/commands/ticket/link/duplicates.d.ts +0 -14
  218. package/dist/commands/ticket/link/duplicates.js +0 -95
  219. package/dist/commands/ticket/link/index.d.ts +0 -19
  220. package/dist/commands/ticket/link/index.js +0 -256
  221. package/dist/commands/ticket/link/relates.d.ts +0 -14
  222. package/dist/commands/ticket/link/relates.js +0 -95
  223. package/dist/commands/ticket/link/remove.d.ts +0 -16
  224. package/dist/commands/ticket/link/remove.js +0 -132
  225. package/dist/commands/ticket/template/apply.js +0 -252
  226. package/dist/commands/ticket/template/create.js +0 -386
  227. package/dist/commands/ticket/template/delete.d.ts +0 -17
  228. package/dist/commands/ticket/template/delete.js +0 -94
  229. package/dist/commands/ticket/template/index.d.ts +0 -15
  230. package/dist/commands/ticket/template/index.js +0 -120
  231. package/dist/commands/ticket/template/list.d.ts +0 -16
  232. package/dist/commands/ticket/template/list.js +0 -112
  233. package/dist/commands/ticket/template/save.js +0 -163
  234. /package/dist/commands/{agent/staff → staff}/add.d.ts +0 -0
  235. /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 {};
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Multi-line text input utility for CLI.
3
+ *
4
+ * Provides inline TTY text input without opening external editors.
5
+ * Handles paste safely, supports cursor navigation, and provides
6
+ * clear visual feedback.
7
+ *
8
+ * Usage:
9
+ * ```typescript
10
+ * const text = await multiLineInput({
11
+ * message: 'Enter description:',
12
+ * default: 'Existing content...',
13
+ * });
14
+ * ```
15
+ */
16
+ /**
17
+ * Options for multiLineInput
18
+ */
19
+ export interface MultiLineInputOptions {
20
+ /** Prompt message displayed above the input area */
21
+ message: string;
22
+ /** Default/initial content to populate the input with */
23
+ default?: string;
24
+ /** Hint text shown below the input area (e.g., key bindings) */
25
+ hint?: string;
26
+ /** Whether input is required (empty not allowed) */
27
+ required?: boolean;
28
+ /** Validation function - returns true if valid, or error message */
29
+ validate?: (value: string) => boolean | string;
30
+ }
31
+ /**
32
+ * Result of multiLineInput
33
+ */
34
+ export interface MultiLineInputResult {
35
+ /** The entered text */
36
+ value: string;
37
+ /** Whether input was cancelled (Ctrl+C) */
38
+ cancelled: boolean;
39
+ }
40
+ /**
41
+ * Collect multi-line input from the user with an inline TTY editor.
42
+ *
43
+ * Features:
44
+ * - Arrow key navigation
45
+ * - Backspace/delete
46
+ * - Copy-paste handling (escapes special characters)
47
+ * - Ctrl+D to finish, Ctrl+C to cancel
48
+ * - Pre-populated content support
49
+ * - Real-time visual feedback
50
+ *
51
+ * @param options Input options
52
+ * @returns The entered text and cancellation status
53
+ */
54
+ export declare function multiLineInput(options: MultiLineInputOptions): Promise<MultiLineInputResult>;
55
+ /**
56
+ * Convenience wrapper that returns just the value string.
57
+ * Throws if cancelled.
58
+ */
59
+ export declare function promptMultiLine(options: MultiLineInputOptions): Promise<string>;
60
+ /**
61
+ * Integration with FlagResolver - creates a prompt-compatible function
62
+ */
63
+ export declare function createMultiLinePrompt(message: string, defaultValue?: string, hint?: string): () => Promise<string>;