feat: ship Backstage template + @plinth-dev/scaffolder-actions#1
Merged
Conversation
Mirrors plinth-dev/cli's `plinth new` flow inside a Backstage portal so both surfaces produce the same output for the same inputs. - packages/scaffolder-actions: pnpm workspace, tsup ESM build, vitest. Pure functions (scaffold/applyReplacements/fetchAndExtract/forApi/ forWeb) are TS ports of the CLI's Go logic — order-sensitive replacement (full Go module path before bare service-name token); skips node_modules, .git, lockfiles, and binary content; tarball fetch via GitHub's codeload tar.gz endpoint with single-component prefix strip via `tar` package's `strip: 1`. - createPlinthScaffoldAction wraps scaffold() in a Backstage TemplateAction with a JSON-schema input/output contract. No zod runtime dep — schema is plain JSON Schema. - template.yaml at repo root drives the action with form params for name/tiers/module path/ref, registered in a Backstage catalog via the standard URL-location pattern. - 14 vitest tests covering rewrite (api + web fixtures, idempotency, binary skip, empty replacements), fetch+extract (httptest fixture via node:http + tar.create + zlib + 404 + injected fetch), and the scaffold orchestrator (both tiers, web-only, name validation, workspace-must-be-absolute, must-pick-at-least-one tier, default ref behaviour). - CI: Node 22 + pnpm 10 — install/lint/typecheck/test/build green. Roadmap deferred: golden-tree CI parity test against the CLI's output and npm publish of @plinth-dev/scaffolder-actions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mirrors
plinth-dev/cli'splinth newflow inside a Backstage portal. Same inputs → same output, regardless of which surface the user enters from.packages/scaffolder-actions/—@plinth-dev/scaffolder-actionsnpm package. Pure-function core (scaffold,applyReplacements,fetchAndExtract,forApi,forWeb) is a TS port of the CLI's Go logic.createPlinthScaffoldAction()wraps it as a Backstage `TemplateAction` with JSON-schema input/output (no zod runtime dep).template.yaml— Backstage software template at repo root. Form parameters: name, web/api toggles, Go module path, starter ref. Registered into a Backstage catalog via the standard URL-location pattern.Implementation notes
Tests
14 vitest tests:
Roadmap deferred
Test plan
🤖 Generated with Claude Code