File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414//!
1515//! ## Wire schema alignment
1616//!
17- //! Field names mirror CCB's `selection_changed` MCP notification payload
18- //! (see `claude-code-best/src/hooks/useIdeSelection.ts`). This keeps the
19- //! deserializer trivial and preserves the "opened file but nothing
20- //! selected" semantics: `line_count == 0 && file_path.is_some()`.
17+ //! Field names mirror the upstream `selection_changed` MCP notification
18+ //! payload so the deserializer is trivial, and preserve the "opened file
19+ //! but nothing selected" semantics: `line_count == 0 && file_path.is_some()`.
2120//!
22- //! The injection template in `crab-ide` also mirrors CCB's prose to
23- //! keep LLM prompt patterns familiar.
21+ //! The injection template in `crab-ide` also mirrors the upstream prose
22+ //! to keep LLM prompt patterns familiar.
2423
2524use serde:: { Deserialize , Serialize } ;
2625use std:: path:: PathBuf ;
@@ -148,8 +147,8 @@ mod tests {
148147 }
149148
150149 #[ test]
151- fn selection_parses_ccb_wire_format ( ) {
152- // Shape matches `selection_changed` notification params from CCB .
150+ fn selection_parses_mcp_wire_format ( ) {
151+ // Shape matches the upstream `selection_changed` MCP notification params.
153152 let json = r#"{
154153 "line_count": 11,
155154 "line_start": 10,
Original file line number Diff line number Diff line change 22//! `<system-reminder>` meta-user messages for LLM context.
33//!
44//! Called by `crab-agent` right before sending a user prompt. The
5- //! output string (wrapped by the caller) follows CCB's template
6- //! verbatim (`messages.ts:3648-3662`) so LLMs trained against
7- //! Claude Code's prompt patterns recognize the shape.
5+ //! output string (wrapped by the caller) follows the upstream template
6+ //! so LLMs trained against that prompt pattern recognize the shape.
87
98#![ allow( dead_code) ] // R1 scaffolding; wired into agent in R3
109
@@ -15,8 +14,7 @@ use std::path::Path;
1514///
1615/// Returns `None` when there is nothing to inject (no selection or
1716/// missing fields). Caller wraps it in `<system-reminder>...</system-reminder>`
18- /// and pushes as a `user`-role meta message, mirroring CCB's
19- /// `wrapMessagesInSystemReminder` + `isMeta: true` behavior.
17+ /// and pushes as a `user`-role meta message.
2018pub fn build_selected_lines_reminder ( sel : & IdeSelection , _cwd : & Path ) -> Option < String > {
2119 if !sel. has_text ( ) {
2220 return None ;
Original file line number Diff line number Diff line change 11//! Discovery of IDE plugin MCP endpoints via lockfile.
22//!
3- //! CCB's plugin writes `~/.claude/ ide/<port>.lock` on startup with a
4- //! JSON payload describing how to reach the MCP server:
3+ //! IDE plugins write `< ide-dir> /<port>.lock` on startup with a JSON
4+ //! payload describing how to reach their MCP server:
55//!
66//! ```json
77//! {
1616//! Filename = port (e.g. `12345.lock` ⇒ MCP server listens on `12345`).
1717//!
1818//! Search paths (checked in order):
19- //! 1. `~/.claude/ide/*.lock` — CCB 's official plugin (piggyback path)
19+ //! 1. `~/.claude/ide/*.lock` — upstream plugin 's directory (piggyback path)
2020//! 2. `~/.crab/ide/*.lock` — our future plugin (self-hosted path)
21- //!
22- //! Reference: `claude-code-best/src/utils/ide.ts:295-393`
2321
2422#![ allow( dead_code) ] // R1 scaffolding; wired up in R2
2523
Original file line number Diff line number Diff line change 11//! MCP notification handlers.
22//!
33//! Registers handlers on the MCP client for the two IDE-specific
4- //! notifications CCB's plugin sends :
4+ //! notifications IDE plugins send :
55//!
66//! - `selection_changed` — ambient state; updates `handles.selection`.
77//! - `at_mentioned` — one-shot; fanned out via a broadcast channel.
8- //!
9- //! Wire schemas come from:
10- //! `claude-code-best/src/hooks/useIdeSelection.ts:32-53`
11- //! `claude-code-best/src/hooks/useIdeAtMentioned.ts:18-26`
128
139#![ allow( dead_code) ] // R1 scaffolding; wired up in R2
1410
Original file line number Diff line number Diff line change 55//! `/home/user/project`. This module will translate between them so
66//! `IdeSelection::file_path` remains useful regardless of where the
77//! crab process is running.
8- //!
9- //! Reference: `claude-code-best/src/utils/idePathConversion.ts`
108
119#![ allow( dead_code) ] // R1 scaffolding; wired up in R3
1210
You can’t perform that action at this time.
0 commit comments