Skip to content

[feat] kit: reusable build-your-own core + examples (STAR-45)#27

Merged
vt128 merged 1 commit into
masterfrom
star-45-kit-build-your-own
Jun 28, 2026
Merged

[feat] kit: reusable build-your-own core + examples (STAR-45)#27
vt128 merged 1 commit into
masterfrom
star-45-kit-build-your-own

Conversation

@vt128

@vt128 vt128 commented Jun 28, 2026

Copy link
Copy Markdown
Member

What & why

starcli is the standard, fully-loaded build. STAR-45 introduces a build-your-own track: 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.

Go is the shell, Starlark is the app. main.go stays a few lines; logic lives in //go:embed'd .star files.

kit

Turns an embedded script + chosen modules + runtime knobs into a ready-to-run starbox. Depends only on starbox + starlet (never on any starpkg module), so a build-your-own shell pulls in only what it actually wires. Three composable wiring styles:

Option Resolves as For
WithModules("json","math") starlet builtins the stdlib
WithLoader("qrcode", loader) an explicit loader you import a specific starpkg/custom module
WithDynamicLoader(fn) a registry on demand exposing many modules (how starcli itself wires every starpkg module)

Unity (the CLI reuses it)

BuildBox is rewritten to translate its options into kit options and delegate construction to kit.Box(). 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 β€” 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 is starbox + qrcode
  • a build-your-own quickstart README

A non-gating CI job builds the examples module.

Verification

  • go test -race -count=2 ./... green (incl. e2e/web safety net)
  • kit coverage 97.5%; total 76.3% (floor 65)
  • gofmt/go vet clean; examples build + vet + run locally

Refs STAR-45.

πŸ€– Generated with Claude Code

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>
@vt128 vt128 merged commit 5ba6220 into master Jun 28, 2026
7 checks passed
@vt128 vt128 deleted the star-45-kit-build-your-own branch June 28, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant