一键导入
blast-radius
Analyze the blast radius of code changes using GitLab Orbit's knowledge graph. Trace cross-file dependencies and assess impact before making changes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyze the blast radius of code changes using GitLab Orbit's knowledge graph. Trace cross-file dependencies and assess impact before making changes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | blast-radius |
| description | Analyze the blast radius of code changes using GitLab Orbit's knowledge graph. Trace cross-file dependencies and assess impact before making changes. |
Use GitLab Orbit's knowledge graph to find all code that depends on a given file, function, or class. This helps developers understand what will break before they make changes.
@blast-radius <file-path> in an issue or MR commentUse get_graph_schema to list available node types and relationships in the Orbit knowledge graph. Key types:
gl_definition — files, functions, classes, modulesgl_reference — edges connecting definitions (source depends on target)Query gl_definition nodes matching the target file or function:
SELECT * FROM gl_definition WHERE path LIKE '%target_file%' OR name = 'functionName';
query_graph("MATCH (d:gl_definition) WHERE d.path CONTAINS 'target_file' RETURN d.id, d.name, d.path")
Note: The SQL syntax is used with Orbit CLI (orbit sql ...). The Cypher-style syntax is used with Orbit Remote (query_graph MCP tool). Pick the one that matches your Orbit access mode.
Find all gl_reference edges pointing TO the definition. These are the direct dependents:
-- What depends on target?
SELECT DISTINCT t2.name, t2.path, t2.language
FROM gl_definition t1
JOIN gl_reference ON t1.id = gl_reference.target_id
JOIN gl_definition t2 ON gl_reference.source_id = t2.id
WHERE t1.path LIKE '%target_file.py%'
For each direct dependent, repeat Step 3 to find files that depend on THEM:
-- Full transitive chain (2 levels)
WITH direct AS (
SELECT t2.id, t2.name, t2.path
FROM gl_definition t1
JOIN gl_reference ON t1.id = gl_reference.target_id
JOIN gl_definition t2 ON gl_reference.source_id = t2.id
WHERE t1.path LIKE '%target_file.py%'
)
SELECT DISTINCT t3.name, t3.path, t3.language
FROM direct d
JOIN gl_reference ON d.id = gl_reference.target_id
JOIN gl_definition t3 ON gl_reference.source_id = t3.id
WHERE t3.id NOT IN (SELECT id FROM direct)
If the knowledge graph spans multiple projects, identify which projects contain dependents:
SELECT DISTINCT t2.project_path
FROM gl_definition t1
JOIN gl_reference ON t1.id = gl_reference.target_id
JOIN gl_definition t2 ON gl_reference.source_id = t2.id
WHERE t1.path LIKE '%target_file.py%'
Risk is classified from the total dependent count (direct + transitive)
using inclusive lower bounds, so every count maps to exactly one level (no
overlapping boundaries). Thresholds are configurable via .env.
| Risk Level | Total dependents | Also Critical if |
|---|---|---|
| Low | 0–2 | — |
| Medium | 3–10 | — |
| High | 11–50 | — |
| Critical | 51+ | dependents span 3+ projects (shared hub) |
The reference implementation of these rules lives in blast_radius/risk.py
and is covered by boundary tests in tests/test_risk.py.
Always structure your findings as:
DIRECT IMPACT:
- <file>:<line> — <how it references the target>
...
TRANSITIVE IMPACT:
- <file> — depends on <direct-dependent>
...
PROJECT IMPACT:
- <project-path>
RISK SCORE: <Low|Medium|High|Critical>
RECOMMENDATION: <suggested action before landing the change>
For local mode (Orbit CLI):
# Index a project
orbit index /path/to/project
# Basic query — all definitions
orbit sql "SELECT * FROM gl_definition LIMIT 20"
# Dependencies of a file
orbit sql "SELECT t2.path, t2.name FROM gl_definition t1 JOIN gl_reference ON t1.id = gl_reference.target_id JOIN gl_definition t2 ON gl_reference.source_id = t2.id WHERE t1.path LIKE '%target%'"
# List relationship types
orbit sql "SELECT DISTINCT relationship_type FROM gl_reference"
# Count dependents per file (hotspot analysis)
orbit sql "SELECT t1.path, COUNT(gl_reference.source_id) as dependents FROM gl_definition t1 JOIN gl_reference ON t1.id = gl_reference.target_id GROUP BY t1.path ORDER BY dependents DESC LIMIT 20"
If query_graph returns no matching gl_definition nodes:
tokens.py instead of src/auth/tokens.py)orbit index (local) or check Orbit Remote indexing status.{error: "No matching definition found for '<query>'. Try a different path or function name."}If the query matches multiple definitions (e.g., auth.py matches src/auth/auth.py and tests/auth/auth.py):
{ambiguous: true, matches: [path1, path2, ...], message: "Multiple matches found. Use the full path from repository root."}Some files may not appear in the knowledge graph if they were added after the last index run. Inform the developer and suggest re-indexing.
blast_radius/engine.py and the cycle test in tests/test_engine.py.resolve_target in blast_radius/engine.py.import() and require() may not appear in static analysis. Flag these as "unanalyzed."*test* and *spec* paths.*.generated.* and __generated__/ paths.