Skip to content

feature: --diff on check, and --json on lint #5

Description

@resuaico

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions