Skip to content

feat(sdk): scaffold the schema capability (custom item type/field/migration starter) - #355

Merged
unbraind merged 3 commits into
mainfrom
feat/scaffold-schema-capability
Jun 24, 2026
Merged

unbraind merged 3 commits into
mainfrom
feat/scaffold-schema-capability

Conversation

@unbraind

Copy link
Copy Markdown
Owner

Summary

Adds schema to the pm package init / pm extension init --capability selector, so authors can start from a custom item type, item field, and migration — the keystone capability for modeling a project domain (project management = context management). The scaffolder now covers 5 of the SDK's 9 capabilities (was 4: commands/hooks/search/importers).

pm package init my-tracker --capability schema generates a starter that:

  • registers a custom item type, item field, and migration via api.registerItemTypes/registerItemFields/registerMigration (plus the base ping command)
  • ships a runnable node:test suite exercising assertRegisteredItemType/assertRegisteredItemField/assertRegisteredMigration + runRegisteredMigrationForTest
  • documents the define* upgrade path (defineItemType/defineItemField/defineMigration) in its README

Key design: schema starters omit activation.commands

A custom item type is a global contribution that built-in commands (pm create <type>, pm list, pm validate) must see — commands the package does not own and cannot enumerate. I verified empirically that declaring narrow activation.commands gates lazy activation to only those commands and silently leaves the custom type unregistered for pm create (Invalid type value). The schema starter therefore omits the field entirely so pm's conservative activation tier (which covers schema) loads it for every command. This is the deliberate exception to the lazy-activation contract introduced in #354; the generated README explains it in a ## Activation section. Recorded as decision pm-halx.

Also

  • Drift-proofs the zsh/fish --capability completion lists by interpolating SCAFFOLD_CAPABILITIES.
  • Documents --capability schema in EXTENSIONS.md, SDK.md, and help-content for both package init and extension init.

Validation

  • Temp-dir smoke: generated node:test 3/3 pass, tsc --noEmit exit 0, pm create <type> + alias + bundled ping + package doctor (0 warnings) all green.
  • All 5 capabilities scaffold cleanly (regression smoke); pm validate ok.
  • Full suite 248 files / 5006 tests at 100/100/100/100 coverage.
  • Static-quality, docs-skills, and changelog:pm:check gates green.

pm items

Epic pm-ugqx. Closes feature pm-d1ig, tasks pm-mdw6/pm-x3vi/pm-pwf1, decision pm-halx. Follow-ups: pm-i5p5 (renderers/parser/preflight/services starters), pm-ok47 (doctor warning for schema + narrow activation.commands).

🤖 Generated with Claude Code

…ration starter)

Add `schema` to the `pm package init` / `pm extension init` `--capability`
selector so authors can start from a custom item type, item field, and
migration — the keystone capability for modeling a project domain. Before
this, the scaffolder covered 4 of the SDK's 9 capabilities
(commands/hooks/search/importers); it now covers 5.

The schema starter registers a custom item type, item field, and migration
via `api.registerItemTypes`/`registerItemFields`/`registerMigration` plus the
base ping command, and ships a runnable `node:test` suite that exercises
`assertRegisteredItemType`/`assertRegisteredItemField`/`assertRegisteredMigration`
and `runRegisteredMigrationForTest`, with README `define*` guidance
(`defineItemType`/`defineItemField`/`defineMigration`).

Activation: the schema starter deliberately omits manifest `activation.commands`.
A custom item type is a GLOBAL contribution that built-in commands
(`pm create <type>`, `pm list`, `pm validate`) must see — commands the package
does not own and cannot enumerate. Declaring narrow `activation.commands` there
gates activation to only those commands and silently leaves the custom type
unregistered for `pm create` (verified empirically). Omitting it lets pm's
conservative activation tier (which covers `schema`) load the package for every
command. The generated README documents this with a `## Activation` section in
place of the lazy-activation contract the command-bearing starters use.

