goatchain 0.0.26 → 0.0.28
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 +3 -21
- package/dist/index.js +290 -294
- package/dist/tool/builtin/bash.d.ts +0 -24
- package/dist/tool/builtin/edit.d.ts +0 -12
- package/dist/tool/builtin/write.d.ts +0 -13
- package/package.json +1 -1
- package/dist/tool/builtin/pathProtection.d.ts +0 -25
package/README.md
CHANGED
|
@@ -563,11 +563,11 @@ tools.register(
|
|
|
563
563
|
| Tool | What it does | How `cwd` is applied | Per-call override | Extra sandbox options |
|
|
564
564
|
| --- | --- | --- | --- | --- |
|
|
565
565
|
| `ReadTool` | Reads files (and some converted formats) | Relative `file_path` resolves from `cwd` | `file_path` can be absolute | `allowedDirectory`, `fileBlacklist`, `disableBlacklist` |
|
|
566
|
-
| `WriteTool` | Writes/overwrites files | Relative `file_path` resolves from `cwd` | `file_path` can be absolute | `allowedDirectory`, `
|
|
567
|
-
| `EditTool` | Replaces `old_string` with `new_string` in a file | Relative `file_path` resolves from `cwd` | `file_path` can be absolute | `
|
|
566
|
+
| `WriteTool` | Writes/overwrites files | Relative `file_path` resolves from `cwd` | `file_path` can be absolute | `allowedDirectory`, `fileBlacklist`, `disableBlacklist` |
|
|
567
|
+
| `EditTool` | Replaces `old_string` with `new_string` in a file | Relative `file_path` resolves from `cwd` | `file_path` can be absolute | `fileBlacklist`, `disableBlacklist` |
|
|
568
568
|
| `GlobTool` | Finds files by pattern | Search root defaults to `cwd` | `path` argument can change search root | `fileBlacklist`, `disableBlacklist` |
|
|
569
569
|
| `GrepTool` | Searches text content in files | Search runs under `cwd` | `path` argument narrows search scope | `fileBlacklist`, `disableBlacklist` |
|
|
570
|
-
| `BashTool` | Runs shell commands | Commands execute in `cwd` | `workdir` argument overrides per call |
|
|
570
|
+
| `BashTool` | Runs shell commands | Commands execute in `cwd` | `workdir` argument overrides per call | None |
|
|
571
571
|
|
|
572
572
|
**Directory & Protection Options:**
|
|
573
573
|
|
|
@@ -575,24 +575,6 @@ tools.register(
|
|
|
575
575
|
| ------------------ | ------------------------------------------------------------------- | ------------------------------------- |
|
|
576
576
|
| `cwd` | Working directory for resolving relative paths | `{ cwd: '/app/output' }` |
|
|
577
577
|
| `allowedDirectory` | Restrict file access to this directory only (blocks path traversal) | `{ allowedDirectory: '/app/output' }` |
|
|
578
|
-
| `readOnlyPaths` | Mark paths/directories as read-only for write-like operations | `{ readOnlyPaths: ['docs', { path: '.env', reason: 'secrets' }] }` |
|
|
579
|
-
|
|
580
|
-
`readOnlyPaths` is supported by `WriteTool`, `EditTool`, and `BashTool`.
|
|
581
|
-
Use it to protect specific directories/files from modifications while still allowing reads/searches.
|
|
582
|
-
|
|
583
|
-
```typescript
|
|
584
|
-
const tools = new ToolRegistry()
|
|
585
|
-
|
|
586
|
-
const readOnlyPaths = [
|
|
587
|
-
'docs', // relative to cwd
|
|
588
|
-
{ path: '.env', reason: 'Secrets file must not be modified' },
|
|
589
|
-
{ path: '/absolute/path/to/protected-dir', reason: 'Managed by another system' },
|
|
590
|
-
]
|
|
591
|
-
|
|
592
|
-
tools.register(new WriteTool({ cwd: OUTPUT_DIR, readOnlyPaths }))
|
|
593
|
-
tools.register(new EditTool({ cwd: OUTPUT_DIR, readOnlyPaths }))
|
|
594
|
-
tools.register(new BashTool({ cwd: OUTPUT_DIR, readOnlyPaths }))
|
|
595
|
-
```
|
|
596
578
|
|
|
597
579
|
**When to use `allowedDirectory`:**
|
|
598
580
|
|