Skip to content

feat: town Claude Code plugin + town generate CLI#39

Merged
harshithmullapudi merged 2 commits into
mainfrom
feat/town-claude-plugin
Jul 9, 2026
Merged

feat: town Claude Code plugin + town generate CLI#39
harshithmullapudi merged 2 commits into
mainfrom
feat/town-claude-plugin

Conversation

@harshithmullapudi

Copy link
Copy Markdown
Member

Summary

  • Claude Code plugin at 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 the town CLI.
  • town generate exterior|interior <concept> CLI command — new subcommand that produces a single pixel-art PNG for a custom plot and prints aura consumed / remaining.
  • POST /api/creator/images — CLI-facing endpoint reusing 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 aura, race-safe debit, returns PNG bytes + aura consumed/remaining.

Skill highlights

generate-plot has 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, and manage-towns cross-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

.claude-plugin/marketplace.json     ← declares this repo as a marketplace
plugin/.claude-plugin/plugin.json   ← plugin manifest (name: "town")
plugin/skills/
  author-town/SKILL.md
  generate-plot/SKILL.md
  write-npc/SKILL.md
  manage-towns/SKILL.md

Install as: /plugin marketplace add RedPlanetHQ/town/plugin install town@redplanethq.

Test plan

  • pnpm --filter @town/web run typecheck passes
  • pnpm --filter @redplanethq/town run typecheck passes
  • pnpm --filter @redplanethq/town run build succeeds; dist/commands/generate.js present
  • Verified in-chat generate_exterior / generate_interior tools still behave identically after refactor into image-gen.ts (same prompt strings, same aura cost of 25)
  • Manual: town logintown generate exterior "brick coffee shop" --out /tmp/e.png — writes PNG, prints aura debit
  • Manual: POST /api/creator/images returns 402 with auraRemaining when town aura < 25
  • Manual: Load the plugin via claude --plugin-dir ./plugin and invoke /town:generate-plot end-to-end (needs PAT + aura)

🤖 Generated with Claude Code

harshithmullapudi and others added 2 commits July 9, 2026 09:47
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>
@harshithmullapudi
harshithmullapudi merged commit 8d59f2d into main Jul 9, 2026
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