Also: drift-proof the zsh/fish `--capability` completion lists by interpolating
`SCAFFOLD_CAPABILITIES`, and document `--capability schema` in EXTENSIONS.md,
SDK.md, and help-content for both `package init` and `extension init`.

pm: closes pm-d1ig (feature), pm-mdw6/pm-x3vi/pm-pwf1 (tasks), pm-halx
(activation decision); follow-ups pm-i5p5 (renderers/parser/preflight/services
starters) and pm-ok47 (doctor warning for schema + narrow activation.commands).
Epic pm-ugqx.

Validation:
- temp-dir smoke: generated node:test 3/3 pass, tsc --noEmit exit 0,
  pm create <type> + alias + bundled ping + package doctor (0 warnings) all green
- all 5 capabilities scaffold cleanly (regression smoke); pm validate ok
- full suite 248 files / 5006 tests at 100/100/100/100 coverage
- static-quality, docs-skills, and changelog:pm:check gates green

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhXvQcAsibdH7Ap5LRKtuc

@sourcery-ai sourcery-ai 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.

Sorry @unbraind, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@unbraind

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

/gemini review

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@unbraind, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 29 minutes and 7 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 @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 credits.

🚦 How do rate 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 see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 01acd442-d4c2-4908-b827-039f99a17f7a

📥 Commits

Reviewing files that changed from the base of the PR and between c899d14 and 8a553c1.

📒 Files selected for processing (23)
  • .agents/pm/decisions/pm-halx.toon
  • .agents/pm/features/pm-d1ig.toon
  • .agents/pm/features/pm-i5p5.toon
  • .agents/pm/history/pm-d1ig.jsonl
  • .agents/pm/history/pm-halx.jsonl
  • .agents/pm/history/pm-i5p5.jsonl
  • .agents/pm/history/pm-mdw6.jsonl
  • .agents/pm/history/pm-ok47.jsonl
  • .agents/pm/history/pm-pwf1.jsonl
  • .agents/pm/history/pm-x3vi.jsonl
  • .agents/pm/issues/pm-ok47.toon
  • .agents/pm/tasks/pm-mdw6.toon
  • .agents/pm/tasks/pm-pwf1.toon
  • .agents/pm/tasks/pm-x3vi.toon
  • CHANGELOG.md
  • docs/EXTENSIONS.md
  • docs/SDK.md
  • src/cli/commands/completion.ts
  • src/cli/commands/extension/scaffold.ts
  • src/cli/help-content.ts
  • tests/unit/commands/completion-command.spec.ts
  • tests/unit/extensions/extension-command.spec.ts
  • tests/unit/extensions/extension-scaffold-define-guidance.spec.ts
📝 Walkthrough

Walkthrough

Adds a new schema scaffold capability to pm package/extension init --capability. The generated starter registers custom item types, fields, and migrations; intentionally omits activation.commands from the manifest so conservative activation exposes types to built-in commands. Shell completion, help content, SDK/EXTENSIONS docs, tests, and PM tracking records are updated accordingly.

Changes

Schema scaffold capability implementation

