Skip to content

Review and Re-score

Diff review closes the editing step. It maps changed files and hunks back to indexed symbols and risk context before the patch becomes part of the codebase.

Example

Review a diff

Maps a real unified diff back to indexed symbols and risk context.

$ git diff -- src/combineReducers.ts | agide diff review
diff review: 1 changed file(s) matched to index data
  src/combineReducers.ts (1 symbol(s) touched)
    src.combineReducers.assertReducerShape (combined=0.197 complexity=3 cognitive=2 churn=0 lines changed=1)

Callgraph exposes package-level architecture edges when the next improvement is about coupling rather than a single function.

Example

Render architecture edges

Returns the strongest package-level call edges for architecture review.

$ agide callgraph --limit 10
callgraph: top 10 cross-package edge(s) by call count
test.typescript.enhancers.test-d -> src.createStore  (8)
src.createStore -> src.utils.kindOf  (7)
test.typescript.enhancers.test-d -> test.typescript.reducers.test-d  (4)
test.typescript.middleware.test-d -> test.typescript.store.test-d  (4)
src.combineReducers -> test.typescript.reducers.test-d  (3)
src.combineReducers -> src.utils.warning  (2)
src.utils.isAction -> src.utils.isPlainObject  (1)
src.createStore -> test.typescript.store.test-d  (1)
src.applyMiddleware -> src.compose  (1)
src.combineReducers -> src.utils.isPlainObject  (1)

Metrics exposes the structural numbers behind higher-level scoring. After a patch, re-index and compare the ranked list again; the loop should move the system toward lower risk, not just change code.

Example

Read raw metrics

Returns raw structural metrics for the selected ranked symbol.

$ agide metrics src.createStore.createStore
metrics src.createStore.createStore
  complexity:       24
  cognitive:        31
  nesting:          2
  physical lines:   300
  effective lines:  193
  side effects:     1.000
  fan-in / fan-out: 10 / 4
  halstead volume:  5771.79
  lcom4:            0