ShiftinBits/constellation-claude

GitHub: ShiftinBits/constellation-claude

为 Claude Code 提供基于 Constellation 的代码库语义索引与依赖分析能力的增强插件。

Stars: 2 | Forks: 0

# 用于 Claude Code 的 Constellation Plugin [![MCP Server](https://img.shields.io/badge/mcp-@constellationdev/mcp-black.svg?logo=modelcontextprotocol)](https://github.com/ShiftinBits/constellation-mcp) [![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL--3.0-3DA639?logo=opensourceinitiative&logoColor=white)](LICENSE) 虽然 Constellation 的 MCP server 提供了原始的代码智能功能,但此插件通过以下方式增强了您的 Claude Code 体验: | 功能 | 优势 | |---------|---------| | **Slash 命令** | 快速访问常用工作流 | | **上下文技能** | Claude 自动加载相关知识——包括在进行高风险更改前主动进行影响分析 | | **安全 Hooks** | 在会话开始时、subagent 中以及执行 Grep/Glob/Bash 搜索命令前,引导 Claude 优先使用 `code_intel` 而非文本搜索 | ## 功能 ### 命令 使用简单的 slash 命令执行强大的分析: | 命令 | 描述 | |---------|-------------| | `/constellation:status` | 检查 API 连接性和项目索引状态 | | `/constellation:diagnose` | 快速检查连接性和身份验证的健康状况 | | `/constellation:impact ` | 在更改符号前分析其爆炸半径 | | `/constellation:deps [--reverse]` | 映射依赖关系或查找依赖于某文件的内容 | | `/constellation:unused` | 发现孤立的 export 和死代码 | | `/constellation:architecture` | 获取代码库结构的高层级概览 | ### 技能 Claude 会根据您的问题自动激活专业知识: | 技能 | 当您询问关于...时触发 | |-------|-------------------------------| | **constellation-troubleshooting** | 错误代码、连接问题、调试问题 | | **impact-analysis** | 重命名、重构、删除或移动符号/文件;“如果...会破坏什么”、“X 是死代码吗”、“什么依赖于 X” | **触发示例:** ``` You: "Rename AuthService to AuthenticationService" Claude: "Before renaming, let me analyze the potential impact..." [impact-analysis skill activates, runs api.impactAnalysis, reports risk + dependents] ``` ### Hooks 事件 hooks 可实现智能、透明的辅助: | Hook | 事件 | 行为 | |------|-----------------|----------| | **会话感知** | `SessionStart` | 在会话开始时注入 `code_intel` MCP 工具感知 | | **Subagent 感知** | `SubagentStart` | 将 `code_intel` 感知注入生成的 subagent 中(诸如 Explore/Plan 之类的内置组件不会继承项目的 AGENTS.md) | | **搜索工具引导** | `PreToolUse` (`Grep\|Glob`) | 提醒 Claude 对于结构性查询应优先使用 `code_intel` 而非 Grep/Glob | | **Bash 搜索引导** | `PreToolUse` (`Bash`) | 检查命令,并在其以 `grep`/`rg`/`glob`/`awk`/`findstr` 开头时发出相同的提醒 | 所有 hooks 都以设置了 `CONSTELLATION_ACCESS_KEY` 为触发条件(没有 key -> 静默空操作,因此插件不会在未配置 Constellation 的环境中进行干扰)。 ## 安装说明 ### 前置条件 1. **Constellation 账户**(参见 [Constellation](https://app.constellationdev.io)) 2. 在 Constellation 中已索引的**项目** 3. 已配置的**访问 key** ### 快速开始 ``` # 将 marketplace 添加到 Claude claude plugin marketplace add ShiftinBits/constellation-claude # 安装 Constellation Claude plugin claude plugin install constellation@constellation-plugins --scope project ``` ## 使用示例 ### 检查您的设置 ``` > /constellation:status Status: Connected Project: my-awesome-app Files Indexed: 1,247 Symbols: 8,932 Languages: TypeScript, JavaScript ``` ### 重构前进行分析 ``` > /constellation:impact validateUser src/auth/validator.ts Symbol: validateUser (function) Risk Level: MEDIUM Files Affected: 12 Symbols Affected: 34 Test Coverage: 67% Recommendations: - Update unit tests in auth.spec.ts - Check integration with UserController ``` ### 查找死代码 ``` > /constellation:unused --kind function Found 7 orphaned functions: ├── src/utils/legacy.ts │ ├── formatLegacyDate (line 23) │ └── parseLegacyConfig (line 45) ├── src/helpers/deprecated.ts │ └── oldValidation (line 12) ... ``` ### 理解依赖关系 ``` > /constellation:deps src/services/payment.service.ts Dependencies (12): ├── Internal (8) │ ├── src/models/payment.model.ts │ ├── src/utils/currency.ts │ └── ... └── External (4) ├── stripe ├── lodash └── ... No circular dependencies detected. ``` ## 故障排除 ### 常见问题 | 问题 | 解决方案 | |-------|----------| | `AUTH_ERROR` | 检查 `CONSTELLATION_ACCESS_KEY` 是否设置正确,使用 `constellation auth` CLI 命令进行设置 | | `PROJECT_NOT_INDEXED` | 在您的项目中运行 `constellation index --full` | | 命令未出现 | 重启 Claude Code 或检查插件路径 | ## 文档 - [Constellation 文档](https://docs.constellationdev.io) — 完整的平台文档 - [MCP Server](https://github.com/shiftinbits/constellation-mcp) — 底层的 MCP server - [Claude Code 插件](https://docs.anthropic.com/claude-code/plugins) — 插件开发指南 ## 许可证 GNU Affero General Public License v3.0 (AGPL-3.0) 版权所有 © 2026 ShiftinBits Inc. 详情请参阅 [LICENSE](LICENSE) 文件。
标签:Claude Code, MCP, SOC Prime, 云安全监控, 代码分析, 代码理解, 凭证管理, 开发工具, 数据可视化, 自定义脚本, 静态分析