Layer / File(s) Summary
Capability constants and entrypoint generation
src/cli/commands/extension/scaffold.ts
Adds "schema" to SCAFFOLD_CAPABILITIES (updating ExtensionScaffoldCapability), SCAFFOLD_MANIFEST_CAPABILITIES, SAMPLE_TEST_CAPABILITIES_LITERAL, ENTRYPOINT_BULLETS, and SAMPLE_TEST_BULLETS. Implements the buildActivateBodyLines schema branch emitting api.registerItemFields, api.registerItemTypes, and api.registerMigration calls with deterministic identifiers.
Generated test source for schema
src/cli/commands/extension/scaffold.ts
Extends buildSampleTestSource with schemaEnabled, schema identifier derivation, assertRegistered*/runRegisteredMigrationForTest imports, and schemaTestLines asserting type/field/migration registrations and migration execution result.
Activation/manifest: schema omits activation.commands
src/cli/commands/extension/scaffold.ts
Updates buildScaffoldActivationCommands to return an empty list for schema. Changes manifest.json generation to conditionally include activation.commands only when the list is non-empty, so schema scaffolds emit no activation field.
Generated README sections and define* builder guidance
src/cli/commands/extension/scaffold.ts
Adds "schema" entries to PACKAGE/EXTENSION_CAPABILITY_README_SECTIONS, introduces SCHEMA_ACTIVATION_README_SECTION, special-cases manifestBullet, extends defineBuilderImports/builder/activate snippets with defineItemType/defineItemField/defineMigration, and wires conditional activation section selection.
Shell completion, help content, and documentation
src/cli/commands/completion.ts, src/cli/help-content.ts, docs/SDK.md, docs/EXTENSIONS.md, CHANGELOG.md
Updates Zsh and Fish --capability choice lists to use SCAFFOLD_CAPABILITIES.join(" "). Adds schema examples/tips to help content. Extends SDK.md to document that schema omits activation.commands for global type availability. Adds changelog entries.
Unit tests for schema scaffold
tests/unit/extensions/extension-command.spec.ts, tests/unit/extensions/extension-scaffold-define-guidance.spec.ts, tests/unit/commands/completion-command.spec.ts
Adds package-mode and standalone schema scaffold test cases asserting generated files, manifest capabilities, absent manifest.activation, index.ts registration calls, and README content. Adds define* guidance and manifest activation assertions for schema. Updates completion test to expect schema in capability list.

PM agent tracking records

