fix(sdk): preserve declared defaults across discovery and templates

Merged
UN
2d ago
+536-56

Extension defaults were applied during execution but omitted from discovery, and SDK template save silently dropped numeric priority 0. This change makes declared defaults discoverable and preserves template priority through persistence and creation.

  • Publish original extension defaults in text/JSON help, runtime flag contracts and command JSON Schema, including falsy values and arrays. Explicit list values keep their existing override behavior.
  • Export TemplatesSaveOptions, normalize numeric/string/named priority before persistence, and reject invalid priority values without changing template or workspace-history bytes.
  • Add installed-extension and reusable-helper contracts, persistence/override regressions, public type checks, SDK documentation and the package-generated changelog.

Tracked by pm-gh1560, pm-gh1561 and pm-pr1570-review. All three are closed with evidence and released claims. Tracker mutations came through pm.

Validation: hosted CI 40069111305 on code head 014b3bcb1 passed all 26 required checks, with exact full-source 100/100/100/100 coverage, 11,195 passing tests and three Windows-only skips in the Linux coverage cohort. The required Windows cohorts and packed Node 22.18/24 consumers also pass. Pre-fix controls fail against the original implementation. The final tracker closeout repeats required checks before merge. Local typecheck, docstring, SDK surface, regression, duplicate, defect, integrity, graph, context, secret and changelog checks are recorded in PM.

CodeRabbit completed a full review; its one actionable audit finding was corrected through pm and its thread resolved. Reviews were requested again after each subsequent push. Later CodeRabbit requests reached its included allowance; Sourcery, Cubic and Greptile report quota/trial limits. Those limits are not review approvals.

Latest pm-changelog 2026.10.23 generates the two actual fixes in Unreleased. Public 2026.10.24 npm/npx and Bun/bunx consumers pass; these fixes await the next eligible daily cut. Intake verified PM-link comments on all 32 then-open issues and zero open PRs/security alerts. Historical release reliability, planned dependency migrations, the two generated-plugin CodeFactor duplicates and DeepScan's auxiliary ESLint failure retain existing canonical owners.

Closes #1560
Closes #1561

Summary by Sourcery

Preserve declared extension defaults during discovery and ensure template priorities remain valid and intact through SDK persistence and creation.

Bug Fixes:

  • Preserve declared extension flag defaults across text and JSON help, runtime contracts, and command schemas, including falsy scalar and array values.
  • Normalize and persist template priorities across supported numeric, string, and named inputs while rejecting invalid values without modifying existing data.

Enhancements:

  • Expose the public TemplatesSaveOptions type through the aggregate and runtime SDK surfaces.

Documentation:

  • Document extension default discovery and template priority validation and persistence behavior in the SDK guide.

Tests:

  • Add regression coverage for extension default discovery, explicit list overrides, template priority persistence, invalid-input atomicity, and public SDK type exports.

Chores:

  • Update the generated changelog and project tracking records for the completed fixes and review.