mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-10 12:07:09 +02:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Paperclip provides CLI guidance to agents and operators through documentation and runtime messages. > - Content-bearing `pnpm paperclipai` examples send arguments through a shell. > - Shell evaluation can execute command substitutions in untrusted argument content. > - Runtime hostname guidance can also place request-derived content inside a shell command. > - This pull request uses `npx paperclipai` for content-bearing guidance and uses a static hostname placeholder. > - The benefit is safer copy-paste guidance for agents and operators. ## Linked Issues or Issue Description **Issue type** Incorrect information **Where is the issue?** CLI guidance in `doc/CLI.md`, `skills/paperclip/SKILL.md`, documentation, and runtime-generated hints. **What's wrong?** Content-bearing `pnpm paperclipai` commands can pass argument text through `/bin/sh`. Shell command substitution in an argument can execute before the CLI receives the value. **Suggested fix** Use `npx paperclipai` for content-bearing commands. Use a static `<host>` placeholder when runtime guidance displays the allowed-hostname command. ## What Changed - Replace content-bearing `pnpm paperclipai` examples with `npx paperclipai` across the documentation and agent-facing guidance. - Update runtime-generated CLI hints to use a static `<host>` placeholder. - Add safety notes to `doc/CLI.md` and `skills/paperclip/SKILL.md`. - Add scans and regression tests for unsafe invocation and hostile hostname headers. - Keep fixed lifecycle commands and `pnpm --filter @paperclipai/*` build commands unchanged. ## Verification - Run `tsc --noEmit` for the changed server files. - Run `cli-invocation-safety.test.ts`. - Run `private-hostname-guard.test.ts`. - Confirm that hostile hostname headers do not enter shown shell commands. - Confirm that the three commits contain the required Paperclip co-author trailer. ## Risks - This change updates documentation and diagnostic text across many surfaces. - Fixed lifecycle and setup commands remain unchanged. - The tests fail if content-bearing `pnpm paperclipai` guidance returns. - The change does not alter the CLI argument parser. ## Model Used OpenAI Codex, GPT-5, tool use, code execution, and repository review assistance. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
78 lines
2.1 KiB
Markdown
78 lines
2.1 KiB
Markdown
---
|
|
title: CLI Overview
|
|
summary: CLI installation and setup
|
|
---
|
|
|
|
The Paperclip CLI handles instance setup, diagnostics, and control-plane operations.
|
|
|
|
## Usage
|
|
|
|
```sh
|
|
pnpm paperclipai --help
|
|
```
|
|
|
|
## Global Options
|
|
|
|
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 |
|
|
| `--profile <name>` | Context profile name |
|
|
| `--json` | Output as JSON |
|
|
|
|
Company-scoped commands also accept `--company-id <id>`.
|
|
|
|
For clean local instances, pass `--data-dir` on the command you run:
|
|
|
|
```sh
|
|
pnpm paperclipai run --data-dir ./tmp/paperclip-dev
|
|
```
|
|
|
|
## Context Profiles
|
|
|
|
Store defaults to avoid repeating flags:
|
|
|
|
```sh
|
|
# Set defaults
|
|
pnpm exec paperclipai context set --api-base http://localhost:3100 --company-id <id>
|
|
|
|
# View current context
|
|
pnpm paperclipai context show
|
|
|
|
# List profiles
|
|
pnpm paperclipai context list
|
|
|
|
# Switch profile
|
|
pnpm paperclipai context use default
|
|
```
|
|
|
|
To avoid storing secrets in context, use an env var:
|
|
|
|
```sh
|
|
pnpm exec paperclipai context set --api-key-env-var-name PAPERCLIP_API_KEY
|
|
export PAPERCLIP_API_KEY=...
|
|
```
|
|
|
|
Secret operations are available under `paperclipai secrets`:
|
|
|
|
```sh
|
|
pnpm exec paperclipai secrets declarations --company-id <company-id> --kind secret
|
|
pnpm exec paperclipai secrets create --company-id <company-id> --name anthropic-api-key --value-env ANTHROPIC_API_KEY
|
|
pnpm exec paperclipai secrets link --company-id <company-id> --name prod-stripe-key --provider aws_secrets_manager --external-ref <provider-ref>
|
|
pnpm exec paperclipai secrets doctor --company-id <company-id>
|
|
pnpm exec paperclipai secrets migrate-inline-env --company-id <company-id> --apply
|
|
```
|
|
|
|
Context is stored at `~/.paperclip/context.json`.
|
|
|
|
## Command Categories
|
|
|
|
The CLI has two categories:
|
|
|
|
1. **[Setup commands](/cli/setup-commands)** — instance bootstrap, diagnostics, configuration
|
|
2. **[Control-plane commands](/cli/control-plane-commands)** — issues, agents, approvals, activity
|