Skip to content

feat(bootstrap): keep one deployment target and prune the other - #35

Merged
ciaransweet merged 2 commits into
mainfrom
feat/bootstrap-target-choice
Sep 8, 2026
Merged

feat(bootstrap): keep one deployment target and prune the other#35
ciaransweet merged 2 commits into
mainfrom
feat/bootstrap-target-choice

Conversation

@ciaransweet

Copy link
Copy Markdown
Contributor

The last phase of #28. This repository carries both deployment targets; an
instance is meant to keep one. Until now nothing removed the other.

./scripts/bootstrap now asks which target you want before anything else, and
scripts/prune-target removes the other: its workflow, its directory under
infra/, its dependency groups, its config file in every toolset, and its
blocks in the shared files. Bootstrap then re-locks, since the dependency
groups moved and every image build runs uv sync --frozen, and sets the
variables that target's deploy reads.

How the shared files are split

A target:k8s or target:aws marker comment delimits a block that goes with
its target, written in the host file's own comment syntax so both blocks sit in
a valid file. target:both marks text that only makes sense while the choice
is open. Nothing is rewritten in place: a line mixing the two targets has to be
split first, because a regex that edits half a line is the kind of thing that
silently stops matching.

The kept target's markers are unwrapped afterwards, and the prune removes
itself and its test last, so a bootstrapped repo reads as an ordinary
repository rather than a half-used template.

Breaking change

./scripts/bootstrap prompts for a target, so a non-interactive call that
passed only a namespace now stops and asks. Pass --target k8s (or aws) to
keep it non-interactive.

Nothing changes for an already-deployed instance until it runs bootstrap.

Verified

Both targets pruned in a copy of the repo, then linted, tested, and put through
their own check: helm lint on one side, a four-shape cdk synth with an
empty missing on the other. The tests do the same thing on every run, which
is what catches a marker someone forgets to close.

Closes #28

🤖 Generated with Claude Code

@ciaransweet
ciaransweet force-pushed the feat/bootstrap-target-choice branch 2 times, most recently from d6a52d2 to 553661c Compare September 8, 2026 15:43
ciaransweet and others added 2 commits September 8, 2026 16:48
Both targets live here, and an instance is meant to keep one. Nothing said
which lines were whose, so removing a target meant reading every file and
judging each paragraph.

A `target:k8s` or `target:aws` marker comment now delimits a block that goes
with its target, written in the host file's own comment syntax so both blocks
can sit in a valid file. `target:both` marks the third kind: text that only
makes sense while the choice is open, such as the sentence telling you to make
it.

Nothing is rewritten in place, so lines that mixed the two targets had to be
split, and a few are simply target-neutral now — a `case` arm matching index
sentinels by shape, a mypy invocation that asks for the AWS dependency group
only when the stack is there, and prose that named the charts and the stack
where it meant "the deployment".

No behaviour changes: every marker is a comment.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`./scripts/bootstrap` now asks which target you want before anything else, and
`scripts/prune-target` removes the other one: its workflow, its directory under
infra/, its dependency groups, its config file in every toolset, and its
blocks in the shared files. The surviving target's markers are then unwrapped,
so a bootstrapped repo carries no trace of having been a template with a
choice in it. Bootstrap re-locks afterwards, since the dependency groups moved
and every image build runs `uv sync --frozen`.

It also sets the variables that target's deploy reads — MCP_NAMESPACE, or
MCP_AWS_INSTANCE and MCP_AWS_REGION — and refuses a target this repo no longer
has rather than pruning the one you are on.

The prune removes itself and its test last. A repository that has chosen
cannot choose again, so the machinery is useful exactly once, and a test
asserting things about a target that is gone is worse than no test.

Tested by pruning a copy of the repo both ways and reading the result, because
what breaks here is not the algorithm but a marker someone forgets to close.
Both pruned copies lint, test, and pass their own target's check — `helm lint`
one side, a four-shape `cdk synth` with no lookups the other.

Closes #28

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ciaransweet
ciaransweet force-pushed the feat/bootstrap-target-choice branch from 553661c to c25ee65 Compare September 8, 2026 15:48
@ciaransweet
ciaransweet merged commit 5e2d3ce into main Sep 8, 2026
11 checks passed
@ciaransweet
ciaransweet deleted the feat/bootstrap-target-choice branch September 8, 2026 15:51
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.

Deploy to AWS without EKS: ECS on Fargate, managed with CDK, chosen at bootstrap

1 participant