weavefoundry / weavefoundry/weaveffi

Let weaveffi new scaffold the starter IDL in JSON or TOML

Open
#39 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
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 toml produces a weaveffi.toml that passes weaveffi validate
  • Same for json; plain weaveffi new demo still 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.rs or the tests in commands/new.rs if present)

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.