Agent Sandbox Registry

agent-sandbox

Decision: Converge init/create command semantics (remove top-level abx init, make create routing explicit)

无中文版

.agents/notes/implemented/feature/2026-09-29-init-create-semantics.md

Decision: Converge init/create command semantics (remove top-level abx init, make create routing explicit)

Status: implemented — partially superseded (2026-09-29) by 2026-09-29-init-restore-and-create-explicit-error.md: decision item 1 (delete top-level abx init) is reversed — the shortcut is restored as the same command object; the create routing row "abx create → base template, direct create" is replaced by an explicit no-argument usage error. Items on DESCRIPTION + --template mutual exclusion and help-surface structure stand. Implemented: 2026-09-29 Supersedes: the abx create routing row "--template wins over a description" in 2026-09-29-nl-create-qwen-code-integration.md

Problem

Four entry points competed for the "get started" slot:

Two concrete defects followed:

  1. Naming ambiguity. Three commands containing init plus create made it impossible to tell from the command name what each one does. abx init in particular sounded like "initialise everything" but only scaffolded files.
  2. Silent input dropping. abx create "DESCRIPTION" --template NAME accepted both inputs and silently ignored the description (--template won). Every other path in the CLI (Qwen Code install/credential failures, missing template, invalid --env format) fails loudly with an actionable message, so silently discarding user input was inconsistent and surprising.

Pre-release status: the CLI has not been officially released, so there are no external users to migrate — the same reasoning that justified the clean break in 2026-09-29-region-command-level-option.md.

Decision

  1. Delete the top-level abx init shortcut.
  2. src/agent_sandbox/cli/main.py: remove "init": "agent_sandbox.cli.commands.template:init_shortcut" from lazy_subcommands.
  3. src/agent_sandbox/cli/commands/template.py: delete the init_shortcut command.
  4. abx init ... now fails with the standard Click error: exit code 2, No such command 'init'.
  5. Repo-wide verification found no dependency on the alias: no imports, no automation/scripts/examples usage, only tests/docs/CHANGELOG mentions (all updated).

  6. Keep exactly three distinct entry points, each named after what it initialises:

Goal Command Cloud?
Store credentials / endpoints (first run) abx config init No
Create a cloud sandbox abx create [DESCRIPTION] Yes
Scaffold a local template project abx template init [DIRECTORY] No
  1. Make abx create routing explicit and total:
Invocation Path
abx create base template, direct create
abx create --template NAME direct template path (no AI generation)
abx create "DESCRIPTION" AI path: Qwen Code generates → build & deploy → create
abx create "DESCRIPTION" --template NAME rejected (usage error, exit code 1)

The guard runs in create() before any config read, AI generation, or network call:

python if description and template: raise click.UsageError( "DESCRIPTION and --template cannot be combined. Drop --template to " "generate a template from the description, or drop DESCRIPTION to " "launch an existing template directly." )

handle_errors maps the UsageError to exit code 1 with the message on stderr — matching the mutual-exclusion precedent already used by abx template init (--template vs --from).

  1. Help surfaces updated:
  2. Root abx --help gains a "Setup, create, or scaffold:" block listing abx config init, abx create [DESCRIPTION], abx template init [DIR].
  3. abx create docstring rewritten as the routing table; --template/-T help now states "Cannot be combined with DESCRIPTION."
  4. Commands: list in the root help no longer contains init.

  5. Docs / evidence / changelog updated (en + zh): cli-reference.md (overview count 12→11, config 4→5, comparison table, create routing table, abx init (shortcut) section removed), cli-design.md (command tree gains tpl_init/cfg_init, routing table, new #### template init subsection), cli-tutorial.md (quick-orientation table, scaffold section), e2e-template-workflow.md (alias mentions removed), CHANGELOG.md (breaking-changes entry + migration note), CLI evidence regenerated (82 cases incl. help-template-init, create-nl-conflict, error-init-removed).

API Design

N/A — this decision does not involve library API changes; it only reshapes the CLI surface:

abx init                       # REMOVED — exit 2, "No such command 'init'."
abx template init [DIRECTORY] [-t CASE] [--from REF] [--name NAME] [--list] [--force]
abx config init [--yes]
abx create [DESCRIPTION] [-T NAME] [...]

Alternatives considered

Dependencies

Test Strategy

Files changed

Acceptance criteria