automata-cli 0.11.0-develop.495 → 0.11.0-develop.501
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.
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
DEFAULT_CHECK_ISSUE_PROMPT,
|
|
4
|
+
DEFAULT_CONDUCTOR_ISSUE_PROMPT,
|
|
5
|
+
DEFAULT_CONDUCTOR_PR_PROMPT,
|
|
4
6
|
DEFAULT_DO_WORK,
|
|
5
7
|
DEFAULT_DO_WORK_ISSUE_DISCUSS_PROMPT,
|
|
6
8
|
DEFAULT_DO_WORK_PR_ORPHAN_PROMPT,
|
|
@@ -10,7 +12,7 @@ import {
|
|
|
10
12
|
readConfig,
|
|
11
13
|
readRawConfig,
|
|
12
14
|
writeConfig
|
|
13
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TSOUCFDW.js";
|
|
14
16
|
|
|
15
17
|
// src/config/ConfigWizard.tsx
|
|
16
18
|
import { useState } from "react";
|
|
@@ -56,7 +58,9 @@ var PROMPTS_MENU_OPTIONS = [
|
|
|
56
58
|
"Check-Issue",
|
|
57
59
|
"Do Work \u2014 Discuss",
|
|
58
60
|
"Do Work \u2014 PR",
|
|
59
|
-
"Do Work \u2014 Orphan PR"
|
|
61
|
+
"Do Work \u2014 Orphan PR",
|
|
62
|
+
"Conductor \u2014 Issue",
|
|
63
|
+
"Conductor \u2014 PR"
|
|
60
64
|
];
|
|
61
65
|
function parseAllowedUsers(value) {
|
|
62
66
|
return value.split(",").map((user) => user.trim()).filter((user) => user.length > 0);
|
|
@@ -137,7 +141,9 @@ var PROMPT_SCREEN_BY_OPTION = {
|
|
|
137
141
|
"Check-Issue": "check-issue-prompt",
|
|
138
142
|
"Do Work \u2014 Discuss": "do-work-discuss-prompt",
|
|
139
143
|
"Do Work \u2014 PR": "do-work-pr-prompt",
|
|
140
|
-
"Do Work \u2014 Orphan PR": "do-work-pr-orphan-prompt"
|
|
144
|
+
"Do Work \u2014 Orphan PR": "do-work-pr-orphan-prompt",
|
|
145
|
+
"Conductor \u2014 Issue": "conductor-issue-prompt",
|
|
146
|
+
"Conductor \u2014 PR": "conductor-pr-prompt"
|
|
141
147
|
};
|
|
142
148
|
function ConfigWizard() {
|
|
143
149
|
const existing = readConfig();
|
|
@@ -202,6 +208,12 @@ function ConfigWizard() {
|
|
|
202
208
|
const [doWorkPrOrphanPrompt, setDoWorkPrOrphanPrompt] = useState(
|
|
203
209
|
existing.doWork?.prompts?.prOrphan ?? DEFAULT_DO_WORK_PR_ORPHAN_PROMPT
|
|
204
210
|
);
|
|
211
|
+
const [conductorIssuePrompt, setConductorIssuePrompt] = useState(
|
|
212
|
+
existing.conductor?.prompts?.issue ?? DEFAULT_CONDUCTOR_ISSUE_PROMPT
|
|
213
|
+
);
|
|
214
|
+
const [conductorPrPrompt, setConductorPrPrompt] = useState(
|
|
215
|
+
existing.conductor?.prompts?.pr ?? DEFAULT_CONDUCTOR_PR_PROMPT
|
|
216
|
+
);
|
|
205
217
|
const [gitTrunkBranch, setGitTrunkBranch] = useState(existing.git?.trunkBranch ?? "");
|
|
206
218
|
const initialReleaseFlowIndex = RELEASE_FLOW_OPTIONS.findIndex((o) => o.value === existing.git?.releaseFlow);
|
|
207
219
|
const [releaseFlowIndex, setReleaseFlowIndex] = useState(Math.max(initialReleaseFlowIndex, 0));
|
|
@@ -391,6 +403,28 @@ function ConfigWizard() {
|
|
|
391
403
|
},
|
|
392
404
|
onBack: () => setScreen("prompts-menu")
|
|
393
405
|
},
|
|
406
|
+
"conductor-issue-prompt": {
|
|
407
|
+
setValue: setConductorIssuePrompt,
|
|
408
|
+
onSubmit: () => {
|
|
409
|
+
savePrompt("conductor-issue.md", conductorIssuePrompt, (value, current) => ({
|
|
410
|
+
...current,
|
|
411
|
+
conductor: { ...current.conductor, prompts: { ...current.conductor?.prompts, issue: value } }
|
|
412
|
+
}));
|
|
413
|
+
setScreen("prompts-menu");
|
|
414
|
+
},
|
|
415
|
+
onBack: () => setScreen("prompts-menu")
|
|
416
|
+
},
|
|
417
|
+
"conductor-pr-prompt": {
|
|
418
|
+
setValue: setConductorPrPrompt,
|
|
419
|
+
onSubmit: () => {
|
|
420
|
+
savePrompt("conductor-pr.md", conductorPrPrompt, (value, current) => ({
|
|
421
|
+
...current,
|
|
422
|
+
conductor: { ...current.conductor, prompts: { ...current.conductor?.prompts, pr: value } }
|
|
423
|
+
}));
|
|
424
|
+
setScreen("prompts-menu");
|
|
425
|
+
},
|
|
426
|
+
onBack: () => setScreen("prompts-menu")
|
|
427
|
+
},
|
|
394
428
|
"git-trunk-branch": {
|
|
395
429
|
setValue: setGitTrunkBranch,
|
|
396
430
|
onSubmit: () => setScreen("git-release-flow"),
|
|
@@ -628,6 +662,18 @@ function ConfigWizard() {
|
|
|
628
662
|
value: doWorkPrOrphanPrompt,
|
|
629
663
|
hint: `Type prompt \xB7 Enter to save \xB7 ${BACK}`
|
|
630
664
|
},
|
|
665
|
+
"conductor-issue-prompt": {
|
|
666
|
+
title: "Prompts \u2014 Conductor \u2014 Issue",
|
|
667
|
+
label: "Instructions for the conductor on a watched issue:",
|
|
668
|
+
value: conductorIssuePrompt,
|
|
669
|
+
hint: `Type prompt \xB7 Enter to save \xB7 ${BACK}`
|
|
670
|
+
},
|
|
671
|
+
"conductor-pr-prompt": {
|
|
672
|
+
title: "Prompts \u2014 Conductor \u2014 PR",
|
|
673
|
+
label: "Instructions for the conductor on a watched pull request:",
|
|
674
|
+
value: conductorPrPrompt,
|
|
675
|
+
hint: `Type prompt \xB7 Enter to save \xB7 ${BACK}`
|
|
676
|
+
},
|
|
631
677
|
"git-trunk-branch": {
|
|
632
678
|
title: "Git \u2014 Trunk Branch",
|
|
633
679
|
label: "Branch publish-release releases to (blank = detect it from the remote):",
|
|
@@ -19,6 +19,8 @@ var DEFAULT_DO_WORK = {
|
|
|
19
19
|
var DEFAULT_DO_WORK_ISSUE_DISCUSS_PROMPT = "You are the agent named in the context below, working on a GitHub issue together with the people allowed to instruct you. Answer the messages marked NEW; the earlier messages are context only.\n\nDo not modify, create or delete any file in the repository, and do not create a branch or a pull request, UNLESS a message marked NEW explicitly asks you to implement the work. If it does: create a branch off the base branch named below, implement the change following the project's existing conventions, run the tests and the linter, and open a pull request whose body contains `Closes #<issue number>`.\n\nOtherwise do not touch the code at all: reply on the issue with the specification, the plan, or the open questions you need answered. Keep the reply short and concrete.\n\nEither way, always post a reply on the issue before you finish \u2014 including when you implemented and opened a pull request. Silence is indistinguishable from a crash, and the run will be reported as having produced no answer.\n\nPost the reply yourself with the GitHub CLI: write it to a temporary file outside the repository (the only file you may create in this case) and run `gh issue comment <issue-number> --body-file <file>`, or `gh pr comment <pr-number> --body-file <file>` when you are replying on a pull request. `do-work` does not publish your output, so printing the answer to stdout does not count as a posted reply.";
|
|
20
20
|
var DEFAULT_DO_WORK_PR_WORK_PROMPT = "You are the agent named in the context below, working on the pull request for a GitHub issue together with the people allowed to instruct you. Work on the branch named below, which is already checked out and up to date.\n\nAddress every message marked NEW and every unresolved review thread listed. Follow the project's existing conventions, run the tests and the linter, then commit and push to that branch. Do not merge the pull request and do not push to the base branch.\n\nOnce a review thread is fixed and pushed, resolve it (GraphQL `resolveReviewThread`) after replying; leave open any thread you did not fix. Reply on the pull request with a short summary of what you changed, or reply in the review thread when your answer belongs to a specific comment. Always post a reply \u2014 silence looks like a crash.";
|
|
21
21
|
var DEFAULT_DO_WORK_PR_ORPHAN_PROMPT = "You are the agent named in the context below, working on a pull request that is not linked to any issue \u2014 a dependency bump, or another change opened without one \u2014 together with the people allowed to instruct you. Work on the branch named below, which is already checked out and up to date.\n\nAddress every message marked NEW and every unresolved review thread listed. Typical work here is finding out why the checks are failing, bringing the branch up to date with the base branch, and fixing whatever the change needs in order to be mergeable. Follow the project's existing conventions, run the tests and the linter, then commit and push to that branch.\n\nDo not merge the pull request, do not close it, and do not push to the base branch. If you conclude that it should be merged or closed, say so in your reply and leave the decision to the humans.\n\nOnce a review thread is fixed and pushed, resolve it (GraphQL `resolveReviewThread`) after replying; leave open any thread you did not fix. Reply on the pull request with a short summary of what you did and what you recommend, or reply in the review thread when your answer belongs to a specific comment. Always post a reply \u2014 silence looks like a crash.";
|
|
22
|
+
var DEFAULT_CONDUCTOR_ISSUE_PROMPT = "You are the conductor: you act for the people allowed to instruct the agent named in the context below. The agent spoke last on the thread below, and no allowed user has answered yet.\n\nRead the whole thread \u2014 the issue, its pull requests, the unresolved review threads and the CI status. Decide what the agent needs next: an answer to its question, a decision, or a correction. Write the next message to the agent, short and concrete. Do not change any file, do not merge or close anything, and do not push to any branch.";
|
|
23
|
+
var DEFAULT_CONDUCTOR_PR_PROMPT = "You are the conductor: you act for the people allowed to instruct the agent named in the context below. The agent spoke last on the pull request below, and no allowed user has answered yet.\n\nRead the whole thread \u2014 the pull request, the unresolved review threads and the CI status. Decide what the agent needs next: an answer to its question, a decision on a review thread, or a correction. A failing check is the agent's work to fix; name it if the agent has not. Write the next message to the agent, short and concrete. Do not change any file, do not merge or close the pull request, and do not push to any branch.";
|
|
22
24
|
var CONFIG_DIR = ".automata";
|
|
23
25
|
var CONFIG_FILE = "config.json";
|
|
24
26
|
function configPath() {
|
|
@@ -87,6 +89,12 @@ function readConfig() {
|
|
|
87
89
|
if (config.doWork?.prompts?.prOrphan) {
|
|
88
90
|
config.doWork.prompts.prOrphan = resolvePromptRef(config.doWork.prompts.prOrphan, dir);
|
|
89
91
|
}
|
|
92
|
+
if (config.conductor?.prompts?.issue) {
|
|
93
|
+
config.conductor.prompts.issue = resolvePromptRef(config.conductor.prompts.issue, dir);
|
|
94
|
+
}
|
|
95
|
+
if (config.conductor?.prompts?.pr) {
|
|
96
|
+
config.conductor.prompts.pr = resolvePromptRef(config.conductor.prompts.pr, dir);
|
|
97
|
+
}
|
|
90
98
|
return config;
|
|
91
99
|
}
|
|
92
100
|
function writeConfig(config) {
|
|
@@ -104,6 +112,8 @@ export {
|
|
|
104
112
|
DEFAULT_DO_WORK_ISSUE_DISCUSS_PROMPT,
|
|
105
113
|
DEFAULT_DO_WORK_PR_WORK_PROMPT,
|
|
106
114
|
DEFAULT_DO_WORK_PR_ORPHAN_PROMPT,
|
|
115
|
+
DEFAULT_CONDUCTOR_ISSUE_PROMPT,
|
|
116
|
+
DEFAULT_CONDUCTOR_PR_PROMPT,
|
|
107
117
|
readRawConfig,
|
|
108
118
|
readConfig,
|
|
109
119
|
writeConfig
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
readConfig,
|
|
12
12
|
readRawConfig,
|
|
13
13
|
writeConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TSOUCFDW.js";
|
|
15
15
|
|
|
16
16
|
// src/index.ts
|
|
17
17
|
import { Command as Command8 } from "commander";
|
|
@@ -293,6 +293,26 @@ var configSetDoWorkPrompt = new Command("do-work-prompt").description("Set the t
|
|
|
293
293
|
process.stdout.write(`do-work ${turnKind} prompt set.
|
|
294
294
|
`);
|
|
295
295
|
});
|
|
296
|
+
var CONDUCTOR_PROMPT_KINDS = ["issue", "pr"];
|
|
297
|
+
var configSetConductorPrompt = new Command("conductor-prompt").description("Set the instructions for the conductor on a watched issue or pull request (prompt text or a .md filename)").argument("<kind>", `Kind of watched item: ${CONDUCTOR_PROMPT_KINDS.join(", ")}`).argument("<value>", "Prompt text, or a plain .md filename inside .automata/").action((kind, value) => {
|
|
298
|
+
if (!CONDUCTOR_PROMPT_KINDS.includes(kind)) {
|
|
299
|
+
process.stderr.write(
|
|
300
|
+
`Error: invalid kind "${kind}". Must be one of: ${CONDUCTOR_PROMPT_KINDS.join(", ")}
|
|
301
|
+
`
|
|
302
|
+
);
|
|
303
|
+
process.exit(1);
|
|
304
|
+
}
|
|
305
|
+
const prompt = value.trim();
|
|
306
|
+
if (prompt.length === 0) {
|
|
307
|
+
process.stderr.write("Error: conductor-prompt requires a non-empty value.\n");
|
|
308
|
+
process.exit(1);
|
|
309
|
+
}
|
|
310
|
+
const current = readRawConfig();
|
|
311
|
+
const prompts = { ...current.conductor?.prompts, [kind]: prompt };
|
|
312
|
+
writeConfig({ ...current, conductor: { ...current.conductor, prompts } });
|
|
313
|
+
process.stdout.write(`conductor ${kind} prompt set.
|
|
314
|
+
`);
|
|
315
|
+
});
|
|
296
316
|
var configSetGitTrunkBranch = new Command("git-trunk-branch").description("Pin the branch `publish-release` releases to, instead of detecting it").argument("<value>", "Branch name (unset = detect it from the remote)").action((value) => {
|
|
297
317
|
const branch = value.trim();
|
|
298
318
|
if (branch.length === 0) {
|
|
@@ -316,12 +336,12 @@ var configSetGitReleaseFlow = new Command("git-release-flow").description("Pin t
|
|
|
316
336
|
process.stdout.write(`git release flow set to: ${flow}
|
|
317
337
|
`);
|
|
318
338
|
});
|
|
319
|
-
var configSet = new Command("set").description("Set a configuration value").addCommand(configSetType).addCommand(configSetIssueDiscoveryTechnique).addCommand(configSetIssueDiscoveryValue).addCommand(configSetClaudeSystemPrompt).addCommand(configSetAllowedUsers).addCommand(configSetAgentUser).addCommand(configSetDoWorkBaseBranch).addCommand(configSetDoWorkProtectedBranches).addCommand(configSetDoWorkExecutor).addCommand(configSetDoWorkModel).addCommand(configSetDoWorkEffort).addCommand(configSetDoWorkMaxRuns).addCommand(configSetDoWorkLockStaleMinutes).addCommand(configSetDoWorkDumpOnBlock).addCommand(configSetDoWorkPostRunLog).addCommand(configSetDoWorkPrompt).addCommand(configSetGitTrunkBranch).addCommand(configSetGitReleaseFlow);
|
|
339
|
+
var configSet = new Command("set").description("Set a configuration value").addCommand(configSetType).addCommand(configSetIssueDiscoveryTechnique).addCommand(configSetIssueDiscoveryValue).addCommand(configSetClaudeSystemPrompt).addCommand(configSetAllowedUsers).addCommand(configSetAgentUser).addCommand(configSetDoWorkBaseBranch).addCommand(configSetDoWorkProtectedBranches).addCommand(configSetDoWorkExecutor).addCommand(configSetDoWorkModel).addCommand(configSetDoWorkEffort).addCommand(configSetDoWorkMaxRuns).addCommand(configSetDoWorkLockStaleMinutes).addCommand(configSetDoWorkDumpOnBlock).addCommand(configSetDoWorkPostRunLog).addCommand(configSetDoWorkPrompt).addCommand(configSetConductorPrompt).addCommand(configSetGitTrunkBranch).addCommand(configSetGitReleaseFlow);
|
|
320
340
|
var configCommand = new Command("config").description("Configure automata settings").addCommand(configSet).action(async () => {
|
|
321
341
|
const [{ render }, React, { ConfigWizard }] = await Promise.all([
|
|
322
342
|
import("ink"),
|
|
323
343
|
import("react"),
|
|
324
|
-
import("./ConfigWizard-
|
|
344
|
+
import("./ConfigWizard-BYPYEVVN.js")
|
|
325
345
|
]);
|
|
326
346
|
const { waitUntilExit } = render(React.createElement(ConfigWizard));
|
|
327
347
|
await waitUntilExit();
|
|
@@ -2520,7 +2540,8 @@ function getPrSurface(prNumber) {
|
|
|
2520
2540
|
},
|
|
2521
2541
|
assignees: (raw.assignees ?? []).map(login).filter((name) => name.length > 0),
|
|
2522
2542
|
messages,
|
|
2523
|
-
threads
|
|
2543
|
+
threads,
|
|
2544
|
+
description: { author: login(raw.author), body: raw.body }
|
|
2524
2545
|
};
|
|
2525
2546
|
}
|
|
2526
2547
|
function assignIssueToAgent(issueNumber, agentUser) {
|