Skip to content

feat(plugin): convert commands to skills, fix intent detection, add E2E tests#6

Merged
sdsrss merged 1 commit intomainfrom
feat/plugin-integration-audit
Mar 29, 2026
Merged

feat(plugin): convert commands to skills, fix intent detection, add E2E tests#6
sdsrss merged 1 commit intomainfrom
feat/plugin-integration-audit

Conversation

@sdsrss
Copy link
Copy Markdown
Owner

@sdsrss sdsrss commented Mar 29, 2026

Summary

  • Convert 5 commands to 2 lean skills (explore.md, index.md) for better Claude Code auto-invocation
  • Fix UserPromptSubmit intent detection: add intentImplement, 22 missing Chinese verbs, lowConfidenceSymbols handling, skip filter fixes
  • Intent coverage: 73% → 100% (synthetic), 99% (real user prompts)
  • Add 91 E2E tests covering intent detection, symbol extraction, function signature parsing, and skill validation

Test plan

  • 66 intent detection tests pass (6 intents × EN/ZH, skip filter, priority logic, integration)
  • 25 pre-edit function signature tests pass (8 languages + keyword filter)
  • 326 Rust tests pass (cargo test)
  • All plugin JS tests pass (pre-commit hook verified)

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Documentation

    • Restructured skill documentation for code exploration and index management workflows.
  • Bug Fixes

    • Improved call graph result accuracy with row limiting.
    • Enhanced cross-file edge preservation during incremental indexing.
    • Fixed embedded output interleaving in server responses.
    • Improved test symbol detection with AST annotations.
    • Refined path normalization and keyword filtering logic.
  • Tests

    • Added comprehensive test coverage for symbol extraction, intent detection, and query type determination across multiple languages.

…2E tests

- Convert 5 commands (impact/understand/trace/status/rebuild) to 2 lean skills
  (explore.md, index.md) — skills get higher auto-invocation by Claude Code
- Fix UserPromptSubmit hook intent detection:
  - Add intentImplement for add/create/build/write/新增/添加/实现/创建 etc.
  - Add 11 missing Chinese modify verbs (优化/简化/修复/更新/解耦 etc.)
  - Add 6 missing Chinese implement verbs (补充/引入/支持/封装/接入/对接)
  - Add 5 missing Chinese understand verbs (检查/审核/审查/验证/诊断)
  - Fix lowConfidenceSymbols: plain-word fallback only used for search, not impact
  - Fix skip filter: reduce Latin char threshold 4→3 (catches "bug"/"API"/"MCP")
  - Fix skip filter: remove "帮我"/"优化" from skip list
  - Coverage: 49/67 (73%) → 67/67 (100%) on synthetic + 92/93 on real prompts
- Add 91 E2E tests (66 intent detection + 25 function signature extraction)
- Refactor user-prompt-context.js: extract pure logic into testable exports

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sdsrss sdsrss merged commit a739357 into main Mar 29, 2026
0 of 2 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 13865f31-a515-4947-a4a1-37c3b20577b4

📥 Commits

Reviewing files that changed from the base of the PR and between c89fd6f and 64ac15e.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (31)
  • CLAUDE.md
  • claude-plugin/commands/impact.md
  • claude-plugin/commands/rebuild.md
  • claude-plugin/commands/status.md
  • claude-plugin/commands/trace.md
  • claude-plugin/commands/understand.md
  • claude-plugin/scripts/pre-edit-guide.js
  • claude-plugin/scripts/pre-edit-guide.test.js
  • claude-plugin/scripts/user-prompt-context.js
  • claude-plugin/scripts/user-prompt-context.test.js
  • claude-plugin/skills/code-navigation.md
  • claude-plugin/skills/explore.md
  • claude-plugin/skills/index.md
  • src/cli.rs
  • src/domain.rs
  • src/embedding/model.rs
  • src/graph/query.rs
  • src/indexer/pipeline.rs
  • src/indexer/watcher.rs
  • src/main.rs
  • src/mcp/protocol.rs
  • src/mcp/server/helpers.rs
  • src/mcp/server/mod.rs
  • src/mcp/server/tools.rs
  • src/parser/relations.rs
  • src/parser/treesitter.rs
  • src/storage/db.rs
  • src/storage/queries.rs
  • src/storage/schema.rs
  • tests/common/mod.rs
  • tests/integration.rs

