Skip to content

feat(sdk): scaffold importers package starters - #338

Merged
unbraind merged 3 commits into
mainfrom
feat/importers-package-scaffold
Jun 22, 2026
Merged

unbraind merged 3 commits into
mainfrom
feat/importers-package-scaffold

Conversation

@unbraind

Copy link
Copy Markdown
Owner

Summary

  • Add pm package init --capability importers / pm extension init --capability importers scaffolds with command-safe import/export registrations, schema-backed flag metadata, and runnable SDK sample tests.
  • Document the new package-author path in SDK/extension docs and expose the capability in help/completion surfaces.
  • Fold compatible GitHub dependency maintenance into this PR: checkout v7.0.0, pnpm/action-setup v6.0.9, softprops/action-gh-release v3.0.1, and @types/node 26.0.0.
  • Regenerate package-owned CHANGELOG.md for pm-j5az and record PM evidence.

Verification

  • pnpm release:gates
  • node scripts/run-tests.mjs coverage -> 100/100/100/100 (Statements 30546/30546, Branches 23823/23823, Functions 5107/5107, Lines 29341/29341)
  • node scripts/run-tests.mjs test -- tests/unit/extensions/extension-command.spec.ts tests/unit/commands/completion-command.spec.ts tests/integration/ci-workflow-contract.spec.ts
  • Manual temp smoke: pm init, pm package init --capability importers, generated npm test, pm install, generated import/export CLI commands
  • pnpm changelog:pm:check
  • pnpm contracts:check
  • pnpm audit --audit-level moderate
  • pnpm security:scan
  • node scripts/release/sentry-telemetry-gate.mjs --json --telemetry-mode best-effort --sentry-window-days 14 --max-critical 0 --max-high 0

Notes

  • No open GitHub issues or Dependabot security alerts were found.
  • commander@15.0.0 was intentionally deferred because it requires Node >=22.12.0 while this package still supports Node >=20.
  • pm validate --check-resolution --check-history-drift returned history drift ok, with pre-existing validate_resolution_missing_fields:227 warnings on older closed items.

Add a first-class pm package/extension init --capability importers scaffold that generates command-safe import/export registrations, schema-backed flag metadata, and runnable SDK sample tests.

Document the new package-author path, expose it in help/completions, cover package and standalone scaffolds, regenerate the package-owned changelog for pm-j5az, and apply compatible Dependabot updates for GitHub Actions pins plus @types/node 26.0.0.

Verification: pnpm release:gates; node scripts/run-tests.mjs coverage (100/100/100/100); focused scaffold/workflow tests; temp-project importers scaffold/install/import/export smoke; pnpm changelog:pm:check; pnpm contracts:check; pnpm audit --audit-level moderate; pnpm security:scan; Sentry/telemetry gate.

@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

@codex review
/gemini review
@gemini-code-assist
@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 22, 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 34 minutes and 51 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 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 configuration

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

Review profile: ASSERTIVE

Plan: Pro

Run ID: a563ff39-93b0-4398-aa9a-861b852f94ce

📥 Commits

Reviewing files that changed from the base of the PR and between bebb6b4 and e73810f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • .agents/pm/features/pm-j5az.toon
  • .agents/pm/history/pm-j5az.jsonl
  • .github/workflows/auto-release.yml
  • .github/workflows/ci.yml
  • .github/workflows/codeql.yml
  • .github/workflows/docs.yml
  • .github/workflows/nightly.yml
  • .github/workflows/release.yml
  • CHANGELOG.md
  • docs/EXTENSIONS.md
  • docs/SDK.md
  • package.json
  • src/cli.ts
  • src/cli/commands/completion.ts
  • src/cli/commands/extension/scaffold.ts
  • src/cli/help-content.ts
  • tests/integration/ci-workflow-contract.spec.ts
  • tests/unit/commands/completion-command.spec.ts
  • tests/unit/extensions/extension-command.spec.ts
📝 Walkthrough

Walkthrough

Adds importers as a new scaffold capability to the extension/package init system: generates paired api.registerImporter/api.registerExporter activation code and node:test suites with SDK helpers, extends CLI completions, help content, and documentation. Separately bumps pinned SHA versions for actions/checkout, pnpm/action-setup, and softprops/action-gh-release across all GitHub Actions workflows and bumps @types/node to ^26.0.0.

Changes

Importers Scaffold Capability

Layer / File(s) Summary
Capability registry, type, and CLI surface
src/cli/commands/extension/scaffold.ts, src/cli/commands/completion.ts, src/cli/help-content.ts
Adds importers to the exported SCAFFOLD_CAPABILITIES list and ExtensionScaffoldCapability union, extends capability-to-manifest mappings, and wires importers into Zsh/Fish completions and help-content examples/tips for both package init and extension init.
Scaffold activation and test codegen
src/cli/commands/extension/scaffold.ts
Extends buildActivateBodyLines to emit api.registerImporter/api.registerExporter with --source/--destination flag metadata; extends buildSampleTestSource to conditionally import SDK testing helpers and generate an importer/exporter assertion test block; adds README bullet and capability-section content for both package and standalone modes.
Unit tests and documentation
tests/unit/extensions/extension-command.spec.ts, tests/unit/commands/completion-command.spec.ts, docs/EXTENSIONS.md, docs/SDK.md
Adds two Vitest cases covering package-mode and standalone importers scaffold output; updates completion spec to include importers in capability list; expands docs/EXTENSIONS.md and docs/SDK.md with importers scaffold instructions and generated test helpers.
Changelog and agent PM records
CHANGELOG.md, .agents/pm/features/pm-j5az.toon, .agents/pm/history/pm-j5az.jsonl
Inserts Unreleased/Added changelog entry; adds pm-j5az feature record and history log capturing lifecycle, artifact list, test plan, evidence, and closure metadata.

GitHub Actions Pin Updates

