weavefoundry / weavefoundry/weaveffi
Let weaveffi new scaffold the starter IDL in JSON or TOML
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 61
- Forks
- 5
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 8
Description
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
-
weaveffi new demo --idl-format tomlproduces aweaveffi.tomlthat passesweaveffi validate - Same for
json; plainweaveffi new demostill produces the YAML file byte-identical to today's output - An invalid format value is rejected at argument parsing (use a clap
ValueEnum) - Tests cover the three formats (see the existing CLI tests in
crates/weaveffi-cli/src/main.rsor the tests incommands/new.rsif present)
Pointers
- Subcommand definition:
Commands::Newincrates/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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Commands::New definition in crates/weaveffi-cli/src/main.rs and the scaffolding logic in crates/weaveffi-cli/src/commands/new.rs. Read crates/weaveffi-cli/src/commands/format.rs for the serialization pattern, then run the existing CLI tests. Done means YAML remains byte-identical, JSON and TOML scaffolds validate, filenames and hints match the selected format, and invalid values are rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100