|
| 1 | +Toolbox Aid |
| 2 | +David Quesenberry |
| 3 | +04/05/2026 |
| 4 | +BUILD_PR_INTERACTIVE_DEV_CONSOLE_UI.md |
| 5 | + |
| 6 | +# BUILD PR |
| 7 | +Interactive Dev Console UI |
| 8 | + |
| 9 | +## Objective |
| 10 | +Build an on-canvas interactive developer console UI on top of the existing dev console runtime, combo-key controls, |
| 11 | +and canvas HUD so commands can be typed and executed directly in one running sample. |
| 12 | + |
| 13 | +## Implementation Scope |
| 14 | +- Create a dedicated interactive console renderer/input state module |
| 15 | +- Update the existing sample-level dev console integration to support typed input |
| 16 | +- Modify one sample entry file only |
| 17 | +- Keep engine core untouched |
| 18 | +- Reuse existing runtime command execution pipeline |
| 19 | + |
| 20 | +## Required Output |
| 21 | +Codex must produce implementation code and package: |
| 22 | +<project folder>/tmp/BUILD_PR_INTERACTIVE_DEV_CONSOLE_UI_delta.zip |
| 23 | + |
| 24 | +## Target Files |
| 25 | +Expected implementation focus: |
| 26 | +- tools/dev/interactiveDevConsoleRenderer.js |
| 27 | +- tools/dev/devConsoleIntegration.js |
| 28 | +- one sample entry file only |
| 29 | +- optional test file if needed |
| 30 | + |
| 31 | +## Implementation Requirements |
| 32 | + |
| 33 | +### 1. New interactive console renderer |
| 34 | +Create: |
| 35 | +tools/dev/interactiveDevConsoleRenderer.js |
| 36 | + |
| 37 | +Responsibilities: |
| 38 | +- render a console surface on canvas |
| 39 | +- render input prompt + current input buffer |
| 40 | +- render visible output history window |
| 41 | +- render command history cursor state when navigating |
| 42 | +- clip safely when output exceeds visible area |
| 43 | +- tolerate empty history and empty input safely |
| 44 | +- remain dependency-free |
| 45 | + |
| 46 | +### 2. Update dev console integration |
| 47 | +Update: |
| 48 | +tools/dev/devConsoleIntegration.js |
| 49 | + |
| 50 | +Requirements: |
| 51 | +- preserve existing combo keys: |
| 52 | + - Shift + ` => toggle console |
| 53 | + - Ctrl + Shift + ` => toggle overlay |
| 54 | + - Ctrl + Shift + R => reload |
| 55 | + - Ctrl + Shift + ] => next panel |
| 56 | + - Ctrl + Shift + [ => previous panel |
| 57 | +- when console is open: |
| 58 | + - capture printable character input |
| 59 | + - Backspace edits current buffer |
| 60 | + - Enter executes command through existing runtime |
| 61 | + - Escape closes console |
| 62 | + - ArrowUp browses older commands |
| 63 | + - ArrowDown browses newer commands |
| 64 | +- when console is closed: |
| 65 | + - do not capture gameplay typing |
| 66 | +- expose a drawConsole(ctx, state) method |
| 67 | +- keep HUD and console draw paths separate but coordinated |
| 68 | + |
| 69 | +### 3. Sample wiring |
| 70 | +Modify ONE sample entry file only. |
| 71 | + |
| 72 | +Requirements: |
| 73 | +- initialize integration once |
| 74 | +- update diagnostics in the loop |
| 75 | +- draw world first |
| 76 | +- draw HUD last when enabled |
| 77 | +- draw console surface when enabled |
| 78 | +- prevent duplicate listeners/runtime instances across reinit or reload |
| 79 | + |
| 80 | +## UI Rules |
| 81 | +- on-canvas only |
| 82 | +- no DOM dependency required |
| 83 | +- readable font, padding, and translucent background |
| 84 | +- visible prompt marker |
| 85 | +- bounded history size |
| 86 | +- safe line wrapping or truncation strategy |
| 87 | +- save()/restore() around canvas state changes |
| 88 | + |
| 89 | +## Minimum Commands to Validate |
| 90 | +- help |
| 91 | +- status |
| 92 | +- scene.info |
| 93 | + |
| 94 | +## Acceptance Criteria |
| 95 | +- console opens and closes reliably |
| 96 | +- typed text appears on canvas |
| 97 | +- Enter executes commands |
| 98 | +- output history is visible |
| 99 | +- ArrowUp/ArrowDown history navigation works |
| 100 | +- Escape closes cleanly |
| 101 | +- sample still runs normally |
| 102 | +- no F-key bindings reintroduced |
| 103 | +- no engine core files modified |
| 104 | + |
| 105 | +## Validation |
| 106 | +- node --check on all touched JS files |
| 107 | +- manual browser run |
| 108 | +- verify text input |
| 109 | +- verify command output |
| 110 | +- verify invalid command output is shown safely |
| 111 | +- verify input stops being captured after close |
| 112 | +- verify no duplicate listeners after repeated toggles/reloads |
| 113 | + |
| 114 | +## Rollback |
| 115 | +If instability appears: |
| 116 | +- disable console surface rendering |
| 117 | +- preserve runtime and HUD behavior |
| 118 | +- keep combo-key control path intact |
0 commit comments