cli-forge-extend
cli-forge Extend
Use this stage when a generated Rust CLI Skill project, or a takeover-adopted
project that already matches the scaffold-compatible file layout, requires
optional capabilities like JSON streaming (stream), interactive terminal
sessions (repl), or background app-server daemon execution (daemon).
Purpose
Add optional feature modules to an existing project.
This stage expands feature-specific templates, injects the necessary hooks into
the main program flow, updates tests, and synchronizes the capability state
back to the cli-plan.yml contract.
Canonical References
./instructions/add-feature.md./planning-brief.md./contracts/extend-receipt.yml.tpl./templates/../cli-forge-plan/instructions/daemon-app-server.md
Entry Gate
| # | Check | Source |
|---|---|---|
| 1 | Target project directory exists | Filesystem |
| 2 | Scaffold baseline exists, or takeover baseline is scaffold-compatible | Filesystem |
| 3 | Requested feature is stream, repl, or daemon |
User/Router |
| 4 | Feature is explicitly marked in_scope in cli-plan.yml |
Plan |
| 5 | Feature is not already added (idempotency check) | Filesystem |
Required Inputs
project_pathfeature(stream,repl, ordaemon)- Details for updating the
cli-plan.yml
Workflow
- If the project lacks both
scaffold-receipt.ymlandtakeover-receipt.yml, stop and route back to Takeover for baseline establishment or refresh. Treat that path as the supported way to create a takeover baseline for an existing project whose contracts may already exist, not as a first-time-only adoption path. - If the project only has
takeover-receipt.yml, continue only when the adopted repository already contains the scaffold-compatible files this stage patches directly and the overlay-required API/dependency surface:Cargo.toml,SKILL.md,src/main.rs,src/lib.rs,src/help.rs, andsrc/context.rs;tests/cli_test.rsshould also be present when the generated feature workflow is expected to patch the integration tests directly.src/context.rsmust expose the scaffold-style context/runtime helpers the overlays call, includingresolve_runtime_locations. For REPL compatibility, the adopted dependency surface must also already includerustylineplus the context API consumed byrepl.rs.tpl. If those files or required surfaces are missing, stop and tell the user normalization or manual implementation is required; do not route back to Takeover. - If the feature is missing or listed as
out_of_scopeincli-plan.yml, route back to the Plan stage to update the CLI contract first. Do not add code before the plan allows it. - Follow
./instructions/add-feature.md. - Expand exactly the requested templates from
./templates/(e.g.,stream.rs.tpl,repl.rs.tpl, ordaemon.rs.tpl). - Run integration updates safely:
- add the relevant flags to the args struct
- wire the subsystem branch into the
matchloop - add matching struct format assertions in tests
- update standard
SKILL.mdboundaries, help text, and README wording
- Require explicit compiler safety at every step using
cargo clippy. - Run the required verification boundaries from the generated project root:
cargo buildcargo testcargo clippy -- -D warningscargo fmt --check
- Ensure
cli-plan.ymlcorrectly reflects the added capability asin_scope. - Generate
.cli-forge/extend-receipt.ymlusing the template at./contracts/extend-receipt.yml.tpl.
Outputs
- Extended source code and documentation
- Updated
.cli-forge/cli-plan.yml .cli-forge/extend-receipt.yml
Exit Gate
| # | Check |
|---|---|
| 1 | Feature files generated from template |
| 2 | Source, README, help, and tests correctly wired |
| 3 | cli-plan.yml updated and synced |
| 4 | cargo build passes |
| 5 | cargo clippy -- -D warnings passes |
| 6 | cargo fmt --check passes |
| 7 | cargo test passes |
| 8 | extend-receipt.yml generated |
Guardrails
- Use templates EXCLUSIVELY from the bundled
./templates/directory for this stage. Do not reach outside this skill package for extension templates. - If the feature being added contradicts the
cli-plan.yml, update the plan first. Scaffolded code and the CLI plan must remain perfectly aligned. - A takeover-adopted project remains takeover-adopted even after extension.
Keep
takeover-receipt.ymlas the baseline marker and addextend-receipt.ymlas the feature-change record, but only after confirming the repository already matches the scaffold-compatible file layout and overlay-required API/dependency surface that this stage patches directly. - If a takeover-adopted project does not have the scaffold-compatible files or overlay-required API/dependency surface this stage expects, stop and tell the user normalization or manual feature implementation is required. Do not route that case back through Takeover.
- If a project already has
design-contract.ymlandcli-plan.ymlbut lacks both baseline receipts, route to Takeover specifically for baseline establishment or contract refresh so the missing adopted baseline can be recorded without pretending the project was scaffolded. - If the target project already declares daemon behavior in
cli-plan.yml, preserve that documented daemon surface.streamandreploverlays must not silently rewrite daemon commands, routing flags, transport choices, or recovery semantics. - Refuse to add unsupported features through this stage. This stage only
handles
stream,repl, anddaemon.
Next Step
Continue with ../cli-forge-validate/SKILL.md
to run the full compliance rule set.
More from bytelandtechnology/cli-forge
cli-forge-publish
Publish stage for the cli-forge skill family: manage the GitHub Release and multi-package npm publication automation for a generated skill.
33cli-forge-distribute
Archived reference for the old split-stage npm publication model. New workflows should use Publish instead.
19cli-forge-intake
Triage stage for the cli-forge skill family: classify the request as description, scaffold, extend, validate, or publish, confirm required inputs, load the shared rules, and hand off to the correct next phase.
13cli-forge-description
Description stage for the cli-forge skill family: define or refresh the generated skill description contract before downstream stages change scaffold, feature, validation, or packaging surfaces.
13