Hive Hive
Sign in

feat(mcp): make Once self-describing for coding agents

GitHub issue · Closed

Metadata
Source
tuist/once #87
Updated
Jun 24, 2026
Domains
Once
Details

Summary

  • A coding agent can now go from “create me an iOS library” to a built target without reading docs: once_list_rules advertises every rule kind with example slugs, once_query_schema returns runnable starter examples inline (real files, not snippets), and once_apply_edit writes the manifest atomically. once_validate_target and once_get_target round out the read/draft/commit loop.
  • Rule schema examples are now real directories under prelude/examples/<slug>/ bundled with include_dir!. Three migrated this round (apple-library-minimal, apple-library-with-objc, apple-application-minimal); a new integration test materializes every bundled example into a tempdir and asserts it loads without diagnostics, so a rule change that breaks an example fails CI.
  • Diagnostic now carries optional target and attribute scoping plus repairs. A new manifest_editor round-trips through toml_edit for atomic create/update/delete on [[target]] blocks; a new target_validator covers required attrs, unknown kinds/attrs, and type mismatches (including list<X> and map<string,V>).
  • CLI mirrors every new MCP tool: once query rules, once query target <id>, once query validate-target [--file], and a new top-level once edit apply [--file] (reads JSON from stdin when --file is omitted) so humans can reproduce what an agent does from the terminal.

Testing

  • cargo test --workspace (345 passed)
  • cargo clippy --workspace --all-targets (clean)
  • cargo fmt --check (clean)
  • End-to-end smoke: piped {"package":"apps/Hello","operations":[{"op":"create","target":{...}}]} through once edit apply, read it back with once query target, and exercised once query validate-target against a draft missing a required attr.
  • once reference --out /tmp/once-ref regenerated mcp/tools.md; verified all seven tools land there.
Comments

No GitHub comments yet.