feat(config): Mission Maker YAML authoring — validate + gen-user (CTLD-TOOLS-USERCONFIG)#47
Merged
Merged
Conversation
…D-TOOLS-USERCONFIG) Implements lot 3 of ctld-tools (the MM volet). `validate` checks a user-config.yaml against the reference catalogue + embedded DCS type set, reporting errors with suggestions. `gen-user` compiles add/remove/patch operations into CTLD_userConfig.lua calling the ctld.userSetup helpers. Mission Makers target crates and troop groups BY NAME — ctld-tools resolves names to the unique weight the runtime uses (AA crates included), and flags unknown/ambiguous names. `gen-user --scaffold` writes a commented starter (block + flow styles). Embedded dcs_types.json (kept in sync with the vendored Lua set) enables offline unit checks. release.yml builds + attaches ctld-tools.exe (isolated, non-blocking). Docs EN+FR present the YAML flow as recommended; the Lua template stays for power users.
Reviewer's GuideAdds Mission Maker-focused YAML authoring to ctld-tools via new validate/gen-user commands, backed by a reference catalogue + embedded DCS type datamine, plus packaging and docs updates so a standalone ctld-tools.exe is attached to releases without impacting CTLD.lua delivery. Sequence diagram for ctld-tools gen-user command generating CTLD_userConfig.luasequenceDiagram
actor MissionMaker
participant CLI as gen_user_cmd
participant GenUser as generate_user_file
participant Validate as render_user_config
participant Ref as Reference.from_src
participant Types as known_dcs_types
participant FS as FileSystem
MissionMaker->>CLI: ctld-tools gen-user --yaml --src --out
CLI->>GenUser: generate_user_file(yaml_path, src, out)
GenUser->>Validate: render_user_config(load_user_config(yaml_path), Reference.from_src(src))
GenUser->>Ref: Reference.from_src(src)
Ref->>FS: load_default_settings(src, inject_aa=True)
Ref-->>GenUser: Reference
Validate->>Validate: validate(cfg, ref)
Validate->>Types: known_dcs_types()
Types-->>Validate: frozenset[type_names]
alt has_errors(findings)
Validate-->>GenUser: raise UserConfigError(findings)
GenUser-->>CLI: UserConfigError
CLI->>MissionMaker: print findings
CLI-->>MissionMaker: exit 1
else no errors
Validate-->>GenUser: rendered Lua string
GenUser->>FS: write_text(out_path, lua)
CLI->>MissionMaker: echo "gen-user: wrote CTLD_userConfig.lua"
end
Flow diagram for DCS type datamine generation and validation usageflowchart LR
DCSRepo[Quaggles datamine repo] --> GenScript[gen_dcs_types.py]
GenScript --> LuaOut[tests/data/dcs_types.lua]
GenScript --> JsonOut[ctld_tools/data/dcs_types.json]
JsonOut --> Package[ctld-tools package / ctld-tools.exe]
Package --> Datamine[known_dcs_types]
Datamine --> Validate[validate user_config, Reference, types]
Validate --> CLIValidate[validate_cmd]
Validate --> CLIGenUser[gen_user_cmd / render_user_config]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
_scalar_blockyou concatenate raw Python values into thectld.yamlConfigDatasYAML block, which will emit booleans asTrue/Falseand won’t quote strings; consider reusing_render_valueor a dedicated scalar serializer so the block is always valid YAML for the Lua side. - The list of
ARRAY_SETTINGSinreference.pyis hard-coded and can silently drift from the actual appendable settings in CTLD; if possible, derive this from the loaded settings or a single source of truth in the Lua/YAML config instead of duplicating the list here.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `_scalar_block` you concatenate raw Python values into the `ctld.yamlConfigDatas` YAML block, which will emit booleans as `True`/`False` and won’t quote strings; consider reusing `_render_value` or a dedicated scalar serializer so the block is always valid YAML for the Lua side.
- The list of `ARRAY_SETTINGS` in `reference.py` is hard-coded and can silently drift from the actual appendable settings in CTLD; if possible, derive this from the loaded settings or a single source of truth in the Lua/YAML config instead of duplicating the list here.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the CTLD-TOOLS-USERCONFIG lot (lot 3 of ctld-tools — the MM volet). Depends on
FEAT-USERCONFIG-API+CTLD-TOOLS-CONFIG(both merged).What
validate— checks auser-config.yamlagainst the reference catalogue (crates incl. AA,troop groups, array settings) and the embedded DCS type set. Reports errors with suggestions
(unknown/ambiguous crate name, unknown
unittype, weight collision, unknown troop/array).gen-user— compilesadd/remove/patchoperations into aCTLD_userConfig.luacalling the
ctld.userSetuphelpers. Mission Makers target by NAME — the tool resolves namesto the unique weight the runtime uses (
removeCrate(1000.05)from"Heavy Tank - Abrams"), mapsname→desc(wrappedctld.tr), and emits the scalarsettingsblock too.gen-user --scaffold— commented starteruser-config.yaml, showing block + flow styles.dcs_types.jsonbundled in the package (kept in sync with the vendoreddcs_types.lua), for offlineunitvalidation.gen_dcs_types.pynow emits both.release.ymlbuilds + attachesctld-tools.exe(PyInstaller), isolated(
continue-on-error) so a packaging hiccup never blocks theCTLD.luarelease.Validation
CTLD_userConfig.luarun against the realctld.userSetuphelpers mutatessettingscorrectly (crate added present, Abrams removed).
src/Lua change — this lot is Python + docs + CI. The Lua template stays for power users;the YAML flow is documented as recommended (
mission-maker/configuration.md, EN + FR).Notes
.mizinjection, TUI.Summary by Sourcery
Add Mission Maker-focused YAML authoring support to ctld-tools, including validation and Lua user config generation, backed by an embedded DCS type dataset and exposed via the CLI and release packaging.
New Features:
validateCLI command to check auser-config.yamlagainst the CTLD reference catalogue and DCS type set, reporting findings and exiting non-zero on errors.gen-userCLI command to compile auser-config.yamlintoCTLD_userConfig.lua, supporting both full generation and scaffold creation for new configs.Enhancements:
python -m ctld_toolsand PyInstaller packaging.Build:
ctld-tools.exeand attach it to GitHub releases, isolated so failures do not block CTLD.lua releases.Tests: