Repository navigation
Scaffold capability-targeted package starters - #332
Conversation
Add package/extension init --capability support for commands and hooks starters. Hook scaffolds now declare commands+hooks, register an after_command lifecycle reactor, and include package-mode SDK sample tests using assertRegisteredHook and runRegisteredHookForTest. Update help, shell completions, SDK contracts, docs, tests, and the package-owned changelog. Close pm-nhby with evidence including temp-project smoke, sentry/telemetry checks, changelog validation, and full 100/100/100/100 coverage.
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
|
Warning Review limit reached
More reviews will be available in 53 minutes and 8 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. 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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (16)
📝 WalkthroughWalkthroughAdds a Changes--capability scaffold feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Code Review
This pull request introduces a --capability <kind> option to the pm package init and pm extension init commands, allowing developers to scaffold starter packages targeted at specific capabilities, specifically commands (default) or hooks. When the hooks capability is selected, the scaffolded package includes an after_command lifecycle reactor along with corresponding SDK-based tests. The changes also update shell completions, CLI contracts, help content, and documentation. A review comment suggests simplifying and strengthening the validation of the --capability option on non-init actions to prevent bypassing the check with empty strings.
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.
| if (typeof options.capability === "string" && options.capability.trim().length > 0 && action !== "init") { | ||
| throw new PmCliError("--capability is only valid with --init/--scaffold.", EXIT_CODE.USAGE); | ||
| } |
There was a problem hiding this comment.
The check for --capability on non-init actions can be simplified and made more robust. Checking options.capability.trim().length > 0 allows users to bypass this validation by passing an empty or whitespace-only string (e.g., --capability ""), which should still be rejected on non-init actions. We can simply check if options.capability is a string.
| if (typeof options.capability === "string" && options.capability.trim().length > 0 && action !== "init") { | |
| throw new PmCliError("--capability is only valid with --init/--scaffold.", EXIT_CODE.USAGE); | |
| } | |
| if (typeof options.capability === "string" && action !== "init") { | |
| throw new PmCliError("--capability is only valid with --init/--scaffold.", EXIT_CODE.USAGE); | |
| } |
There was a problem hiding this comment.
Code Review
This pull request introduces a --capability <kind> option (supporting commands and hooks) to the pm package init and pm extension init commands, allowing authors to scaffold targeted starter packages. Selecting hooks scaffolds an after_command lifecycle reactor along with corresponding SDK testing coverage, documentation, and shell completions. The feedback suggests improving the robustness of the --capability validation on non-init actions by checking for any presence of the flag (options.capability !== undefined) rather than just non-empty strings.
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.
| if (typeof options.capability === "string" && options.capability.trim().length > 0 && action !== "init") { | ||
| throw new PmCliError("--capability is only valid with --init/--scaffold.", EXIT_CODE.USAGE); | ||
| } |
There was a problem hiding this comment.
The check for --capability on non-init actions can be simplified and made more robust. Currently, it only throws if the capability is a non-empty string. If a user passes --capability "" or --capability (which might be parsed as a boolean or empty string depending on the environment) to a non-init action, it will not be rejected. Checking for options.capability !== undefined is simpler and correctly rejects any presence of the flag on non-init actions.
| if (typeof options.capability === "string" && options.capability.trim().length > 0 && action !== "init") { | |
| throw new PmCliError("--capability is only valid with --init/--scaffold.", EXIT_CODE.USAGE); | |
| } | |
| if (options.capability !== undefined && action !== "init") { | |
| throw new PmCliError("--capability is only valid with --init/--scaffold.", EXIT_CODE.USAGE); | |
| } |
Address Gemini review feedback by treating any present --capability value as invalid on non-init package/extension actions, including an empty string value. Add regression coverage and record the reviewer follow-up on pm-nhby.
|
Review follow-up pushed in 3e2fd95 for Gemini feedback. Please review the current head again. @codex review |
|
To use Codex here, create a Codex account and connect to github. |
|
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Code Review
This pull request introduces the "--capability " option for the "pm package init" and "pm extension init" commands, allowing developers to scaffold capability-targeted starter packages. Specifically, it supports the default "commands" capability and a new "hooks" capability, which scaffolds an "after_command" lifecycle reactor along with corresponding SDK testing coverage. The changes span CLI command registration, shell completions, CLI contracts, documentation, and comprehensive unit tests. As there are no review comments provided, I have no additional feedback on this pull request.
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.
Summary
pm package init/pm extension init --capability <commands|hooks>withcommandsas the defaultcommands+hooks, a starter command, anafter_commandlifecycle reactor, and package-mode SDK sample tests usingassertRegisteredHook/runRegisteredHookForTestCHANGELOG.mdVerification
node scripts/run-tests.mjs test -- tests/unit/extensions/extension-command.spec.ts tests/unit/commands/completion-command.spec.ts tests/unit/commands/contracts-command.spec.ts tests/unit/sdk/sdk-index.spec.ts tests/unit/cli/cli-main-errors.spec.tspnpm build && pnpm contracts:checkpnpm quality:staticpnpm security:scanpm init,pm package init ./hook-package --capability hooks, local SDKnpm install,npm test,pm install ./hook-package,pm package doctor --project --detail deep --trace,pm hook-package pingnode scripts/run-tests.mjs coverage-> 100/100/100/100 across 4,830 testspnpm changelog:pm && pnpm changelog:pm:checknode scripts/release/sentry-telemetry-gate.mjs --json --telemetry-mode best-effort --sentry-window-days 14 --max-critical 0 --max-high 0PM
pm-nhby