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

@@ -45,6 +45,7 @@ pnpm paperclip allowed-hostname dotta-macbook-pro
All client commands support:
- `--data-dir <path>`
- `--api-base <url>`
- `--api-key <token>`
- `--context <path>`
@@ -53,6 +54,13 @@ All client commands support:
Company-scoped commands also support `--company-id <id>`.
Use `--data-dir` on any CLI command to isolate all default local state (config/context/db/logs/storage/secrets) away from `~/.paperclip`:
```sh
pnpm paperclip run --data-dir ./tmp/paperclip-dev
pnpm paperclip issue list --data-dir ./tmp/paperclip-dev
```
## Context Profiles
Store local defaults in `~/.paperclip/context.json`: