Two small CI-quality-of-life additions. Either one alone is a fine PR.
agentsync check --diff
Today check reports that CLAUDE.md is out of sync. In CI that is the moment you want to see what changed without checking out the branch. Print a unified diff (difflib.unified_diff) between the file on disk and the rendered output, with the same red/green rich styling.
Everything needed is already in the Result: r.text is the rendered version and r.path is the file. See cmd_sync.
agentsync lint --json
Machine-readable issues, so the output can feed a GitHub annotation or a code-review bot:
{"issues": [{"check": "C001", "severity": "warning", "line": 14,
"message": "`src/api/client.ts` does not exist in the repository.",
"fix": "Update the path, or delete the instruction if the thing is gone."}],
"counts": {"error": 0, "warning": 1, "advisory": 0}}
Issue is already a dataclass, so dataclasses.asdict does most of it. Keep the exit codes exactly as they are — the contract in the README does not change.
Tests go in tests/test_cli.py; assert on the parsed JSON, not on the formatted text.
Two small CI-quality-of-life additions. Either one alone is a fine PR.
agentsync check --diffToday
checkreports thatCLAUDE.mdis out of sync. In CI that is the moment you want to see what changed without checking out the branch. Print a unified diff (difflib.unified_diff) between the file on disk and the rendered output, with the same red/green rich styling.Everything needed is already in the
Result:r.textis the rendered version andr.pathis the file. Seecmd_sync.agentsync lint --jsonMachine-readable issues, so the output can feed a GitHub annotation or a code-review bot:
{"issues": [{"check": "C001", "severity": "warning", "line": 14, "message": "`src/api/client.ts` does not exist in the repository.", "fix": "Update the path, or delete the instruction if the thing is gone."}], "counts": {"error": 0, "warning": 1, "advisory": 0}}Issueis already a dataclass, sodataclasses.asdictdoes most of it. Keep the exit codes exactly as they are — the contract in the README does not change.Tests go in
tests/test_cli.py; assert on the parsed JSON, not on the formatted text.