Skip to content

Source starter kits from new service#1846

Open
harmony7 wants to merge 3 commits into
mainfrom
kats/starter-kits
Open

Source starter kits from new service#1846
harmony7 wants to merge 3 commits into
mainfrom
kats/starter-kits

Conversation

@harmony7

Copy link
Copy Markdown
Member

Change summary

Fastly is consolidating the ~40 standalone fastly/compute-starter-kit-* template repos into a single monorepo, served by a new starter-kit edge service (https://compute-starter-kits.fastly.dev).

This PR updates fastly compute init to talk to it.

  • New --from=starter-kit/<lang>/<name> form. Resolves directly against a tarball endpoint exposed by the edge service, reusing the existing tarball-fetch/extract code path unchanged (pkg/commands/compute/init.go).

  • Transparent legacy-repo redirect. When --from (or a re-clone of a previously-deployed service's cloned_from metadata) points at a fastly/compute-starter-kit-* repo, the CLI checks for a root-level .starter-kit-id marker file before cloning. If present, its contents (starter-kit/<lang>/<name>) are resolved against the new service instead — the legacy repo is never cloned. Absent/unreadable/malformed marker files fall back to today's git-clone behavior unchanged. See pkg/commands/compute/starterkit_redirect.go.

  • Interactive picker now sources live from the edge service instead of the ~11-kit list previously baked into pkg/config/config.toml at build time. Results are filtered to catalog.show_on_cli and to kits supported by the running CLI version (catalog.min_cli_version), with the "default" kit sorted first (pkg/commands/compute/language.go).

    • If there are kits that are perhaps deemed too esoteric to bring up here, we can hide them using this mechanism
  • New pkg/starterkit package: typed client for the edge service (Kits, TarballURL, ParseFrom), mirroring the existing pkg/github client pattern.

  • Removed the old mechanism: scripts/config.sh's per-kit curl/tomlq loop, config.StarterKit/StarterKitLanguages types, and the [[starter-kits]] section of the generated config.

Two latent bugs surfaced (and are fixed) by this change:

  • The CLI-version gate was comparing against revision.AppVersion's "unknown version" sentinel (v0.0.0-unknown), which parses as valid semver and is lower than any real min_cli_version — this hid every starter kit for anyone running a local/dev build. Now treated the same as "unknown."
  • pkg/file/archive.go's Extract() checked for fastly.toml relative to the process's cwd instead of the archive's actual destination — invisible until now because every archive-extraction path previously had dst == cwd; exposed once the default interactive kit became tarball-sourced, breaking compute init --directory <dir>.

All Submissions

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Large portions of this submissions were written with assistance from Claude Code.

New Feature Submissions

  • Does your submission pass tests?

Changes to Core Features

  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?

New unit tests in pkg/starterkit, pkg/commands/compute/language_test.go, and pkg/commands/compute/starterkit_redirect_test.go (all fully mocked, no network). Existing pkg/commands/compute/init_test.go scenarios updated for the new starterkit.Kit-based fixtures, plus two new scenarios exercising --from=starter-kit/<lang>/<name> and the .starter-kit-id redirect end-to-end against the real, live edge service and a real legacy repo fixture (github.com/fastly/compute-starter-kit-typescript-default) under TEST_COMPUTE_INIT=1.

make test (full suite, -race) and golangci-lint run --new-from-rev=origin/main both pass clean.

User Impact

  • fastly compute init --from starter-kit/<lang>/<name> is a new, directly-usable form.
  • Existing --from=<github-url> and local-path/zip/tar.gz behavior is unchanged.
  • The interactive "no --from" starter-kit prompt now requires network connectivity (it previously worked from an embedded list). This wasn't fully offline before either, since selecting a kit still triggered a real git clone or download — this just moves that dependency one step earlier, to listing the options themselves.
  • Any fastly/compute-starter-kit-* repo that gets a .starter-kit-id marker file added will transparently redirect existing users of --from=<that-repo-url> to the new service, with no CLI-side action needed, so long as they update to this new version.

Are there any considerations that need to be addressed for release?

  • Every kit in the live manifest currently declares min_cli_version: "16.0.0" — this should ship as (or after) v16.0.0, otherwise the interactive picker will show zero kits.
  • The .starter-kit-id marker file format (when writing this file into legacy repos) is starter-kit/<lang>/<name> (matches the new --from syntax).
  • No config_version bump needed — the removed [[starter-kits]] config section is a pure field removal, and old persisted user configs with stale entries there are simply ignored by the TOML parser.

@harmony7
harmony7 requested a review from a team as a code owner July 14, 2026 17:21
@kpfleming

Copy link
Copy Markdown
Member

If I'm not mistaken, the only usage of Rust in this repository was for tomlq, and since this PR eliminates that we can remove any remaining Rust-related bits too.

@anthony-gomez-fastly anthony-gomez-fastly left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! thank you!

@rcaril rcaril left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks!

@harmony7

Copy link
Copy Markdown
Member Author

This must not be merged until the https://github.com/fastly/compute-starter-kits repo goes public

@harmony7
harmony7 force-pushed the kats/starter-kits branch from f18c849 to aaef935 Compare July 15, 2026 05:23
@harmony7

harmony7 commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

If I'm not mistaken, the only usage of Rust in this repository was for tomlq, and since this PR eliminates that we can remove any remaining Rust-related bits too.

@kpfleming Can you help me with that? It's hard for me to tell which ones can be safely removed, because some of the CI seems to still use Rust (e.g. in testing where it builds a sample rust app)

@harmony7

Copy link
Copy Markdown
Member Author

@anthony-gomez-fastly @rcaril @kpfleming
I added another changeset where I updated the documentation of --from and added an example. Please take a look.

@kpfleming

Copy link
Copy Markdown
Member

Can you help me with that? It's hard for me to tell which ones can be safely removed, because some of the CI seems to still use Rust (e.g. in testing where it builds a sample rust app)

Let's just ignore the removal of Rust then, it's not that important.

@anthony-gomez-fastly

Copy link
Copy Markdown
Member

Ty for updating the command docs, looks great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants