feat(cli): add --data-dir flag to isolate local state

Add --data-dir option to all CLI commands, allowing users to override
the default ~/.paperclip root for config, context, database, logs, and
storage. Includes preAction hook to auto-derive --config and --context
paths when --data-dir is set. Add unit tests and doc updates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dotta
2026-03-02 14:20:37 -06:00
parent ba388dc382
commit cabf09e7b1
8 changed files with 176 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ All commands support:
| Flag | Description |
|------|-------------|
| `--data-dir <path>` | Local Paperclip data root (isolates from `~/.paperclip`) |
| `--api-base <url>` | API base URL |
| `--api-key <token>` | API authentication token |
| `--context <path>` | Context file path |
@@ -27,6 +28,12 @@ All commands support:
Company-scoped commands also accept `--company-id <id>`.
For clean local instances, pass `--data-dir` on the command you run:
```sh
pnpm paperclip run --data-dir ./tmp/paperclip-dev
```
## Context Profiles
Store defaults to avoid repeating flags:

View File

@@ -100,3 +100,10 @@ Override with:
```sh
PAPERCLIP_HOME=/custom/home PAPERCLIP_INSTANCE_ID=dev pnpm paperclip run
```
Or pass `--data-dir` directly on any command:
```sh
pnpm paperclip run --data-dir ./tmp/paperclip-dev
pnpm paperclip doctor --data-dir ./tmp/paperclip-dev
```