From 62bcbf6be0206cc4fd2ca0e35dd5eb879ca6c8e7 Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sun, 23 Aug 2026 00:01:33 +0200 Subject: [PATCH] docs(coding-agent): document -- end-of-options delimiter --- packages/coding-agent/README.md | 6 +++++- packages/coding-agent/docs/usage.md | 6 +++++- packages/coding-agent/src/cli/args.ts | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/coding-agent/README.md b/packages/coding-agent/README.md index e6e43c2eb..66a079007 100644 --- a/packages/coding-agent/README.md +++ b/packages/coding-agent/README.md @@ -514,7 +514,7 @@ Read the [blog post](https://mariozechner.at/posts/2025-11-30-pi-coding-agent/) ## CLI Reference ```bash -pi [options] [@files...] [messages...] +pi [options] [--] [@files...] [messages...] ``` ### Package Commands @@ -613,6 +613,7 @@ Combine `--no-*` with explicit flags to load exactly what you need, ignoring set | `--verbose` | Force verbose startup | | `-a`, `--approve` | Trust project-local files for this run | | `-na`, `--no-approve` | Ignore project-local files for this run | +| `--` | Stop option parsing; remaining arguments are prompts or `@file` inputs | | `-h`, `--help` | Show help | | `-v`, `--version` | Show version | @@ -635,6 +636,9 @@ pi "List all .ts files in src/" # Non-interactive pi -p "Summarize this codebase" +# Prompt beginning with a dash +pi -p -- "- Summarize these points" + # Non-interactive with piped stdin cat README.md | pi -p "Summarize this text" diff --git a/packages/coding-agent/docs/usage.md b/packages/coding-agent/docs/usage.md index 41a5c37d9..bbf60db1e 100644 --- a/packages/coding-agent/docs/usage.md +++ b/packages/coding-agent/docs/usage.md @@ -142,7 +142,7 @@ If you use pi for open source work and want to publish sessions for model, promp ## CLI Reference ```bash -pi [options] [@files...] [messages...] +pi [options] [--] [@files...] [messages...] ``` ### Package Commands @@ -246,6 +246,7 @@ pi --no-extensions -e ./my-extension.ts | `--verbose` | Force verbose startup | | `-a`, `--approve` | Trust project-local files for this run | | `-na`, `--no-approve` | Ignore project-local files for this run | +| `--` | Stop option parsing; remaining arguments are prompts or `@file` inputs | | `-h`, `--help` | Show help | | `-v`, `--version` | Show version | @@ -272,6 +273,9 @@ pi "List all .ts files in src/" # Non-interactive pi -p "Summarize this codebase" +# Prompt beginning with a dash +pi -p -- "- Summarize these points" + # Non-interactive with piped stdin cat README.md | pi -p "Summarize this text" diff --git a/packages/coding-agent/src/cli/args.ts b/packages/coding-agent/src/cli/args.ts index 5f111812b..8e03419e6 100644 --- a/packages/coding-agent/src/cli/args.ts +++ b/packages/coding-agent/src/cli/args.ts @@ -262,7 +262,7 @@ export function printHelp(extensionFlags?: ExtensionFlag[]): void { console.log(`${chalk.bold(APP_NAME)} - AI coding assistant with read, bash, edit, write tools ${chalk.bold("Usage:")} - ${APP_NAME} [options] [@files...] [messages...] + ${APP_NAME} [options] [--] [@files...] [messages...] ${chalk.bold("Commands:")} ${APP_NAME} install [-l] Install extension source and add to settings @@ -316,6 +316,7 @@ ${chalk.bold("Options:")} --approve, -a Trust project-local files for this run --no-approve, -na Ignore project-local files for this run --offline Disable startup network operations (same as PI_OFFLINE=1) + -- End option parsing; treat remaining arguments as messages/files --help, -h Show this help --version, -v Show version number @@ -340,6 +341,9 @@ ${chalk.bold("Examples:")} # Non-interactive mode (process and exit) ${APP_NAME} -p "List all .ts files in src/" + # Prompt beginning with a dash + ${APP_NAME} -p -- "- Summarize these points" + # Multiple messages (interactive) ${APP_NAME} "Read package.json" "What dependencies do we have?"