Stay updated — Join the build list for tutorials and AI insights. No spam.

Dependency Tracing

Trace relationships between components, find call chains, and understand data flow using graphify path.

Dependency Tracing

Trace relationships between any two components using graphify path — the most powerful command for understanding how code connects.

🔗 The path Command

1# Always signal activity first
2mkdir -p graphify-out && touch graphify-out/.graphify-activity
3
4# Trace from A to B
5graphify path <source> <target>

What It Shows

  • Node chain — Sequence of nodes connecting source to target
  • Edge types — imports_from, calls, contains, references
  • File locations — Exact paths and line numbers
  • Direction — Data/control flow direction

🎯 Common Use Cases

1. Script → Config (How does a script read config?)

1graphify path scripts/dictionary/yt-to-content-v2.py tasks/content.yaml

Typical output:

scripts/dictionary/yt-to-content-v2.py
  → imports_from → argparse (stdlib)
  → calls → main()
  → calls → parse_args()
  → reads → tasks/content.yaml (via Taskfile.yaml vars)

2. Task → Script (How does automation invoke code?)

1graphify path tasks/content.yaml scripts/dictionary/yt-to-content-v2.py

3. Module → Output (Where does data go?)

1graphify path scripts/dictionary/extract_vocab.py data/dictionary/capitalism/vocabulary.yaml

4. Skill → Implementation (How does a skill work?)

1graphify path .github/skills/youtube-content/SKILL.md scripts/dictionary/yt-to-content-v2.py

5. Content → Generator (What creates this file?)

1graphify path content/courses/ags/storytelling/j-wiebe/youtube-content/articulate-your-thoughts/index.md scripts/dictionary/yt-to-content-v2.py

🔍 Edge Types Explained

Edge TypeMeaningExample
imports_fromModule imports anotherimport yaml
callsFunction calls anothermain() → parse_args()
containsFile contains symbolyt-to-content-v2.py → mergeParams()
referencesSymbol references anothermergeParams() → deepMerge()
readsCode reads filescript → tasks/content.yaml
writesCode writes filescript → vocabulary.yaml

🧭 Reading Path Output

Example: Task → Script

tasks/content.yaml
  → contains → yt:content task
  → references → scripts/dictionary/yt-to-content-v2.py (via {{.DICT_PYTHON}})
  → calls → graphify . (indirect)

Example: Script → Output

scripts/dictionary/yt-to-content-v2.py
  → contains → main()
  → calls → argparse.ArgumentParser.parse_args()
  → calls → yt_to_content.main()
  → calls → create_folders()
  → writes → .prompts/youtube/prompts/j-wiebe/articulate-your-thoughts-prompt.md
  → writes → .prompts/youtube/transcripts/j-wiebe/articulate-your-thoughts-transcript.txt

🎯 Practical Scenarios

Debugging: “Why did this file change?”

1# Find what writes to it
2graphify query "what writes to data/course/ags/storytelling/j-wiebe/youtube-content/course-structure.yaml?"
3# Then trace
4graphify path scripts/dictionary/yt-to-content-v2.py data/course/ags/storytelling/j-wiebe/youtube-content/course-structure.yaml

Refactoring: “Is it safe to change this function?”

1# Find all callers
2graphify query "what calls mergeParams?"
3# Or trace from each caller
4graphify path scripts/dictionary/merge_params.py scripts/dictionary/yt-to-content-v2.py

Understanding: “How does data get from X to Y?”

1# YouTube URL → Hugo page
2graphify path scripts/dictionary/yt-to-content-v2.py content/courses/ags/storytelling/j-wiebe/youtube-content/articulate-your-thoughts/index.md

Onboarding: “How does this feature work end-to-end?”

1# Config → Script → Output
2graphify path tasks/content.yaml scripts/dictionary/yt-to-content-v2.py
3graphify path scripts/dictionary/yt-to-content-v2.py .prompts/youtube/prompts/j-wiebe/articulate-your-thoughts-prompt.md

💡 Advanced Tips

Trace Multiple Paths

1# Find all paths between two nodes (if multiple exist)
2for target in scripts/dictionary/*.py; do
3  graphify path tasks/content.yaml "$target" 2>/dev/null | head -20
4done

Combine with Explain

1# 1. Find the path
2graphify path A B
3
4# 2. Deep-dive on intermediate nodes
5graphify explain intermediate_node.py

Filter by Edge Type

1# Only show import chains
2graphify path A B | grep "imports_from"
3
4# Only show call chains
5graphify path A B | grep "calls"

🚨 Common Issues

IssueSolution
No path foundNodes not in same graph; rebuild with graphify update .
Path too longGraph has many indirect connections; use explain on key nodes
Wrong directionTry graphify path B A (reverse)
Missing edgesFull graph needed (with API key) for doc/file references

Next Steps