Skip to content

Add --verbose and --json flags to cargo agents sync#234

Open
nikomatsakis wants to merge 2 commits into
symposium-dev:mainfrom
nikomatsakis:cargo-agents-sync-verbose
Open

Add --verbose and --json flags to cargo agents sync#234
nikomatsakis wants to merge 2 commits into
symposium-dev:mainfrom
nikomatsakis:cargo-agents-sync-verbose

Conversation

@nikomatsakis
Copy link
Copy Markdown
Member

What does this PR do?

Introduce a structured report system for sync decisions. A custom tracing layer captures events with a report field and either pretty-prints them to stderr (--verbose) or accumulates JSON (--json).

  • -v shows which plugins/groups/skills were considered and why each was included or skipped, plus searched directories
  • --json emits a JSON array of structured event objects to stdout
  • -v --json combines both: verbose detail in JSON format
  • Report events use the tracing level to control verbosity: INFO for actions (install/remove), DEBUG for decision trace
Disclosure questions

AI disclosure.

  • The AI tool authored large parts of the code

Questions for reviewers.

@nikomatsakis nikomatsakis force-pushed the cargo-agents-sync-verbose branch 2 times, most recently from c766b36 to f0c5ab6 Compare June 1, 2026 09:10
@nikomatsakis nikomatsakis marked this pull request as ready for review June 1, 2026 13:51
Comment thread src/report.rs
@@ -0,0 +1,389 @@
//! Structured report layer.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we need to document this pattern somehow -- eg., in AGENTS.md and in the design docs.

@nikomatsakis nikomatsakis marked this pull request as draft June 1, 2026 13:55
@nikomatsakis nikomatsakis force-pushed the cargo-agents-sync-verbose branch from f0c5ab6 to b0a2627 Compare June 1, 2026 14:01
@nikomatsakis nikomatsakis marked this pull request as ready for review June 1, 2026 14:59
@nikomatsakis nikomatsakis force-pushed the cargo-agents-sync-verbose branch from b0a2627 to e792d4d Compare June 1, 2026 15:06
nikomatsakis and others added 2 commits June 4, 2026 00:27
Introduce a tracing-based report layer that captures structured events
and renders them in three modes: Normal (human-friendly to stdout),
Verbose (decision trace to stderr), or Json (accumulated array).

The report layer is always installed. Commands emit events via
tracing with a `report` field; the layer handles rendering. This
replaces direct println!/eprintln! in sync and plugin commands.

Commands instrumented:
- `sync`: plugin/group/skill matching, directory searches,
  installations, removals, warnings — all via report events
- `plugin list`: provider listing with contained plugins
- `plugin validate`: per-item validation results and crate checks
- `hook` dispatch: hook selection and execution (debug level)

Global flags:
- `-v`/`--verbose`: show debug-level decision trace on stderr
- `--json`: emit JSON array to stdout, suppress human output

Co-authored-by: Claude <claude@anthropic.com>
- Add `sync_with_report` helper to test harness for capturing report
  events with a scoped tracing subscriber
- Three integration tests:
  - INFO level emits only install/remove events
  - DEBUG level includes plugin/skill decision trace
  - Skipped skills appear with reasons when predicates don't match
- Document -v/--json in cargo-agents global options reference
- Document report behavior in cargo-agents-sync reference

Co-authored-by: Claude <claude@anthropic.com>
@nikomatsakis nikomatsakis force-pushed the cargo-agents-sync-verbose branch from e792d4d to d12c924 Compare June 4, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant