Code reference detail
rope.test.ts
packages/cli/test/rope.test.ts
| Idea | Status | Tags | Summary | Katz |
|---|---|---|---|---|
| algorithm | done | [rope] shall, in this order: 1. Resolve target: idea name, `path#idea`, file basename, or indexed code file. More than one match returns cardinality-free candidates ranked by [click] session context; none falls through to search. 2. Determine base [fray]: user input `--fray` when given, else the [dynamic-rope-tuning] base. 3. Apply [rope-tuning] to reach the effective fray, clamped to the [fray] cap. 4. Perform breadth-first search from the target up to effective-fray hops over content edges ( ideaset membership, imports, and comment links are excluded; a file centre starts one hop out on ideas that reference it ). 5. Score each neighbour with [rope-idea-cardinality]; normalise to the top candidate and drop ideas below a 0. 5 ratio. 6. Deduplicate using the click session store: skip ideas already surfaced in the session ( [click-store-context-optimisation] ). 7. Order the chain: hop distance ascending, then cardinality descending within a hop, then by name. 8. Return compact context: the centre target plus candidate rows ( names, ids, file URIs, scores, hops ). 9. Track the centre and listed ideas in the click session store. | 0.036 | |
| fray | done | Fray is like temperature. it describes how many adjacent ideas are included in a [rope] response. This should have a default, but user can [rope-tuning] to adjust the [fray]. The effective fray is capped at 6; a user `--fray` is clamped the same way as a tuned one. | 0.063 | |
| rope | done | Rope is the command / function used for [roping], It is used in the [analysers] and the [cli] / [mcp]. Surface: CLI `reqlan rope <target> [--fray <n>] [--tuning <mode>] [--graph]`, MCP tool `rope`, and AnalysisApi `rope`. Default `fray` is dynamic ( see [dynamic-rope-tuning] ); `--fray <n>` overrides it. Returns the chain of ideas around the target with each idea ' s context, respecting click session deduplication ( [click-store-context-optimisation] ). Ambiguous targets return ranked matches; no match falls through to search. The target may be `@root` ( [rope-graph] ). Implemented by ["../../crates/reqlan-analytical/src/rope.rs"], `rope` in ["../../crates/reqlan-analytical/src/api.rs"], `rope` in ["../../crates/reqlan-napi/src/analysis.rs"], `rope` in ["../../packages/analytical/src/native/native-analysis-api.ts"], ["../../packages/cli/src/commands/rope.ts"], and `handleRopeTool` in ["../../packages/mcp/src/server.ts"]. | 0.065 | |
| rope-graph | done | `--graph` on the CLI `rope` command renders the [rope-output] chain as a linearised graph in the terminal: the root at the top, then box-drawing lines ( `├─`, `└─`, `│` ) to each idea in chain order; the first drawn line runs from the root to the highest-cardinality idea. Each drawn node keeps its context lines, dim hops, and dim score per [rope-output]. Root selection: the target idea is the implicit root. The target `@root` ropes the project root instead: the ideas with no inbound content references ( nothing references them; ideaset membership does not count ) — the project ' s constitution. More than one root lists ranked matches; `@root` resolves before any other target form. `--graph` is a CLI render mode only: JSON and MCP output carry the same `via` rows and stay plain. | 0.045 | |
| rope-output | done | [rope] returns the ["../cli/click.rq".click_output] shape ( `ClickResult`, camelCase JSON; optional fields are omitted, never null ). Always: `sessionKey` and `candidates` ( empty array when nothing qualifies ). `kind` is `rope`, `ambiguous`, `search`, or `none` ( never click ' s `unique` / `revisit` ). `rope`: `target` is the centre — idea centres carry `name`, `id` ( `<file>#<name>` ), `fileUri`, `lineStart`, body `content`, and optional `status`; file centres carry `id` ( `file:<uri>` ), `name` ( basename ), `fileUri`, `lineStart` 0, no content. `candidates` are the chain: ordered by hop distance ascending, then cardinality descending within a hop, each row `{name, id, kind, fileUri, summary, score, hops}` where `summary` is the idea ' s context text ( absent for file rows ), `score` is normalised cardinality ( top = 1, threshold 0. 5, cap 24 ), and `hops` is BFS distance ( a file centre seeds its referencing ideas at hop 1 ); session-surfaced ideas are dropped. `ambiguous`: no `target`; `candidates` ranked by click-session hop distance — `hops` 0 means already surfaced in the session, absent means unconnected; `score` = `1 / (1 + hops)`, `1/9` when unknown. `search`: no `target`; fuzzy `candidates` with raw fuzzy `score` and no `hops`. `none`: empty `candidates`, no `target`. Rope-kind candidate rows also carry `via`: the id of the idea the row hangs from ( BFS parent; the centre id at hop 1, `file:<uri>` under a file centre ). Other kinds omit `via`. Rope never emits click ' s `outbound`, `backlinks`, `commentRefs`, `siblings`, or `connected`. CLI text output renders the chain and colours it when stdout is a terminal: bold centre, cyan idea names, dim hops and scores; JSON and MCP output stay plain. | 0.042 | |
| rope-tuning | done | Depending on model, or harness, or user input, the [fray] can be adjusted. Tuning modes: `default`, `focused`, `exploratory`, `deep`. Effective fray per [dynamic-rope-tuning] base: `default` = base, `focused` = 1, `exploratory` = ceil ( base * 1. 5 ), `deep` = base * 2, always clamped to the [fray] cap. User input `--tuning <mode>` adjusts the fray accordingly; unknown modes are an error. | 0.056 |
Reference labels
"../../packages/cli/test/rope.test.ts", "../../packages/cli/test/rope.test.ts:rope --graph draws the linearised chain", "../../packages/cli/test/rope.test.ts:rope command emits kind rope with frayed candidates", "../../packages/cli/test/rope.test.ts:rope command rejects an unknown --tuning value", "../../packages/cli/test/rope.test.ts:rope text output prints the chain with context"