cc-local-use 0.1.0 → 0.2.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 +160 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# cc-local-use
|
|
2
|
+
|
|
3
|
+
A TypeScript library for calling the local [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI programmatically, with sane defaults.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js >= 18
|
|
8
|
+
- [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code) installed and authenticated (`claude` command available in PATH)
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install cc-local-use
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
### Basic query
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import { createClient } from "cc-local-use";
|
|
22
|
+
|
|
23
|
+
const cc = createClient({ model: "claude-opus-4-6" });
|
|
24
|
+
|
|
25
|
+
const answer = await cc.query("Summarise this file", { cwd: "/your/project" });
|
|
26
|
+
console.log(answer);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Streaming
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
import { createClient } from "cc-local-use";
|
|
33
|
+
|
|
34
|
+
const cc = createClient();
|
|
35
|
+
|
|
36
|
+
for await (const chunk of cc.stream("Write a short poem about the sea")) {
|
|
37
|
+
process.stdout.write(chunk);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### JSON mode (with metadata)
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
import { createClient } from "cc-local-use";
|
|
45
|
+
|
|
46
|
+
const cc = createClient();
|
|
47
|
+
|
|
48
|
+
const result = await cc.queryJSON("What is 2 + 2? Reply with just the number.");
|
|
49
|
+
console.log(result.result); // "4"
|
|
50
|
+
console.log(result.cost_usd); // e.g. 0.000123
|
|
51
|
+
console.log(result.session_id); // session ID for resuming
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Resume a session
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
const first = await cc.queryJSON("My name is Alice.");
|
|
58
|
+
const reply = await cc.query("What is my name?", {
|
|
59
|
+
resumeSession: first.session_id,
|
|
60
|
+
});
|
|
61
|
+
console.log(reply); // "Your name is Alice."
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## API
|
|
65
|
+
|
|
66
|
+
### `createClient(options?)`
|
|
67
|
+
|
|
68
|
+
Creates a new Claude Code client.
|
|
69
|
+
|
|
70
|
+
| Option | Type | Default | Description |
|
|
71
|
+
|--------|------|---------|-------------|
|
|
72
|
+
| `claudePath` | `string` | `"claude"` | Path to the `claude` executable |
|
|
73
|
+
| `model` | `string` | — | Default model for all calls |
|
|
74
|
+
| `cwd` | `string` | `process.cwd()` | Default working directory for the subprocess |
|
|
75
|
+
|
|
76
|
+
Returns a `ClaudeCodeClient` with three methods:
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### `cc.query(prompt, options?)`
|
|
81
|
+
|
|
82
|
+
Sends a prompt and returns the full text response as a `Promise<string>`.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### `cc.stream(prompt, options?)`
|
|
87
|
+
|
|
88
|
+
Sends a prompt and returns an `AsyncGenerator<string, ResultEvent>` that yields text chunks as they arrive. The generator's return value is the final `ResultEvent`.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
### `cc.queryJSON(prompt, options?)`
|
|
93
|
+
|
|
94
|
+
Sends a prompt and returns a `Promise<ResultEvent>` with the structured result including metadata.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### `QueryOptions`
|
|
99
|
+
|
|
100
|
+
All three methods accept an optional `QueryOptions` object:
|
|
101
|
+
|
|
102
|
+
| Option | Type | Description |
|
|
103
|
+
|--------|------|-------------|
|
|
104
|
+
| `model` | `string` | Override the model for this call |
|
|
105
|
+
| `systemPrompt` | `string` | System prompt prepended to the conversation |
|
|
106
|
+
| `maxTurns` | `number` | Max number of agentic turns (`--max-turns`) |
|
|
107
|
+
| `resumeSession` | `string` | Resume an existing session by ID (`--resume`) |
|
|
108
|
+
| `cwd` | `string` | Working directory for the subprocess |
|
|
109
|
+
| `extraArgs` | `string[]` | Extra raw CLI arguments appended verbatim |
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### `ResultEvent`
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
interface ResultEvent {
|
|
117
|
+
type: "result";
|
|
118
|
+
subtype: "success" | "error";
|
|
119
|
+
is_error: boolean;
|
|
120
|
+
result: string;
|
|
121
|
+
cost_usd: number;
|
|
122
|
+
duration_ms: number;
|
|
123
|
+
duration_api_ms: number;
|
|
124
|
+
session_id: string;
|
|
125
|
+
num_turns: number;
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### Error handling
|
|
132
|
+
|
|
133
|
+
On non-zero exit, all methods throw a `ClaudeCodeError`:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
type ClaudeCodeError = Error & {
|
|
137
|
+
readonly exitCode: number | null;
|
|
138
|
+
readonly stderr: string;
|
|
139
|
+
};
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
```js
|
|
143
|
+
import { createClient } from "cc-local-use";
|
|
144
|
+
|
|
145
|
+
const cc = createClient();
|
|
146
|
+
|
|
147
|
+
try {
|
|
148
|
+
await cc.query("hello");
|
|
149
|
+
} catch (err) {
|
|
150
|
+
if (err.name === "ClaudeCodeError") {
|
|
151
|
+
console.error("Exit code:", err.exitCode);
|
|
152
|
+
console.error("Stderr:", err.stderr);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Notes
|
|
158
|
+
|
|
159
|
+
- All calls automatically pass `--dangerously-skip-permissions` and `--print` to the CLI.
|
|
160
|
+
- The `claude` process inherits the current process's environment variables (`process.env`).
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,8 @@ export interface ClientOptions {
|
|
|
45
45
|
model?: string;
|
|
46
46
|
/** Default working directory for the subprocess. */
|
|
47
47
|
cwd?: string;
|
|
48
|
+
/** Pass `--dangerously-skip-permissions` to the CLI. Defaults to `true`. */
|
|
49
|
+
dangerouslySkipPermissions?: boolean;
|
|
48
50
|
}
|
|
49
51
|
export interface QueryOptions {
|
|
50
52
|
/** Override the model for this call. */
|
|
@@ -92,8 +94,9 @@ export type ClaudeCodeClient = {
|
|
|
92
94
|
queryJSON: (prompt: string, options?: QueryOptions) => Promise<ResultEvent>;
|
|
93
95
|
};
|
|
94
96
|
/**
|
|
95
|
-
* Create a Claude Code client. All calls automatically include
|
|
96
|
-
* `--dangerously-skip-permissions`
|
|
97
|
+
* Create a Claude Code client. All calls automatically include `--print`.
|
|
98
|
+
* `--dangerously-skip-permissions` is included by default but can be
|
|
99
|
+
* disabled via `dangerouslySkipPermissions: false`.
|
|
97
100
|
*
|
|
98
101
|
* @example
|
|
99
102
|
* import { createClient } from "cc-local-use";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI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,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAMD,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAwDF,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;;OAKG;IACH,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnE;;;;;;;;OAQG;IACH,MAAM,EAAE,CACN,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,YAAY,KACnB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAEpD;;;;;;OAMG;IACH,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;CAC7E,CAAC;AAMF;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,gBAAe,aAAkB,KAAG,gBAkGhE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,13 +10,10 @@ const makeError = (message, exitCode, stderr) => {
|
|
|
10
10
|
// ──────────────────────────────────────────────
|
|
11
11
|
// Internal helpers (module-level pure functions)
|
|
12
12
|
// ──────────────────────────────────────────────
|
|
13
|
-
const buildArgs = (clientModel, options, outputFormat) => {
|
|
14
|
-
const args = [
|
|
15
|
-
|
|
16
|
-
"--
|
|
17
|
-
outputFormat,
|
|
18
|
-
"--print",
|
|
19
|
-
];
|
|
13
|
+
const buildArgs = (clientModel, options, outputFormat, skipPermissions) => {
|
|
14
|
+
const args = ["--output-format", outputFormat, "--print"];
|
|
15
|
+
if (skipPermissions)
|
|
16
|
+
args.unshift("--dangerously-skip-permissions");
|
|
20
17
|
const model = options.model ?? clientModel;
|
|
21
18
|
if (model)
|
|
22
19
|
args.push("--model", model);
|
|
@@ -39,8 +36,9 @@ const spawnClaude = (claudePath, defaultCwd, prompt, args, options) => spawn(cla
|
|
|
39
36
|
// Factory
|
|
40
37
|
// ──────────────────────────────────────────────
|
|
41
38
|
/**
|
|
42
|
-
* Create a Claude Code client. All calls automatically include
|
|
43
|
-
* `--dangerously-skip-permissions`
|
|
39
|
+
* Create a Claude Code client. All calls automatically include `--print`.
|
|
40
|
+
* `--dangerously-skip-permissions` is included by default but can be
|
|
41
|
+
* disabled via `dangerouslySkipPermissions: false`.
|
|
44
42
|
*
|
|
45
43
|
* @example
|
|
46
44
|
* import { createClient } from "cc-local-use";
|
|
@@ -50,8 +48,9 @@ export const createClient = (clientOptions = {}) => {
|
|
|
50
48
|
const claudePath = clientOptions.claudePath ?? "claude";
|
|
51
49
|
const defaultModel = clientOptions.model;
|
|
52
50
|
const defaultCwd = clientOptions.cwd;
|
|
51
|
+
const skipPermissions = clientOptions.dangerouslySkipPermissions ?? true;
|
|
53
52
|
const query = async (prompt, options = {}) => {
|
|
54
|
-
const args = buildArgs(defaultModel, options, "text");
|
|
53
|
+
const args = buildArgs(defaultModel, options, "text", skipPermissions);
|
|
55
54
|
const child = spawnClaude(claudePath, defaultCwd, prompt, args, options);
|
|
56
55
|
let stdout = "";
|
|
57
56
|
let stderr = "";
|
|
@@ -70,7 +69,7 @@ export const createClient = (clientOptions = {}) => {
|
|
|
70
69
|
});
|
|
71
70
|
};
|
|
72
71
|
async function* stream(prompt, options = {}) {
|
|
73
|
-
const args = buildArgs(defaultModel, options, "stream-json");
|
|
72
|
+
const args = buildArgs(defaultModel, options, "stream-json", skipPermissions);
|
|
74
73
|
const child = spawnClaude(claudePath, defaultCwd, prompt, args, options);
|
|
75
74
|
const rl = createInterface({ input: child.stdout, crlfDelay: Infinity });
|
|
76
75
|
let stderrBuf = "";
|
|
@@ -108,7 +107,7 @@ export const createClient = (clientOptions = {}) => {
|
|
|
108
107
|
return resultEvent;
|
|
109
108
|
}
|
|
110
109
|
const queryJSON = async (prompt, options = {}) => {
|
|
111
|
-
const args = buildArgs(defaultModel, options, "json");
|
|
110
|
+
const args = buildArgs(defaultModel, options, "json", skipPermissions);
|
|
112
111
|
const child = spawnClaude(claudePath, defaultCwd, prompt, args, options);
|
|
113
112
|
let stdout = "";
|
|
114
113
|
let stderr = "";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAwFhD,MAAM,SAAS,GAAG,CAChB,OAAe,EACf,QAAuB,EACvB,MAAc,EACG,EAAE;IACnB,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,OAAO,CAAoB,CAAC;IAClD,GAAG,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAC7B,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc-local-use",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A TypeScript library for calling local Claude Code CLI with sane defaults",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc",
|
|
10
10
|
"dev": "tsc --watch",
|
|
11
|
+
"prepublishOnly": "npm run build",
|
|
11
12
|
"test": "node --experimental-vm-modules node_modules/.bin/jest"
|
|
12
13
|
},
|
|
13
14
|
"files": [
|
|
@@ -20,4 +21,4 @@
|
|
|
20
21
|
"engines": {
|
|
21
22
|
"node": ">=18"
|
|
22
23
|
}
|
|
23
|
-
}
|
|
24
|
+
}
|