scripts: add migrate-v1-to-v2 for v2 spec migration#63
Open
bendebury wants to merge 1 commit into
Open
Conversation
Standalone Go script kit authors run to convert their spec.yaml from schemaVersion 1 to schemaVersion 2. Today's scope covers Phase 1 cosmetic renames: memory: → agentContext: kind: agent → kind: sandbox agent: → sandbox: The script writes a .bak of the original, then rewrites the spec in place. Comments, blank lines, and block-scalar formatting are preserved (regex-based line replacement rather than YAML re-marshal). Running on an already-v2 spec is a no-op and does not create a .bak. Designed to grow with the v2 migration: each later phase (volumes redesign, credentials redesign, settings lift) extends applyPhase1Transforms with its own transform pass as the corresponding PRs land. See scripts/README.md for the current scope and the v2 spec doc in docker/sandboxes for the migration roadmap. The script is intentionally standalone — no module dependencies outside the Go standard library — so kit authors can run it via `go run scripts/migrate-v1-to-v2.go <path>` without pulling the rest of sbx-kits-contrib's deps. Tests are golden-file based under scripts/testdata/: one v1 input and one v2 expected fixture per scenario, with byte-for-byte comparison including whitespace and comments. Adds CONTRIBUTING.md and scripts/README.md pointers so kit authors find the script without having to read the source. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: catherine bendebury <catherine.bendebury@docker.com>
3 tasks
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
Standalone Go script kit authors run to convert their
spec.yamlfrom schemaVersion 1 to schemaVersion 2. Lands ahead of the rest of the v2 migration so kit authors have a working tool the moment the breaking changes start shipping.The script is intentionally incremental. Today's scope covers Phase 1 cosmetic renames; later phases (volumes redesign, credentials redesign, settings lift) extend the same
applyPhase1Transformspattern as their PRs land. Seescripts/README.mdfor the current scope and the v2 spec doc on docker/sandboxes for the migration roadmap.Usage
Writes
<path>/spec.yamlin place and leaves<path>/spec.yaml.bakas a backup. Running on an already-v2 spec is a no-op and does not create a.bak.Transforms (Phase 1)
kind: agentkind: sandboxagent:blocksandbox:blockmemory:fieldagentContext:fieldDesign
package mainwith only stdlib imports, so kit authors cango runagainst any checkout without pulling sbx-kits-contrib's deps..bak— if a previous migration left one, the script errors rather than silently overwriting the backup.agent:(unlikely but possible) is left alone.Test plan
scripts/testdata/— v1 input + v2 expected pairs compared byte-for-bytemigrate()function against temp-dir copies of the fixtures.bakverificationgo test ./scripts/...greenDocs
scripts/README.md— canonical usage reference, scope-as-it-grows, fixture conventionsCONTRIBUTING.mdadds a "Migrating an existing kit to v2" section pointing at the script🤖 Generated with Claude Code