Skip to content

feat(#271): labelle add pack / labelle add feature subcommand - #272

Merged
apotema merged 2 commits into
mainfrom
packs/add-scaffold
Jul 1, 2026
Merged

apotema merged 2 commits into
mainfrom
packs/add-scaffold

Conversation

@apotema

@apotema apotema commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Closes #271. Part of the Packs initiative (umbrella labelle-toolkit/labelle-engine#651, RFC-packs §7).

What

labelle add scaffolds the two authoring units the Packs RFC defines:

labelle add pack <name>
labelle add feature <kind> <name>     # kind: need | role | status

Following the exact split labelle init uses, the CLI is a thin forwarder: it parses add ... off argv and hands it verbatim to the assembler's add subcommand, which owns the templating (the pack.labelle schema and the game-root convention layout are the assembler's). See the assembler PR for the templates + logic: labelle-toolkit/labelle-assembler#485.

Where the logic lives

  • CLI (this PR): new src/cli/add.zig (one-line runSubcommand(".", "add", args)), wired into the Command enum + dispatch + arg parsing in cli.zig, plus help text/examples. Bumps REQUIRED_PROTOCOL 3 → 4 (the add subcommand needs the protocol-4 assembler).
  • Assembler (labelle-assembler#485): the add subcommand, pack.labelle/feature templates, validation, and tests.

Verified

  • zig build + zig build test green.
  • End-to-end against the protocol-4 assembler (LABELLE_ASSEMBLER override): labelle add pack citizens and labelle add feature need boredom scaffold the expected trees; labelle add feature bogus x propagates the assembler's exit code 2.

Deferred / notes

Part of labelle-toolkit/labelle-engine#651.

Thin CLI forwarder for the Packs scaffold (RFC §7): parses `add ...` off
argv and hands it verbatim to the assembler's `add` subcommand, same split
as `labelle init`. Adds `add` to the Command enum + dispatch + arg parsing,
a new `cli/add.zig`, and help text/examples.

Bumps REQUIRED_PROTOCOL to 4 (the `add` subcommand needs the protocol-4
assembler).

Closes #271. Part of #651.
@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@apotema, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 15fea89e-881a-4d79-a8d0-0783606ea200

📥 Commits

Reviewing files that changed from the base of the PR and between 239f696 and 498126f.

📒 Files selected for processing (4)
  • src/cli.zig
  • src/cli/add.zig
  • src/cli/assembler_proc.zig
  • src/cli/config.zig
📝 Walkthrough

Walkthrough

This PR adds a new labelle add CLI subcommand. src/cli.zig parses the add token, forwards remaining arguments, and dispatches to a new cli/add.zig module, which forwards to assembler_proc.runSubcommand. The required assembler protocol version is raised from 3 to 4, and help text is updated with examples.

Changes

Labelle add subcommand

Layer / File(s) Summary
CLI parsing and dispatch
src/cli.zig
Imports the new add module, adds add_cmd to the Command enum, parses the add token into extra_args, and dispatches to cmdAdd.
Add forwarder and protocol bump
src/cli/add.zig, src/cli/assembler_proc.zig
New cmdAdd function forwards to assembler_proc.runSubcommand with "." and passthrough args; REQUIRED_PROTOCOL raised from 3 to 4.
Help text updates
src/cli/help.zig
Adds add pack <name> / add feature <kind> <name> descriptions and example invocations.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Poem

A rabbit hops with a brand-new command,
"labelle add" now scaffolds by hand!
Pack and feature, forwarded with care,
Protocol four floats in the air.
Help text hops along too —
🐇 new burrows for you! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the new labelle add pack/feature subcommand added in this PR.
Description check ✅ Passed The description matches the changeset and explains the new labelle add forwarding behavior and protocol bump.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch packs/add-scaffold

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the add subcommand to the CLI, which delegates to the assembler binary to scaffold packs and feature-units. The changes include registering the new command in src/cli.zig, implementing the forwarding logic in src/cli/add.zig, updating the minimum required assembler protocol version to 4 in src/cli/assembler_proc.zig, and updating the help documentation. I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 239f6961f2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cli/assembler_proc.zig Outdated
/// subcommands the CLI depends on. `resolve` checks this and fails early
/// with a clear message instead of letting a stale binary reject a
/// subcommand.
pub const REQUIRED_PROTOCOL: u32 = 4;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep the default assembler protocol-compatible

When no project pin or LABELLE_ASSEMBLER override is set, resolveDefault still downloads assembler.DEFAULT_ASSEMBLER_VERSION (0.40.0), whose tagged assembler declares protocol 3, so raising the global minimum here makes fresh installs reject the auto-downloaded default before generate, build, run, or the new add can execute. Please bump the default assembler release to a protocol-4 build or require protocol 4 only for the add subcommand.

Useful? React with 👍 / 👎.

Comment thread src/cli.zig
.version => return help.printVersion(),
.targets => return help.printTargets(),
.init_cmd => return init.cmdInit(allocator, parsed_args.extra_args[0..parsed_args.extra_count]),
.add_cmd => return add.cmdAdd(allocator, parsed_args.extra_args[0..parsed_args.extra_count]),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require a project before scaffolding add output

Because add is returned from the standalone-command switch, it skips the existing config.readProjectConfig guard below and will invoke the assembler even when the current directory is not a Labelle project. In that situation a mistyped cwd such as a parent directory or home directory creates packs/, components/, or scripts/ there instead of producing the same “No project.labelle found” error as project-scoped commands; validate the manifest or route through the normal project-dir path before forwarding.

Useful? React with 👍 / 👎.

@apotema

apotema commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Address two codex review findings on the `labelle add` PR.

Finding 1 (protocol floor): reverting the global protocol minimum back
to 3 and gating `add` at 4 per-subcommand. The prior global bump 3->4
rejected the auto-downloaded DEFAULT_ASSEMBLER_VERSION (0.40.0, protocol
3) before any command could run — a breaking change for every fresh
install with no project pin. `minProtocolFor(subcommand)` is now a small
lookup (floor = MIN_PROTOCOL = 3, `add` = 4) that `resolve`/`checkProtocol`
consult; new gated subcommands add one line (e.g. `check` -> 5, #273)
without raising the floor. Error message names the subcommand.

Finding 2 (require a project): `add` is dispatched from the standalone
switch, skipping the readProjectConfig guard project-scoped commands use,
so `labelle add ...` in a non-project cwd would scaffold packs/components/
scripts there. `cmdAdd` now checks `config.projectExists(".")` and emits
the shared "No project.labelle found" error (exit 1) before forwarding.

Tests: minProtocolFor map (add=4, floor cmds=3, unknown=floor, gate>floor)
and config.projectExists (present/absent/nonexistent). 301/301 pass.
@apotema

apotema commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both codex review findings in 498126f.

Finding 1 — per-subcommand protocol minimum (no global bump).
Reverted the global floor back to protocol 3 (MIN_PROTOCOL) and gate add at 4 per-subcommand. The prior 3→4 global bump would have rejected the auto-downloaded DEFAULT_ASSEMBLER_VERSION (0.40.0, protocol 3) before any command could run for fresh installs with no project pin.

  • assembler_proc.zig: new minProtocolFor(subcommand) — a small { name, min } lookup: floor = MIN_PROTOCOL (3), add = 4. resolve/checkProtocol now take the subcommand and use its minimum; the error message names the offending subcommand.
  • Extensible for packs: labelle check — the §6 enforcement lint (Closes #270) #273: adding check → 5 is a one-line entry (already stubbed as a comment) — it never raises the floor for existing commands or the default binary.
  • cli.zig generate/build/run path passes "generate" (stays at floor 3).

Finding 2 — add must require a project.
add is dispatched from the standalone-command switch, so it skipped the readProjectConfig guard. cmdAdd now checks config.projectExists(".") and prints the shared "No project.labelle found" message (factored into config.printNoProjectError, reused by the main project guard too) then exits 1 — before forwarding to the assembler, so no packs//components//scripts/ gets scaffolded in the wrong cwd.

Tests (added, 292 → 301, all green):

  • MinProtocolForSpec: add=4, generate/install/clean/upgrade/init=floor(3), unknown→floor, and a protocol-3 binary is rejected for add but accepted for generate.
  • ProjectExistsSpec: true with a manifest, false in an empty dir, false for a nonexistent path.

zig build + zig build test pass (0.16). mergeable: MERGEABLE, mergeStateStatus: CLEAN.

@apotema

apotema commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@apotema
apotema merged commit 382ee0c into main Jul 1, 2026
6 checks passed
apotema added a commit that referenced this pull request Jul 1, 2026
…ng (#273)

Sync `packs/check-lint` past main (#272 per-subcommand protocol floor,
`add` subcommand) and finish the `labelle check` wiring:

- cli.zig: resolve the Command-enum merge conflict keeping BOTH `add_cmd`
  and `check_cmd`; surface `check.ParseCheckArgsSpec` in the test
  aggregator.
- assembler_proc.zig: un-stub the gate table entry `check` -> 5 so
  `runSubcommand(.., "check", ..)` rejects a protocol-<5 assembler up
  front (clear "needs protocol >= 5" error) instead of it failing with
  "unknown subcommand"; add a MinProtocolForSpec case for it.
- check.zig: rewrite arg parsing into a pure, testable `parseCheckArgs`.
  Reserve `--project-root` (space + `=value` forms) so the CLI's own
  injection is never double-added and its value is not mistaken for the
  positional dir; accept at most one positional (TooManyArguments
  otherwise); forward all other flags untouched. Add ParseCheckArgsSpec
  unit tests (dir extraction, flag forwarding, project-root reservation,
  too-many-args error).

zig build + zig build test green (312/312).

Claude-Session: https://claude.ai/code/session_01P7B7UzgrWEbBYLT3YBrAog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

packs: labelle add pack/feature scaffold (recipe shares the manifest template source)

1 participant