goatchain 0.0.25 → 0.0.26
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 +19 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -569,12 +569,30 @@ tools.register(
|
|
|
569
569
|
| `GrepTool` | Searches text content in files | Search runs under `cwd` | `path` argument narrows search scope | `fileBlacklist`, `disableBlacklist` |
|
|
570
570
|
| `BashTool` | Runs shell commands | Commands execute in `cwd` | `workdir` argument overrides per call | `readOnlyPaths` |
|
|
571
571
|
|
|
572
|
-
**Directory
|
|
572
|
+
**Directory & Protection Options:**
|
|
573
573
|
|
|
574
574
|
| Option | Description | Example |
|
|
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
|
+
```
|
|
578
596
|
|
|
579
597
|
**When to use `allowedDirectory`:**
|
|
580
598
|
|