Scaffolder duplicates templates/ boilerplate and a second manifest renderer

Offen
#51 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Refactoring
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv

Rechercherichtung

Start in mcp-server/tools/scaffold.py (_build_manifest, _scaffold_lua/_js/_csharp) and compare it with generate_manifest in mcp-server/tools/manifest_gen.py and manifest_common.py, then with the matching folders under templates/. Step one is golden-output tests for scaffold_resource and snapshot tests for generate_manifest, since no test suite exists yet. Done means one shared manifest renderer, scaffold output matching templates/<framework> after substitution, and a decision on NUI support.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

severity: medium tech-debt

Summary

scaffold_resource_tool builds every file from inline Python strings and never reads templates/, and it has its own manifest renderer separate from generate_manifest. The copies have already drifted from the templates and from each other.

Where

  • mcp-server/tools/scaffold.py:15-33 (FRAMEWORK_INIT_CLIENT / FRAMEWORK_INIT_SERVER)
  • mcp-server/tools/scaffold.py:84-137 (_build_manifest)
  • mcp-server/tools/scaffold.py:140-256 (_scaffold_lua, _scaffold_js, _scaffold_csharp)
  • mcp-server/tools/manifest_gen.py:58-128 (generate_manifest, second renderer; re-implements games_block at 58-61)
  • mcp-server/tools/manifest_common.py:4, :29-33 (games_block), :47-51 (substitute_variables, no callers)
  • templates/, skills/resource-scaffolding/SKILL.md:110-116

Details

Drift already present between the scaffold output, generate_manifest, and templates/:

  1. The scaffolded C# csproj has no HintPath for CitizenFX.Core; the template has one.
  2. C# manifest entries differ three ways (scaffold Client/ClientMain.net.dll / Server/ServerMain.net.dll, generate_manifest {name}.net.dll, template MyResource.net.dll).
  3. Framework templates include '@oxmysql/lib/MySQL.lua' and show player-data calls; scaffold output has neither.
  4. Templates pin VORP/RSG to rdr3 and ESX/QB/Qbox/ox to gta5; the scaffold accepts any game with any framework.
  5. No NUI option exists although templates/nui-vite and templates/nui-svelte are maintained, and CLAUDE.md says the scaffold supports "optional NUI".

manifest_common.py says it exists "to avoid duplication", yet both tools build the same header list and per-language script blocks separately. generate_manifest supports dependencies, scanned scripts and NUI; the scaffold supports none of them. substitute_variables exists for templating but has no callers, while docs/ROADMAP.md marks templating as shipped.

The functional bugs are tracked separately in "C# scaffold fails to compile; C# manifests reference DLLs that are never built" and "generate_manifest emits Lua tables without commas, mishandles scanned scripts".

Impact

Users get structurally different resources from the MCP tool and from the templates. Every template fix must be ported by hand into Python string literals with nothing checking it, and every manifest convention change must be made in two functions.

Suggested fix

Each step can ship on its own:

  1. Add golden-output tests for scaffold_resource across language and framework, and snapshot tests for generate_manifest (with deps, scripts, has_nui).
  2. Add render_manifest(name, game, language, framework, author, description, deps=(), extra_scripts=(), has_nui=False) to manifest_common.py, ported from generate_manifest; make generate_manifest call it (snapshots unchanged), then make the scaffold call it and delete _build_manifest.
  3. Add {{name}} / {{author}} placeholders to templates/ and have _scaffold_lua/_js/_csharp copy templates/<x>/ through substitute_variables, resolving the templates dir relative to __file__. Delete the inline strings.
  4. Add optional parameters: output_dir, nui: none|vanilla|react|svelte (overlay templates/nui-*), dry_run.

Acceptance criteria

  • There is one manifest renderer used by both tools.
  • Scaffold output for a framework matches templates/<framework> after name/author substitution (enforced by a test).
  • scaffold_resource_tool can add NUI from the maintained templates, or CLAUDE.md stops claiming it.
  • substitute_variables is used or removed, and ROADMAP reflects reality.

Getting started

  • Relevant files: mcp-server/tools/scaffold.py, mcp-server/tools/manifest_gen.py, mcp-server/tools/manifest_common.py, templates/
  • How to run checks: there is no test suite yet; run the MCP server with cd mcp-server && pip install -r requirements.txt && python server.py, and CI checks live in .github/workflows/validate.yml
  • Related docs: docs/ARCHITECTURE.md (Templates), skills/resource-scaffolding/SKILL.md

Filed by repo-audit/full-audit at 701824d. Severity: medium. Effort: M. audit-key: tech-debt|mcp-server/tools/scaffold.py|scaffold_resource

Vorherrschende Sprache
Python
Sterne
7
Forks
4
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/CFX-Developer-Tools

Alle Issues in TMHSDigital/CFX-Developer-Tools

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.