orcastrator 0.2.2 → 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.
@@ -35,15 +35,21 @@ export async function answerCommandHandler(positionalRunId, answerArg, options)
35
35
  }
36
36
  runId = await selectRun(store) ?? undefined;
37
37
  if (!runId) {
38
- throw new Error("no run id provided");
38
+ console.error("No runs found.");
39
+ process.exitCode = 1;
40
+ return;
39
41
  }
40
42
  }
41
43
  const run = await store.getRun(runId);
42
44
  if (!run) {
43
- throw new Error(`Run not found: ${runId}`);
45
+ console.error(`Run not found: ${runId}`);
46
+ process.exitCode = 1;
47
+ return;
44
48
  }
45
49
  if (run.overallStatus !== "waiting_for_answer") {
46
- throw new Error(`Run ${runId} is not waiting for an answer.`);
50
+ console.error(`Run ${runId} is not waiting for an answer (status: ${run.overallStatus}).`);
51
+ process.exitCode = 1;
52
+ return;
47
53
  }
48
54
  const answer = await resolveAnswer(answerArg);
49
55
  const answerPath = path.join(store.getRunDir(runId), "answer.txt");
@@ -57,5 +63,13 @@ export function registerAnswerCommand(program) {
57
63
  .command("answer [run-id] [answer]")
58
64
  .description("Submit an answer for a run waiting for input")
59
65
  .option("--run <id>", "Run ID waiting for answer")
60
- .action(async (runId, answer, options) => answerCommandHandler(runId, answer, options));
66
+ .action(async (runId, answer, options) => {
67
+ try {
68
+ await answerCommandHandler(runId, answer, options);
69
+ }
70
+ catch (err) {
71
+ console.error(err instanceof Error ? err.message : String(err));
72
+ process.exitCode = 1;
73
+ }
74
+ });
61
75
  }
@@ -71,7 +71,9 @@ export async function runCommandHandler(options) {
71
71
  await writeFile(specPath, `${inlineTask}\n`, "utf8");
72
72
  }
73
73
  try {
74
- await access(specPath, fsConstants.R_OK);
74
+ await access(specPath, fsConstants.R_OK).catch(() => {
75
+ throw new Error(`Spec file not found or not readable: ${specPath}`);
76
+ });
75
77
  const orcaConfig = await resolveConfig(options.config);
76
78
  const runId = generateRunId(specPath);
77
79
  console.log(`Run ID: ${runId}`);
@@ -195,24 +197,38 @@ export function registerRunCommand(program) {
195
197
  .option("--on-complete <cmd>", "Shell hook command for onComplete")
196
198
  .option("--on-error <cmd>", "Shell hook command for onError")
197
199
  .action(async (goal, commandOptions) => {
198
- const normalizedOptions = {
199
- ...commandOptions,
200
- ...(goal !== undefined ? { goal } : {})
201
- };
202
- const inlineTask = normalizedOptions.task ?? normalizedOptions.prompt ?? normalizedOptions.goal;
203
- const inputSpecPath = normalizedOptions.spec ?? normalizedOptions.plan;
204
- if (normalizedOptions.goal !== undefined && (normalizedOptions.task || normalizedOptions.prompt)) {
205
- throw new Error("positional goal and --task/--prompt are mutually exclusive");
206
- }
207
- if (normalizedOptions.goal !== undefined && inputSpecPath) {
208
- throw new Error("positional goal and --spec/--plan are mutually exclusive");
209
- }
210
- if (!inputSpecPath && !inlineTask) {
211
- throw new Error("One of --spec, --task, or --prompt (-p) must be provided.");
200
+ try {
201
+ const normalizedOptions = {
202
+ ...commandOptions,
203
+ ...(goal !== undefined ? { goal } : {})
204
+ };
205
+ const inlineTask = normalizedOptions.task ?? normalizedOptions.prompt ?? normalizedOptions.goal;
206
+ const inputSpecPath = normalizedOptions.spec ?? normalizedOptions.plan;
207
+ if (normalizedOptions.goal !== undefined && (normalizedOptions.task || normalizedOptions.prompt)) {
208
+ console.error("Error: positional goal and --task/--prompt are mutually exclusive.");
209
+ process.exitCode = 1;
210
+ return;
211
+ }
212
+ if (normalizedOptions.goal !== undefined && inputSpecPath) {
213
+ console.error("Error: positional goal and --spec/--plan are mutually exclusive.");
214
+ process.exitCode = 1;
215
+ return;
216
+ }
217
+ if (!inputSpecPath && !inlineTask) {
218
+ console.error("Error: one of --spec, --task, or --prompt (-p) must be provided.");
219
+ process.exitCode = 1;
220
+ return;
221
+ }
222
+ if (inputSpecPath && inlineTask) {
223
+ console.error("Error: --spec is mutually exclusive with --task / --prompt.");
224
+ process.exitCode = 1;
225
+ return;
226
+ }
227
+ await runCommandHandler(normalizedOptions);
212
228
  }
213
- if (inputSpecPath && inlineTask) {
214
- throw new Error("--spec is mutually exclusive with --task / --prompt.");
229
+ catch (err) {
230
+ console.error(err instanceof Error ? err.message : String(err));
231
+ process.exitCode = 1;
215
232
  }
216
- await runCommandHandler(normalizedOptions);
217
233
  });
218
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orcastrator",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "orca": "dist/cli/index.js"
@@ -20,7 +20,7 @@
20
20
  "@inquirer/prompts": "^8.2.1",
21
21
  "chalk": "^5.3.0",
22
22
  "commander": "^13.1.0",
23
- "orca-codex-client": "^0.1.1",
23
+ "orca-codex-client": "^0.1.3",
24
24
  "zod": "^3.24.1"
25
25
  },
26
26
  "devDependencies": {