feat: town Claude Code plugin + town generate CLI#39
Merged
Conversation
Adds a skills-only Claude Code plugin at `plugin/` (declared via `.claude-plugin/marketplace.json`, following core's marketplace pattern) that teaches Claude to scaffold, edit, generate art for, staff, and ship Towns end-to-end through the `town` CLI. Four skills: author-town, generate-plot (with an iterative read-PNG + amend-concept loop capped at 3 tries), write-npc, and manage-towns. Also adds `town generate exterior|interior <concept>` — a new CLI subcommand that hits a new `POST /api/creator/images` endpoint. The endpoint reuses the existing gpt-image-1 + sharp pipeline (extracted into `lib/creator/image-gen.ts` so in-chat tools and the CLI share one prompt recipe), preflights + debits IMAGE_GEN_AURA_COST, and returns the PNG bytes plus `auraConsumed` / `auraRemaining` so the CLI can show cost per generation. The plugin's `generate-plot` skill depends on this command. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
plugin/(declared via.claude-plugin/marketplace.json, matching core's marketplace layout). Four skills:author-town,generate-plot,write-npc,manage-towns— teach Claude to scaffold, edit, staff, and ship Towns end-to-end through thetownCLI.town generate exterior|interior <concept>CLI command — new subcommand that produces a single pixel-art PNG for a custom plot and printsaura consumed / remaining.POST /api/creator/images— CLI-facing endpoint reusing the existing gpt-image-1 + sharp pipeline (extracted intolib/creator/image-gen.tsso in-chat tools and the CLI share one prompt recipe). Preflights aura, race-safe debit, returns PNG bytes + aura consumed/remaining.Skill highlights
generate-plothas an explicit iterative loop: generate → Read the PNG → score against a 10-item visual checklist → amend the concept and retry (cap 3) → bail out reporting total aura spent if it still fails ≥ 3 items. This is the quality bar the plugin needs to justify spending ~60 aura per custom building.author-town,write-npc, andmanage-townscross-reference each other so the flow is: author-town scaffolds and browses the catalog → hands off to generate-plot for custom art or write-npc for personas → hands off to manage-towns for deploy.Layout
Install as:
/plugin marketplace add RedPlanetHQ/town→/plugin install town@redplanethq.Test plan
pnpm --filter @town/web run typecheckpassespnpm --filter @redplanethq/town run typecheckpassespnpm --filter @redplanethq/town run buildsucceeds;dist/commands/generate.jspresentgenerate_exterior/generate_interiortools still behave identically after refactor intoimage-gen.ts(same prompt strings, same aura cost of 25)town login→town generate exterior "brick coffee shop" --out /tmp/e.png— writes PNG, prints aura debitPOST /api/creator/imagesreturns 402 withauraRemainingwhen town aura < 25claude --plugin-dir ./pluginand invoke/town:generate-plotend-to-end (needs PAT + aura)🤖 Generated with Claude Code