Code reference detail
format-diff.ts
packages/cli/src/format-diff.ts
| Idea | Status | Tags | Summary | Katz |
|---|---|---|---|---|
| diff | done | 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 [skills_and_mcp.mcp_diff], and [diff_webview]. Engine: ["../../crates/reqlan-analytical/src/diff.rs"]. Git spawns stay hidden ( [consumption_silence] ). Related: [architecture] [function_parity] [idea] [idea_reference] [diff_verbosity] [diff_cli_color] | 0.163 | |
| diff_cli_color | done | Color the human text when stdout is a terminal and `NO_COLOR` is unset. `--color` forces color. `--no-color` forces plain text. `--json` is never colored. Created and added lines are green. Deleted and removed lines are red. Modified is yellow. Moved is cyan. | 0.061 | |
| diff_verbosity | done | Three levels. The default is summary. CLI: `--verbosity summary|references|text`, or `-v` / `-vv`. MCP and [diff_webview] use the same three values. - summary — change kind, idea name, and file. `fromFile` only for moved. - references — summary, plus [idea_reference] targets added on the right and removed from the left. Order each list by name. Omit a target that is on both sides. - text — summary, plus the body and attributes before and after. Created shows the right side. Deleted shows the left side. Modified shows both. Moved has no text change. Do not list reference names at this level. Attributes stay inside modified. The references level does not print attribute text. The text level prints body lines, then attribute lines as `@name` / `@name value`. `--json` omits `references` and `text` at summary. It adds `references` at references only. It adds `text` at text only. | 0.071 |
Reference labels
"../../packages/cli/src/format-diff.ts", ../../packages/cli/src/format-diff.ts