@scottwalker/claude-connector 0.1.0 → 0.3.0
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/README.md +92 -31
- package/dist/builder/args-builder.d.ts +6 -1
- package/dist/builder/args-builder.d.ts.map +1 -1
- package/dist/builder/args-builder.js +64 -24
- package/dist/builder/args-builder.js.map +1 -1
- package/dist/client/chat-handle.d.ts +115 -0
- package/dist/client/chat-handle.d.ts.map +1 -0
- package/dist/client/chat-handle.js +246 -0
- package/dist/client/chat-handle.js.map +1 -0
- package/dist/client/claude.d.ts +51 -53
- package/dist/client/claude.d.ts.map +1 -1
- package/dist/client/claude.js +78 -45
- package/dist/client/claude.js.map +1 -1
- package/dist/client/session.d.ts +4 -2
- package/dist/client/session.d.ts.map +1 -1
- package/dist/client/session.js +21 -12
- package/dist/client/session.js.map +1 -1
- package/dist/client/stream-handle.d.ts +99 -0
- package/dist/client/stream-handle.d.ts.map +1 -0
- package/dist/client/stream-handle.js +158 -0
- package/dist/client/stream-handle.js.map +1 -0
- package/dist/constants.d.ts +116 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +160 -0
- package/dist/constants.js.map +1 -0
- package/dist/errors/errors.d.ts.map +1 -1
- package/dist/errors/errors.js +7 -6
- package/dist/errors/errors.js.map +1 -1
- package/dist/executor/cli-executor.d.ts.map +1 -1
- package/dist/executor/cli-executor.js +7 -11
- package/dist/executor/cli-executor.js.map +1 -1
- package/dist/executor/interface.d.ts +6 -0
- package/dist/executor/interface.d.ts.map +1 -1
- package/dist/executor/sdk-executor.d.ts +11 -4
- package/dist/executor/sdk-executor.d.ts.map +1 -1
- package/dist/executor/sdk-executor.js +55 -40
- package/dist/executor/sdk-executor.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/parser/json-parser.d.ts.map +1 -1
- package/dist/parser/json-parser.js +20 -19
- package/dist/parser/json-parser.js.map +1 -1
- package/dist/parser/stream-parser.d.ts.map +1 -1
- package/dist/parser/stream-parser.js +26 -25
- package/dist/parser/stream-parser.js.map +1 -1
- package/dist/scheduler/scheduler.js +6 -11
- package/dist/scheduler/scheduler.js.map +1 -1
- package/dist/types/client.d.ts +27 -5
- package/dist/types/client.d.ts.map +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +5 -6
- package/dist/utils/validation.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="etc/logo-rounded.svg" alt="Claude Code — In Your Code" width="350" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Claude Connector</h1>
|
|
2
6
|
|
|
3
7
|
Programmatic Node.js interface for [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview) CLI.
|
|
4
8
|
|
|
5
9
|
Use Claude Code from your application code — no terminal required. Works with your existing Max/Team/Enterprise subscription.
|
|
6
10
|
|
|
7
|
-
**[Website](https://scott-walker.github.io/claude-connector/)** | **[API Reference](./docs/API.md)** | **[Architecture](./docs/ARCHITECTURE.md)**
|
|
11
|
+
**[Website](https://scott-walker.github.io/claude-connector/)** | **[Examples](./docs/EXAMPLES.md)** | **[API Reference](./docs/API.md)** | **[Architecture](./docs/ARCHITECTURE.md)**
|
|
8
12
|
|
|
9
13
|
---
|
|
10
14
|
|
|
@@ -15,9 +19,10 @@ Claude Code is a powerful AI coding agent, but it only runs in a terminal. **cla
|
|
|
15
19
|
**Key design decisions:**
|
|
16
20
|
|
|
17
21
|
- **CLI wrapper, not API client** — uses your local `claude` binary and subscription, not the Anthropic HTTP API
|
|
18
|
-
- **
|
|
22
|
+
- **Two execution modes** — persistent SDK session (fast, default) or CLI process spawning (simple)
|
|
19
23
|
- **Executor abstraction** — swap CLI for SDK or HTTP backend without changing your code
|
|
20
24
|
- **Full CLI parity** — exposes all 45+ Claude Code flags through typed options
|
|
25
|
+
- **Typed handles** — `StreamHandle` (fluent `.on().done()` + `for-await`) and `ChatHandle` (multi-turn conversations)
|
|
21
26
|
|
|
22
27
|
## Requirements
|
|
23
28
|
|
|
@@ -27,15 +32,15 @@ Claude Code is a powerful AI coding agent, but it only runs in a terminal. **cla
|
|
|
27
32
|
## Install
|
|
28
33
|
|
|
29
34
|
```bash
|
|
30
|
-
npm install claude-connector
|
|
35
|
+
npm install @scottwalker/claude-connector
|
|
31
36
|
```
|
|
32
37
|
|
|
33
38
|
## Quick Start
|
|
34
39
|
|
|
35
40
|
```typescript
|
|
36
|
-
import { Claude } from 'claude-connector'
|
|
41
|
+
import { Claude, PERMISSION_ACCEPT_EDITS } from '@scottwalker/claude-connector'
|
|
37
42
|
|
|
38
|
-
const claude = new Claude()
|
|
43
|
+
const claude = new Claude({ permissionMode: PERMISSION_ACCEPT_EDITS })
|
|
39
44
|
|
|
40
45
|
// Simple query
|
|
41
46
|
const result = await claude.query('Find and fix bugs in auth.ts')
|
|
@@ -51,6 +56,8 @@ console.log(result.usage) // { inputTokens, outputTokens }
|
|
|
51
56
|
Point to a specific Claude Code installation when multiple versions coexist:
|
|
52
57
|
|
|
53
58
|
```typescript
|
|
59
|
+
import { Claude } from '@scottwalker/claude-connector'
|
|
60
|
+
|
|
54
61
|
const claude = new Claude({
|
|
55
62
|
executable: '/opt/claude-code/v2/bin/claude',
|
|
56
63
|
cwd: '/path/to/project',
|
|
@@ -59,21 +66,41 @@ const claude = new Claude({
|
|
|
59
66
|
|
|
60
67
|
### Streaming
|
|
61
68
|
|
|
62
|
-
Real-time output as Claude works
|
|
69
|
+
Real-time output as Claude works. `stream()` returns a `StreamHandle` — use the fluent `.on().done()` API or classic `for-await`:
|
|
63
70
|
|
|
64
71
|
```typescript
|
|
65
|
-
|
|
72
|
+
import {
|
|
73
|
+
Claude,
|
|
74
|
+
EVENT_TEXT, EVENT_TOOL_USE, EVENT_RESULT, EVENT_ERROR,
|
|
75
|
+
} from '@scottwalker/claude-connector'
|
|
76
|
+
|
|
77
|
+
const claude = new Claude()
|
|
78
|
+
|
|
79
|
+
// Fluent API (.on / .done)
|
|
80
|
+
const result = await claude
|
|
81
|
+
.stream('Rewrite the auth module')
|
|
82
|
+
.on(EVENT_TEXT, (e) => process.stdout.write(e.text))
|
|
83
|
+
.on(EVENT_TOOL_USE, (e) => console.log(`[Tool] ${e.toolName}`))
|
|
84
|
+
.on(EVENT_ERROR, (e) => console.error(e.message))
|
|
85
|
+
.done()
|
|
86
|
+
|
|
87
|
+
console.log(`Done in ${result.durationMs}ms`)
|
|
88
|
+
|
|
89
|
+
// Classic for-await
|
|
90
|
+
const handle = claude.stream('Rewrite the auth module')
|
|
91
|
+
|
|
92
|
+
for await (const event of handle) {
|
|
66
93
|
switch (event.type) {
|
|
67
|
-
case
|
|
94
|
+
case EVENT_TEXT:
|
|
68
95
|
process.stdout.write(event.text)
|
|
69
96
|
break
|
|
70
|
-
case
|
|
97
|
+
case EVENT_TOOL_USE:
|
|
71
98
|
console.log(`[Tool] ${event.toolName}`)
|
|
72
99
|
break
|
|
73
|
-
case
|
|
100
|
+
case EVENT_RESULT:
|
|
74
101
|
console.log(`\nDone in ${event.durationMs}ms`)
|
|
75
102
|
break
|
|
76
|
-
case
|
|
103
|
+
case EVENT_ERROR:
|
|
77
104
|
console.error(event.message)
|
|
78
105
|
break
|
|
79
106
|
}
|
|
@@ -85,6 +112,9 @@ for await (const event of claude.stream('Rewrite the auth module')) {
|
|
|
85
112
|
Maintain conversation context across queries:
|
|
86
113
|
|
|
87
114
|
```typescript
|
|
115
|
+
import { Claude } from '@scottwalker/claude-connector'
|
|
116
|
+
|
|
117
|
+
const claude = new Claude()
|
|
88
118
|
const session = claude.session()
|
|
89
119
|
await session.query('Analyze the architecture of this project')
|
|
90
120
|
await session.query('Now refactor the auth module based on your analysis')
|
|
@@ -103,6 +133,9 @@ const s3 = claude.session({ resume: session.sessionId!, fork: true })
|
|
|
103
133
|
Get typed JSON responses via JSON Schema:
|
|
104
134
|
|
|
105
135
|
```typescript
|
|
136
|
+
import { Claude } from '@scottwalker/claude-connector'
|
|
137
|
+
|
|
138
|
+
const claude = new Claude()
|
|
106
139
|
const result = await claude.query('Extract all API endpoints from the codebase', {
|
|
107
140
|
schema: {
|
|
108
141
|
type: 'object',
|
|
@@ -130,10 +163,14 @@ console.log(result.structured)
|
|
|
130
163
|
Run independent queries concurrently (each spawns a separate CLI process):
|
|
131
164
|
|
|
132
165
|
```typescript
|
|
166
|
+
import { Claude, PERMISSION_PLAN } from '@scottwalker/claude-connector'
|
|
167
|
+
|
|
168
|
+
const claude = new Claude()
|
|
169
|
+
|
|
133
170
|
const [bugs, tests, docs] = await claude.parallel([
|
|
134
171
|
{ prompt: 'Find bugs in src/', options: { cwd: './src' } },
|
|
135
172
|
{ prompt: 'Run the test suite', options: { allowedTools: ['Bash'] } },
|
|
136
|
-
{ prompt: 'Review documentation', options: { permissionMode:
|
|
173
|
+
{ prompt: 'Review documentation', options: { permissionMode: PERMISSION_PLAN } },
|
|
137
174
|
])
|
|
138
175
|
```
|
|
139
176
|
|
|
@@ -142,13 +179,16 @@ const [bugs, tests, docs] = await claude.parallel([
|
|
|
142
179
|
Node.js-level equivalent of the `/loop` CLI command:
|
|
143
180
|
|
|
144
181
|
```typescript
|
|
182
|
+
import { Claude, SCHED_RESULT, SCHED_ERROR } from '@scottwalker/claude-connector'
|
|
183
|
+
|
|
184
|
+
const claude = new Claude()
|
|
145
185
|
const job = claude.loop('5m', 'Check CI pipeline status and report failures')
|
|
146
186
|
|
|
147
|
-
job.on(
|
|
187
|
+
job.on(SCHED_RESULT, (result) => {
|
|
148
188
|
console.log(`[${new Date().toISOString()}] ${result.text}`)
|
|
149
189
|
})
|
|
150
190
|
|
|
151
|
-
job.on(
|
|
191
|
+
job.on(SCHED_ERROR, (err) => {
|
|
152
192
|
console.error('Check failed:', err.message)
|
|
153
193
|
})
|
|
154
194
|
|
|
@@ -163,6 +203,8 @@ Supported intervals: `'30s'`, `'5m'`, `'2h'`, `'1d'`, or raw milliseconds.
|
|
|
163
203
|
Connect Model Context Protocol servers:
|
|
164
204
|
|
|
165
205
|
```typescript
|
|
206
|
+
import { Claude } from '@scottwalker/claude-connector'
|
|
207
|
+
|
|
166
208
|
const claude = new Claude({
|
|
167
209
|
// From config file
|
|
168
210
|
mcpConfig: './mcp.json',
|
|
@@ -186,6 +228,8 @@ const claude = new Claude({
|
|
|
186
228
|
Define specialized agents:
|
|
187
229
|
|
|
188
230
|
```typescript
|
|
231
|
+
import { Claude, PERMISSION_ACCEPT_EDITS } from '@scottwalker/claude-connector'
|
|
232
|
+
|
|
189
233
|
const claude = new Claude({
|
|
190
234
|
agents: {
|
|
191
235
|
reviewer: {
|
|
@@ -197,7 +241,7 @@ const claude = new Claude({
|
|
|
197
241
|
deployer: {
|
|
198
242
|
description: 'Deployment automation agent',
|
|
199
243
|
tools: ['Bash', 'Read'],
|
|
200
|
-
permissionMode:
|
|
244
|
+
permissionMode: PERMISSION_ACCEPT_EDITS,
|
|
201
245
|
},
|
|
202
246
|
},
|
|
203
247
|
})
|
|
@@ -208,6 +252,9 @@ const claude = new Claude({
|
|
|
208
252
|
Run operations in an isolated copy of the repository:
|
|
209
253
|
|
|
210
254
|
```typescript
|
|
255
|
+
import { Claude } from '@scottwalker/claude-connector'
|
|
256
|
+
|
|
257
|
+
const claude = new Claude()
|
|
211
258
|
const result = await claude.query('Refactor the entire auth module', {
|
|
212
259
|
worktree: 'refactor-auth', // or `true` for auto-generated name
|
|
213
260
|
})
|
|
@@ -219,7 +266,9 @@ Pass data alongside the prompt (like `echo data | claude -p "prompt"`):
|
|
|
219
266
|
|
|
220
267
|
```typescript
|
|
221
268
|
import { readFileSync } from 'node:fs'
|
|
269
|
+
import { Claude } from '@scottwalker/claude-connector'
|
|
222
270
|
|
|
271
|
+
const claude = new Claude()
|
|
223
272
|
const result = await claude.query('Analyze this error log and suggest fixes', {
|
|
224
273
|
input: readFileSync('./error.log', 'utf-8'),
|
|
225
274
|
})
|
|
@@ -230,6 +279,8 @@ const result = await claude.query('Analyze this error log and suggest fixes', {
|
|
|
230
279
|
Attach hooks to tool execution:
|
|
231
280
|
|
|
232
281
|
```typescript
|
|
282
|
+
import { Claude } from '@scottwalker/claude-connector'
|
|
283
|
+
|
|
233
284
|
const claude = new Claude({
|
|
234
285
|
hooks: {
|
|
235
286
|
PostToolUse: [
|
|
@@ -253,6 +304,11 @@ const claude = new Claude({
|
|
|
253
304
|
All Claude Code CLI capabilities in one place:
|
|
254
305
|
|
|
255
306
|
```typescript
|
|
307
|
+
import {
|
|
308
|
+
Claude,
|
|
309
|
+
EFFORT_HIGH, PERMISSION_ACCEPT_EDITS, PERMISSION_PLAN,
|
|
310
|
+
} from '@scottwalker/claude-connector'
|
|
311
|
+
|
|
256
312
|
const claude = new Claude({
|
|
257
313
|
// CLI binary
|
|
258
314
|
executable: '/usr/local/bin/claude',
|
|
@@ -260,11 +316,11 @@ const claude = new Claude({
|
|
|
260
316
|
|
|
261
317
|
// Model
|
|
262
318
|
model: 'opus', // 'opus' | 'sonnet' | 'haiku' | full model ID
|
|
263
|
-
effortLevel:
|
|
319
|
+
effortLevel: EFFORT_HIGH, // EFFORT_LOW | EFFORT_MEDIUM | EFFORT_HIGH | EFFORT_MAX
|
|
264
320
|
fallbackModel: 'sonnet', // auto-fallback on failure
|
|
265
321
|
|
|
266
322
|
// Permissions
|
|
267
|
-
permissionMode:
|
|
323
|
+
permissionMode: PERMISSION_ACCEPT_EDITS, // PERMISSION_DEFAULT | PERMISSION_ACCEPT_EDITS | PERMISSION_PLAN | PERMISSION_AUTO | PERMISSION_DONT_ASK | PERMISSION_BYPASS
|
|
268
324
|
allowedTools: ['Read', 'Edit', 'Bash(npm run *)'],
|
|
269
325
|
disallowedTools: ['WebFetch'],
|
|
270
326
|
|
|
@@ -302,7 +358,7 @@ const claude = new Claude({
|
|
|
302
358
|
// Override any option per query
|
|
303
359
|
const result = await claude.query('Analyze this module', {
|
|
304
360
|
model: 'haiku', // cheaper model for this query
|
|
305
|
-
permissionMode:
|
|
361
|
+
permissionMode: PERMISSION_PLAN, // read-only
|
|
306
362
|
maxTurns: 3,
|
|
307
363
|
})
|
|
308
364
|
```
|
|
@@ -320,7 +376,9 @@ import {
|
|
|
320
376
|
CliTimeoutError,
|
|
321
377
|
ParseError,
|
|
322
378
|
ValidationError,
|
|
323
|
-
} from 'claude-connector'
|
|
379
|
+
} from '@scottwalker/claude-connector'
|
|
380
|
+
|
|
381
|
+
const claude = new Claude()
|
|
324
382
|
|
|
325
383
|
try {
|
|
326
384
|
const result = await claude.query('Fix the bug')
|
|
@@ -346,10 +404,13 @@ try {
|
|
|
346
404
|
|
|
347
405
|
## Custom Executor
|
|
348
406
|
|
|
349
|
-
The `IExecutor` abstraction lets you swap the CLI backend for testing, mocking, or
|
|
407
|
+
The `IExecutor` abstraction lets you swap the CLI backend for testing, mocking, or alternative transports:
|
|
350
408
|
|
|
351
409
|
```typescript
|
|
352
|
-
import {
|
|
410
|
+
import {
|
|
411
|
+
Claude, EVENT_TEXT, EVENT_RESULT,
|
|
412
|
+
type IExecutor, type ExecuteOptions, type QueryResult, type StreamEvent,
|
|
413
|
+
} from '@scottwalker/claude-connector'
|
|
353
414
|
|
|
354
415
|
class MockExecutor implements IExecutor {
|
|
355
416
|
async execute(args: readonly string[], options: ExecuteOptions): Promise<QueryResult> {
|
|
@@ -366,9 +427,9 @@ class MockExecutor implements IExecutor {
|
|
|
366
427
|
}
|
|
367
428
|
|
|
368
429
|
async *stream(args: readonly string[], options: ExecuteOptions): AsyncIterable<StreamEvent> {
|
|
369
|
-
yield { type:
|
|
430
|
+
yield { type: EVENT_TEXT, text: 'Mocked stream' }
|
|
370
431
|
yield {
|
|
371
|
-
type:
|
|
432
|
+
type: EVENT_RESULT,
|
|
372
433
|
text: 'Mocked stream',
|
|
373
434
|
sessionId: 'mock-session',
|
|
374
435
|
usage: { inputTokens: 0, outputTokens: 0 },
|
|
@@ -385,19 +446,18 @@ const claude = new Claude({ model: 'opus' }, new MockExecutor())
|
|
|
385
446
|
## Architecture
|
|
386
447
|
|
|
387
448
|
```
|
|
388
|
-
|
|
449
|
+
┌──────────┐ ┌─────────────┐ ┌─────────────┐ ┌───────────────┐
|
|
389
450
|
│ Claude │────>│ ArgsBuilder │────>│ IExecutor │────>│ CLI Process │
|
|
390
451
|
│ (facade) │ │ │ │ (abstract) │ │ (claude -p) │
|
|
391
|
-
|
|
452
|
+
└──────────┘ └─────────────┘ └─────────────┘ └───────────────┘
|
|
392
453
|
│ ^
|
|
393
454
|
v |
|
|
394
|
-
Session
|
|
395
|
-
Scheduler
|
|
455
|
+
Session SdkExecutor (default, persistent session)
|
|
456
|
+
Scheduler CliExecutor (useSdk: false, process-per-query)
|
|
396
457
|
```
|
|
397
458
|
|
|
398
|
-
- **
|
|
459
|
+
- **Two modes** — SDK (persistent session, fast) or CLI (process-per-query, simple)
|
|
399
460
|
- **Executor pattern** — swap CLI for SDK/HTTP without touching consumer code
|
|
400
|
-
- **Stateless queries** — each `query()` spawns an independent process
|
|
401
461
|
- **Immutable config** — client options frozen at construction, per-query overrides are non-destructive
|
|
402
462
|
|
|
403
463
|
See [docs/ARCHITECTURE.md](./docs/ARCHITECTURE.md) for detailed design documentation.
|
|
@@ -423,6 +483,7 @@ npm run stream # streaming mode (word by word)
|
|
|
423
483
|
|----------|-------------|
|
|
424
484
|
| [Architecture](./docs/ARCHITECTURE.md) | Design principles, SOLID breakdown, data flow diagrams |
|
|
425
485
|
| [API Reference](./docs/API.md) | Complete reference for all classes, methods, types, and options |
|
|
486
|
+
| [Examples](./docs/EXAMPLES.md) | Comprehensive cookbook covering every feature with code snippets |
|
|
426
487
|
| [Changelog](./CHANGELOG.md) | Version history |
|
|
427
488
|
| [Contributing](./CONTRIBUTING.md) | Development setup and guidelines |
|
|
428
489
|
|
|
@@ -434,7 +495,7 @@ cd claude-connector
|
|
|
434
495
|
npm install
|
|
435
496
|
|
|
436
497
|
npm run build # compile TypeScript
|
|
437
|
-
npm test # run
|
|
498
|
+
npm test # run 122 unit tests
|
|
438
499
|
npm run test:integration # build + run integration test
|
|
439
500
|
npm run typecheck # type-check without emitting
|
|
440
501
|
```
|
|
@@ -16,8 +16,9 @@ import type { ClientOptions, QueryOptions } from '../types/index.js';
|
|
|
16
16
|
*/
|
|
17
17
|
/** Merged options ready for argument building. */
|
|
18
18
|
export interface ResolvedOptions {
|
|
19
|
-
readonly prompt
|
|
19
|
+
readonly prompt?: string;
|
|
20
20
|
readonly outputFormat: 'json' | 'stream-json';
|
|
21
|
+
readonly inputFormat?: 'stream-json';
|
|
21
22
|
readonly cwd: string;
|
|
22
23
|
readonly model?: string;
|
|
23
24
|
readonly effortLevel?: string;
|
|
@@ -40,6 +41,10 @@ export interface ResolvedOptions {
|
|
|
40
41
|
readonly continueSession?: boolean;
|
|
41
42
|
readonly forkSession?: boolean;
|
|
42
43
|
readonly schema?: Record<string, unknown>;
|
|
44
|
+
readonly agent?: string;
|
|
45
|
+
readonly tools?: readonly string[];
|
|
46
|
+
readonly name?: string;
|
|
47
|
+
readonly strictMcpConfig?: boolean;
|
|
43
48
|
}
|
|
44
49
|
/**
|
|
45
50
|
* Merge client-level defaults with per-query overrides.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args-builder.d.ts","sourceRoot":"","sources":["../../src/builder/args-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"args-builder.d.ts","sourceRoot":"","sources":["../../src/builder/args-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAarE;;;;;;;;;;;;;;GAcG;AAEH,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,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_DISALLOWED_TOOLS, FLAG_TOOLS, FLAG_SYSTEM_PROMPT, FLAG_APPEND_SYSTEM_PROMPT, FLAG_MAX_TURNS, FLAG_MAX_BUDGET, FLAG_ADD_DIR, FLAG_MCP_CONFIG, FLAG_STRICT_MCP_CONFIG, FLAG_AGENTS, FLAG_AGENT, FLAG_JSON_SCHEMA, FLAG_WORKTREE, FLAG_NO_SESSION_PERSISTENCE, FLAG_NAME, FLAG_SETTINGS, FORMAT_STREAM_JSON, } from '../constants.js';
|
|
1
2
|
/**
|
|
2
3
|
* Merge client-level defaults with per-query overrides.
|
|
3
4
|
*/
|
|
@@ -27,6 +28,10 @@ export function mergeOptions(client, query, extra) {
|
|
|
27
28
|
continueSession: extra.continueSession,
|
|
28
29
|
forkSession: extra.forkSession,
|
|
29
30
|
schema: query?.schema,
|
|
31
|
+
agent: query?.agent ?? client.agent,
|
|
32
|
+
tools: query?.tools ?? client.tools,
|
|
33
|
+
name: client.name,
|
|
34
|
+
strictMcpConfig: client.strictMcpConfig,
|
|
30
35
|
};
|
|
31
36
|
}
|
|
32
37
|
/**
|
|
@@ -35,83 +40,121 @@ export function mergeOptions(client, query, extra) {
|
|
|
35
40
|
* @returns Array of strings to pass to `spawn('claude', args)`.
|
|
36
41
|
*/
|
|
37
42
|
export function buildArgs(options) {
|
|
38
|
-
const args = [
|
|
43
|
+
const args = [FLAG_PRINT, FLAG_OUTPUT_FORMAT, options.outputFormat];
|
|
44
|
+
// BUG-1 fix: stream-json requires --verbose
|
|
45
|
+
if (options.outputFormat === FORMAT_STREAM_JSON) {
|
|
46
|
+
args.push(FLAG_VERBOSE);
|
|
47
|
+
}
|
|
48
|
+
// ── Input format (bidirectional streaming) ─────────────────────
|
|
49
|
+
if (options.inputFormat) {
|
|
50
|
+
args.push(FLAG_INPUT_FORMAT, options.inputFormat);
|
|
51
|
+
}
|
|
39
52
|
// ── Prompt ──────────────────────────────────────────────────────
|
|
40
|
-
|
|
53
|
+
if (options.prompt) {
|
|
54
|
+
args.push(options.prompt);
|
|
55
|
+
}
|
|
41
56
|
// ── Session ─────────────────────────────────────────────────────
|
|
42
57
|
if (options.continueSession) {
|
|
43
|
-
args.push(
|
|
58
|
+
args.push(FLAG_CONTINUE);
|
|
44
59
|
}
|
|
45
60
|
if (options.sessionId) {
|
|
46
|
-
args.push(
|
|
61
|
+
args.push(FLAG_RESUME, options.sessionId);
|
|
47
62
|
}
|
|
48
63
|
if (options.forkSession) {
|
|
49
|
-
args.push(
|
|
64
|
+
args.push(FLAG_FORK_SESSION);
|
|
50
65
|
}
|
|
51
66
|
// ── Model ───────────────────────────────────────────────────────
|
|
52
67
|
if (options.model) {
|
|
53
|
-
args.push(
|
|
68
|
+
args.push(FLAG_MODEL, options.model);
|
|
54
69
|
}
|
|
55
70
|
if (options.fallbackModel) {
|
|
56
|
-
args.push(
|
|
71
|
+
args.push(FLAG_FALLBACK_MODEL, options.fallbackModel);
|
|
72
|
+
}
|
|
73
|
+
if (options.effortLevel) {
|
|
74
|
+
args.push(FLAG_EFFORT, options.effortLevel);
|
|
57
75
|
}
|
|
58
76
|
// ── Permissions ─────────────────────────────────────────────────
|
|
59
77
|
if (options.permissionMode) {
|
|
60
|
-
args.push(
|
|
78
|
+
args.push(FLAG_PERMISSION_MODE, options.permissionMode);
|
|
61
79
|
}
|
|
62
80
|
if (options.allowedTools?.length) {
|
|
63
|
-
args.push(
|
|
81
|
+
args.push(FLAG_ALLOWED_TOOLS, ...options.allowedTools);
|
|
64
82
|
}
|
|
65
83
|
if (options.disallowedTools?.length) {
|
|
66
|
-
args.push(
|
|
84
|
+
args.push(FLAG_DISALLOWED_TOOLS, ...options.disallowedTools);
|
|
85
|
+
}
|
|
86
|
+
// ── Tools (built-in set restriction) ────────────────────────────
|
|
87
|
+
if (options.tools) {
|
|
88
|
+
if (options.tools.length === 0) {
|
|
89
|
+
args.push(FLAG_TOOLS, '');
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
args.push(FLAG_TOOLS, ...options.tools);
|
|
93
|
+
}
|
|
67
94
|
}
|
|
68
95
|
// ── System prompt ───────────────────────────────────────────────
|
|
69
96
|
if (options.systemPrompt) {
|
|
70
|
-
args.push(
|
|
97
|
+
args.push(FLAG_SYSTEM_PROMPT, options.systemPrompt);
|
|
71
98
|
}
|
|
72
99
|
if (options.appendSystemPrompt) {
|
|
73
|
-
args.push(
|
|
100
|
+
args.push(FLAG_APPEND_SYSTEM_PROMPT, options.appendSystemPrompt);
|
|
74
101
|
}
|
|
75
102
|
// ── Limits ──────────────────────────────────────────────────────
|
|
76
103
|
if (options.maxTurns !== undefined) {
|
|
77
|
-
args.push(
|
|
104
|
+
args.push(FLAG_MAX_TURNS, String(options.maxTurns));
|
|
78
105
|
}
|
|
79
106
|
if (options.maxBudget !== undefined) {
|
|
80
|
-
args.push(
|
|
107
|
+
args.push(FLAG_MAX_BUDGET, String(options.maxBudget));
|
|
81
108
|
}
|
|
82
109
|
// ── Directories ─────────────────────────────────────────────────
|
|
83
110
|
if (options.additionalDirs?.length) {
|
|
84
111
|
for (const dir of options.additionalDirs) {
|
|
85
|
-
args.push(
|
|
112
|
+
args.push(FLAG_ADD_DIR, dir);
|
|
86
113
|
}
|
|
87
114
|
}
|
|
88
115
|
// ── MCP ─────────────────────────────────────────────────────────
|
|
89
116
|
if (options.mcpConfig) {
|
|
90
117
|
const configs = Array.isArray(options.mcpConfig) ? options.mcpConfig : [options.mcpConfig];
|
|
91
118
|
for (const cfg of configs) {
|
|
92
|
-
args.push(
|
|
119
|
+
args.push(FLAG_MCP_CONFIG, cfg);
|
|
93
120
|
}
|
|
94
121
|
}
|
|
122
|
+
if (options.mcpServers && Object.keys(options.mcpServers).length > 0) {
|
|
123
|
+
args.push(FLAG_MCP_CONFIG, JSON.stringify({ mcpServers: options.mcpServers }));
|
|
124
|
+
}
|
|
125
|
+
if (options.strictMcpConfig) {
|
|
126
|
+
args.push(FLAG_STRICT_MCP_CONFIG);
|
|
127
|
+
}
|
|
95
128
|
// ── Agents ──────────────────────────────────────────────────────
|
|
96
129
|
if (options.agents && Object.keys(options.agents).length > 0) {
|
|
97
|
-
args.push(
|
|
130
|
+
args.push(FLAG_AGENTS, JSON.stringify(options.agents));
|
|
131
|
+
}
|
|
132
|
+
if (options.agent) {
|
|
133
|
+
args.push(FLAG_AGENT, options.agent);
|
|
98
134
|
}
|
|
99
135
|
// ── Structured output ───────────────────────────────────────────
|
|
100
136
|
if (options.schema) {
|
|
101
|
-
args.push(
|
|
137
|
+
args.push(FLAG_JSON_SCHEMA, JSON.stringify(options.schema));
|
|
102
138
|
}
|
|
103
139
|
// ── Worktree ────────────────────────────────────────────────────
|
|
104
140
|
if (options.worktree) {
|
|
105
141
|
if (typeof options.worktree === 'string') {
|
|
106
|
-
args.push(
|
|
142
|
+
args.push(FLAG_WORKTREE, options.worktree);
|
|
107
143
|
}
|
|
108
144
|
else {
|
|
109
|
-
args.push(
|
|
145
|
+
args.push(FLAG_WORKTREE);
|
|
110
146
|
}
|
|
111
147
|
}
|
|
112
148
|
// ── Misc ────────────────────────────────────────────────────────
|
|
113
149
|
if (options.noSessionPersistence) {
|
|
114
|
-
args.push(
|
|
150
|
+
args.push(FLAG_NO_SESSION_PERSISTENCE);
|
|
151
|
+
}
|
|
152
|
+
if (options.name) {
|
|
153
|
+
args.push(FLAG_NAME, options.name);
|
|
154
|
+
}
|
|
155
|
+
// ── Hooks (via --settings) ──────────────────────────────────────
|
|
156
|
+
if (options.hooks && Object.keys(options.hooks).length > 0) {
|
|
157
|
+
args.push(FLAG_SETTINGS, JSON.stringify({ hooks: options.hooks }));
|
|
115
158
|
}
|
|
116
159
|
return args;
|
|
117
160
|
}
|
|
@@ -126,9 +169,6 @@ export function resolveEnv(client, query) {
|
|
|
126
169
|
if (query?.env) {
|
|
127
170
|
Object.assign(env, query.env);
|
|
128
171
|
}
|
|
129
|
-
if (client.effortLevel || query?.effortLevel) {
|
|
130
|
-
env['CLAUDE_CODE_EFFORT_LEVEL'] = (query?.effortLevel ?? client.effortLevel);
|
|
131
|
-
}
|
|
132
172
|
return env;
|
|
133
173
|
}
|
|
134
174
|
//# sourceMappingURL=args-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args-builder.js","sourceRoot":"","sources":["../../src/builder/args-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"args-builder.js","sourceRoot":"","sources":["../../src/builder/args-builder.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EAAE,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAC/D,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EACzD,mBAAmB,EAAE,WAAW,EAAE,oBAAoB,EACtD,kBAAkB,EAAE,qBAAqB,EAAE,UAAU,EACrD,kBAAkB,EAAE,yBAAyB,EAAE,cAAc,EAC7D,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,sBAAsB,EACtE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EACxD,2BAA2B,EAAE,SAAS,EAAE,aAAa,EACxC,kBAAkB,GAChC,MAAM,iBAAiB,CAAC;AAmDzB;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAqB,EACrB,KAA+B,EAC/B,KAMC;IAED,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,GAAG,EAAE,KAAK,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;QAC9C,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,MAAM,CAAC,KAAK;QACnC,WAAW,EAAE,KAAK,EAAE,WAAW,IAAI,MAAM,CAAC,WAAW;QACrD,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,cAAc,EAAE,KAAK,EAAE,cAAc,IAAI,MAAM,CAAC,cAAc;QAC9D,YAAY,EAAE,KAAK,EAAE,YAAY,IAAI,MAAM,CAAC,YAAY;QACxD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