feat(template): template new authoring wizard + scaffold builder (spec 23) - #81
Merged
Conversation
…pec 23) Add `devstack template new` — the interactive sibling of `template init` that authors a complete template bundle (template.yaml + optional build/ tree + golden) through one deterministic builder fed by two front-ends. - internal/template/scaffold: pure, deterministic Build(Spec)->Bundle (app vs engine is a compile-time branch; meta emitted as literal YAML via ordered goccy MapSlice; actions only under service:/build); WriteBundle atomic + no-clobber/--force backup; PreviewSource for the real Resolve+LintResolved preview. - Three authoring lints (meta-templating hard error; delimiter-collision and param-type warnings) shared by `template new` preview AND wired into `template lint` (template.ParseCheck added for collision detection). - CLI: newTemplateNewCmd with the full flag surface (--kind/--name/--from/ --extends/--base-image/--param/--port/--provides/--exports/--entrypoint/ --golden/--regold/--dir/--dry-run/--force/--print-spec) + a Bubble Tea v2 wizard gated on prompt.IsInteractive so --json/--quiet/--no-input/non-TTY/CI never enter bubbletea. --print-spec ⇒ --from is a byte-identical round-trip. - template.ValidRef exported for name validation; `template init` unchanged. Co-Authored-By: Claude Opus 4.8 (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.
Implements feature #15 / spec 23 — interactive template & Dockerfile authoring. Built in a parallel worktree, integrated + verified locally (
make ci+ determinism green, smoke-tested end-to-end).What's here
internal/template/scaffold(new, distinct from the workspaceinternal/scaffold):Spec/Bundle/Build(Spec)(Bundle,error)— pure & deterministic. App emitsservice.build+build/Dockerfile(+entrypoint.sh), noprovides; engine emitsimage:+provides/exports/defaultPort+volumes:, nobuild/. App-vs-engine is a compile-time switch with aValidate()guard. Meta as literal YAML (ordered goccy MapSlice, sorted params);[[ ]]only underservice/build.WriteBundlere-implements the atomic temp+rename+0644 pattern with no-clobber +--forcebackup.LintResolvedwas compose-go-only): meta-templating ([[ ]]in a meta key → hard error), delimiter-collision (bad action in abuild/file → warn), param-type (default doesn't parse as type → warn) — shared by bothtemplate newpreview andtemplate lint.template new(internal/cli/template_new.go): full flag surface incl.--from/--print-spec(byte-identical round-trip),--kind/--param name:type[:default]/--entrypoint/--golden/--regold/--dry-run/--force.template initunchanged.template_new_tui.go): kind/name/extends pickers, params loop, live preview via the realResolve→LintResolved, confirm — gated byprompt.IsInteractive && !hasFlags.Verified
make ci+make determinismgreen; CGO=0 4-target cross-build clean; no new deps (huh/v2 already vendored). Smoke:template new --print-spec→--fromround-trip writes the bundle;template lint/template testpass on the authored template; bare non-TTYtemplate newdegrades (no hang).Manual TTY wizard keystrokes still warrant a quick hands-on check (bubbletea can't be driven headlessly; the degrade gate + the builder it feeds are fully tested).
🤖 Generated with Claude Code