Summary
WeaveFFI accepts IDLs in YAML, JSON, and TOML everywhere (weaveffi generate, validate, lint, and so on pick the parser from the file extension), but weaveffi new <name> always scaffolds weaveffi.yml. Users who keep their configs in JSON or TOML have to hand-convert the starter file.
Proposed change
Add an --idl-format <yaml|json|toml> flag (default yaml) to the New subcommand in crates/weaveffi-cli/src/main.rs and thread it into cmd_new in crates/weaveffi-cli/src/commands/new.rs. Rather than maintaining three hand-written string templates, the simplest robust approach is to parse the existing YAML starter with weaveffi_ir::parse::parse_api_str and re-serialize it in the requested format (the format command already does canonical serialization per format, see crates/weaveffi-cli/src/commands/format.rs for the pattern). Name the output file weaveffi.yml, weaveffi.json, or weaveffi.toml accordingly, and update the generated README and any printed next-step hints to reference the right filename.
Acceptance criteria
Pointers
- Subcommand definition:
Commands::New in crates/weaveffi-cli/src/main.rs
- Scaffolding logic and the starter IDL template:
crates/weaveffi-cli/src/commands/new.rs
- Canonical serialization per format:
crates/weaveffi-cli/src/commands/format.rs
Suggested commit message
feat: let weaveffi new scaffold the starter IDL in JSON or TOML
Summary
WeaveFFI accepts IDLs in YAML, JSON, and TOML everywhere (
weaveffi generate,validate,lint, and so on pick the parser from the file extension), butweaveffi new <name>always scaffoldsweaveffi.yml. Users who keep their configs in JSON or TOML have to hand-convert the starter file.Proposed change
Add an
--idl-format <yaml|json|toml>flag (defaultyaml) to theNewsubcommand incrates/weaveffi-cli/src/main.rsand thread it intocmd_newincrates/weaveffi-cli/src/commands/new.rs. Rather than maintaining three hand-written string templates, the simplest robust approach is to parse the existing YAML starter withweaveffi_ir::parse::parse_api_strand re-serialize it in the requested format (theformatcommand already does canonical serialization per format, seecrates/weaveffi-cli/src/commands/format.rsfor the pattern). Name the output fileweaveffi.yml,weaveffi.json, orweaveffi.tomlaccordingly, and update the generated README and any printed next-step hints to reference the right filename.Acceptance criteria
weaveffi new demo --idl-format tomlproduces aweaveffi.tomlthat passesweaveffi validatejson; plainweaveffi new demostill produces the YAML file byte-identical to today's outputValueEnum)crates/weaveffi-cli/src/main.rsor the tests incommands/new.rsif present)Pointers
Commands::Newincrates/weaveffi-cli/src/main.rscrates/weaveffi-cli/src/commands/new.rscrates/weaveffi-cli/src/commands/format.rsSuggested commit message