Skip to content

docs: Rewrite the plugin documentation for the current plugin framework - #1385

Open
TimothyJones wants to merge 1 commit into
mainfrom
claude/plugin-docs-update-ck8mgs
Open

docs: Rewrite the plugin documentation for the current plugin framework#1385
TimothyJones wants to merge 1 commit into
mainfrom
claude/plugin-docs-update-ck8mgs

Conversation

@TimothyJones

Copy link
Copy Markdown
Member

Replaces the outdated reference/plugin-framework page (which predated the real plugin framework and still described the JSii approach) with a new root-level Plugins documentation section, written so that a user with no prior context can implement their own plugin.

What's here

A new docs/plugins/ section with six pages:

  1. Extending ContractCase with plugins (index) — what plugins can do, and an architecture diagram explaining why plugins are TypeScript running in the core regardless of the host language
  2. The anatomy of a plugin — the ContractCasePlugin object, why humanReadableName / shortName / uniqueMachineName are three separate names, the -dsl package split and its rationale, and namespacing rules
  3. Writing matchers — a complete worked example (yourorg:AnyUlid) covering descriptor design, the special _case:matcher:* keys, context modifiers, all four executor functions, the check(strip(x)) invariant, errors-as-values, and child descent with addLocation
  4. Writing mock types — the write/read setup block explained via the function plugin's mirrored caller/execution pair, the mock lifecycle as a sequence diagram, a walkthrough of the real MockFunctionExecution executor, and mockConfig / getPluginConfig
  5. Declaring your DSL — the full PluginDslDeclaration model including PassToMatcher
  6. Loading and distributingloadPlugins, the package-name-only security restriction and why, load-time checks, "both sides need the plugin", and a pre-publishing checklist

Also:

  • reference/plugin-framework is kept alive (retitled "Contract file format") because published TSDoc in case-definition-dsl links to that URL for the matcher format; it now points readers to the new section
  • Four notes added to docs/maintainers/todo.md for gaps found while writing (addressed by the follow-up PRs stacked on this one)

Verification

  • Docusaurus build passes with onBrokenLinks: 'throw', so all internal links and anchors are checked
  • Every TypeScript example was compiled against the real case-plugin-base / case-plugin-dsl-types source with tsc --strict
  • The module-loading behaviour claims were verified empirically against all import/require packaging permutations

🤖 Generated with Claude Code

https://claude.ai/code/session_014mD6p9EEmftbpBQHZZBWB1


Generated by Claude Code

The plugin framework page predated the current plugin API (it still
described the JSii approach, and carried a banner saying it was
inaccurate). Replace it with a new top-level Plugins section that
documents the framework as it is today, written so that a plugin can be
implemented without prior knowledge of ContractCase internals:

- The anatomy of a plugin: the ContractCasePlugin object, the
  description fields and why each name exists, package structure and
  the -dsl split, and type namespacing rules
- Writing matchers: descriptors, the four executor functions and their
  invariants, context modification, descending into children, and the
  match context
- Writing mock types: descriptors, the write/read setup block, the mock
  executor lifecycle, mockConfig, and a worked example from the core
  function plugin
- Declaring your DSL: the PluginDslDeclaration data model (noting the
  generator itself is still work in progress)
- Loading and distributing plugins: loadPlugins, module name
  restrictions, load-time checks, and a pre-publishing checklist

The old /docs/reference/plugin-framework URL is kept alive as the
contract file format reference, since published API documentation links
to it for the matcher format.

Also adds maintainer todo notes for the gaps found while writing these
docs: plugin resolution from the Java connector's temp directory,
loadPlugins missing from the TS DSL, default-export unwrapping in
BoundaryPluginLoader, and completing the DSL generator CLI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014mD6p9EEmftbpBQHZZBWB1
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.

2 participants