Skip to content
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 5 additions & 0 deletions .changeset/cli-command-completions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"cf": minor
---

Suggest commands and flags from the CLI's parser when you press Tab. Existing bash, zsh, fish and PowerShell completion scripts keep working. Generated command help and suggestions no longer load the selected command's API handler.
7 changes: 7 additions & 0 deletions .changeset/stricli-parser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"cf": minor
---

Parse CLI arguments with Stricli instead of yargs.

Keep the existing command names, flags, and boolean coercion. Only an affirmative force switch bypasses destructive confirmation.
7 changes: 7 additions & 0 deletions .changeset/suggest-local-auth-profiles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"cf": minor
---

Complete saved auth profile names when pressing Tab.

Use the existing shell integration to complete `--profile` values or named profiles for `cf auth activate`, `create`, and `delete`. Suggestions come from local profile names; no credentials or Cloudflare API calls are needed.
53 changes: 53 additions & 0 deletions .github/workflows/packed-cli-parity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Packed CLI parity

on:
pull_request:
paths:
- "packages/cli/src/lib/stricli*.ts"
- "scripts/compare-packed-cli.mjs"
- ".github/workflows/packed-cli-parity.yml"

permissions:
contents: read

jobs:
compare:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- name: Preserve launcher shebangs and allow long paths on Windows
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
git config --system core.longpaths true
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
path: head
persist-credentials: false
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
path: base
ref: ${{ github.event.pull_request.base.sha }}
persist-credentials: false
- uses: $/.github/actions/install-dependencies
with:
working-directory: head
- uses: $/.github/actions/install-dependencies
with:
working-directory: base
- name: Build, pack and install both CLIs outside their workspaces
shell: bash
run: |
set -euo pipefail
for side in base head; do
mkdir "install-$side"
(cd "$side" && pnpm --filter cf build)
(cd "$side/packages/cli" && pnpm pack --pack-destination "../../../install-$side")
(cd "install-$side" && npm install --ignore-scripts --no-audit --no-fund ./*.tgz)
done
- name: Compare installed commands, including their exit status
run: node head/scripts/compare-packed-cli.mjs install-base install-head
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ In the rules below, `src/` means `packages/cli/src/`.
- Keep the hand-written registry import-free plain data; root lazy loaders
and telemetry belong in `root-commands.ts`. Keep each command's `meta.ts`
sidecar and the typed `hand-written-meta.ts` list in sync.
- Let strict yargs own unknown-option validation. Keep emitter options and
- Keep unknown-option validation in the shared command parser. Keep emitter options and
metadata synchronized. Reserve a new cross-cutting flag in
`src/lib/global-options.ts` before introducing it; generation fails on any
API field that would take a flag cf owns.
Expand Down
35 changes: 14 additions & 21 deletions docs/architecture.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions packages/cli/AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cf (`packages/cli`)

Cloudflare CLI. Yargs-based, TypeScript, ESM, Node ≥ 22.
Cloudflare CLI. Generated commands and the hand-written `auth` family use native Stricli declarations; other hand-written families use the compatibility builder. TypeScript, ESM, Node ≥ 22.

This package IS the CLI. It also owns the generator that produces its
per-API command surface: the forge plugin in `generator/plugin/`, which
Expand All @@ -11,7 +11,7 @@ forge runs (`forge generate --target wasm://...`) to write `src/commands/_genera
The cross-cutting runtime (`src/index.ts` and generic helpers under `src/lib/`) must remain a generic shell over whatever commands the generator emits into `src/commands/_generated/`. Product-specific behavior belongs in Forge unless it is one of the deliberately bounded hand-written exceptions below or the universal zone-name resolver used by global `--zone`.

- `src/index.ts` imports `generatedCommands` and registers them in a loop
- each generated top-level command root is registered through `lazyCommand`; selecting it loads the root's statically imported group/leaf subtree
- each generated top-level command root is registered through `lazyCommand`; selecting it loads the product’s command definitions; generated execution handlers load separately, on invocation
- Adding a new API product is a forge change, not a cf change

If a generic runtime or generator change starts branching on a product name, first look for a Forge/OpenAPI annotation. The existing Worker-name derivation is a narrowly scoped generator exception; `context.ts` / `project-settings.ts` resolve an omitted Worker from source config for that helper. The zone runtime exception is likewise contained: `context.ts` delegates non-ID global zone values to `resolve.ts`, which validates the domain and calls `client.zones.list()` for the selected account. Do not use these as permission to spread product checks through the runtime.
Expand Down Expand Up @@ -49,10 +49,10 @@ second consumer.
| Global CLI state | `src/lib/state.ts` |
| Local request routing | `src/lib/local.ts`, `src/lib/local-runtime.ts` |
| Build/deploy conversion | `src/lib/{build-output,deploy-context,deploy-input}.ts` |
| Help labels and flag groups | yargs configuration in `src/index.ts` (no custom renderer) |
| Help labels and flag groups | declaration-driven help in `src/lib/stricli.ts` |
| Generator output shape | `generator/plugin/` (rerun `pnpm generate`) |
| Metadata JSON shape | `generator/plugin/files.ts` |
| Shell completions | `src/commands/completions/index.ts` (`@bomb.sh/tab`, backed by complete `commands.json` metadata) |
| Shell completions | `src/commands/completions/index.ts` (shell scripts from `@bomb.sh/tab`, suggestions from the runtime parser) |

## Build

Expand Down Expand Up @@ -181,10 +181,10 @@ cf resolves account parameters itself.

## Generated (DO NOT EDIT)

- `src/commands/_generated/` — yargs command files, `_operations/` operation
- `src/commands/_generated/` — Stricli command and route-map files, `_operations/` operation
literals, and `_meta/*.json`

The output is tracked in git, owned by `pnpm generate`, and must not be hand-edited. Shell-completion scripts are no longer generated — `cf complete` (backed by `@bomb.sh/tab`) reads the complete generated and hand-written command tree from `_meta/commands.json`. `_meta/hand-written-commands.json` republishes the hand-written subset with root/leaf/subgroup/override provenance.
The output is tracked in git, owned by `pnpm generate`, and must not be hand-edited. `cf complete` uses Stricli suggestions from the registered commands and flags; `@bomb.sh/tab` supplies the four shell integrations. `_meta/hand-written-commands.json` republishes the hand-written subset with root/leaf/subgroup/override provenance.

## Generator plugin

Expand Down
Loading
Loading