Skip to content

Search and Rank

Search is for discovery when you already know the behavior you want to inspect. It returns symbols with qnames, files, line numbers, snippets, and scores.

Example

Find code by intent

Searches by intent and returns ranked symbols with file and snippet context.

$ agide search "apply middleware dispatch" --limit 5
symbols (5 total)
function  src.applyMiddleware.applyMiddleware
function applyMiddleware(
  ...middlewares: Middleware[]
): StoreEnhancer<any> {
  return createStore => (reducer, preloadedState) => {
    const store = createStore(reducer, preloadedState)
...
interface  src.types.middleware.Middleware
interface Middleware<
  _DispatchExt = {}, // TODO: see if this can be used in type definition somehow (can't be removed, as is used to get final dispatch type)
  S = any,
...

Output shortened for readability.

Rank is the default way to start an agent improvement pass. The combined view sorts by quality signals such as complexity, coupling, churn, side effects, and ambiguity so you can start with the worst offender instead of guessing.

Example

Rank quality hotspots

Shows the worst combined quality hotspots across complexity, coupling, churn, side effects, and ambiguity.

$ agide rank --limit 5
rank combined (5 rows)
comb   cplx   coup   churn  effects ambig  symbol                                 summary
1.000  1.000  1.000  0.000  1.000   1.000  src.createStore.createStore            300 lines, many decision branches; widely…
0.695  0.800  0.286  0.000  1.000   1.000  src.combineReducers.combineReducers    mutates external state heavily; many deci…
0.386  0.873  0.286  0.000  0.000   1.000  src.utils.kindOf.miniKindOf            many decision branches; no documentation
0.271  0.400  0.214  0.000  0.200   1.000  src.combineReducers.getUnexpectedStat… no documentation; branchy
0.199  0.182  0.214  0.000  0.200   1.000  src.utils.isPlainObject.isPlainObject  no documentation

Dimension drill-down keeps the same interface but focuses on one risk signal when a pass is specifically about complexity, coupling, churn, side effects, or ambiguity.

Example

Drill into one dimension

Ranks the same project by a single quality dimension.

$ agide rank complexity --limit 5
rank complexity (5 rows)
comb   cplx   coup   churn  effects ambig  symbol                                 summary
1.000  1.000  1.000  0.000  1.000   1.000  src.createStore.createStore            300 lines, many decision branches; widely…
0.386  0.873  0.286  0.000  0.000   1.000  src.utils.kindOf.miniKindOf            many decision branches; no documentation
0.695  0.800  0.286  0.000  1.000   1.000  src.combineReducers.combineReducers    mutates external state heavily; many deci…
0.271  0.400  0.214  0.000  0.200   1.000  src.combineReducers.getUnexpectedStat… no documentation; branchy
0.193  0.236  0.143  0.000  0.200   1.000  src.bindActionCreators.bindActionCrea… no documentation

The per-symbol report card is the context to hand to an engineer or agent before editing a risky function.

Example

Inspect one symbol

Returns a report card for a single symbol copied from verified rank output.

$ agide rank src.createStore.createStore
src.createStore.createStore · function · $REDUX/src/createStore.ts
300 lines

  complexity  worst     300 lines, many decision branches
  coupling    worst     widely used
  churn       ok      
  side effects  worst     mutates external state heavily
  ambiguity   warning   no documentation

suggested: consider isolating side effects from the core logic