Loading...
Loading...
Find function callees with GrepAI trace. Use this skill to discover what functions a specific function calls.
npx skill4agent add yoanbernabeu/grepai-skills grepai-trace-calleesgrepai trace calleesgrepai trace calleesfunc ProcessOrder(order) {
validateOrder(order)
calculateTotal(order)
sendConfirmation(order.email)
}
│
↓
┌───────┴───────────────────┐
│ What does ProcessOrder │
│ call? │
├───────────────────────────┤
│ • validateOrder │
│ • calculateTotal │
│ • sendConfirmation │
└───────────────────────────┘grepai trace callees "FunctionName"grepai trace callees "ProcessOrder"🔍 Callees of "ProcessOrder"
Found 4 callees:
1. validateOrder
File: services/order.go:45
Context: validateOrder(order)
2. calculateTotal
File: services/order.go:48
Context: total := calculateTotal(order.Items)
3. applyDiscount
File: services/order.go:51
Context: total = applyDiscount(total, order.Coupon)
4. sendConfirmation
File: services/order.go:55
Context: sendConfirmation(order.Email, total)grepai trace callees "ProcessOrder" --json{
"query": "ProcessOrder",
"mode": "callees",
"count": 4,
"results": [
{
"file": "services/order.go",
"line": 45,
"callee": "validateOrder",
"context": "validateOrder(order)"
},
{
"file": "services/order.go",
"line": 48,
"callee": "calculateTotal",
"context": "total := calculateTotal(order.Items)"
},
{
"file": "services/order.go",
"line": 51,
"callee": "applyDiscount",
"context": "total = applyDiscount(total, order.Coupon)"
},
{
"file": "services/order.go",
"line": 55,
"callee": "sendConfirmation",
"context": "sendConfirmation(order.Email, total)"
}
]
}grepai trace callees "ProcessOrder" --json --compact{
"q": "ProcessOrder",
"m": "callees",
"c": 4,
"r": [
{"f": "services/order.go", "l": 45, "fn": "validateOrder"},
{"f": "services/order.go", "l": 48, "fn": "calculateTotal"},
{"f": "services/order.go", "l": 51, "fn": "applyDiscount"},
{"f": "services/order.go", "l": 55, "fn": "sendConfirmation"}
]
}grepai trace callees "ProcessOrder" --toonNote:and--jsonare mutually exclusive.--toon
grepai trace callees "ProcessOrder" --mode fastgrepai trace callees "ProcessOrder" --mode precise| Mode | Speed | Accuracy | Dependencies |
|---|---|---|---|
| ⚡⚡⚡ | Good | None |
| ⚡⚡ | Excellent | tree-sitter |
# What does this complex function do?
grepai trace callees "handleRequest"
# Map the data flow
grepai trace callees "processPayment"# What external services does this call?
grepai trace callees "syncData"
# What database operations happen?
grepai trace callees "saveUser"# What side effects does this function have?
grepai trace callees "updateProfile"
# Is this function doing too much?
grepai trace callees "doEverything" # Lots of callees = code smell# Generate dependency list for docs
grepai trace callees "initialize" --json | jq '.results[].callee'| Command | Question | Use Case |
|---|---|---|
| Who calls me? | Impact analysis |
| What do I call? | Behavior analysis |
# Combined analysis
grepai trace callers "processOrder" # Who uses this?
grepai trace callees "processOrder" # What does it do?# Get callees and filter to only .go files
grepai trace callees "main" --json | jq '.results[] | select(.file | endswith(".go"))'grepai trace callees "Login" --json | jq '.results[] | select(.callee | startswith("Test") | not)'# Count how many database vs. API calls
grepai trace callees "processOrder" --json | jq '.results[].callee' | grep -c "db"func ProcessOrder(order Order) error {
// Direct call
validateOrder(order)
// Method call
order.Validate()
// Package function
utils.Log("processing")
// Built-in (may or may not be captured)
fmt.Println("done")
return nil
}validateOrderValidateLogPrintlnfunc process(fn func()) {
fn() // Callee is unknown at static analysis time
}# Direct callees only
grepai trace callees "main"
# Full dependency tree (recursive)
grepai trace graph "main" --depth 3grepai trace callees "main" --json | jq -r '.results[].callee' | sort -u# Does processOrder call sendEmail?
grepai trace callees "processOrder" --json | jq -e '.results[] | select(.callee == "sendEmail")' && echo "Yes" || echo "No"#!/bin/bash
echo "# Function Dependencies Report"
echo ""
for fn in main initialize processOrder; do
echo "## $fn"
grepai trace callees "$fn" --json | jq -r '.results[].callee' | sed 's/^/- /'
echo ""
done--mode preciseenabled_languagesgrepai watch--mode precise🔍 Callees of "ProcessOrder"
Mode: fast
Function found in: services/order.go:40
Found 4 callees:
1. validateOrder
File: services/order.go:45
Context: validateOrder(order)
2. calculateTotal
File: services/order.go:48
Context: total := calculateTotal(order.Items)
3. applyDiscount
File: services/order.go:51
Context: total = applyDiscount(total, order.Coupon)
4. sendConfirmation
File: services/order.go:55
Context: sendConfirmation(order.Email, total)
Tip: Use 'grepai trace graph ProcessOrder' for recursive analysis