Adopt pm-cli 2026.7.26 typed authoring contracts and drop the any-cast defineExtension shim
What
Adopts the pm-cli 2026.7.26 typed authoring contracts and removes the forced-any defineExtension shim.
pm item: pm-github-zjxx
Why
This package carried:
import type { defineExtension as defineExtensionType } from "@unbrained/pm-cli/sdk";
const defineExtension: typeof defineExtensionType = ((extension: any) => extension) as any;
Two anys that existed only to bridge a type surface the SDK did not expose. 2026.7.26 adds @unbrained/pm-cli/sdk/authoring with the real contracts.
Approach: local declaration, not a value import
defineExtension is a pure identity function — <T extends ExtensionModule>(module: T) => T. So the shim is replaced with an equivalent locally declared, fully typed helper:
const defineExtension = <TModule extends ExtensionModule>(module: TModule): TModule => module;
Declared locally on purpose. This package's dependency on @unbrained/pm-cli is type-only, so every import erases at build time and the published extension carries no runtime module edge to the CLI. Importing defineExtension as a value would have introduced one. Contract checking is identical, since the constraint is the SDK's own ExtensionModule.
activate is now typed with the real ExtensionApi rather than any, so every api.register* call is checked against the host contract.
Verification
npm run typecheck— cleannpm test— 168 passing- dependency ranges moved to pm-cli 2026.7.26 (first release exposing
sdk/authoring) and pm-changelog 2026.7.25
Summary by cubic
Adopts @unbrained/pm-cli 2026.7.26 typed authoring contracts and removes the any-cast defineExtension shim for better type safety with no runtime edge. Consumers need @unbrained/pm-cli >= 2026.7.26.
-
Refactors
- Type-only import
ExtensionApiandExtensionModulefrom@unbrained/pm-cli/sdk/authoring. - Replace the shim with a local typed identity
defineExtension<T extends ExtensionModule>(module). - Type
activate(api: ExtensionApi)and remove remaininganycasts. - Close the implementation record and regenerate
CHANGELOG.mdagainst v2026.07.26.
- Type-only import
-
Dependencies
- Bump
@unbrained/pm-clito^2026.7.26(peer:>=2026.7.26). - Bump
pm-changelogto^2026.7.25.
- Bump