automata-cli 0.1.0-009-codex-flag-implement-next.71 → 0.1.0-009-codex-flag-implement-next.75
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/dist/index.js +11 -72
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -957,7 +957,12 @@ function handleSpawnError(error, toolName) {
|
|
|
957
957
|
process.exit(1);
|
|
958
958
|
}
|
|
959
959
|
function handleExitCode(status, toolName) {
|
|
960
|
-
if (status
|
|
960
|
+
if (status === null) {
|
|
961
|
+
process.stderr.write(`Error: ${toolName} terminated abnormally (exit code is null, likely due to a signal).
|
|
962
|
+
`);
|
|
963
|
+
process.exit(1);
|
|
964
|
+
}
|
|
965
|
+
if (status !== 0) {
|
|
961
966
|
process.stderr.write(`Error: ${toolName} exited with code ${status}.
|
|
962
967
|
`);
|
|
963
968
|
process.exit(status);
|
|
@@ -1095,11 +1100,10 @@ function summarizeTool(name, input) {
|
|
|
1095
1100
|
}
|
|
1096
1101
|
|
|
1097
1102
|
// src/codex/codexService.ts
|
|
1098
|
-
import {
|
|
1099
|
-
import { createInterface as createInterface2 } from "readline";
|
|
1103
|
+
import { spawnSync as spawnSync5 } from "child_process";
|
|
1100
1104
|
function invokeCodexCode(prompt, options = {}) {
|
|
1101
1105
|
if (options.verbose) {
|
|
1102
|
-
|
|
1106
|
+
process.stderr.write("Warning: --verbose is not supported for Codex and will be ignored.\n");
|
|
1103
1107
|
}
|
|
1104
1108
|
invokeCodexCodeSync(prompt, options.yolo ?? false);
|
|
1105
1109
|
}
|
|
@@ -1112,74 +1116,9 @@ function invokeCodexCodeSync(prompt, yolo) {
|
|
|
1112
1116
|
handleSpawnError(result.error, "codex");
|
|
1113
1117
|
handleExitCode(result.status, "Codex");
|
|
1114
1118
|
}
|
|
1115
|
-
function invokeCodexCodeVerbose(prompt, yolo) {
|
|
1116
|
-
return new Promise((resolve2) => {
|
|
1117
|
-
const codexBin = resolveCommand("codex");
|
|
1118
|
-
const args = ["exec"];
|
|
1119
|
-
if (yolo) args.push("--dangerously-bypass-approvals-and-sandbox");
|
|
1120
|
-
args.push("--json", prompt);
|
|
1121
|
-
const child = spawn2(codexBin, args, { stdio: ["inherit", "pipe", "inherit"] });
|
|
1122
|
-
const rl = createInterface2({ input: child.stdout });
|
|
1123
|
-
let stepCount = 0;
|
|
1124
|
-
child.on("error", (err) => {
|
|
1125
|
-
handleSpawnError(err, "codex");
|
|
1126
|
-
});
|
|
1127
|
-
rl.on("line", (line) => {
|
|
1128
|
-
try {
|
|
1129
|
-
const event = JSON.parse(line);
|
|
1130
|
-
formatCodexEvent(event, stepCount);
|
|
1131
|
-
if (event["type"] === "agent_message" || event["type"] === "tool_call") stepCount++;
|
|
1132
|
-
} catch {
|
|
1133
|
-
}
|
|
1134
|
-
});
|
|
1135
|
-
child.on("close", (code) => {
|
|
1136
|
-
handleExitCode(code, "Codex");
|
|
1137
|
-
resolve2();
|
|
1138
|
-
});
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
function formatCodexEvent(event, stepCount) {
|
|
1142
|
-
const type = event["type"];
|
|
1143
|
-
if (type === "tool_call") {
|
|
1144
|
-
const name = event["name"];
|
|
1145
|
-
const input = event["input"];
|
|
1146
|
-
const summary = name ? summarizeCodexTool(name, input) : "tool call";
|
|
1147
|
-
process.stderr.write(` [step ${stepCount + 1}] ${summary}
|
|
1148
|
-
`);
|
|
1149
|
-
} else if (type === "agent_message") {
|
|
1150
|
-
const content = event["content"];
|
|
1151
|
-
if (content && content.length > 0) {
|
|
1152
|
-
const preview = content.length > 120 ? content.slice(0, 120) + "..." : content;
|
|
1153
|
-
const firstLine = preview.split("\n")[0] ?? preview;
|
|
1154
|
-
process.stderr.write(` [step ${stepCount + 1}] ${firstLine}
|
|
1155
|
-
`);
|
|
1156
|
-
}
|
|
1157
|
-
} else if (type === "session_complete" || type === "completed") {
|
|
1158
|
-
const result = event["result"];
|
|
1159
|
-
process.stderr.write("\n--- Result ---\n");
|
|
1160
|
-
if (result) {
|
|
1161
|
-
process.stdout.write(result + "\n");
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
function summarizeCodexTool(name, input) {
|
|
1166
|
-
if (!input) return `tool: ${name}`;
|
|
1167
|
-
switch (name) {
|
|
1168
|
-
case "shell":
|
|
1169
|
-
return `running: ${truncate(String(input["cmd"] ?? input["command"] ?? ""), 80)}`;
|
|
1170
|
-
case "read_file":
|
|
1171
|
-
return `reading ${String(input["path"] ?? "file")}`;
|
|
1172
|
-
case "write_file":
|
|
1173
|
-
return `writing ${String(input["path"] ?? "file")}`;
|
|
1174
|
-
case "list_files":
|
|
1175
|
-
return `listing files: ${String(input["path"] ?? ".")}`;
|
|
1176
|
-
default:
|
|
1177
|
-
return `tool: ${name}`;
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
1119
|
|
|
1181
1120
|
// src/commands/getReady.ts
|
|
1182
|
-
var implementNextCommand = new Command3("implement-next").description("Find the next open GitHub issue matching the configured filter, claim it, and invoke Claude
|
|
1121
|
+
var implementNextCommand = new Command3("implement-next").description("Find the next open GitHub issue matching the configured filter, claim it, and invoke the AI code assistant (Claude or Codex)").option("--json", "Output issue details as JSON").option("--no-claude", "Skip all AI invocation (Claude or Codex) after claiming the issue").option("--codex", "Use Codex CLI instead of Claude Code").option("--query-only", "Print issue content and exit without claiming or invoking any AI tools").option("--yolo", "Launch with --dangerously-skip-permissions (Claude) or --dangerously-bypass-approvals-and-sandbox (Codex)").option("--verbose", "Show step-by-step progress summary and final result").option("--opus", "Use claude-opus-4-6").option("--sonnet", "Use claude-sonnet-4-6").option("--haiku", "Use claude-haiku-4-5-20251001").action(async (options) => {
|
|
1183
1122
|
const config = readConfig();
|
|
1184
1123
|
if (config.remoteType !== "gh") {
|
|
1185
1124
|
process.stderr.write(
|
|
@@ -1250,8 +1189,8 @@ var testClaudeCmd = new Command4("claude").description("Test Claude Code invocat
|
|
|
1250
1189
|
const model = resolveModelOption(options);
|
|
1251
1190
|
await invokeClaudeCode(options.prompt, { yolo: options.yolo, verbose: options.verbose, model });
|
|
1252
1191
|
});
|
|
1253
|
-
var testCodexCmd = new Command4("codex").description("Test Codex CLI invocation with a user-supplied prompt").requiredOption("--prompt <string>", "Prompt to send to Codex CLI").option("--yolo", "Launch Codex with --dangerously-bypass-approvals-and-sandbox").option("--verbose", "
|
|
1254
|
-
|
|
1192
|
+
var testCodexCmd = new Command4("codex").description("Test Codex CLI invocation with a user-supplied prompt").requiredOption("--prompt <string>", "Prompt to send to Codex CLI").option("--yolo", "Launch Codex with --dangerously-bypass-approvals-and-sandbox").option("--verbose", "Not supported for Codex; prints a warning and is otherwise ignored").action((options) => {
|
|
1193
|
+
invokeCodexCode(options.prompt, { yolo: options.yolo, verbose: options.verbose });
|
|
1255
1194
|
});
|
|
1256
1195
|
var testCommand = new Command4("test").description("Test commands for verifying automata integrations").addCommand(testClaudeCmd).addCommand(testCodexCmd);
|
|
1257
1196
|
|