Skip to content

Simulator logger and diagnostic dump implementation plan

For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

Goal: Add one-click diagnostic dump export/import with automatic state restore, and provide a header-level logger toggle that reloads the simulator with the selected logger mode.

Architecture: Keep docs server CLI focused on serving/opening docs and remove logger-specific startup flags. In simulator runtime, keep enableLogger as local UI state (default off), rebuild the map instance after toggle, and show explicit ON/OFF state in the header.

Tech Stack: Node.js CLI (bin/docs-server.js), Vue 3 composables/components in src/simulator, TypeScript runtime guards, browser File API.


Task 1: Simplify docs CLI logger behavior

Files:

  • Modify: bin/docs-server.js
  1. Remove --logger and --no-logger options from CLI help text and parser.
  2. Remove simulator logger URL mapping logic during auto-open.
  3. Keep --open behavior unchanged and open the docs root endpoint directly.

Task 2: Add simulator dump types and payload model

Files:

  • Modify: src/simulator/types/index.ts
  1. Add SimulatorDiagnosticDumpPayload and SimulatorDiagnosticDumpFile types.
  2. Keep payload minimal: mapHex, pathHex, roomProperties, runtime.
  3. Use versioned schema (version: 1) for forward compatibility.

Task 3: Add robust export/import behavior in playground composable

Files:

  • Modify: src/simulator/core/useRuntimeBindings.ts
  • Modify: src/simulator/core/usePlaygroundRender.ts
  • Modify: src/simulator/core/useMapPlayground.ts
  1. Add a runtime snapshot apply helper to useRuntimeBindings for post-render runtime restore.
  2. Implement exportDiagnosticDump():
    • Serialize current input + runtime to JSON.
    • Trigger browser file download with local-time filename suffix .simulator-dump.json.
  3. Implement importDiagnosticDump(file):
    • Read and validate JSON shape.
    • Validate and normalize runtime fields against runtime defaults.
    • Restore input values.
    • Re-render map.
    • Stop import flow if rendering fails.
    • Apply runtime snapshot only after successful render.

Task 4: Add global header controls for dump and logger toggle

Files:

  • Modify: src/simulator/components/SimulatorActionBar.vue
  • Modify: src/simulator/components/SimulatorMapPlayground.vue
  • Modify: src/simulator/core/useMapPlayground.ts
  1. Keep dump import/export controls in the global header toolbar.
  2. Add a dedicated logger toggle button with clear ON/OFF visual states.
  3. Set logger default state to off.
  4. On logger toggle, rebuild/re-render map so config.global.enableLogger takes effect immediately.

Task 5: Add traceability record for this iteration

Files:

  • Modify: docs/records/plans/2026-03-11-simulator-logger-dump-plan.md
  1. Update approach to reflect header-level logger toggle.
  2. Remove outdated CLI logger-flag acceptance criteria.
  3. Keep record in English and aligned with project traceability requirements.

Task 6: Verify and report

Commands:

  1. Run npm run lint.
  2. Run npx tsc --noEmit.
  3. Report results and any follow-up risks.

最后更新于: