Skip to content

Latest commit

 

History

History
50 lines (29 loc) · 4.26 KB

File metadata and controls

50 lines (29 loc) · 4.26 KB

Prompt: Fix MCP Tool Friction from Cyberpunk HUD Exercise

Worktree context

The friction log and HUD artifacts were created in worktree nice-hamilton (branch dlight/nice-hamilton). The friction log is at:

.claude/worktrees/nice-hamilton/docs/friction-log-cyberpunk-hud.md

The fixes themselves should be done on a new branch from main (not in nice-hamilton) since they modify server/plugin code. The HUD files in nice-hamilton are test artifacts — don't modify them.

Context

We built a cyberpunk HUD in test_project/ using only MCP tools as a stress test. The friction log documents 12 issues found during the exercise. Your job is to fix them, following the project's conventions in CLAUDE.md and the skill file at ~/.claude/skills/godot-ai/skill.md.

Scope

Fix these issues in priority order. Each fix needs: GDScript handler change, Python handler/tool change, Python tests, and GDScript tests. Follow the "Adding a new tool" checklist in CLAUDE.md. Run pytest -v and test_run before considering any batch done.

Tier 1 — High impact, straightforward fixes

  1. theme_create auto-create parent directories (friction #1): Add DirAccess.make_dir_recursive_p() before saving in the theme handler's create_theme method. Same fix should apply to script_create and any other file-creating handler.

  2. ui_build_layout support theme_override_* properties (friction #7): In ui_handler.gd's _apply_property(), the property path lookup via ClassDB won't find theme_override_* paths. These need special handling — detect the theme_override_ prefix and use add_theme_*_override() methods instead of set(). The three sub-paths are theme_override_colors/, theme_override_constants/, theme_override_font_sizes/.

  3. theme_set_stylebox_flat per-side parameters (friction #5 + #11): Add optional border_width_top, border_width_bottom, border_width_left, border_width_right, corner_radius_top_left, corner_radius_top_right, corner_radius_bottom_left, corner_radius_bottom_right, and content_margin_top/bottom/left/right parameters. When provided, these override the uniform value. StyleBoxFlat already has these properties natively.

  4. editor_screenshot source="game" fix (friction #4): The take_screenshot handler in editor_handler.gd likely has a KeyError when accessing the source param. Debug the handler, find the bug, and fix it. Add a test that captures a game-view screenshot while project_run is active.

Tier 2 — New capabilities

  1. Scene instancing tool (friction #3): Add a scene_instance tool (or extend node_create with an optional scene_path param). GDScript side: load(scene_path).instantiate(), add as child with undo support. This is essential for composition workflows.

  2. animation_delete tool (friction #9): Add animation_delete(player_path, animation_name) that removes a clip from the AnimationPlayer's library. Also consider adding an overwrite: bool = false param to animation_create and animation_create_simple.

  3. Allow renaming scene root (friction #2): Remove the restriction in node_rename. Godot's editor allows this via EditorUndoRedoManager.

Tier 3 — Nice to have

  1. scene_open readiness race (friction #10): The play-state transition from project_stop doesn't fully settle before readiness flips to ready. Either add a small delay in the readiness handler, or have scene_open (and other write tools) internally wait for play-state to fully resolve.

  2. signal_connect autoload support (friction #8): When source/target path resolution fails against the edited scene tree, check ProjectSettings.get_setting("autoload/*") to resolve autoload node paths. This lets agents wire signals to singletons.

  3. Animation track path update/validation (friction #12): Add animation_validate(player_path, animation_name) that checks all track paths resolve to actual nodes. Optionally add animation_update_track_path(player_path, animation_name, track_index, new_path).

Constraints

  • Follow the pre-commit smoke test checklist in CLAUDE.md
  • Every fix gets Python unit tests, integration tests, AND GDScript tests
  • Open a PR for each tier (or one PR per tier)
  • Don't change the cyberpunk HUD files — they're the test artifact