Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

diff

Semantic diffs with function-level attribution and natural-language summaries.

Usage

prx diff [options] [file]

Options

FlagDescription
--since <ref>Compare against a git ref (default: HEAD)
--stagedShow staged changes
--stat-onlySummary only (~30 tokens)
--budget NCap output at N tokens
--plainHuman-readable output

Examples

# All changed files vs HEAD
prx diff

# Single file
prx diff src/auth.ts

# Compare against a specific ref
prx diff --since HEAD~3

# Staged changes only
prx diff --staged

# Cheap summary (~30 tokens)
prx diff --stat-only

Example output:

{
  "data": {
    "files_changed": 2,
    "insertions": 15,
    "deletions": 8,
    "hunks": [
      {
        "file": "src/auth/handler.ts",
        "function": "handleLogin",
        "added": ["+    const token = jwt.sign(payload, secret);"],
        "removed": ["-    const token = createToken(payload);"]
      }
    ]
  }
}

Tips

  • Use --stat-only for a cheap change summary at the start of a task. It costs ~30 tokens and tells you which files changed and how much.
  • prx diff attributes hunks to the enclosing function, which is more useful than raw line numbers when reviewing changes.
  • For seeing what changed in a single file without loading the whole file, prx read src/file.ts --mode diff is often more convenient.

See also: read, edit