Layer / File(s) Summary
PM decision, feature, task, and issue records
.agents/pm/decisions/pm-halx.toon, .agents/pm/features/pm-d1ig.toon, .agents/pm/features/pm-i5p5.toon, .agents/pm/issues/pm-ok47.toon, .agents/pm/tasks/pm-mdw6.toon, .agents/pm/tasks/pm-pwf1.toon, .agents/pm/tasks/pm-x3vi.toon, .agents/pm/history/*
Creates and closes feature pm-d1ig (schema scaffold), feature pm-i5p5 (capability matrix follow-up), decision pm-halx (omit activation.commands), issue pm-ok47 (doctor warning), and tasks pm-mdw6/pm-pwf1/pm-x3vi. Corresponding JSONL history logs record each lifecycle event.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • unbraind/pm-cli#332: Extends the same scaffold.ts capability system by adding commands/hooks scaffold branches, directly related to the pattern this PR extends for schema.
  • unbraind/pm-cli#344: Modifies extension-scaffold-define-guidance.spec.ts and the define* builder documentation generation in scaffold.ts, the same files this PR extends for schema define* guidance.
  • unbraind/pm-cli#354: Modifies buildScaffoldActivationCommands and the lazy-activation contract in scaffold.ts, directly related to this PR's change that makes schema return an empty activation commands list.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding schema capability scaffolding for custom item type, field, and migration starters.
Description check ✅ Passed The description is directly aligned with the changeset and explains the schema scaffold, activation behavior, docs, completions, and validation.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ 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.

❤️ Share

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

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Get PR details
gh pr view 355 --repo unbraind/pm-cli --json title,body,files,additions,deletions,changedFiles

echo "---FILES---"
gh pr diff 355 --repo unbraind/pm-cli 2>/dev/null | head -3000

Length of output: 99036



@unbraind: Reviewed. The implementation is well-structured and the activation design decision (omitting activation.commands for schema so global item types reach built-in commands) is sound, empirically validated, and well-documented at every level. A few observations below.


Findings

1. context.id in the generated migration may mislead authors (medium)

src/cli/commands/extension/scaffold.ts, buildActivateBodyLines for schema:

run: async (context) => ({ migrated: true, id: context.id }),

The generated test then asserts:

assert.deepEqual(migrated, { migrated: true, id: "starter-schema-0001-init" });

This passes because runRegisteredMigrationForTest apparently sets context.id to the migration ID in its synthetic context. But in a real migration, context is the item being migrated, so context.id is the item's ID — not the migration ID. An author who reads this starter, sees id: context.id, and expects it to be the migration ID will get a surprise in production. Consider adding an inline comment to the generated migration:

// `context.id` is the ID of the item being migrated, not the migration ID.
// In this deterministic no-op starter we echo it back; replace with your
// real per-item rewrite (e.g., reshape fields, rename keys, set defaults).
run: async (context) => ({ migrated: true, id: context.id }),

2. Naive folder pluralization (low)

const itemTypeFolder = `${extensionName}s`;

Works for most extension names but produces "focuss" for "focus", "statuss" for "status", etc. This is starter scaffolding so it's not a hard bug, but a comment like // Replace with your domain's canonical plural folder name on the generated folder line would remind authors to customise it.

3. CHANGELOG.md "Other" section ordering (nit)

The four new tasks are listed decision → docs → tests → implementation. Grouping by natural reading order (implementation → tests → docs → decision, or the reverse) would make the changelog easier to scan, but this is purely cosmetic.


What's good

  • Exhaustiveness is compiler-enforced — all six Record<ExtensionScaffoldCapability, …> maps include schema, so a missed entry would be a compile error.
  • activationCommands hoisted before manifest construction and the conditional spread (activationCommands.length > 0 ? { activation: … } : {}) is clean.
  • Drift-proofed completion via SCAFFOLD_CAPABILITIES.join(" ") interpolation — adding the next capability will automatically update both zsh and fish completions.
  • Both variants tested (package + standalone extension): manifest activation asserted undefined, entrypoint registrations, test file SDK helpers, and README sections all verified.
  • Activation reasoning documented at every level: decision file, buildScaffoldActivationCommands JSDoc, generated README ## Activation section, SDK.md, EXTENSIONS.md, help-content.ts.

The context.id comment in point 1 is the only change worth a quick follow-up; the rest are low-priority. Overall the PR is solid and ready to merge.

@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 new schema capability to the pm package/extension init scaffolder, enabling developers to generate starter templates for custom item types, fields, and migrations. Notably, the schema starter omits activation.commands from its manifest to leverage conservative activation, ensuring that custom types are globally registered and accessible to built-in commands. The changes also include updated documentation, shell completion support, and comprehensive unit tests. The review feedback suggests a valuable improvement: conditionally populating the aliases array for the generated item type to prevent redundant self-aliases when the extension name does not contain hyphens.

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.

Comment on lines +352 to +356
const itemTypeName = extensionName;
const itemTypeFolder = `${extensionName}s`;
const itemTypeAlias = extensionName.replace(/-/g, "");
const fieldName = `${extensionName.replace(/-/g, "_")}_note`;
const migrationId = `${extensionName}-0001-init`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

If the extensionName does not contain any hyphens (e.g., todo), itemTypeAlias will be identical to itemTypeName. Registering an alias that is identical to the item type name is redundant and can cause validation errors or infinite loops in alias resolution depending on how pm handles aliases. We should conditionally populate the aliases array only when the alias differs from the type name.

    const itemTypeName = extensionName;
    const itemTypeFolder = `${extensionName}s`;
    const itemTypeAlias = extensionName.replace(/-/g, "");
    const aliases = itemTypeAlias !== itemTypeName ? [itemTypeAlias] : [];
    const fieldName = `${extensionName.replace(/-/g, "_")}_note`;
    const migrationId = `${extensionName}-0001-init`;

Comment thread src/cli/commands/extension/scaffold.ts Outdated
" {",
` name: ${JSON.stringify(itemTypeName)},`,
` folder: ${JSON.stringify(itemTypeFolder)},`,
` aliases: [${JSON.stringify(itemTypeAlias)}],`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Use the conditionally defined aliases array to avoid registering redundant self-aliases.

Suggested change
` aliases: [${JSON.stringify(itemTypeAlias)}],`,
` aliases: ${JSON.stringify(aliases)},`,

Comment on lines +893 to +897
const itemTypeName = extensionName;
const itemTypeFolder = `${extensionName}s`;
const itemTypeAlias = extensionName.replace(/-/g, "");
const fieldName = `${extensionName.replace(/-/g, "_")}_note`;
const migrationId = `${extensionName}-0001-init`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Similarly, define the aliases array conditionally here to prevent redundant self-aliases in the generated README/define builder guidance.

    const itemTypeName = extensionName;
    const itemTypeFolder = `${extensionName}s`;
    const itemTypeAlias = extensionName.replace(/-/g, "");
    const aliases = itemTypeAlias !== itemTypeName ? [itemTypeAlias] : [];
    const fieldName = `${extensionName.replace(/-/g, "_")}_note`;
    const migrationId = `${extensionName}-0001-init`;

Comment thread src/cli/commands/extension/scaffold.ts Outdated
"export const itemType = defineItemType({",
` name: ${JSON.stringify(itemTypeName)},`,
` folder: ${JSON.stringify(itemTypeFolder)},`,
` aliases: [${JSON.stringify(itemTypeAlias)}],`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Use the conditionally defined aliases array in the generated define builder snippet.

Suggested change
` aliases: [${JSON.stringify(itemTypeAlias)}],`,
` aliases: ${JSON.stringify(aliases)},`,

@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 adds the "schema" capability to the "pm package/extension init" command, enabling the scaffolding of custom item types, fields, and migrations. To ensure global availability of these custom types to built-in commands, the scaffolded manifest deliberately omits "activation.commands", allowing conservative activation. The changes also update the documentation, shell completion scripts, and test suites to support and verify this new capability. There are no review comments, so 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.

… pluralization

Address review feedback on the generated schema starter:

- The generated migration comment said "per-item rewrite", but pm runs each
  migration ONCE (it is a run-once schema operation, not a per-item callback):
  the run context identifies the migration itself, so `context.id` is the
  migration id (not an item id), and authors iterate the corpus themselves via
  `context.pm_root`. Reword the comment to state this accurately so the starter
  does not mislead authors about `context.id`.
- Add a reminder comment on the generated item-type `folder` line, since naive
  `${name}s` pluralization yields e.g. `focuss`/`statuss`; authors should set
  their domain's canonical plural folder name.

Generated-string comments only; no behavior change. Regenerated smoke still
passes (node --test 3/3, tsc --noEmit exit 0); scaffold unit suites green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhXvQcAsibdH7Ap5LRKtuc
@unbraind

Copy link
Copy Markdown
Owner Author

Thanks for the thorough review. Addressed in 0ce4d90:

1. Migration context.id (medium) — Good catch on the clarity gap, though the precise semantics are slightly different from the suggestion. pm migrations are run-once schema operations, not per-item callbacks: the run context (SchemaMigrationRunContext) identifies the migration itself, so context.id is the migration id (not an item id) in both the test helper and production (src/cli/main.ts:1529-1539 constructs { id: resolveMigrationId(...), command: "migration", layer, extension, pm_root, status } — there is no item payload). The real imprecision was my own generated comment saying "per-item rewrite", which wrongly implied pm invokes run per item. Reworded the comment to state that pm runs each migration once, context.id is the migration id, and authors iterate the corpus themselves via context.pm_root.

2. Naive folder pluralization (low) — Added a // Replace with your domain's canonical plural folder name. reminder on the generated folder line. (pm package init focus --capability schema → focuss is the perfect illustration.)

3. CHANGELOG "Other" ordering (nit) — CHANGELOG.md is auto-generated by the pm-changelog package (npm run changelog:pm) from closed pm items; the section ordering is the tool's deterministic sort, so I'm leaving it as generated rather than hand-editing (a manual reorder would be overwritten on the next regen).

Re-verified after the change: regenerated schema scaffold passes node --test 3/3 and tsc --noEmit exit 0; scaffold unit suites green.

@coderabbitai full review

/gemini review

@coderabbitai

coderabbitai Bot commented Jun 24, 2026 •

Copy link
Copy Markdown

@unbraind: Thank you for the detailed correction on finding #1 — you're right that my "per-item rewrite" framing was wrong. SchemaMigrationRunContext identifies the migration itself, pm invokes run once per migration (not once per item), and context.id is the migration ID in both the test helper and production. The reworded comment pointing to context.pm_root for corpus iteration is the accurate framing. Apologies for the misleading suggestion.

  • #1 (medium) — Correction noted and appreciated; the reworded comment is more accurate than what I suggested.
  • #2 (low) — Addressed.
  • #3 (nit) — Auto-generated ordering makes complete sense; leaving it as-is is the right call.

Triggering the full review now.


✏️ Learnings added
Learnt from: unbraind
URL: https://github.com/unbraind/pm-cli/pull/355

Timestamp: 2026-06-24T13:44:34.863Z
Learning: In the `pm-cli` project, `SchemaMigrationRunContext` identifies the migration itself, not an item being migrated. `pm` runs each migration **once** (run-once schema operation). Inside the `run` callback, `context.id` is the **migration ID** (constructed via `resolveMigrationId` in `src/cli/main.ts`), and authors iterate the data corpus themselves via `context.pm_root`. There is no per-item payload in the run context.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

✅ Action performed

Full review finished.

@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 implements the schema capability for the package and extension scaffolding command (pm package/extension init --capability schema). This capability generates a starter template that registers a custom item type, a custom item field, and a schema migration using the SDK builders. Crucially, the generated manifest omits activation.commands to ensure that custom types are registered globally and remain available to built-in commands like pm create. The changes also include updated documentation, shell completion scripts, and comprehensive unit tests. As there are no review comments provided, I have no feedback to address.

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.

When a schema starter's extension name has no hyphen (e.g. "todo"), the
de-hyphenated short alias equals the item type name. Registering an alias
identical to the type name is a redundant self-alias that adds noise to the
generated starter and can confuse alias resolution. Both scaffold paths — the
imperative activate() body (buildActivateBodyLines) and the package README
define* snippet (buildStarterExtensionScaffoldFiles) — now emit an empty
aliases array in that case and keep the useful short alias only for hyphenated
names (e.g. "my-todo" -> ["mytodo"]).

Addresses gemini-code-assist review findings on #355.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TAMJXaMdNwGzsfgmoo44L6
@unbraind

Copy link
Copy Markdown
Owner Author

Thanks @gemini-code-assist — good catch on the redundant self-alias. Addressed in 8a553c1.

Both scaffold paths now compute aliases conditionally: a single-word name whose de-hyphenated form equals the item type name (e.g. todo) emits aliases: [], while a hyphenated name still gets the useful short alias (e.g. my-todo → ["mytodo"]). This applies to both the imperative activate() body and the package README define* snippet, kept in sync. Added a regression test covering both branches.

@coderabbitai full review

/gemini review

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026 •

Copy link
Copy Markdown

@unbraind: The conditional alias logic is clean — single-word names producing aliases: [] avoids the tautological self-alias while hyphenated names still get the useful short form, and keeping the activate() body and the README define* snippet in sync is the right approach. Triggering the full review now.

✅ Action performed

Full review finished.

@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 implements the schema scaffold capability for pm package/extension init, allowing developers to generate starters with custom item types, fields, and migrations. Notably, the generated manifest for the schema capability omits activation.commands to ensure the custom types are globally registered and accessible to built-in commands via conservative activation. The changes also include updated documentation, shell completion scripts, and extensive unit tests covering the new capability. As there are no review comments provided, I have no additional feedback to offer.

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.

@unbraind
unbraind merged commit db1da49 into main Jun 24, 2026
15 checks passed
@unbraind
unbraind deleted the feat/scaffold-schema-capability branch June 24, 2026 14:14
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.

1 participant