Layer / File(s) Summary
Workflow action pins, @types/node, and contract test
.github/workflows/*.yml, tests/integration/ci-workflow-contract.spec.ts, package.json
Bumps actions/checkout (v6→v7.0.0) and pnpm/action-setup across all six workflows; bumps softprops/action-gh-release to v3.0.1 in release.yml; updates the CI contract spec to match the new SHA; bumps @types/node to ^26.0.0.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • unbraind/pm-cli#68: Directly overlaps with this PR's workflow action pin changes in .github/workflows/release.yml and the corresponding tests/integration/ci-workflow-contract.spec.ts assertion update.
  • unbraind/pm-cli#332: Extends the same --capability-driven scaffold system in src/cli/commands/extension/scaffold.ts for commands/hooks variants using the same buildActivateBodyLines/buildSampleTestSource plumbing this PR extends for importers.
  • unbraind/pm-cli#333: Adds the search capability to the same scaffold pipeline (capability lists, buildActivateBodyLines, completions, help, docs, tests) that this PR extends with importers.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(sdk): scaffold importers package starters' clearly and specifically describes the main change: adding scaffolding support for importers capability in the SDK.
Description check ✅ Passed The description comprehensively covers the changeset, including the new importers scaffolding capability, documentation updates, dependency maintenance, verification steps, and implementation notes.
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 and usage tips.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

@coderabbitai

coderabbitai Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

@unbraind Sure! I'll kick off a full review of this PR 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 introduces a new importers capability to the package and extension scaffolding system, allowing authors to generate paired import/export commands with schema-governed flag metadata and runnable SDK tests. The changes also update shell completions, documentation, help content, and bump the @types/node dependency to ^26.0.0. The review feedback suggests a usability improvement to use spaces instead of hyphens in the generated command actions for consistency, along with corresponding test updates.

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 +224 to +274
if (capability === "importers") {
return [
...commandLines,
"",
" // Importers/exporters are the bridge between pm's context graph and",
" // another project-management system. Keep the starter deterministic so",
" // package tests can run without touching the network or filesystem; replace",
" // these payloads with your adapter's real mapping as the package grows.",
" api.registerImporter(",
` ${JSON.stringify(adapterName)},`,
" async (context) => ({",
" imported: 1,",
" source: context.options.source ?? \"starter\",",
" args: context.args,",
" }),",
" {",
` action: ${JSON.stringify(`${adapterActionPrefix}-import`)},`,
' description: "Import starter records into pm context.",',
" flags: [",
" {",
' long: "--source",',
' value_name: "name",',
' value_type: "string",',
' description: "Source name or path to import from.",',
" },",
" ],",
" },",
" );",
"",
" api.registerExporter(",
` ${JSON.stringify(adapterName)},`,
" async (context) => ({",
" exported: true,",
" destination: context.options.destination ?? \"stdout\",",
" args: context.args,",
" }),",
" {",
` action: ${JSON.stringify(`${adapterActionPrefix}-export`)},`,
' description: "Export pm context into starter records.",',
" flags: [",
" {",
' long: "--destination",',
' value_name: "name",',
' value_type: "string",',
' description: "Destination name or path to export to.",',
" },",
" ],",
" },",
" );",
];
}

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

For consistency with other scaffolded commands (like the ping command), the generated importer/exporter command actions should use spaces instead of hyphens. This improves CLI usability.

This suggestion changes the action to be built from adapterName. You will also need to remove the unused adapterActionPrefix variable on line 170.

  if (capability === "importers") {
    return [
      ...commandLines,
      "",
      "  // Importers/exporters are the bridge between pm's context graph and",
      "  // another project-management system. Keep the starter deterministic so",
      "  // package tests can run without touching the network or filesystem; replace",
      "  // these payloads with your adapter's real mapping as the package grows.",
      "  api.registerImporter(",
      `    ${JSON.stringify(adapterName)},`,
      "    async (context) => ({",
      "      imported: 1,",
      "      source: context.options.source ?? \"starter\",",
      "      args: context.args,",
      "    }),",
      "    {",
      `      action: ${JSON.stringify(`${adapterName} import`)},`,
      '      description: "Import starter records into pm context.",',
      "      flags: [",
      "        {",
      '          long: "--source",',
      '          value_name: "name",',
      '          value_type: "string",',
      '          description: "Source name or path to import from.",',
      "        },",
      "      ],",
      "    },",
      "  );",
      "",
      "  api.registerExporter(",
      `    ${JSON.stringify(adapterName)},`,
      "    async (context) => ({",
      "      exported: true,",
      "      destination: context.options.destination ?? \"stdout\",",
      "      args: context.args,",
      "    }),",
      "    {",
      `      action: ${JSON.stringify(`${adapterName} export`)},`,
      '      description: "Export pm context into starter records.",',
      "      flags: [",
      "        {",
      '          long: "--destination",',
      '          value_name: "name",',
      '          value_type: "string",',
      '          description: "Destination name or path to export to.",',
      "        },",
      "      ],",
      "    },",
      "  );",
    ];
  }

Comment on lines +2168 to +2171
expect(entry).toContain("api.registerImporter(");
expect(entry).toContain('action: "starter-importers-items-import"');
expect(entry).toContain("api.registerExporter(");
expect(entry).toContain('action: "starter-importers-items-export"');

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

These test assertions should be updated to reflect the suggested change for more consistent command naming (using spaces instead of hyphens).

Suggested change
expect(entry).toContain("api.registerImporter(");
expect(entry).toContain('action: "starter-importers-items-import"');
expect(entry).toContain("api.registerExporter(");
expect(entry).toContain('action: "starter-importers-items-export"');
expect(entry).toContain("api.registerImporter(");
expect(entry).toContain('action: "starter importers items import"');
expect(entry).toContain("api.registerExporter(");
expect(entry).toContain('action: "starter importers items export"');

@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 a new importers capability to the package and extension scaffolding system (pm package init --capability importers). This capability scaffolds paired import/export command registrations (api.registerImporter and api.registerExporter) with schema-governed flag metadata, alongside runnable SDK tests and updated documentation. Additionally, shell completions and help content have been updated to support the new capability, and the @types/node dependency has been upgraded to ^26.0.0. I have no feedback to provide as there are no review comments and the implementation is complete and well-tested.

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.

Generate importer/exporter action identifiers from the same space-separated command path exposed to package authors, matching review feedback on PR #338.

Record focused verification and temp-directory smoke evidence on pm-j5az.
@unbraind

Copy link
Copy Markdown
Owner Author

Fresh head pushed after applying review feedback. Please review the current head.

@codex review
/gemini review
@gemini-code-assist
@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

@unbraind Sure! I'll kick off a full review of the current head now.

✅ Action performed

Full review finished.

@chatgpt-codex-connector

Copy link
Copy Markdown

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

@unbraind

Copy link
Copy Markdown
Owner Author

Gemini follow-up note: the current head 02285d3 already applies the action-name suggestion. The generated importer/exporter actions now use the space-separated adapter command path, the unused adapterActionPrefix variable is removed, tests were updated, and focused tests/build/temp package smoke passed after the change.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 34-38: The actions/checkout step on line 34 is using the default
persist-credentials setting which unnecessarily writes the GITHUB_TOKEN to the
local git config. Since this release workflow does not perform any git push
operations, add persist-credentials: false to the with section of the
actions/checkout action to prevent unnecessary token exposure and improve
security.

In `@package.json`:
- Line 136: The `@types/node` dependency version is misaligned with the minimum
Node.js runtime specified in engines.node. Change the `@types/node` version from
^26.0.0 to ^20.0.0 to match the Node 20 minimum runtime floor declared in the
package.json engines field, ensuring type definitions do not include APIs
unavailable in the minimum supported Node.js version.

In `@src/cli/help-content.ts`:
- Around line 214-215: The help snippet examples contain inconsistent package
names that break the copy/paste flow. In the first set of examples around lines
214-215, the init example uses "my-sync-package" but the install example on the
next line reverts to "my-search-package". Similarly, this same inconsistency
occurs in the second set of examples around lines 256-257. Update the install
example paths to use "my-sync-package" instead of "my-search-package" in both
locations to maintain consistency with the preceding init examples throughout
the help content.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6e463a98-898a-4eeb-a4cd-6c84276645bf

📥 Commits

Reviewing files that changed from the base of the PR and between bebb6b4 and df7e29d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • .agents/pm/features/pm-j5az.toon
  • .agents/pm/history/pm-j5az.jsonl
  • .github/workflows/auto-release.yml
  • .github/workflows/ci.yml
  • .github/workflows/codeql.yml
  • .github/workflows/docs.yml
  • .github/workflows/nightly.yml
  • .github/workflows/release.yml
  • CHANGELOG.md
  • docs/EXTENSIONS.md
  • docs/SDK.md
  • package.json
  • src/cli/commands/completion.ts
  • src/cli/commands/extension/scaffold.ts
  • src/cli/help-content.ts
  • tests/integration/ci-workflow-contract.spec.ts
  • tests/unit/commands/completion-command.spec.ts
  • tests/unit/extensions/extension-command.spec.ts

Comment thread .github/workflows/release.yml Resolved
Comment thread package.json Resolved
Comment thread src/cli/help-content.ts Resolved

@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 a new importers capability to the package and extension scaffolding system (pm package init --capability importers and pm extension init --capability importers). This capability scaffolds paired import/export commands with schema-governed flag metadata, documentation, and runnable SDK tests. Additionally, the PR updates the @types/node devDependency to ^26.0.0 and updates pinned GitHub actions in workflows and tests. There are no review comments to address, and I have no further 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.

Apply CodeRabbit review feedback for release checkout hardening and importers help examples.

Keep Node typings aligned to the Node 20 runtime floor by restoring @types/node to major 20 and making the optional compile-cache API structurally typed.

Record verification and redact the local pnpm store path from pm-j5az history.
@unbraind

Copy link
Copy Markdown
Owner Author

Fresh head pushed after addressing CodeRabbit feedback. Please review the current head.

@codex review
/gemini review
@gemini-code-assist
@coderabbitai full 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 22, 2026 •

Copy link
Copy Markdown

@unbraind Sure! I'll kick off a full review of the current head 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 introduces a new importers capability to the package and extension scaffolding system (pm package init / pm extension init). This capability scaffolds paired import/export commands with example flag metadata, along with runnable SDK-based unit tests and documentation. In addition, the PR downgrades @types/node to ^20.0.0 to maintain compatibility with Node 20, updates the compile-cache optimization to be type-safe against these older typings, and updates shell completions, help content, and integration tests. There are no review comments to address, and the changes are well-implemented and fully tested.

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 c379987 into main Jun 22, 2026
16 checks passed
@unbraind
unbraind deleted the feat/importers-package-scaffold branch June 22, 2026 08:35
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