CLI and Integration
CLI and Integration
Section titled “CLI and Integration”CLI usage, integrations, advanced features, and troubleshooting. For an overview, see Circular Dependencies.
Advanced Features
Section titled “Advanced Features”Function-Level Cycles
Section titled “Function-Level Cycles”Arxo also detects cycles at the function/call level:
{ "scc": { "function": { "cycle_count": 507, "call_mass": 172, "cycle_cut_candidates": 4 } }}Use case: Find circular function calls within a module.
Edge Filtering and Findings
Section titled “Edge Filtering and Findings”SCC supports cycle analysis modes via metric config:
metrics: - id: scc config: edge_mode: all # all | runtime_only | structural_only emit_findings: true # emit FindingType::CyclicDependency max_cycles_in_ui: 50 # cap cycle microscope payloadGit History Integration
Section titled “Git History Integration”Enable git history to enrich cycle details with churn and hotspot metrics:
metrics: - id: scc config: use_git_history: true # Loads git history (slower but more actionable)What changes:
- Each node in
scc_detailsgets achurnvalue (total commits touching that file) - Each node gets a
hotspot_score(churn × centrality) indicating refactoring priority - The UI’s “Cycle Microscope” shows a sortable table ranking nodes by hotspot score
Example output:
{ "scc_details": [ { "scc_idx": 2, "nodes": ["src/document/builders/join.js", "src/document/utilities/assert-doc.js"], "node_table": [ { "node_id": "src/document/builders/join.js", "centrality": 0.15, "churn": 47, "hotspot_score": 7.05 // High - prioritize this for refactoring }, { "node_id": "src/document/utilities/assert-doc.js", "centrality": 0.08, "churn": 12, "hotspot_score": 0.96 } ] } ]}Strategy: Refactor nodes with the highest hotspot_score first (biggest impact on both structural and evolution metrics).
CLI Usage
Section titled “CLI Usage”Basic Analysis
Section titled “Basic Analysis”# Detect cyclesarxo analyze
# JSON outputarxo analyze --format json
# Show only SCC metricarxo analyze --metric sccWith Policy
Section titled “With Policy”# Enforce zero-cycle policyarxo analyze --config arxo.yml
# Exit code 1 if policy failsecho $?Detailed Output
Section titled “Detailed Output”# Get cycle-cut candidatesarxo analyze --format json | jq '.ui_schemas.scc.issues.categories.cycle_cut_candidates.critical'
# List all cyclesarxo analyze --format json | jq '.ui_schemas.scc.scc_details[] | select((.nodes | length) > 1)'
# Find largest cyclearxo analyze --format json | jq '.ui_schemas.scc.scc_details | max_by(.nodes | length)'Integration
Section titled “Integration”Pre-commit Hook
Section titled “Pre-commit Hook”repos: - repo: local hooks: - id: arxo-scc name: Check for circular dependencies entry: arxo analyze --metric scc --format json language: system pass_filenames: falseGitHub Actions
Section titled “GitHub Actions”name: Architecture Checkson: [push, pull_request]
jobs: cycles: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: arxo-dev/setup-arxo@v1 - run: arxo analyze --metric sccThe Arxo IDE shows cycles inline:
- Red squiggles on imports that create cycles
- Quick fix: “Show cycle path”
- CodeLens: “N modules in cycle”
Troubleshooting
Section titled “Troubleshooting””No cycles detected” but code has circular imports
Section titled “”No cycles detected” but code has circular imports”Cause: Grouping level might be too coarse.
Solution: Adjust grouping in config:
data: import_graph: group_by: file # Instead of folderLarge cycle reported but can’t find it
Section titled “Large cycle reported but can’t find it”Cause: Cycle spans many intermediate modules.
Solution: Use detailed output:
arxo analyze --format json | jq '.ui_schemas.scc.scc_details[] | select((.nodes | length) > 10)'Performance is slow
Section titled “Performance is slow”Cause: Analysis is not cached.
Solution: Enable caching:
cache: enabled: trueChurn and hotspot_score are always zero
Section titled “Churn and hotspot_score are always zero”Cause: Git history is not being loaded.
Solution: Explicitly enable git history in metric config:
metrics: - id: scc config: use_git_history: true # This is required for churn dataDebug: Set ARCH0_SCC_DEBUG=1 to see whether git history is being loaded:
ARCH0_SCC_DEBUG=1 arxo analyzeOutput will show:
[scc] use_git_history=true git_history=SomeUnderstanding scc.module.* vs scc.* metrics
Section titled “Understanding scc.module.* vs scc.* metrics”Both exist by design (module namespace mirror):
scc.component_countandscc.module.component_countare identicalscc.cycle_countandscc.module.cycle_countare identicalscc.max_cycle_sizeandscc.module.max_cycle_sizeare identicalscc.total_nodes_in_cyclesandscc.module.total_nodes_in_cyclesare identical
Which to use in policies? Either. scc.* is shorter and recommended.
Further Reading
Section titled “Further Reading”- Circular Dependencies — Back to overview
- Git History Integration — Enable churn and hotspot_score
- Function-Level Cycles — Call-graph cycles and cycle-cut candidates
- Performance — Benchmarks and tool comparison
- Fixing Cycles — Refactoring process
- CI Integration — Automate cycle detection