@vexdo/cli 0.2.2 → 0.2.4

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.
Files changed (2) hide show
  1. package/dist/index.js +32 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ var DEFAULT_REVIEW_MODEL = "claude-haiku-4-5-20251001";
16
16
  var DEFAULT_MAX_ITERATIONS = 3;
17
17
  var DEFAULT_AUTO_SUBMIT = false;
18
18
  var DEFAULT_CODEX_MODEL = "gpt-4o";
19
+ var DEFAULT_CODEX_BASE_BRANCH = "main";
19
20
  function isRecord(value) {
20
21
  return typeof value === "object" && value !== null;
21
22
  }
@@ -38,9 +39,12 @@ function parseServices(value) {
38
39
  }
39
40
  const name = requireString(readObjectField(service, "name"), `services[${String(index)}].name`);
40
41
  const servicePath = requireString(readObjectField(service, "path"), `services[${String(index)}].path`);
42
+ const envIdRaw = readObjectField(service, "env_id");
43
+ const env_id = envIdRaw === void 0 ? void 0 : requireString(envIdRaw, `services[${String(index)}].env_id`);
41
44
  return {
42
45
  name,
43
- path: servicePath
46
+ path: servicePath,
47
+ env_id
44
48
  };
45
49
  });
46
50
  }
@@ -90,14 +94,16 @@ function parseMaxConcurrent(value) {
90
94
  }
91
95
  function parseCodex(value) {
92
96
  if (value === void 0) {
93
- return { model: DEFAULT_CODEX_MODEL };
97
+ return { model: DEFAULT_CODEX_MODEL, base_branch: DEFAULT_CODEX_BASE_BRANCH };
94
98
  }
95
99
  if (!isRecord(value)) {
96
100
  throw new Error("codex must be an object");
97
101
  }
98
102
  const modelRaw = readObjectField(value, "model");
99
103
  const model = modelRaw === void 0 ? DEFAULT_CODEX_MODEL : requireString(modelRaw, "codex.model");
100
- return { model };
104
+ const baseBranchRaw = readObjectField(value, "base_branch");
105
+ const base_branch = baseBranchRaw === void 0 ? DEFAULT_CODEX_BASE_BRANCH : requireString(baseBranchRaw, "codex.base_branch");
106
+ return { model, base_branch };
101
107
  }
102
108
  function findProjectRoot(startDir = process.cwd()) {
103
109
  let current = path.resolve(startDir);
@@ -1221,7 +1227,11 @@ async function checkCodexAvailable() {
1221
1227
  }
1222
1228
  }
1223
1229
  async function submitTask(prompt, options) {
1224
- const args = ["cloud", "exec", prompt];
1230
+ const args = ["cloud", "exec", "--env", options?.envId ?? ""];
1231
+ if (options?.branch) {
1232
+ args.push("--branch", options.branch);
1233
+ }
1234
+ args.push(prompt);
1225
1235
  const result = await runCodexCommand(args, { cwd: options?.cwd });
1226
1236
  const sessionId = parseSessionId(result.stdout);
1227
1237
  if (result.exitCode !== 0 || !sessionId) {
@@ -1229,8 +1239,9 @@ async function submitTask(prompt, options) {
1229
1239
  }
1230
1240
  return sessionId;
1231
1241
  }
1232
- async function resumeTask(sessionId, feedback) {
1233
- const result = await runCodexCommand(["cloud", "exec", "resume", sessionId, feedback]);
1242
+ async function resumeTask(sessionId, feedback, options) {
1243
+ const args = ["cloud", "exec", "--env", options?.envId ?? "", "resume", sessionId, feedback];
1244
+ const result = await runCodexCommand(args);
1234
1245
  const nextSessionId = parseSessionId(result.stdout);
1235
1246
  if (result.exitCode !== 0 || !nextSessionId) {
1236
1247
  throw new CodexError("resume_failed", `Failed to resume codex cloud session ${sessionId}.`, result);
@@ -1374,6 +1385,16 @@ function requireAnthropicApiKey() {
1374
1385
  async function requireGhAvailable() {
1375
1386
  await checkGhAvailable();
1376
1387
  }
1388
+ function resolveCodexEnvId(serviceName, configEnvId) {
1389
+ const envVarName = `CODEX_ENV_ID_${serviceName.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`;
1390
+ const envId = configEnvId ?? process.env[envVarName];
1391
+ if (!envId) {
1392
+ throw new Error(
1393
+ `Codex environment ID is required for service "${serviceName}". Set env_id under services.${serviceName} in .vexdo.yml or export ${envVarName}=<id>.`
1394
+ );
1395
+ }
1396
+ return envId;
1397
+ }
1377
1398
 
1378
1399
  // src/lib/review-loop.ts
1379
1400
  import path6 from "path";
@@ -2266,8 +2287,9 @@ async function runStart(taskFile, options) {
2266
2287
  scopedLogger.info(`[dry-run] Would run codex cloud implementation for service ${step.service}`);
2267
2288
  return { service: step.service, status: "done" };
2268
2289
  }
2290
+ const envId = options.dryRun ? void 0 : resolveCodexEnvId(step.service, serviceCfg.env_id);
2269
2291
  scopedLogger.info("Submitting to Codex Cloud...");
2270
- const submissionSession = stepState.session_id ?? await submitTask(step.spec, { cwd: serviceRoot });
2292
+ const submissionSession = stepState.session_id ?? await submitTask(step.spec, { cwd: serviceRoot, envId, branch: config.codex.base_branch });
2271
2293
  await updateStep(projectRoot, task.id, step.service, { session_id: submissionSession });
2272
2294
  const execution = await runCloudReviewLoop({
2273
2295
  taskId: task.id,
@@ -2283,7 +2305,8 @@ async function runStart(taskFile, options) {
2283
2305
  claude,
2284
2306
  verbose: options.verbose,
2285
2307
  log: scopedLogger,
2286
- serviceRoot
2308
+ serviceRoot,
2309
+ envId
2287
2310
  });
2288
2311
  await updateStep(projectRoot, task.id, step.service, {
2289
2312
  lastReviewComments: execution.lastReviewComments,
@@ -2437,7 +2460,7 @@ async function runCloudReviewLoop(opts) {
2437
2460
  };
2438
2461
  }
2439
2462
  opts.log.warn(`Review requested fixes (iteration ${String(iteration2 + 1)}/${String(opts.config.review.max_iterations)})`);
2440
- sessionId = await resumeTask(sessionId, arbiter.feedback_for_codex);
2463
+ sessionId = await resumeTask(sessionId, arbiter.feedback_for_codex, { envId: opts.envId });
2441
2464
  opts.stepState.session_id = sessionId;
2442
2465
  iteration2 += 1;
2443
2466
  opts.stepState.iteration = iteration2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vexdo/cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {