@rcrsr/rill-ext-claude-code 0.8.5 → 0.9.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 +7 -105
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @rcrsr/rill-ext-claude-code
|
|
2
2
|
|
|
3
|
-
[rill](https://rill.run) extension for
|
|
3
|
+
[rill](https://rill.run) extension for [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI integration. Provides `prompt`, `skill`, and `command` host functions with streaming output parsing, token tracking, and process lifecycle management.
|
|
4
4
|
|
|
5
5
|
> **Experimental.** Breaking changes will occur before stabilization.
|
|
6
6
|
|
|
@@ -33,113 +33,15 @@ const result = await execute(parse(script), ctx);
|
|
|
33
33
|
dispose?.();
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
##
|
|
37
|
-
|
|
38
|
-
All functions return a dict with `result`, `tokens`, `cost`, `exitCode`, and `duration`.
|
|
39
|
-
|
|
40
|
-
### claude_code::prompt(text, options?)
|
|
41
|
-
|
|
42
|
-
Execute a Claude Code prompt.
|
|
43
|
-
|
|
44
|
-
```rill
|
|
45
|
-
claude_code::prompt("Analyze this code for security issues") => $response
|
|
46
|
-
$response.result -> log
|
|
47
|
-
$response.tokens.output -> log
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### claude_code::skill(name, args?)
|
|
51
|
-
|
|
52
|
-
Execute a Claude Code skill (slash command).
|
|
53
|
-
|
|
54
|
-
```rill
|
|
55
|
-
claude_code::skill("commit", [message: "fix: resolve login bug"])
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### claude_code::command(name, args?)
|
|
59
|
-
|
|
60
|
-
Execute a Claude Code command.
|
|
61
|
-
|
|
62
|
-
```rill
|
|
63
|
-
claude_code::command("review-pr", [pr: "123"]) => $review
|
|
64
|
-
$review.result -> log
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Configuration
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
const ext = createClaudeCodeExtension({
|
|
71
|
-
binaryPath: '/usr/local/bin/claude', // default: 'claude'
|
|
72
|
-
defaultTimeout: 60000, // default: 1800000 (30 min)
|
|
73
|
-
dangerouslySkipPermissions: true, // default: true
|
|
74
|
-
settingSources: '', // default: '' (no plugins)
|
|
75
|
-
});
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
| Option | Type | Default | Description |
|
|
79
|
-
|--------|------|---------|-------------|
|
|
80
|
-
| `binaryPath` | string | `'claude'` | Path to Claude Code CLI binary |
|
|
81
|
-
| `defaultTimeout` | number | `1800000` | Default timeout in ms (max: 3600000) |
|
|
82
|
-
| `dangerouslySkipPermissions` | boolean | `true` | Bypass permission checks |
|
|
83
|
-
| `settingSources` | string | `''` | Setting sources to load (see below) |
|
|
84
|
-
|
|
85
|
-
### settingSources
|
|
86
|
-
|
|
87
|
-
Controls which Claude Code settings load at startup. Maps to `--setting-sources`.
|
|
88
|
-
|
|
89
|
-
| Value | Effect |
|
|
90
|
-
|-------|--------|
|
|
91
|
-
| `''` (default) | No settings loaded. Disables plugins, MCP servers, slash commands. |
|
|
92
|
-
| `'user'` | Load user settings (~/.claude/settings.json) including plugins. |
|
|
93
|
-
| `'project'` | Load project settings (.claude/settings.json). |
|
|
94
|
-
| `'user,project'` | Load both user and project settings. |
|
|
95
|
-
|
|
96
|
-
The factory validates the binary path and timeout eagerly. It throws if the binary is not found in `$PATH` or the timeout is out of range.
|
|
97
|
-
|
|
98
|
-
## Result Shape
|
|
99
|
-
|
|
100
|
-
```typescript
|
|
101
|
-
interface ClaudeCodeResult {
|
|
102
|
-
result: string; // combined text from assistant messages
|
|
103
|
-
tokens: TokenCounts; // prompt, cacheWrite5m, cacheWrite1h, cacheRead, output
|
|
104
|
-
cost: number; // total cost in USD
|
|
105
|
-
exitCode: number; // CLI process exit code (0 = success)
|
|
106
|
-
duration: number; // execution duration in ms
|
|
107
|
-
}
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Lifecycle
|
|
111
|
-
|
|
112
|
-
Call `dispose()` on the extension to clean up active processes:
|
|
113
|
-
|
|
114
|
-
```typescript
|
|
115
|
-
const ext = createClaudeCodeExtension();
|
|
116
|
-
// ... use extension ...
|
|
117
|
-
await ext.dispose?.();
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
## Test Host
|
|
121
|
-
|
|
122
|
-
A runnable example at `examples/test-host.ts` wires up the extension with the rill runtime:
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
# Built-in demo
|
|
126
|
-
pnpm exec tsx examples/test-host.ts
|
|
127
|
-
|
|
128
|
-
# Inline expression
|
|
129
|
-
pnpm exec tsx examples/test-host.ts -e 'claude_code::prompt("Tell me a joke") -> log'
|
|
130
|
-
|
|
131
|
-
# Script file
|
|
132
|
-
pnpm exec tsx examples/test-host.ts script.rill
|
|
133
|
-
```
|
|
36
|
+
## Documentation
|
|
134
37
|
|
|
135
|
-
|
|
38
|
+
See [full documentation](docs/extension-claude-code.md) for configuration, functions, error handling, events, and examples.
|
|
136
39
|
|
|
137
|
-
##
|
|
40
|
+
## Related
|
|
138
41
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
| [Host API Reference](https://github.com/rcrsr/rill/blob/main/docs/ref-host-api.md) | Runtime context and host functions |
|
|
42
|
+
- [rill](https://github.com/rcrsr/rill) — Core language runtime
|
|
43
|
+
- [Extensions Guide](https://github.com/rcrsr/rill/blob/main/docs/integration-extensions.md) — Extension contract and patterns
|
|
44
|
+
- [Host API Reference](https://github.com/rcrsr/rill/blob/main/docs/ref-host-api.md) — Runtime context and host functions
|
|
143
45
|
|
|
144
46
|
## License
|
|
145
47
|
|
package/dist/index.d.ts
CHANGED
|
@@ -11,4 +11,6 @@ export { extractResult } from './result.js';
|
|
|
11
11
|
export type { SpawnResult, SpawnOptions } from './process.js';
|
|
12
12
|
export { spawnClaudeCli } from './process.js';
|
|
13
13
|
export { createClaudeCodeExtension } from './factory.js';
|
|
14
|
+
import type { ExtensionConfigSchema } from '@rcrsr/rill';
|
|
15
|
+
export declare const configSchema: ExtensionConfigSchema;
|
|
14
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,OAAO,UAAU,CAAC;AAM/B,YAAY,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAMpB,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAMxD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAM5C,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,OAAO,UAAU,CAAC;AAM/B,YAAY,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAMpB,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAMxD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAM5C,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAMzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,eAAO,MAAM,YAAY,EAAE,qBAK1B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,4 +17,10 @@ export { spawnClaudeCli } from './process.js';
|
|
|
17
17
|
// EXTENSION FACTORY
|
|
18
18
|
// ============================================================
|
|
19
19
|
export { createClaudeCodeExtension } from './factory.js';
|
|
20
|
+
export const configSchema = {
|
|
21
|
+
binaryPath: { type: 'string' },
|
|
22
|
+
defaultTimeout: { type: 'number' },
|
|
23
|
+
dangerouslySkipPermissions: { type: 'boolean' },
|
|
24
|
+
settingSources: { type: 'string' },
|
|
25
|
+
};
|
|
20
26
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+DAA+D;AAC/D,UAAU;AACV,+DAA+D;AAE/D,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AA4B/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,+DAA+D;AAC/D,oBAAoB;AACpB,+DAA+D;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,+DAA+D;AAC/D,oBAAoB;AACpB,+DAA+D;AAE/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+DAA+D;AAC/D,UAAU;AACV,+DAA+D;AAE/D,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AA4B/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,+DAA+D;AAC/D,oBAAoB;AACpB,+DAA+D;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAO5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,+DAA+D;AAC/D,oBAAoB;AACpB,+DAA+D;AAE/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAQzD,MAAM,CAAC,MAAM,YAAY,GAA0B;IACjD,UAAU,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC9B,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAClC,0BAA0B,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC/C,cAAc,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;CACnC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rcrsr/rill-ext-claude-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "rill extension for Claude Code CLI integration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Andre Bremer",
|
|
@@ -17,30 +17,30 @@
|
|
|
17
17
|
"scripting"
|
|
18
18
|
],
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"@rcrsr/rill": "^0.9.0",
|
|
21
|
+
"node-pty": "^1.0.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@
|
|
24
|
+
"@rcrsr/rill": "^0.9.0",
|
|
25
|
+
"@types/which": "^3.0.4"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
|
-
"url": "git+https://github.com/rcrsr/rill.git",
|
|
32
|
+
"url": "git+https://github.com/rcrsr/rill-ext.git",
|
|
33
33
|
"directory": "packages/ext/claude-code"
|
|
34
34
|
},
|
|
35
|
-
"homepage": "https://
|
|
35
|
+
"homepage": "https://github.com/rcrsr/rill-ext/tree/main/packages/ext/claude-code#readme",
|
|
36
36
|
"bugs": {
|
|
37
|
-
"url": "https://github.com/rcrsr/rill/issues"
|
|
37
|
+
"url": "https://github.com/rcrsr/rill-ext/issues"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"which": "^6.0.
|
|
43
|
+
"which": "^6.0.1"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsc --build",
|