automata-cli 0.4.0-develop.152 → 0.4.0-develop.157
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/README.md +13 -0
- package/dist/index.js +21 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,6 +113,19 @@ See [docs/execute.md](docs/execute.md) for full details.
|
|
|
113
113
|
|
|
114
114
|
---
|
|
115
115
|
|
|
116
|
+
## `automata execute-prompt`
|
|
117
|
+
|
|
118
|
+
Run predefined AI workflows that gather context from the current branch before invoking Claude or Codex.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
automata execute-prompt sonar --with claude
|
|
122
|
+
automata execute-prompt fix-comments --with codex --model o3
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
See [docs/execute-prompt.md](docs/execute-prompt.md) for full details.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
116
129
|
## Development
|
|
117
130
|
|
|
118
131
|
### Prerequisites
|
package/dist/index.js
CHANGED
|
@@ -1727,20 +1727,6 @@ function resolveCommand(name) {
|
|
|
1727
1727
|
}
|
|
1728
1728
|
return name;
|
|
1729
1729
|
}
|
|
1730
|
-
var MODEL_IDS = {
|
|
1731
|
-
opus: "claude-opus-4-6",
|
|
1732
|
-
sonnet: "claude-sonnet-4-6",
|
|
1733
|
-
haiku: "claude-haiku-4-5-20251001"
|
|
1734
|
-
};
|
|
1735
|
-
function resolveModelOption(opts) {
|
|
1736
|
-
const selected = ["opus", "sonnet", "haiku"].filter((m) => opts[m]);
|
|
1737
|
-
if (selected.length > 1) {
|
|
1738
|
-
process.stderr.write(`Error: --${selected[0]} and --${selected[1]} are mutually exclusive.
|
|
1739
|
-
`);
|
|
1740
|
-
process.exit(1);
|
|
1741
|
-
}
|
|
1742
|
-
return selected.length === 1 ? MODEL_IDS[selected[0]] : void 0;
|
|
1743
|
-
}
|
|
1744
1730
|
function invokeClaudeCode(prompt, options = {}) {
|
|
1745
1731
|
if (options.verbose) {
|
|
1746
1732
|
return invokeClaudeCodeVerbose(prompt, options.yolo ?? false, options.model);
|
|
@@ -2111,13 +2097,30 @@ function formatPrInfoContext(pr) {
|
|
|
2111
2097
|
return JSON.stringify(pr, null, 2);
|
|
2112
2098
|
}
|
|
2113
2099
|
function addAiOptions(cmd) {
|
|
2114
|
-
return cmd.
|
|
2100
|
+
return cmd.requiredOption("--with <executor>", "Executor to use: claude or codex").option("--model <string>", "Model identifier to pass to the executor").option("--silent", "Suppress step-by-step Claude output; show only the final summary").option("--push", "Append instruction to commit and push changes after the AI finishes");
|
|
2101
|
+
}
|
|
2102
|
+
function resolveExecutor(withOption) {
|
|
2103
|
+
const executor = withOption.toLowerCase();
|
|
2104
|
+
if (executor !== "claude" && executor !== "codex") {
|
|
2105
|
+
process.stderr.write(`Error: --with must be 'claude' or 'codex', got '${withOption}'.
|
|
2106
|
+
`);
|
|
2107
|
+
process.exit(1);
|
|
2108
|
+
}
|
|
2109
|
+
return executor;
|
|
2110
|
+
}
|
|
2111
|
+
function invokeSelectedExecutor(prompt, executor, options) {
|
|
2112
|
+
if (executor === "codex") {
|
|
2113
|
+
invokeCodexCode(prompt, { yolo: true, model: options.model });
|
|
2114
|
+
return;
|
|
2115
|
+
}
|
|
2116
|
+
return invokeClaudeCode(prompt, { yolo: true, verbose: !options.silent, model: options.model });
|
|
2115
2117
|
}
|
|
2116
2118
|
var executeSonarCmd = addAiOptions(
|
|
2117
2119
|
new Command5("sonar").description(
|
|
2118
2120
|
"Check the current branch for a SonarCloud analysis and invoke the AI with the Sonar prompt and analysis URL"
|
|
2119
2121
|
)
|
|
2120
2122
|
).action(async (options) => {
|
|
2123
|
+
const executor = resolveExecutor(options.with);
|
|
2121
2124
|
let branch;
|
|
2122
2125
|
try {
|
|
2123
2126
|
branch = getCurrentBranch();
|
|
@@ -2157,12 +2160,7 @@ Current PR context from automata git get-pr-info --json:
|
|
|
2157
2160
|
${formatPrInfoContext(pr)}`,
|
|
2158
2161
|
options.push
|
|
2159
2162
|
);
|
|
2160
|
-
|
|
2161
|
-
invokeCodexCode(fullPrompt, { yolo: true });
|
|
2162
|
-
} else {
|
|
2163
|
-
const model = resolveModelOption(options);
|
|
2164
|
-
await invokeClaudeCode(fullPrompt, { yolo: true, verbose: options.verbose, model });
|
|
2165
|
-
}
|
|
2163
|
+
await invokeSelectedExecutor(fullPrompt, executor, options);
|
|
2166
2164
|
});
|
|
2167
2165
|
function formatComments(comments) {
|
|
2168
2166
|
return comments.map((c) => {
|
|
@@ -2176,6 +2174,7 @@ var executeFixCommentsCmd = addAiOptions(
|
|
|
2176
2174
|
"Fetch open review comments on the current PR and invoke the AI with the Fix-Comments prompt"
|
|
2177
2175
|
)
|
|
2178
2176
|
).action(async (options) => {
|
|
2177
|
+
const executor = resolveExecutor(options.with);
|
|
2179
2178
|
const result = resolveCurrentBranchComments();
|
|
2180
2179
|
if (!result.ok) {
|
|
2181
2180
|
if (result.kind === "error") {
|
|
@@ -2212,12 +2211,7 @@ Open review comments:
|
|
|
2212
2211
|
${formatComments(comments)}`,
|
|
2213
2212
|
options.push
|
|
2214
2213
|
);
|
|
2215
|
-
|
|
2216
|
-
invokeCodexCode(fullPrompt, { yolo: true });
|
|
2217
|
-
} else {
|
|
2218
|
-
const model = resolveModelOption(options);
|
|
2219
|
-
await invokeClaudeCode(fullPrompt, { yolo: true, verbose: options.verbose, model });
|
|
2220
|
-
}
|
|
2214
|
+
await invokeSelectedExecutor(fullPrompt, executor, options);
|
|
2221
2215
|
});
|
|
2222
2216
|
var executePromptCommand = new Command5("execute-prompt").description("Execute a configured custom prompt using an AI assistant").addCommand(executeSonarCmd).addCommand(executeFixCommentsCmd);
|
|
2223
2217
|
|