@sandagent/runner-cli 0.2.7 → 0.2.9
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 +11 -2
- package/dist/bundle.mjs +4 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,11 @@ Dependencies:
|
|
|
32
32
|
## Installation
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
|
|
35
|
+
# Global install (recommended if you want the `sandagent` command)
|
|
36
|
+
npm install -g @sandagent/runner-cli@beta
|
|
37
|
+
|
|
38
|
+
# Or add to a project
|
|
39
|
+
npm install @sandagent/runner-cli@beta
|
|
36
40
|
```
|
|
37
41
|
|
|
38
42
|
## Usage
|
|
@@ -41,6 +45,12 @@ pnpm add @sandagent/runner-cli
|
|
|
41
45
|
sandagent run [options] -- "<user input>"
|
|
42
46
|
```
|
|
43
47
|
|
|
48
|
+
Without installing globally, you can also run it via `npx`:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx -y @sandagent/runner-cli@beta run -- "Create a hello world script"
|
|
52
|
+
```
|
|
53
|
+
|
|
44
54
|
### Basic Examples
|
|
45
55
|
|
|
46
56
|
```bash
|
|
@@ -150,4 +160,3 @@ The CLI is designed to:
|
|
|
150
160
|
|
|
151
161
|
- [Claude Agent SDK](https://platform.claude.com/docs/agent-sdk/typescript)
|
|
152
162
|
- [AI SDK UI Stream Protocol](https://ai-sdk.dev/docs/ai-sdk-ui/stream-protocol)
|
|
153
|
-
|
package/dist/bundle.mjs
CHANGED
|
@@ -260,23 +260,20 @@ function createCanUseToolCallback(claudeOptions) {
|
|
|
260
260
|
}
|
|
261
261
|
const cwd = claudeOptions.cwd || process.cwd();
|
|
262
262
|
try {
|
|
263
|
-
const
|
|
263
|
+
const fs = await import("node:fs");
|
|
264
264
|
const path = await import("node:path");
|
|
265
265
|
const approvalDir = path.join(cwd, ".sandagent", "approvals");
|
|
266
266
|
const approvalFile = path.join(approvalDir, `${toolUseID}.json`);
|
|
267
|
-
execSync(`mkdir -p "${approvalDir}"`);
|
|
268
267
|
const timeout = Date.now() + 6e4;
|
|
269
268
|
let lastApproval = null;
|
|
270
269
|
while (Date.now() < timeout) {
|
|
271
270
|
try {
|
|
272
|
-
const data =
|
|
273
|
-
encoding: "utf-8"
|
|
274
|
-
});
|
|
271
|
+
const data = fs.readFileSync(approvalFile, "utf-8");
|
|
275
272
|
const approval = JSON.parse(data);
|
|
276
273
|
lastApproval = approval;
|
|
277
274
|
if (approval.status === "completed") {
|
|
278
275
|
try {
|
|
279
|
-
|
|
276
|
+
fs.unlinkSync(approvalFile);
|
|
280
277
|
} catch {
|
|
281
278
|
}
|
|
282
279
|
return {
|
|
@@ -292,7 +289,7 @@ function createCanUseToolCallback(claudeOptions) {
|
|
|
292
289
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
293
290
|
}
|
|
294
291
|
try {
|
|
295
|
-
|
|
292
|
+
fs.unlinkSync(approvalFile);
|
|
296
293
|
} catch {
|
|
297
294
|
}
|
|
298
295
|
if (lastApproval && Object.keys(lastApproval.answers).length > 0) {
|
package/package.json
CHANGED