Skip to content

feat: add QuestCore game editor scaffold with codegen and parser#8

Merged
amirna2 merged 2 commits intomainfrom
feat/editor-scaffold
Mar 8, 2026
Merged

feat: add QuestCore game editor scaffold with codegen and parser#8
amirna2 merged 2 commits intomainfrom
feat/editor-scaffold

Conversation

@amirna2
Copy link
Owner

@amirna2 amirna2 commented Mar 8, 2026

Summary

Adds the QuestCore game editor as a SvelteKit web app in tools/editor/. This PR covers the design doc and Phase 1 implementation: the TypeScript data model, Lua code generation, and Lua import parser — the full round-trip contract between .lua files and the editor's typed model.

Purpose

The editor will let game authors visually create QuestCore games without knowing Lua. This PR proves the foundational contract: we can parse existing .lua game files into a TypeScript model and re-export them as clean Lua. All subsequent UI work (Phases 2-5) builds on this.

What's included:

  • docs/design/editor-design.md — Full technical design document
  • TypeScript data model (export types + editor wrapper types + factory functions)
  • Lua codegen: model → .lua for all content types (game, rooms, items, NPCs, enemies, rules, events)
  • Lua parser: .lua → luaparse AST → walker → table evaluator → typed model
  • Round-trip test: imports all Lost Crown .lua files, re-exports them, and verifies correctness
  • 63 passing tests across 7 test files

Tests Performed

  • npm test — 63 unit tests covering:
    • All 10 condition types and 16 effect types (codegen)
    • Room, entity, rule, event code generation
    • AST walker declaration extraction
    • Table evaluator (records, arrays, helper calls)
    • Full Lost Crown round-trip (import → model → export)
  • npm run check — zero TypeScript/Svelte errors
  • npm run build — production build succeeds

Tests Not Performed

  • make ci — Go CI pipeline doesn't cover the tools/editor/ directory (separate Node.js project)
  • E2E tests — no UI yet (Phase 2)
  • No editor CI job exists yet — will be added when UI is built

CI Checks

  • make ci passes locally

AI Assisted

  • Yes
  • No

🤖 Generated with Claude Code

amirna2 and others added 2 commits March 7, 2026 21:47
Add the editor design doc and initial SvelteKit project scaffold with:
- TypeScript export model (Room, Entity, Rule, Condition, Effect types)
- Editor model layer (EditorItem<T> wrapper with metadata)
- Factory functions for creating new content items
- Known verb list with aliases
- Tailwind 4, Vitest, adapter-static (SPA), luaparse configured
- Directory structure for codegen, parser, validator, store, components

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement the Phase 1 contract: parse .lua files into TypeScript model
and re-export them as clean Lua. Verified with full round-trip of the
Lost Crown game (8 rooms, 10 entities, 30+ rules, 5 event handlers).

Codegen: model → .lua for all content types (game, rooms, items, NPCs,
enemies, rules, events) with condition/effect serialization.

Parser: .lua → luaparse AST → walker → table evaluator → typed model.
Handles both curried syntax (Room "id" {}) and call syntax (Rule(...)).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@amirna2 amirna2 merged commit 9ccd7a8 into main Mar 8, 2026
3 checks passed
@amirna2 amirna2 deleted the feat/editor-scaffold branch March 8, 2026 06:04
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