automata-cli 0.5.0-develop.181 → 0.5.0-develop.221

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automata-cli",
3
- "version": "0.5.0-develop.181",
3
+ "version": "0.5.0-develop.221",
4
4
  "description": "Automata CLI tool",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,432 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- DEFAULT_CHECK_ISSUE_PROMPT,
4
- DEFAULT_FIX_COMMENTS_PROMPT,
5
- DEFAULT_SONAR_PROMPT,
6
- readConfig,
7
- readRawConfig,
8
- writeConfig
9
- } from "./chunk-OLM47VIK.js";
10
-
11
- // src/config/ConfigWizard.tsx
12
- import { useState } from "react";
13
- import { Box, Text, useInput, useApp } from "ink";
14
- import { writeFileSync, mkdirSync } from "fs";
15
- import { join } from "path";
16
- import { jsx, jsxs } from "react/jsx-runtime";
17
- function writePromptFile(filename, content) {
18
- const dir = join(process.cwd(), ".automata");
19
- mkdirSync(dir, { recursive: true });
20
- writeFileSync(join(dir, filename), content, "utf8");
21
- }
22
- var REMOTE_OPTIONS = [
23
- { label: "GitHub", value: "gh" },
24
- { label: "Azure DevOps", value: "azdo" }
25
- ];
26
- var TECHNIQUE_OPTIONS = [
27
- { label: "By Label", value: "label" },
28
- { label: "By Assignee", value: "assignee" },
29
- { label: "By Title Contains", value: "title-contains" }
30
- ];
31
- var MAIN_MENU_OPTIONS = ["Remote / Mode", "Implement-Next", "Prompts", "Issue Watch"];
32
- var PROMPTS_MENU_OPTIONS = ["Sonar", "Fix-Comments", "Check-Issue"];
33
- function parseAllowedUsers(value) {
34
- return value.split(",").map((user) => user.trim()).filter((user) => user.length > 0);
35
- }
36
- function ConfigWizard() {
37
- const existing = readConfig();
38
- const rawExisting = readRawConfig();
39
- const initialRemoteIndex = REMOTE_OPTIONS.findIndex((o) => o.value === existing.remoteType);
40
- const initialTechIndex = TECHNIQUE_OPTIONS.findIndex((o) => o.value === existing.issueDiscoveryTechnique);
41
- const [screen, setScreen] = useState("main");
42
- const [mainMenuIndex, setMainMenuIndex] = useState(0);
43
- const [selectedRemoteIndex, setSelectedRemoteIndex] = useState(initialRemoteIndex >= 0 ? initialRemoteIndex : 0);
44
- const [selectedTechIndex, setSelectedTechIndex] = useState(initialTechIndex >= 0 ? initialTechIndex : 0);
45
- const [discoveryValue, setDiscoveryValue] = useState(existing.issueDiscoveryValue ?? "");
46
- const [systemPrompt, setSystemPrompt] = useState(existing.claudeSystemPrompt ?? "");
47
- const [promptsMenuIndex, setPromptsMenuIndex] = useState(0);
48
- const [sonarPrompt, setSonarPrompt] = useState(existing.prompts?.sonar ?? DEFAULT_SONAR_PROMPT);
49
- const [fixCommentsPrompt, setFixCommentsPrompt] = useState(
50
- existing.prompts?.fixComments ?? DEFAULT_FIX_COMMENTS_PROMPT
51
- );
52
- const [checkIssuePrompt, setCheckIssuePrompt] = useState(existing.prompts?.checkIssue ?? DEFAULT_CHECK_ISSUE_PROMPT);
53
- const [allowedUsers, setAllowedUsers] = useState((existing.allowedUsers ?? []).join(", "));
54
- const [agentUser, setAgentUser] = useState(existing.agentUser ?? "");
55
- const [pendingRemote, setPendingRemote] = useState(existing.remoteType ?? "gh");
56
- const [pendingTechnique, setPendingTechnique] = useState(
57
- existing.issueDiscoveryTechnique ?? "label"
58
- );
59
- const { exit } = useApp();
60
- useInput((input, key) => {
61
- if (screen === "main") {
62
- if (key.upArrow) {
63
- setMainMenuIndex((i) => i > 0 ? i - 1 : MAIN_MENU_OPTIONS.length - 1);
64
- } else if (key.downArrow) {
65
- setMainMenuIndex((i) => i < MAIN_MENU_OPTIONS.length - 1 ? i + 1 : 0);
66
- } else if (key.return) {
67
- const chosen = MAIN_MENU_OPTIONS[mainMenuIndex];
68
- if (chosen === "Remote / Mode") {
69
- setScreen("remote");
70
- } else if (chosen === "Implement-Next") {
71
- setScreen("technique");
72
- } else if (chosen === "Issue Watch") {
73
- setScreen("allowed-users");
74
- } else {
75
- setScreen("prompts-menu");
76
- }
77
- } else if (key.escape || key.ctrl && input === "c") {
78
- exit();
79
- }
80
- } else if (screen === "remote") {
81
- if (key.upArrow) {
82
- setSelectedRemoteIndex((i) => i > 0 ? i - 1 : REMOTE_OPTIONS.length - 1);
83
- } else if (key.downArrow) {
84
- setSelectedRemoteIndex((i) => i < REMOTE_OPTIONS.length - 1 ? i + 1 : 0);
85
- } else if (key.return) {
86
- const chosen = REMOTE_OPTIONS[selectedRemoteIndex];
87
- setPendingRemote(chosen.value);
88
- if (chosen.value === "gh") {
89
- setScreen("technique");
90
- } else {
91
- writeConfig({ ...rawExisting, remoteType: chosen.value });
92
- exit();
93
- }
94
- } else if (key.escape) {
95
- setScreen("main");
96
- } else if (key.ctrl && input === "c") {
97
- exit();
98
- }
99
- } else if (screen === "technique") {
100
- if (key.upArrow) {
101
- setSelectedTechIndex((i) => i > 0 ? i - 1 : TECHNIQUE_OPTIONS.length - 1);
102
- } else if (key.downArrow) {
103
- setSelectedTechIndex((i) => i < TECHNIQUE_OPTIONS.length - 1 ? i + 1 : 0);
104
- } else if (key.return) {
105
- const chosen = TECHNIQUE_OPTIONS[selectedTechIndex];
106
- setPendingTechnique(chosen.value);
107
- setScreen("value");
108
- } else if (key.escape) {
109
- setScreen("main");
110
- } else if (key.ctrl && input === "c") {
111
- exit();
112
- }
113
- } else if (screen === "value") {
114
- if (key.return) {
115
- setScreen("system-prompt");
116
- } else if (key.backspace || key.delete) {
117
- setDiscoveryValue((v) => v.slice(0, -1));
118
- } else if (key.escape) {
119
- setScreen("main");
120
- } else if (key.ctrl && input === "c") {
121
- exit();
122
- } else if (input && !key.ctrl && !key.meta) {
123
- setDiscoveryValue((v) => v + input);
124
- }
125
- } else if (screen === "system-prompt") {
126
- if (key.return) {
127
- let claudeSystemPromptValue;
128
- if (systemPrompt) {
129
- writePromptFile("claude-system-prompt.md", systemPrompt);
130
- claudeSystemPromptValue = "claude-system-prompt.md";
131
- }
132
- writeConfig({
133
- ...rawExisting,
134
- remoteType: pendingRemote,
135
- issueDiscoveryTechnique: pendingTechnique,
136
- issueDiscoveryValue: discoveryValue || void 0,
137
- claudeSystemPrompt: claudeSystemPromptValue
138
- });
139
- exit();
140
- } else if (key.backspace || key.delete) {
141
- setSystemPrompt((v) => v.slice(0, -1));
142
- } else if (key.escape) {
143
- setScreen("main");
144
- } else if (key.ctrl && input === "c") {
145
- exit();
146
- } else if (input && !key.ctrl && !key.meta) {
147
- setSystemPrompt((v) => v + input);
148
- }
149
- } else if (screen === "prompts-menu") {
150
- if (key.upArrow) {
151
- setPromptsMenuIndex((i) => i > 0 ? i - 1 : PROMPTS_MENU_OPTIONS.length - 1);
152
- } else if (key.downArrow) {
153
- setPromptsMenuIndex((i) => i < PROMPTS_MENU_OPTIONS.length - 1 ? i + 1 : 0);
154
- } else if (key.return) {
155
- const chosen = PROMPTS_MENU_OPTIONS[promptsMenuIndex];
156
- if (chosen === "Sonar") {
157
- setScreen("sonar-prompt");
158
- } else if (chosen === "Fix-Comments") {
159
- setScreen("fix-comments-prompt");
160
- } else {
161
- setScreen("check-issue-prompt");
162
- }
163
- } else if (key.escape) {
164
- setScreen("main");
165
- } else if (key.ctrl && input === "c") {
166
- exit();
167
- }
168
- } else if (screen === "sonar-prompt") {
169
- if (key.return) {
170
- let sonarValue;
171
- if (sonarPrompt) {
172
- writePromptFile("sonar-prompt.md", sonarPrompt);
173
- sonarValue = "sonar-prompt.md";
174
- }
175
- const current = readRawConfig();
176
- writeConfig({
177
- ...current,
178
- prompts: { ...current.prompts, sonar: sonarValue }
179
- });
180
- setScreen("prompts-menu");
181
- } else if (key.backspace || key.delete) {
182
- setSonarPrompt((v) => v.slice(0, -1));
183
- } else if (key.escape) {
184
- setScreen("prompts-menu");
185
- } else if (key.ctrl && input === "c") {
186
- exit();
187
- } else if (input && !key.ctrl && !key.meta) {
188
- setSonarPrompt((v) => v + input);
189
- }
190
- } else if (screen === "fix-comments-prompt") {
191
- if (key.return) {
192
- let fixCommentsValue;
193
- if (fixCommentsPrompt) {
194
- writePromptFile("fix-comments-prompt.md", fixCommentsPrompt);
195
- fixCommentsValue = "fix-comments-prompt.md";
196
- }
197
- const current = readRawConfig();
198
- writeConfig({
199
- ...current,
200
- prompts: { ...current.prompts, fixComments: fixCommentsValue }
201
- });
202
- setScreen("prompts-menu");
203
- } else if (key.backspace || key.delete) {
204
- setFixCommentsPrompt((v) => v.slice(0, -1));
205
- } else if (key.escape) {
206
- setScreen("prompts-menu");
207
- } else if (key.ctrl && input === "c") {
208
- exit();
209
- } else if (input && !key.ctrl && !key.meta) {
210
- setFixCommentsPrompt((v) => v + input);
211
- }
212
- } else if (screen === "check-issue-prompt") {
213
- if (key.return) {
214
- let checkIssueValue;
215
- if (checkIssuePrompt) {
216
- writePromptFile("check-issue-prompt.md", checkIssuePrompt);
217
- checkIssueValue = "check-issue-prompt.md";
218
- }
219
- const current = readRawConfig();
220
- writeConfig({
221
- ...current,
222
- prompts: { ...current.prompts, checkIssue: checkIssueValue }
223
- });
224
- setScreen("prompts-menu");
225
- } else if (key.backspace || key.delete) {
226
- setCheckIssuePrompt((v) => v.slice(0, -1));
227
- } else if (key.escape) {
228
- setScreen("prompts-menu");
229
- } else if (key.ctrl && input === "c") {
230
- exit();
231
- } else if (input && !key.ctrl && !key.meta) {
232
- setCheckIssuePrompt((v) => v + input);
233
- }
234
- } else if (screen === "allowed-users") {
235
- if (key.return) {
236
- setScreen("agent-user");
237
- } else if (key.backspace || key.delete) {
238
- setAllowedUsers((v) => v.slice(0, -1));
239
- } else if (key.escape) {
240
- setScreen("main");
241
- } else if (key.ctrl && input === "c") {
242
- exit();
243
- } else if (input && !key.ctrl && !key.meta) {
244
- setAllowedUsers((v) => v + input);
245
- }
246
- } else if (screen === "agent-user") {
247
- if (key.return) {
248
- const parsedUsers = parseAllowedUsers(allowedUsers);
249
- const current = readRawConfig();
250
- writeConfig({
251
- ...current,
252
- allowedUsers: parsedUsers.length > 0 ? parsedUsers : void 0,
253
- agentUser: agentUser.trim() || void 0
254
- });
255
- exit();
256
- } else if (key.backspace || key.delete) {
257
- setAgentUser((v) => v.slice(0, -1));
258
- } else if (key.escape) {
259
- setScreen("allowed-users");
260
- } else if (key.ctrl && input === "c") {
261
- exit();
262
- } else if (input && !key.ctrl && !key.meta) {
263
- setAgentUser((v) => v + input);
264
- }
265
- }
266
- });
267
- if (screen === "main") {
268
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
269
- /* @__PURE__ */ jsx(Text, { bold: true, children: "Configure Automata" }),
270
- /* @__PURE__ */ jsx(Text, { children: " " }),
271
- MAIN_MENU_OPTIONS.map((option, index) => /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { color: index === mainMenuIndex ? "cyan" : void 0, children: [
272
- index === mainMenuIndex ? "\u276F " : " ",
273
- option
274
- ] }) }, option)),
275
- /* @__PURE__ */ jsx(Text, { children: " " }),
276
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2191/\u2193 to move \xB7 Enter to select \xB7 Ctrl+C to cancel" })
277
- ] });
278
- }
279
- if (screen === "remote") {
280
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
281
- /* @__PURE__ */ jsx(Text, { bold: true, children: "Remote / Mode" }),
282
- /* @__PURE__ */ jsx(Text, { children: " " }),
283
- /* @__PURE__ */ jsx(Text, { children: "Remote environment type:" }),
284
- REMOTE_OPTIONS.map((option, index) => /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { color: index === selectedRemoteIndex ? "cyan" : void 0, children: [
285
- index === selectedRemoteIndex ? "\u276F " : " ",
286
- option.label
287
- ] }) }, option.value)),
288
- /* @__PURE__ */ jsx(Text, { children: " " }),
289
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2191/\u2193 to move \xB7 Enter to confirm \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
290
- ] });
291
- }
292
- if (screen === "technique") {
293
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
294
- /* @__PURE__ */ jsx(Text, { bold: true, children: "Implement-Next \u2014 Issue Discovery Technique" }),
295
- /* @__PURE__ */ jsx(Text, { children: " " }),
296
- /* @__PURE__ */ jsx(Text, { children: "How to find the next issue to work on:" }),
297
- TECHNIQUE_OPTIONS.map((option, index) => /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { color: index === selectedTechIndex ? "cyan" : void 0, children: [
298
- index === selectedTechIndex ? "\u276F " : " ",
299
- option.label
300
- ] }) }, option.value)),
301
- /* @__PURE__ */ jsx(Text, { children: " " }),
302
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2191/\u2193 to move \xB7 Enter to confirm \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
303
- ] });
304
- }
305
- if (screen === "value") {
306
- const techLabel = TECHNIQUE_OPTIONS.find((t) => t.value === pendingTechnique)?.label ?? pendingTechnique;
307
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
308
- /* @__PURE__ */ jsx(Text, { bold: true, children: "Implement-Next \u2014 Issue Discovery Value" }),
309
- /* @__PURE__ */ jsx(Text, { children: " " }),
310
- /* @__PURE__ */ jsxs(Text, { children: [
311
- techLabel,
312
- " value:",
313
- " ",
314
- /* @__PURE__ */ jsxs(Text, { color: "cyan", children: [
315
- discoveryValue,
316
- /* @__PURE__ */ jsx(Text, { children: "_" })
317
- ] })
318
- ] }),
319
- /* @__PURE__ */ jsx(Text, { children: " " }),
320
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Type value \xB7 Enter to continue \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
321
- ] });
322
- }
323
- if (screen === "system-prompt") {
324
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
325
- /* @__PURE__ */ jsx(Text, { bold: true, children: "Implement-Next \u2014 Claude System Prompt" }),
326
- /* @__PURE__ */ jsx(Text, { children: " " }),
327
- /* @__PURE__ */ jsxs(Text, { children: [
328
- "System prompt (optional):",
329
- " ",
330
- /* @__PURE__ */ jsxs(Text, { color: "cyan", children: [
331
- systemPrompt,
332
- /* @__PURE__ */ jsx(Text, { children: "_" })
333
- ] })
334
- ] }),
335
- /* @__PURE__ */ jsx(Text, { children: " " }),
336
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Type prompt \xB7 Enter to save and exit \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
337
- ] });
338
- }
339
- if (screen === "prompts-menu") {
340
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
341
- /* @__PURE__ */ jsx(Text, { bold: true, children: "Prompts" }),
342
- /* @__PURE__ */ jsx(Text, { children: " " }),
343
- PROMPTS_MENU_OPTIONS.map((option, index) => /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(Text, { color: index === promptsMenuIndex ? "cyan" : void 0, children: [
344
- index === promptsMenuIndex ? "\u276F " : " ",
345
- option
346
- ] }) }, option)),
347
- /* @__PURE__ */ jsx(Text, { children: " " }),
348
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "\u2191/\u2193 to move \xB7 Enter to edit \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
349
- ] });
350
- }
351
- if (screen === "sonar-prompt") {
352
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
353
- /* @__PURE__ */ jsx(Text, { bold: true, children: "Prompts \u2014 Sonar" }),
354
- /* @__PURE__ */ jsx(Text, { children: " " }),
355
- /* @__PURE__ */ jsxs(Text, { children: [
356
- "Sonar prompt:",
357
- " ",
358
- /* @__PURE__ */ jsxs(Text, { color: "cyan", children: [
359
- sonarPrompt,
360
- /* @__PURE__ */ jsx(Text, { children: "_" })
361
- ] })
362
- ] }),
363
- /* @__PURE__ */ jsx(Text, { children: " " }),
364
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Type prompt \xB7 Enter to save \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
365
- ] });
366
- }
367
- if (screen === "check-issue-prompt") {
368
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
369
- /* @__PURE__ */ jsx(Text, { bold: true, children: "Prompts \u2014 Check-Issue" }),
370
- /* @__PURE__ */ jsx(Text, { children: " " }),
371
- /* @__PURE__ */ jsxs(Text, { children: [
372
- "Check-Issue prompt:",
373
- " ",
374
- /* @__PURE__ */ jsxs(Text, { color: "cyan", children: [
375
- checkIssuePrompt,
376
- /* @__PURE__ */ jsx(Text, { children: "_" })
377
- ] })
378
- ] }),
379
- /* @__PURE__ */ jsx(Text, { children: " " }),
380
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Type prompt \xB7 Enter to save \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
381
- ] });
382
- }
383
- if (screen === "allowed-users") {
384
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
385
- /* @__PURE__ */ jsx(Text, { bold: true, children: "Issue Watch \u2014 Allowed Users" }),
386
- /* @__PURE__ */ jsx(Text, { children: " " }),
387
- /* @__PURE__ */ jsxs(Text, { children: [
388
- "Logins allowed to instruct the agent (comma separated):",
389
- " ",
390
- /* @__PURE__ */ jsxs(Text, { color: "cyan", children: [
391
- allowedUsers,
392
- /* @__PURE__ */ jsx(Text, { children: "_" })
393
- ] })
394
- ] }),
395
- /* @__PURE__ */ jsx(Text, { children: " " }),
396
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Type logins \xB7 Enter to continue \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
397
- ] });
398
- }
399
- if (screen === "agent-user") {
400
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
401
- /* @__PURE__ */ jsx(Text, { bold: true, children: "Issue Watch \u2014 Agent User" }),
402
- /* @__PURE__ */ jsx(Text, { children: " " }),
403
- /* @__PURE__ */ jsxs(Text, { children: [
404
- "Login the agent posts as:",
405
- " ",
406
- /* @__PURE__ */ jsxs(Text, { color: "cyan", children: [
407
- agentUser,
408
- /* @__PURE__ */ jsx(Text, { children: "_" })
409
- ] })
410
- ] }),
411
- /* @__PURE__ */ jsx(Text, { children: " " }),
412
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Type login \xB7 Enter to save and exit \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
413
- ] });
414
- }
415
- return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginY: 1, children: [
416
- /* @__PURE__ */ jsx(Text, { bold: true, children: "Prompts \u2014 Fix-Comments" }),
417
- /* @__PURE__ */ jsx(Text, { children: " " }),
418
- /* @__PURE__ */ jsxs(Text, { children: [
419
- "Fix-Comments prompt:",
420
- " ",
421
- /* @__PURE__ */ jsxs(Text, { color: "cyan", children: [
422
- fixCommentsPrompt,
423
- /* @__PURE__ */ jsx(Text, { children: "_" })
424
- ] })
425
- ] }),
426
- /* @__PURE__ */ jsx(Text, { children: " " }),
427
- /* @__PURE__ */ jsx(Text, { dimColor: true, children: "Type prompt \xB7 Enter to save \xB7 Esc to go back \xB7 Ctrl+C to cancel" })
428
- ] });
429
- }
430
- export {
431
- ConfigWizard
432
- };