Agent Sandbox Registry

agent-sandbox

Decision: Natural-language template init, and a create-path switch to it

无中文版

.agents/notes/implemented/feature/2026-09-30-nl-template-init-and-create-scope-prompt.md

Decision: Natural-language template init, and a create-path switch to it

Status: implemented Implemented: 2026-09-30

Problem

abx create "DESCRIPTION" (including the sandbox create shortcut) generates a template and then builds, pushes, deploys, and creates a sandbox. That full pipeline is easy to start by accident when the user only wanted the template files. abx template init already scaffolds a local project and stops, but it only accepts a directory or a built-in case — it cannot take the same natural-language description.

Decision

  1. Interactive scope check on natural-language create. Before install, clarification, or generation, an interactive terminal (not --yes, not --json) is shown the four steps — generate, build and push, deploy, create a sandbox — and asked:

Switch to template init and only create the local template? [y/N]

The default is no, so Enter continues the full create. Yes runs the template-only generator and returns before Sandbox.create. --yes and --json skip the question and keep the full pipeline. A non-interactive shell prints one reminder (Template only: abx template init "...") and continues; the existing build confirmation still applies.

  1. abx template init "DESCRIPTION" generates files and stops. A DIRECTORY argument that contains whitespace or CJK text is a description. A path token (my-app, ./my app, .) stays a directory, so existing scaffold invocations are unchanged. The description cannot be combined with --template/-t or --from.

Generation reuses the create-path clarification and codegen (_generate_template_workspace). The files are copied to ./<name>/ (--name, otherwise the generated template name). --force overwrites. --yes/-y skips clarification and is required for non-interactive generation when the description is incomplete. Nothing is built, pushed, deployed, or launched.

abx init "DESCRIPTION" is the same command object.

  1. Output directory. Files are never written loose into the current directory. Both init forms create a subdirectory of the working directory unless a scaffold invocation passes an explicit path.
Invocation Where the files go
abx template init -t python ./python/
abx template init -t python --name myapp ./myapp/
abx template init -t python ./my-template ./my-template/ (the given directory)
abx template init --from owner/repo ./<template-name>/
abx template init --from owner/repo ./dest ./dest/
abx template init "DESCRIPTION" ./<generated-name>/ under the current directory
abx template init --name myapp "DESCRIPTION" ./myapp/

Natural-language init has one positional, and that positional is the description, so a second path is a usage error. --name chooses the subdirectory. create --dir selects the parent of the AI workspace used by the full create pipeline (~/.abx/generated when omitted). It does not apply after the switch to template init: the warning is --dir is ignored for template-only generation; the files are written to ./<name>/.

No stray directories. _resolve_output_dir only validates the --dir / prompt answer (an existing file, or a parent that cannot be written, is a usage error); it never creates the directory. The generation step (prepare_workdir) creates it, so an answer typed at the wrong prompt (for example a clarification answer such as pandas, y or 2 CPU 4 GB) or a run cancelled before generation leaves nothing behind. tests/test_cli/test_create_nl.py also runs every test in its own working directory so scripted input can never write into the checkout.

API Design

abx create "DESCRIPTION"              # interactive: ask, default = full create
abx create -y "DESCRIPTION"           # full pipeline, no switch question
abx template init "DESCRIPTION"       # the generated template in ./<name>/
abx template init -y "DESCRIPTION"    # same, skip clarification
abx template init --name myapp "DESCRIPTION"   # ./myapp/
abx template init -t python                 # ./python/  (cwd subdirectory)
abx template init -t python ./my-app        # explicit directory
abx template init "DESCRIPTION" ./elsewhere # rejected: one positional only

CLI-only. No SDK signature change.

.agents/design/ is a frozen historical snapshot and is not extended. This note is the engineering design record. The public write-up is docs/en/design/cli-design.md and docs/zh/design/cli-design.md.

Alternatives considered

Dependencies

Test Strategy

Acceptance criteria

Files changed