diff --git a/README.md b/README.md index f7f190d..f17187c 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,10 @@ Remember important facts: ```bash # Via MCP server -remember("We use JWT for auth because of scalability requirements") +remember({ + topic: "auth-strategy", + content: "We use JWT for auth because of scalability requirements" +}) ``` ## MCP Tools @@ -175,8 +178,7 @@ Get detailed explanation of a symbol: ```typescript explain_code({ - symbol: "UserService", - context_lines: 20 + symbol: "UserService" }) ``` @@ -187,7 +189,7 @@ Find why a decision was made: ```typescript trace_decision({ topic: "why microservices", - max_results: 5 + time_range: "90d" }) ``` @@ -197,8 +199,8 @@ Find related code and dependencies: ```typescript find_related({ - symbol: "AuthController", - relationship_type: "both" // "depends_on" | "depended_by" | "both" + file: "src/auth/controller.ts", + direction: "both" // "dependencies" | "dependents" | "both" }) ``` @@ -208,8 +210,9 @@ Store persistent knowledge: ```typescript remember({ - key: "auth-strategy", - value: "We use JWT for stateless auth across microservices" + topic: "auth-strategy", + content: "We use JWT for stateless auth across microservices", + tags: ["architecture", "security"] }) ``` @@ -229,7 +232,7 @@ Retrieve learned patterns: ```typescript get_session_patterns({ - pattern_type: "architecture", // or "errors", "refactoring", "testing" + pattern_type: "testing", // "naming" | "error" | "testing" | "organization" | "import" | "config" min_confidence: 0.7 }) ``` diff --git a/npm/README.md b/npm/README.md index 4ea4add..46ab24f 100644 --- a/npm/README.md +++ b/npm/README.md @@ -138,7 +138,10 @@ Remember important facts: ```bash # Via MCP server -remember("We use JWT for auth because of scalability requirements") +remember({ + topic: "auth-strategy", + content: "We use JWT for auth because of scalability requirements" +}) ``` ## MCP Tools @@ -165,8 +168,7 @@ Get detailed explanation of a symbol: ```typescript explain_code({ - symbol: "UserService", - context_lines: 20 + symbol: "UserService" }) ``` @@ -177,7 +179,7 @@ Find why a decision was made: ```typescript trace_decision({ topic: "why microservices", - max_results: 5 + time_range: "90d" }) ``` @@ -187,8 +189,8 @@ Find related code and dependencies: ```typescript find_related({ - symbol: "AuthController", - relationship_type: "both" // "depends_on" | "depended_by" | "both" + file: "src/auth/controller.ts", + direction: "both" // "dependencies" | "dependents" | "both" }) ``` @@ -198,8 +200,9 @@ Store persistent knowledge: ```typescript remember({ - key: "auth-strategy", - value: "We use JWT for stateless auth across microservices" + topic: "auth-strategy", + content: "We use JWT for stateless auth across microservices", + tags: ["architecture", "security"] }) ``` @@ -219,7 +222,7 @@ Retrieve learned patterns: ```typescript get_session_patterns({ - pattern_type: "architecture", // or "errors", "refactoring", "testing" + pattern_type: "testing", // "naming" | "error" | "testing" | "organization" | "import" | "config" min_confidence: 0.7 }) ``` diff --git a/src/git/history.rs b/src/git/history.rs index f8788da..0f85683 100644 --- a/src/git/history.rs +++ b/src/git/history.rs @@ -339,6 +339,9 @@ impl GitHistory { continue; }; for file in &commit.files_changed { + if seen.len() >= limit { + break; + } seen.entry(file.clone()).or_insert(commit.timestamp); } if seen.len() >= limit { @@ -495,10 +498,14 @@ mod tests { } let git = GitHistory::open(&path).unwrap(); + assert_eq!(git.walk_commits(100).unwrap().len(), 8); let files = git.recent_files(2).unwrap(); assert_eq!(files.len(), 2); - assert!(files.iter().any(|(file, _)| file == "lib.rs")); + assert!( + files.iter().any(|(file, _)| file == "lib.rs"), + "recent files: {files:?}" + ); } #[test]