[feat] kit: reusable build-your-own core + examples (STAR-45)#27
Merged
Conversation
starcli is the standard, fully-loaded build; factor its runtime construction into a small reusable core, github.com/1set/starcli/kit, that both the turnkey CLI and a user's own shell go through β so they behave identically. kit turns an embedded Starlark script plus a chosen set of modules and runtime knobs into a ready-to-run starbox. It depends only on starbox + starlet (never on any starpkg module), so a build-your-own shell pulls in only the modules it actually wires. Three wiring styles compose: WithModules (builtins), WithLoader (an explicit starpkg/custom loader), and WithDynamicLoader (a registry β how the CLI exposes every starpkg module). BuildBox is rewritten to translate its options into kit options and delegate construction to kit.Box(); the CLI-specific concerns (capability gating, scenario printer, file logging) stay in the cli layer as a thin wrapper. The existing e2e/web/cli suites pass unchanged, so the refactor is behaviour- preserving. Adds examples/ as a separate module (minimal deps, out of the coverage gate): hello (the smallest shell) and qrcard (wiring one starpkg module), plus a build-your-own quickstart. A non-gating CI job builds the examples module. Co-Authored-By: Claude Opus 4.8 <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.
What & why
starcliis the standard, fully-loaded build. STAR-45 introduces abuild-your-owntrack: a few-line Go shell that embeds your Starlark scripts and wires only the modules you need. To keep the project consistent, the CLI's runtime construction is factored into a small reusable core βgithub.com/1set/starcli/kitβ that both the turnkey CLI and a user's own shell go through, so they behave identically.kitTurns an embedded script + chosen modules + runtime knobs into a ready-to-run
starbox. Depends only onstarbox+starlet(never on any starpkg module), so a build-your-own shell pulls in only what it actually wires. Three composable wiring styles:WithModules("json","math")WithLoader("qrcode", loader)WithDynamicLoader(fn)starcliitself wires every starpkg module)Unity (the CLI reuses it)
BuildBoxis rewritten to translate its options intokitoptions and delegate construction tokit.Box(). CLI-specific concerns (capability gating, scenario printer, file logging) stay in theclilayer as a thin wrapper. The existing e2e/web/cli suites pass unchanged β the refactor is behaviour-preserving.Examples
examples/is a separate Go module (minimal deps, out of the coverage gate):helloβ the smallest shell (embed + one call)qrcardβ wiring a single starpkg module (qrcode); its whole dep tree isstarbox+qrcodeA non-gating CI job builds the examples module.
Verification
go test -race -count=2 ./...green (incl. e2e/web safety net)kitcoverage 97.5%; total 76.3% (floor 65)gofmt/go vetclean; examples build + vet + run locallyRefs STAR-45.
π€ Generated with Claude Code