@vexdo/cli 0.2.1 → 0.2.3

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 +23 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -38,9 +38,12 @@ function parseServices(value) {
38
38
  }
39
39
  const name = requireString(readObjectField(service, "name"), `services[${String(index)}].name`);
40
40
  const servicePath = requireString(readObjectField(service, "path"), `services[${String(index)}].path`);
41
+ const envIdRaw = readObjectField(service, "env_id");
42
+ const env_id = envIdRaw === void 0 ? void 0 : requireString(envIdRaw, `services[${String(index)}].env_id`);
41
43
  return {
42
44
  name,
43
- path: servicePath
45
+ path: servicePath,
46
+ env_id
44
47
  };
45
48
  });
46
49
  }
@@ -1221,10 +1224,7 @@ async function checkCodexAvailable() {
1221
1224
  }
1222
1225
  }
1223
1226
  async function submitTask(prompt, options) {
1224
- const args = ["cloud", "exec", prompt];
1225
- if (options?.cwd) {
1226
- args.push("-C", options.cwd);
1227
- }
1227
+ const args = ["cloud", "exec", "--env", options?.envId ?? "", prompt];
1228
1228
  const result = await runCodexCommand(args, { cwd: options?.cwd });
1229
1229
  const sessionId = parseSessionId(result.stdout);
1230
1230
  if (result.exitCode !== 0 || !sessionId) {
@@ -1232,8 +1232,9 @@ async function submitTask(prompt, options) {
1232
1232
  }
1233
1233
  return sessionId;
1234
1234
  }
1235
- async function resumeTask(sessionId, feedback) {
1236
- const result = await runCodexCommand(["cloud", "exec", "resume", sessionId, feedback]);
1235
+ async function resumeTask(sessionId, feedback, options) {
1236
+ const args = ["cloud", "exec", "--env", options?.envId ?? "", "resume", sessionId, feedback];
1237
+ const result = await runCodexCommand(args);
1237
1238
  const nextSessionId = parseSessionId(result.stdout);
1238
1239
  if (result.exitCode !== 0 || !nextSessionId) {
1239
1240
  throw new CodexError("resume_failed", `Failed to resume codex cloud session ${sessionId}.`, result);
@@ -1377,6 +1378,16 @@ function requireAnthropicApiKey() {
1377
1378
  async function requireGhAvailable() {
1378
1379
  await checkGhAvailable();
1379
1380
  }
1381
+ function resolveCodexEnvId(serviceName, configEnvId) {
1382
+ const envVarName = `CODEX_ENV_ID_${serviceName.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`;
1383
+ const envId = configEnvId ?? process.env[envVarName];
1384
+ if (!envId) {
1385
+ throw new Error(
1386
+ `Codex environment ID is required for service "${serviceName}". Set env_id under services.${serviceName} in .vexdo.yml or export ${envVarName}=<id>.`
1387
+ );
1388
+ }
1389
+ return envId;
1390
+ }
1380
1391
 
1381
1392
  // src/lib/review-loop.ts
1382
1393
  import path6 from "path";
@@ -2269,8 +2280,9 @@ async function runStart(taskFile, options) {
2269
2280
  scopedLogger.info(`[dry-run] Would run codex cloud implementation for service ${step.service}`);
2270
2281
  return { service: step.service, status: "done" };
2271
2282
  }
2283
+ const envId = options.dryRun ? void 0 : resolveCodexEnvId(step.service, serviceCfg.env_id);
2272
2284
  scopedLogger.info("Submitting to Codex Cloud...");
2273
- const submissionSession = stepState.session_id ?? await submitTask(step.spec, { cwd: serviceRoot });
2285
+ const submissionSession = stepState.session_id ?? await submitTask(step.spec, { cwd: serviceRoot, envId });
2274
2286
  await updateStep(projectRoot, task.id, step.service, { session_id: submissionSession });
2275
2287
  const execution = await runCloudReviewLoop({
2276
2288
  taskId: task.id,
@@ -2286,7 +2298,8 @@ async function runStart(taskFile, options) {
2286
2298
  claude,
2287
2299
  verbose: options.verbose,
2288
2300
  log: scopedLogger,
2289
- serviceRoot
2301
+ serviceRoot,
2302
+ envId
2290
2303
  });
2291
2304
  await updateStep(projectRoot, task.id, step.service, {
2292
2305
  lastReviewComments: execution.lastReviewComments,
@@ -2440,7 +2453,7 @@ async function runCloudReviewLoop(opts) {
2440
2453
  };
2441
2454
  }
2442
2455
  opts.log.warn(`Review requested fixes (iteration ${String(iteration2 + 1)}/${String(opts.config.review.max_iterations)})`);
2443
- sessionId = await resumeTask(sessionId, arbiter.feedback_for_codex);
2456
+ sessionId = await resumeTask(sessionId, arbiter.feedback_for_codex, { envId: opts.envId });
2444
2457
  opts.stepState.session_id = sessionId;
2445
2458
  iteration2 += 1;
2446
2459
  opts.stepState.iteration = iteration2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vexdo/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {