automata-cli 0.1.0-009-codex-flag-implement-next.67 → 0.1.0-009-codex-flag-implement-next.71
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 +38 -54
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -939,6 +939,32 @@ import { spawn, spawnSync as spawnSync4 } from "child_process";
|
|
|
939
939
|
import { createInterface } from "readline";
|
|
940
940
|
import { existsSync } from "fs";
|
|
941
941
|
import { delimiter, join as join2 } from "path";
|
|
942
|
+
|
|
943
|
+
// src/cli/spawnUtils.ts
|
|
944
|
+
function truncate(str, max) {
|
|
945
|
+
return str.length > max ? str.slice(0, max) + "..." : str;
|
|
946
|
+
}
|
|
947
|
+
function handleSpawnError(error, toolName) {
|
|
948
|
+
if (!error) return;
|
|
949
|
+
const err = error;
|
|
950
|
+
if (err.code === "ENOENT") {
|
|
951
|
+
process.stderr.write(`Error: \`${toolName}\` CLI is not installed or not on PATH.
|
|
952
|
+
`);
|
|
953
|
+
process.exit(1);
|
|
954
|
+
}
|
|
955
|
+
process.stderr.write(`Error: ${err.message}
|
|
956
|
+
`);
|
|
957
|
+
process.exit(1);
|
|
958
|
+
}
|
|
959
|
+
function handleExitCode(status, toolName) {
|
|
960
|
+
if (status !== null && status !== 0) {
|
|
961
|
+
process.stderr.write(`Error: ${toolName} exited with code ${status}.
|
|
962
|
+
`);
|
|
963
|
+
process.exit(status);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
// src/claude/claudeService.ts
|
|
942
968
|
function resolveCommand(name) {
|
|
943
969
|
const pathDirs = (process.env["PATH"] ?? "").split(delimiter);
|
|
944
970
|
for (const dir of pathDirs) {
|
|
@@ -974,8 +1000,8 @@ function invokeClaudeCodeSync(prompt, yolo, model) {
|
|
|
974
1000
|
if (model) args.push("--model", model);
|
|
975
1001
|
args.push("-p", prompt);
|
|
976
1002
|
const result = spawnSync4(claudeBin, args, { encoding: "utf8", stdio: "inherit" });
|
|
977
|
-
handleSpawnError(result.error);
|
|
978
|
-
handleExitCode(result.status);
|
|
1003
|
+
handleSpawnError(result.error, "claude");
|
|
1004
|
+
handleExitCode(result.status, "Claude Code");
|
|
979
1005
|
}
|
|
980
1006
|
function invokeClaudeCodeVerbose(prompt, yolo, model) {
|
|
981
1007
|
return new Promise((resolve2) => {
|
|
@@ -988,7 +1014,7 @@ function invokeClaudeCodeVerbose(prompt, yolo, model) {
|
|
|
988
1014
|
const rl = createInterface({ input: child.stdout });
|
|
989
1015
|
let turnCount = 0;
|
|
990
1016
|
child.on("error", (err) => {
|
|
991
|
-
handleSpawnError(err);
|
|
1017
|
+
handleSpawnError(err, "claude");
|
|
992
1018
|
});
|
|
993
1019
|
rl.on("line", (line) => {
|
|
994
1020
|
try {
|
|
@@ -999,7 +1025,7 @@ function invokeClaudeCodeVerbose(prompt, yolo, model) {
|
|
|
999
1025
|
}
|
|
1000
1026
|
});
|
|
1001
1027
|
child.on("close", (code) => {
|
|
1002
|
-
handleExitCode(code);
|
|
1028
|
+
handleExitCode(code, "Claude Code");
|
|
1003
1029
|
resolve2();
|
|
1004
1030
|
});
|
|
1005
1031
|
});
|
|
@@ -1067,27 +1093,6 @@ function summarizeTool(name, input) {
|
|
|
1067
1093
|
return `tool: ${name}`;
|
|
1068
1094
|
}
|
|
1069
1095
|
}
|
|
1070
|
-
function truncate(str, max) {
|
|
1071
|
-
return str.length > max ? str.slice(0, max) + "..." : str;
|
|
1072
|
-
}
|
|
1073
|
-
function handleSpawnError(error) {
|
|
1074
|
-
if (!error) return;
|
|
1075
|
-
const err = error;
|
|
1076
|
-
if (err.code === "ENOENT") {
|
|
1077
|
-
process.stderr.write("Error: `claude` CLI is not installed or not on PATH.\n");
|
|
1078
|
-
process.exit(1);
|
|
1079
|
-
}
|
|
1080
|
-
process.stderr.write(`Error: ${err.message}
|
|
1081
|
-
`);
|
|
1082
|
-
process.exit(1);
|
|
1083
|
-
}
|
|
1084
|
-
function handleExitCode(status) {
|
|
1085
|
-
if (status !== null && status !== 0) {
|
|
1086
|
-
process.stderr.write(`Error: Claude Code exited with code ${status}.
|
|
1087
|
-
`);
|
|
1088
|
-
process.exit(status);
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
1096
|
|
|
1092
1097
|
// src/codex/codexService.ts
|
|
1093
1098
|
import { spawn as spawn2, spawnSync as spawnSync5 } from "child_process";
|
|
@@ -1104,8 +1109,8 @@ function invokeCodexCodeSync(prompt, yolo) {
|
|
|
1104
1109
|
if (yolo) args.push("--dangerously-bypass-approvals-and-sandbox");
|
|
1105
1110
|
args.push(prompt);
|
|
1106
1111
|
const result = spawnSync5(codexBin, args, { encoding: "utf8", stdio: "inherit" });
|
|
1107
|
-
|
|
1108
|
-
|
|
1112
|
+
handleSpawnError(result.error, "codex");
|
|
1113
|
+
handleExitCode(result.status, "Codex");
|
|
1109
1114
|
}
|
|
1110
1115
|
function invokeCodexCodeVerbose(prompt, yolo) {
|
|
1111
1116
|
return new Promise((resolve2) => {
|
|
@@ -1117,7 +1122,7 @@ function invokeCodexCodeVerbose(prompt, yolo) {
|
|
|
1117
1122
|
const rl = createInterface2({ input: child.stdout });
|
|
1118
1123
|
let stepCount = 0;
|
|
1119
1124
|
child.on("error", (err) => {
|
|
1120
|
-
|
|
1125
|
+
handleSpawnError(err, "codex");
|
|
1121
1126
|
});
|
|
1122
1127
|
rl.on("line", (line) => {
|
|
1123
1128
|
try {
|
|
@@ -1128,7 +1133,7 @@ function invokeCodexCodeVerbose(prompt, yolo) {
|
|
|
1128
1133
|
}
|
|
1129
1134
|
});
|
|
1130
1135
|
child.on("close", (code) => {
|
|
1131
|
-
|
|
1136
|
+
handleExitCode(code, "Codex");
|
|
1132
1137
|
resolve2();
|
|
1133
1138
|
});
|
|
1134
1139
|
});
|
|
@@ -1161,38 +1166,17 @@ function summarizeCodexTool(name, input) {
|
|
|
1161
1166
|
if (!input) return `tool: ${name}`;
|
|
1162
1167
|
switch (name) {
|
|
1163
1168
|
case "shell":
|
|
1164
|
-
return `running: ${
|
|
1169
|
+
return `running: ${truncate(String(input["cmd"] ?? input["command"] ?? ""), 80)}`;
|
|
1165
1170
|
case "read_file":
|
|
1166
|
-
return `reading ${input["path"] ?? "file"}`;
|
|
1171
|
+
return `reading ${String(input["path"] ?? "file")}`;
|
|
1167
1172
|
case "write_file":
|
|
1168
|
-
return `writing ${input["path"] ?? "file"}`;
|
|
1173
|
+
return `writing ${String(input["path"] ?? "file")}`;
|
|
1169
1174
|
case "list_files":
|
|
1170
|
-
return `listing files: ${input["path"] ?? "."}`;
|
|
1175
|
+
return `listing files: ${String(input["path"] ?? ".")}`;
|
|
1171
1176
|
default:
|
|
1172
1177
|
return `tool: ${name}`;
|
|
1173
1178
|
}
|
|
1174
1179
|
}
|
|
1175
|
-
function truncate2(str, max) {
|
|
1176
|
-
return str.length > max ? str.slice(0, max) + "..." : str;
|
|
1177
|
-
}
|
|
1178
|
-
function handleSpawnError2(error) {
|
|
1179
|
-
if (!error) return;
|
|
1180
|
-
const err = error;
|
|
1181
|
-
if (err.code === "ENOENT") {
|
|
1182
|
-
process.stderr.write("Error: `codex` CLI is not installed or not on PATH.\n");
|
|
1183
|
-
process.exit(1);
|
|
1184
|
-
}
|
|
1185
|
-
process.stderr.write(`Error: ${err.message}
|
|
1186
|
-
`);
|
|
1187
|
-
process.exit(1);
|
|
1188
|
-
}
|
|
1189
|
-
function handleExitCode2(status) {
|
|
1190
|
-
if (status !== null && status !== 0) {
|
|
1191
|
-
process.stderr.write(`Error: Codex exited with code ${status}.
|
|
1192
|
-
`);
|
|
1193
|
-
process.exit(status);
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
1180
|
|
|
1197
1181
|
// src/commands/getReady.ts
|
|
1198
1182
|
var implementNextCommand = new Command3("implement-next").description("Find the next open GitHub issue matching the configured filter, claim it, and invoke Claude Code").option("--json", "Output issue details as JSON").option("--no-claude", "Skip Claude Code invocation 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 Claude").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) => {
|