Hive
feat(mcp): make Once self-describing for coding agents
GitHub issue · Closed
Source
tuist/once #87
Updated
Jun 24, 2026
Domains
Once
Summary
- A coding agent can now go from “create me an iOS library” to a built target without reading docs:
once_list_rulesadvertises every rule kind with example slugs,once_query_schemareturns runnable starter examples inline (real files, not snippets), andonce_apply_editwrites the manifest atomically.once_validate_targetandonce_get_targetround out the read/draft/commit loop. - Rule schema examples are now real directories under
prelude/examples/<slug>/bundled withinclude_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. Diagnosticnow carries optionaltargetandattributescoping plusrepairs. A newmanifest_editorround-trips throughtoml_editfor atomic create/update/delete on[[target]]blocks; a newtarget_validatorcovers required attrs, unknown kinds/attrs, and type mismatches (includinglist<X>andmap<string,V>).- CLI mirrors every new MCP tool:
once query rules,once query target <id>,once query validate-target [--file], and a new top-levelonce edit apply [--file](reads JSON from stdin when--fileis 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":{...}}]}throughonce edit apply, read it back withonce query target, and exercisedonce query validate-targetagainst a draft missing a required attr. once reference --out /tmp/once-refregeneratedmcp/tools.md; verified all seven tools land there.
No GitHub comments yet.