Repository navigation
new-plugin scaffolds a provider's source on a kind; which-kind guide (I19.7) - #219
Conversation
--provider/--name/--category/--homepage, --source/--kind/--reader/--layer, --url and --package (repeatable), asked for in a terminal when missing; every kind and reader scaffolds (apisurface included, an OpenAPI adapter gets its Versions stub), plugins/all gets a new kind's import, and the old --format flags keep working for one release. make new-plugin ARGS=. docs/which-kind.md asks which kind a source is; a test checks every registered source's kind is one of its answers. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: adssib <[email protected]>
|
Claude finished @adssib's task in 1m 28s —— View job Rules
Bugs
Verified
Non-blocking
|
| // when one of the provider id, the source id or the kind is missing (a full | ||
| // command line asks nothing). | ||
| func ask(o *Options, in *bufio.Reader, out io.Writer) error { | ||
| if o.ProviderID != "" && o.SourceID != "" && o.Kind != "" { |
There was a problem hiding this comment.
The documented command fails for a new provider. When --provider, --source and --kind are all given, this returns before asking for anything. A new provider's --name is required, though, so make new-plugin ARGS='--provider acme --source api --kind openapi' (the example in the Makefile, the AGENTS.md command block and docs/which-kind.md) stops in Run with:
new-plugin: --provider "": want the provider's name, ...
That happens even in a terminal, where the PR says the command asks for what's missing. One fix: drop the early return, since prompt/list already skip fields that are set. If "a full command line asks nothing" should stay true, change the condition so it also asks when the provider isn't registered and o.Provider == "". Worth adding a TestAsksWhatIsMissing case for an unregistered provider with only these three flags.
Signed-off-by: adssib <[email protected]>
Signed-off-by: adssib <[email protected]>
Stacked on #218
Closes #178
What this changes
new-pluginscaffolds a provider with sources on the merged kinds (I19.7), and the "which kind?" guide.--provider <id> --name --category --homepage(a registered provider's come from the registry and must match),--source <id> --kind openapi|changelog|notices|migrationguide|catalog|apisurface --reader …(for a kind with several: changelog markdown|json, notices deprecations|feed, migrationguide sdk|members),--layer,--urland--package(repeatable),--watches,--page,--api(the first name; default<provider>-<source>). In a terminal it asks for what's missing (provider id, then a new provider's name/category/homepage, source id, kind, reader, layer, URLs, packages, watches). One source per run.Versionsstub next toLatestTag/Fetch; every other kind lists, reads and extracts itself), theRegisterProviderblock with every metadata field includingPackages, the golden + drop test skeleton over placeholders, the testdata README rows,providers/<name>.md, and the kind's import inplugins/allwhen it's new. It refuses a takenprovider/sourceid or first name and changes nothing. New template:apisurface(its test builds placeholder wheels in memory).--api --provider <Name> --format <format> --source <URL>) still work for one release, mapped to the new kinds.make new-plugin ARGS='…'.docs/which-kind.md: one question per kind, in order;TestWhichKindNamesEveryKindfails if a registered source's kind isn't one of its answers. README, AGENTS.md, CONTRIBUTING.md anddocs/writing-a-plugin.md(step 1 = the new flags and prompts) updated; provider pages say "Kind:".Acceptance criteria
new-plugin's own test scaffolds one source per kind and reader (9 templates) into a copy of the repo and builds, vets and tests it, andlist-pluginslists each with its packageChecks
make checkpasses (tidy, build, gofmt, vet, import allowlist, net/http guard,go test -race, noTODO(new-plugin), leak guard);make contractagainst patch-it'smainfixtures passes (11 files).Related PRs
apps/plugins-repo.md)v0.3.0(see "What the next bump changes" in the combined PR); the contract change this stack prepares for: patch-it-dev/patch-it#58 (adopted in a separate PR after it merges)🤖 Generated with Claude Code