Idea detail
diff
reqlan rq/cli/diff.rq:8
Summary
Compare ideas in two git snapshots.
The key is the file path plus the idea_name.
The command reads `.rq` files from git and parses each snapshot.
It does not read or write the ideas index.
Line position does not count. The same body and attributes at a different line are unchanged.
Content is the idea body plus its attributes.
Change kinds:
- created — the key exists only on the right snapshot
- deleted — the key exists only on the left snapshot
- modified — the key exists on both snapshots and the content differs
- moved — the name exists in exactly one file on each side, the paths differ, and the content is the same
The same name in more than one file on one side stays on the path-plus-name key.
A renamed idea is deleted plus created.
Unchanged ideas are omitted.
A reference-only edit stays modified.
No arguments: if any `.rq` path is staged, unstaged, or untracked and not gitignored, the left side is `HEAD` and the right side is that pending snapshot. Otherwise the left side is `HEAD~1` and the right side is `HEAD`. A non- `.rq` change does not select the pending snapshot.
One argument: that revision against `HEAD`.
Two arguments: the first revision against the second.
A target is a branch, a commit, `HEAD`, `~N` ( `HEAD~N` ), or `<rev>~N`.
The pending snapshot uses the working-tree file for an unstaged edit, the index blob when the working tree matches `HEAD`, and the working-tree file when a path is both staged and unstaged.
An untracked `.rq` file that git does not ignore is included.
If `HEAD` has no parent, the left snapshot is empty and every idea on `HEAD` is created.
A missing revision or a directory that is not a git repository is an error. Exit status is 2. A successful diff exits 0, including an empty diff.
When a side is filled by a default, the human CLI and diff_webview print a header `Comparing <from> -> <to>` before the rows. Explicit two-argument runs omit that header. `--json` and MCP stay a row array only.
Surfaces: CLI `reqlan diff` ( commands ), MCP mcp_diff, and diff.
Engine: diff.rs. Git spawns stay hidden ( consumption_silence ).
Related: architecture function_parity idea idea_reference diff_verbosity diff_cli_color
Navigation
Attributes
| Key | Value |
|---|---|
| example | ```bash reqlan diff A B reqlan diff reqlan diff HEAD~1 reqlan diff --verbosity references reqlan diff --verbosity text reqlan diff --json ``` |
| implementation | diff.rs, api.rs, lib.rs, native-analysis-api.ts, diff.ts, server.ts |
| status | done |
| tests | diff.rs:created_idea_is_listed_without_the_unchanged_idea, diff.rs:modified_body_is_modified, diff.rs:attribute_change_is_modified, diff.rs:deleted_idea_is_deleted, diff.rs:line_shift_is_not_a_change, diff.rs:one_argument_compares_with_head, diff.rs:tilde_count_matches_head_tilde, diff.rs:branch_against_head_and_two_branches, diff.rs:pending_unstaged_staged_and_layered_edits, diff.rs:clean_tree_compares_head_with_parent_and_ignores_non_rq, diff.rs:head_without_parent_lists_current_ideas_as_created, diff.rs:moved_idea_reports_both_paths, diff.rs:ambiguous_name_does_not_move, diff.rs:renamed_idea_is_deleted_and_created, diff.rs:same_revision_is_empty, diff.rs:missing_repository_and_revision_are_errors, diff.rs:implicit_targets_report_resolved_labels, diff.test.ts:lists a created idea and omits the unchanged idea, diff.test.ts:one argument matches an explicit HEAD on the right, diff.test.ts:tilde count matches HEAD~N, diff.test.ts:compares a branch with HEAD and with another branch, diff.test.ts:pending edits use the worktree, including a later unstaged layer, diff.test.ts:a clean tree compares HEAD~1 with HEAD and ignores a non-rq edit, diff.test.ts:a missing repository or revision exits 2 |
Ancestor context
No ancestor chain recorded.
Outbound references
Inbound references
Unresolved references
| Kind | Idea | Path | Snippet |
|---|---|---|---|
| None | |||
Local graph
Initialising graph…