ai-foreman 1.0.0 → 1.0.1

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.
@@ -1,4 +1,15 @@
1
- import { query } from "@anthropic-ai/claude-agent-sdk";
1
+ /** Lazy-load the Claude Agent SDK. Throws an actionable error if not installed. */
2
+ export async function requireClaudeSDK() {
3
+ try {
4
+ return await import("@anthropic-ai/claude-agent-sdk");
5
+ }
6
+ catch {
7
+ throw new Error("Claude Agent SDK not installed.\n" +
8
+ "To use Claude Code as your agent runtime, run:\n" +
9
+ " npm install @anthropic-ai/claude-agent-sdk\n" +
10
+ "Or use Codex only: ai-foreman start --agent codex");
11
+ }
12
+ }
2
13
  import { AsyncQueue } from "../util/asyncQueue.js";
3
14
  /**
4
15
  * Pure function: build the `options` object passed to `query()`.
@@ -38,7 +49,12 @@ export class ClaudeAdapter {
38
49
  _sessionId;
39
50
  pending;
40
51
  closed = false;
41
- constructor(opts) {
52
+ static async create(opts) {
53
+ const { query } = await requireClaudeSDK();
54
+ return new ClaudeAdapter(opts, query);
55
+ }
56
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
57
+ constructor(opts, query) {
42
58
  this.query = query({
43
59
  prompt: this.inbox,
44
60
  options: {
@@ -144,7 +144,7 @@ export function buildTicketsCommand() {
144
144
  };
145
145
  const builder = agent === "codex"
146
146
  ? new CodexAdapter(adapterOpts)
147
- : new ClaudeAdapter(adapterOpts);
147
+ : await ClaudeAdapter.create(adapterOpts);
148
148
  const viewer = printEvents(builder.events());
149
149
  const foreman = new Foreman(builder, log, config.notifications.enabled, false, 3, dir);
150
150
  console.log(`foreman tickets: populating tickets with ${agent}`);
package/dist/index.js CHANGED
@@ -99,7 +99,7 @@ program
99
99
  };
100
100
  const builder = opts.agent === "codex"
101
101
  ? new CodexAdapter(adapterOpts)
102
- : new ClaudeAdapter(adapterOpts);
102
+ : await ClaudeAdapter.create(adapterOpts);
103
103
  // Commander surfaces --no-qa as opts.qa === false; when --qa/--no-qa is not
104
104
  // passed, opts.qa is undefined and we fall back to the config default.
105
105
  const qaEnabled = opts.qa !== false && config.qa.enabled !== false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-foreman",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "An orchestrator that keeps Codex CLI / Claude Code builders moving through their step list unattended. Part of Rafi.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -33,8 +33,10 @@
33
33
  "engines": {
34
34
  "node": ">=20"
35
35
  },
36
+ "optionalDependencies": {
37
+ "@anthropic-ai/claude-agent-sdk": "^0.3.148"
38
+ },
36
39
  "dependencies": {
37
- "@anthropic-ai/claude-agent-sdk": "^0.3.148",
38
40
  "@clack/prompts": "^1.4.0",
39
41
  "ajv": "^8.20.0",
40
42
  "ajv-formats": "^3.0.1",
@@ -42,7 +44,7 @@
42
44
  "commander": "^12.1.0",
43
45
  "luxon": "^3.7.2",
44
46
  "yaml": "^2.5.1",
45
- "special-agents": "0.1.0"
47
+ "special-agents": "0.2.0"
46
48
  },
47
49
  "devDependencies": {
48
50
  "@types/better-sqlite3": "^7.6.13",