📝 Walkthrough

Walkthrough

This PR restructures documentation from command-centric to skill-based organization, refactors user-prompt-context parsing into testable functions, improves the indexer to preserve cross-file edges during incremental updates, enhances the MCP server with concurrent-safe stdout handling, and adds parser robustness for Rust test detection and superclass extraction.

Changes

Cohort / File(s) Summary
Documentation restructuring
CLAUDE.md, claude-plugin/commands/impact.md, claude-plugin/commands/rebuild.md, claude-plugin/commands/status.md, claude-plugin/commands/trace.md, claude-plugin/commands/understand.md, claude-plugin/skills/code-navigation.md
Removed command-level documentation files and replaced with skill-based docs (explore.md, index.md). Updated session memory in CLAUDE.md with new testing/refactor context.
Prompt analysis refactoring
claude-plugin/scripts/user-prompt-context.js, claude-plugin/scripts/user-prompt-context.test.js
Extracted parsing/intent logic into testable pure functions (shouldSkip, extractFilePaths, extractSymbols, detectIntents, determineQueryType), exported for testing, and added PLAIN_WORD_EXCLUDE filter. Added 466-line comprehensive test suite covering English/Chinese intent detection, symbol/path extraction, query determination, and cooldown behavior.
Pre-edit guide improvements
claude-plugin/scripts/pre-edit-guide.js, claude-plugin/scripts/pre-edit-guide.test.js
Extracted inline regex into isCommonKeyword() helper function. Added 161-line test file validating function-name extraction across 6 languages with pattern consistency checks against source file.
CLI and input parsing
src/cli.rs
Improved positional argument parsing to skip single-dash flags, enhanced relative-path normalization with fallback logic, and fixed benchmark timing to use incremental index instead of full rebuild.
Index pipeline edge preservation
src/indexer/pipeline.rs
Added logic to preserve inbound cross-file edges during batch file deletion by collecting edges pre-deletion, mapping to new node IDs post-insertion, and reconstructing edges via new get_inbound_cross_file_edges query.
Domain symbol handling
src/domain.rs
Added public helper is_test_symbol_or_annotated() that checks AST-derived test flags before falling back to naming heuristics.
Server concurrency and protocol
src/main.rs, src/mcp/protocol.rs, src/mcp/server/mod.rs
Implemented shared mutex-protected stdout for thread-safe concurrent writes, tightened oversized-message guard, added canonical project-root caching, switched .gitignore updates to append-based approach, and removed skip-serializing-if from JsonRpcResponse.id.
MCP server refinements
src/mcp/server/helpers.rs, src/mcp/server/tools.rs
Removed "USE" from HTTP method prefix recognition and eliminated redundant MatchedNode struct in semantic search Phase 3.
Parser and AST improvements
src/parser/relations.rs, src/parser/treesitter.rs
Enhanced superclass name cleanup to handle angle-brackets, improved string literal prefix stripping, added parser reset on parse failure, extended Rust test-attribute detection to include ::test] patterns, and added two test cases for Rust dispatch call detection.
Storage and queries
src/storage/queries.rs, src/storage/schema.rs, src/storage/db.rs
Added get_inbound_cross_file_edges() public query, added LIMIT to fuzzy-name fallback, tightened FTS5 term filtering to minimum length 2, removed user_version updates from migrations, wrapped table-mutation in transactions, and validated SQL input strings.
Test infrastructure
src/indexer/watcher.rs, tests/common/mod.rs, tests/integration.rs
Simplified watcher test imports, improved parse_tool_result error messages with context, updated integration tests to use symbol_name parameter and added explicit incremental-rebuild call before reindex test.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 Hoppy code changes, indices preserved so well,
Cross-file edges dance where pipeline bells resound,
Stdout threads now safely serialized—no more intertwine,
Tests multiply like bunnies, covering every line,
A skill-based renaissance blooms in docs divine! 🌱✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/plugin-integration-audit

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant