WORK-626
ID:WORK-626Status:done

Every plugin package exports its manifest and publishes what it declares

SPEC-153 implementation note 1: the packaging prerequisites everything else in that spec rests on. All three failures are invisible in the monorepo, so this step must not be assumed. Measured in SPEC-153:

Priority:mediumComplexity:simpleMilestone:v0.40.0Source:SPEC-153
claude/v040-plugin-manifest-exports View source

Criteria completion

Criteria completion: 5 of 5 (100%) checked; history from Oct 8 to Oct 80%25%50%75%100%Oct 8Oct 8
Branches 2
claude/v040-plugin-manifest-exports current done
claude/post-v0.38-roadmap-jb7pie donemain done
History 2
  1. e0dbdc6
    • ☑ `require.resolve('<pkg>/package.json')` succeeds for all nine plugins, asserted by a test that iterates the plugin list rather than naming two
    • ☑ Every plugin declaring an `exports` map lists `./package.json` in it
    • ☑ Every entry in each plugin's `files` exists on disk after a build, asserted by the same test
    • ☑ `discoverPluginFixtures`' comment no longer attributes the failure to workspace links
    • ☑ A changeset records the `exports` additions
    by bjornolofandersson
  2. d7f2b03
    Created (in-progress)by bjornolofandersson

Acceptance Criteria

  • require.resolve('<pkg>/package.json') succeeds for all nine plugins, asserted by a test that iterates the plugin list rather than naming two
  • Every plugin declaring an exports map lists ./package.json in it
  • Every entry in each plugin's files exists on disk after a build, asserted by the same test
  • discoverPluginFixtures' comment no longer attributes the failure to workspace links
  • A changeset records the exports additions

Resolution

Completed: 2026-10-08

Branch: claude/v040-plugin-manifest-exports PR: refrakt-md/refrakt#675

What was done

  • plugins/plan/package.json, plugins/docs/package.json: added "./package.json": "./package.json" to the exports map. require.resolve('<pkg>/package.json') used to throw ERR_PACKAGE_PATH_NOT_EXPORTED for both and now resolves.
  • plugins/plan/package.json: dropped styles from files, since the directory does not exist. npm pack --dry-run still publishes 157 entries under dist and package.json.
  • packages/runes/test/plugin-manifests.test.ts (new): reads the plugins from plugins/ instead of naming them. For each one it asserts that <pkg>/package.json resolves by name, that any exports map lists ./package.json, and that every files entry exists on disk after a build. With the manifest changes reverted it fails for plan and docs, which reproduces SPEC-153's measurement.
  • packages/runes/src/plugins.ts: corrected the catch comment. It now says the failure means the package is not installed or its exports map leaves out ./package.json. It no longer blames workspace links.
  • .changeset/plugin-manifest-exports.md: patch for plan and docs.

Notes

  • The work item's prose says every plugin gains a ./package.json export. The criterion, and SPEC-153 note 1 ("or no exports map"), only require it of plugins that declare a map. The other seven have no map, and adding one only to carry this entry would close off deep imports into them, so they keep none. The test catches a future map that leaves the entry out.
  • The comment sits in discoverPluginFixtureManifest, which discoverPluginFixtures calls.
  • Finding, not fixed (out of scope): the same catch {} also wraps the fixture loop, so it swallows parseFixture errors. Its docstring says those throw and that the WORK-414 corpus check relies on that. It does nothing today because no plugin ships fixtures/. It should be fixed before one does, ideally together with SPEC-153's plugin-side step.