Skip to content

docs: add interface-first plugin authoring guide#3132

Draft
sfc-gh-olorek wants to merge 1 commit into
mainfrom
ol/writing-a-plugin-guide
Draft

docs: add interface-first plugin authoring guide#3132
sfc-gh-olorek wants to merge 1 commit into
mainfrom
ol/writing-a-plugin-guide

Conversation

@sfc-gh-olorek

Copy link
Copy Markdown
Contributor

Pre-review checklist

  • If my changes add or modify user-facing interface (commands, flags, output formats), I consulted maintainers and got sign-off beforehand (how).
  • I've confirmed that instructions included in README.md are still correct after my changes in the codebase.
  • I've added or updated unit tests to verify correctness of my new code.
  • I've added or updated integration tests to verify correctness of my new code.
  • Manually tested on macOS
  • Manually tested on Windows
  • I've confirmed my changes are up-to-date with the target branch.
  • I've described my changes in RELEASE-NOTES.md (see when and how).
  • I've updated documentation if behavior changed.

Documentation-only PR: no user-facing interface, no code/tests, no platform-specific behavior — those items are N/A. skip-release-notes applied.

Changes description

Split out from #2862 (the original PR is now the cookiecutter template only).

Adds docs/contributing/writing-a-plugin.md, a contributor guide for the
interface-first plugin pattern:

  • Two-phase contribution workflow (interface → review → implement).
  • Defining the command surface in interface.py (spec dataclasses + handler ABC).
  • Implementing handler.py and wiring it with build_command_spec.
  • Validating the contract with the snowflake.cli.api.plugins.command.testing helpers.
  • Installing/enabling the plugin and using decorators.

Linked from the CONTRIBUTING.md Detailed guides index and cross-linked from
adding-commands.md as an alternative to the classic command layout (consistent
with how the lean CONTRIBUTING.md delegates detail to docs/contributing/*).

All API references were checked against current main: build_command_spec is
imported from ...command.bridge, the ParamDef/spec examples match the current
dataclasses, and the Phase 2 example follows conventions.md SQL-safety rules
(to_string_literal, no raw interpolation).

Pairs with #2862 (the cookiecutter template). Merge #2862 first so the
plugin-template/ references in this guide resolve on main.

Add docs/contributing/writing-a-plugin.md describing the interface-first
plugin pattern: the two-phase contribution workflow, defining the command
surface in interface.py, implementing handler.py, testing the spec/handler
contract, and wiring it together with build_command_spec.

Link it from the CONTRIBUTING.md "Detailed guides" index and cross-link it
from adding-commands.md as an alternative to the classic command layout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant