callgraph.sh — thin wrapper over callgraph (Rust); compact, token-efficient PHP / JS / TS / Vue file context for agents,
(callgraph parses PHP, .vue/.js/.ts files and CSS/SCSS/JSON/MD/HTML into one schema;
 on Vue: props, emits (emit:<name>), template (components, event handlers), setup, hooks;
 searchable keys: route::<name>, i18n::<key>, vue::emit:<name>, <file>::<export>)
WITHOUT reading the file (methods + call graph, categorized).

Usage:
  bash ~/.claude/skills/callgraph/callgraph.sh <file>                    outline (default) — see below
  bash ~/.claude/skills/callgraph/callgraph.sh <file> --format outline    same, explicit
  bash ~/.claude/skills/callgraph/callgraph.sh <file> --format api        public contract + docblock, WITHOUT the call graph
  bash ~/.claude/skills/callgraph/callgraph.sh <file> --format stats      category statistics
  bash ~/.claude/skills/callgraph/callgraph.sh <file> --format mermaid    Mermaid flowchart (for visualization)
  bash ~/.claude/skills/callgraph/callgraph.sh <file> --format dot        Graphviz DOT (for visualization)
  bash ~/.claude/skills/callgraph/callgraph.sh <file> --format json       raw categorized JSON (the callgraph parser's output)
  bash ~/.claude/skills/callgraph/callgraph.sh <file>[::method] --format flow  if/match/switch branches with line ranges (condition → what it calls)
  bash ~/.claude/skills/callgraph/callgraph.sh <dir> --format summary   one line per file (class, method count, docblock)
  bash ~/.claude/skills/callgraph/callgraph.sh <dir> --format coverage  undocumented public methods
  bash ~/.claude/skills/callgraph/callgraph.sh <dir> --format hotspots  top 20 methods by degree (in/out) — where to look first
  bash ~/.claude/skills/callgraph/callgraph.sh <dir|file1 file2 ...> --format outline
                                                several files/dirs — outlines one after another
  bash ~/.claude/skills/callgraph/callgraph.sh <file>::<methodname>       ONLY one method — the most compact form
                                                for large files, when you care about one specific method
                                                (combinable with any --format)
  bash ~/.claude/skills/callgraph/callgraph.sh <file|dir> --grep <pattern>       only calls whose target matches the pattern
                                                (only the methods/files containing a matching call — "where is it called");
                                                each call with its source line: "L25 │ $this->repo->find($id)";
                                                identical lines of one caller merged ("L12, L40 │ …"), at most 3 rows
                                                per caller, then "… +N more: L55, L61";
                                                "via Resolver" = called through an interface / trait / parent type
                                                (a Type::method pattern also finds those calls)
                                                Rust: "?::m" = receiver type unknown; a Type::m pattern still finds it (by name)
                                                TS: typed receivers (this.repo.find() with "repo: Repo") match Type::m;
                                                untyped / any / union receivers stay unresolved (search by method name)
  bash ~/.claude/skills/callgraph/callgraph.sh <dir> --grep <pattern> --depth N [--guess]
                                                callers of callers up to N levels (impact analysis); --guess: also the
                                                unresolved, name-only matches ("?")
  Paths: when several would repeat the project root, the first line is "root: /abs/project" and every path after it is
  relative to that root (usable as-is in the next call with the same --project).
  --project <alias|dir>: a registered alias, or an existing folder (absolute or relative) used as the root as-is.
  Syntax errors: "⚠ syntax error at L<n>" under FILE (and a closing ⚠ line); the code before and after the broken
  part is still mapped; exit code 0 — with --strict (or CALLGRAPH_STRICT=1, for CI) show / locate / profile exit
  with 3 instead (same output).
  bash ~/.claude/skills/callgraph/callgraph.sh <file>::<method> [...] --body   source of the method(s), line-numbered, compact: no
                                                docblock or blank lines, comments inside the body are kept (the line
                                                numbers stay exact; the "==" header says "docblock L…-… omitted")
                                                --doc: with the docblock; --raw: the exact, unfiltered source
  bash ~/.claude/skills/callgraph/callgraph.sh <dir> --grep <pattern> --body    source of the caller methods found
  bash ~/.claude/skills/callgraph/callgraph.sh <file> --lines <n>-<m>           any line range, line-numbered (e.g. a view file)
  bash ~/.claude/skills/callgraph/callgraph.sh <dir|file> --strings <pattern>   where string literals (error message, key) occur
  bash ~/.claude/skills/callgraph/callgraph.sh <dir|file> --const <pattern>     constant references, definitions and re-exports
                                                (PHP class constants / use const, Rust const/static / pub use, JS/TS export { })

Notes (pilot — a short note on a file or method, stored outside the source in <project>/.callgraph/notes.jsonl):
  bash ~/.claude/skills/callgraph/callgraph.sh note add <file>[::<method>] "<text>" [--project alias]
                                                prints the new note id; the anchor is the method NAME (Class::method also ok)
  bash ~/.claude/skills/callgraph/callgraph.sh note list [<file|dir>] [--project alias]
                                                "<id>  <file>::<Class>::<method>  2026-11-05 20:27  📝 <text>";
                                                [orphaned] = the method is no longer in the file
  bash ~/.claude/skills/callgraph/callgraph.sh note rm <id> [--project alias]
  bash ~/.claude/skills/callgraph/callgraph.sh <dir|file> --notes <pattern>    search notes (regex on text or anchor, case-insensitive)
  The outline shows "📝 2026-11-05 20:27 · <text>" under the file header / the method (newest first, max 3),
  --body above the method source. Times are UTC.

Where to start with a task (one call with the names and domain terms of the task):
  bash ~/.claude/skills/callgraph/callgraph.sh locate <term>... [--all] [--project alias]
                                                ranked files from the project map (no source reading), each with up to
                                                3 reasons: exact definition, file name, name part (camelCase / snake_case /
                                                kebab-case, singular / plural), string literal, call; "callers: N";
                                                top 5 files, --all: every matching file; "no match: …" lists the terms
                                                not found, "too general" the ones matching more than 30 files;
                                                exact definitions / file names rank first
                                                "a quoted phrase" (with spaces): one term, matched as a whole against
                                                string literals (UI labels); route::events.show: the route definition
                                                (->name() in routes/*.php) first, then the route() / to_route() /
                                                redirect()->route() calls; --orange-500: a CSS custom property

Excluded files: built-in folders (vendor, node_modules, …), minified / bundled JS / CSS, every folder's .gitignore
  (git rules), and .callgraphignore: "md" / ".md" / "*.md" excludes an extension, any other line is a .gitignore
  pattern relative to its folder ("public/build", "/storage/", "!keep.js"). --no-gitignore (any command) or
  CALLGRAPH_GITIGNORE=0 (MCP server, hook): the .gitignore files are not applied (.callgraphignore still is).
  "protect <pattern>" in .callgraphignore: the file stays in the map (outline, grep, locate) but is marked 🔒 —
  a hint for the agent not to edit it (migrations, generated code); the source can still be read.
Supported files: PHP, JS, TS, Vue, Rust, Swift, Python (.py, .pyi), Go (.go) + CSS/SCSS, JSON, Markdown, HTML (.html, .htm).
  --signatures (show): parameter and return types next to each method (also in --format api; TS/Vue return types,
  PHP DocBlock @param / @return, Python annotations, Go types).
  --help / -h / help: this text. Environment: CALLGRAPH_LANG, CALLGRAPH_STATS=0, CALLGRAPH_TELEMETRY=0,
  CALLGRAPH_UPDATE_CHECK=0, CALLGRAPH_NEXT=1, CALLGRAPH_STRICT=1, CALLGRAPH_GITIGNORE=0, CALLGRAPH_WATCH=0.
  bash ~/.claude/skills/callgraph/callgraph.sh --version                       version, platform and the binary's path

Project profile (architecture, layers and patterns from folder / file names, checked against the graph):
  bash ~/.claude/skills/callgraph/callgraph.sh profile [--project alias] [--full] [--with-vendor]
                                                ~15 lines: architecture, layers with folders and file counts, patterns,
                                                call direction between layers, unknown folders; --full: per folder;
                                                embedded third-party code and build output are skipped (--with-vendor:
                                                counted too); a role in both PHP and JS: controller (php) / controller (js)
  bash ~/.claude/skills/callgraph/callgraph.sh <dir> --layer service           only the files of that layer (name,name...;
                                                one ecosystem: controller:php, controller:js, …:swift, …:rust)
  bash ~/.claude/skills/callgraph/callgraph.sh <dir> --layers                  summary grouped by layer, [role] on FILE lines
  bash ~/.claude/skills/callgraph/callgraph.sh <dir> --grep <pattern> --depth 2 --by-layer   callers grouped by layer
                                                (closest to the callee first), a "[service]  3 calls" header per group
  event / listener / job / mail / notification need proof in the code (Dispatchable, extends Mailable…); an enum gets
  no role from its name; --layer / --layers / --by-layer classify exactly like the profile.
  Own folder names: a .callgraph-layers file in the project root ("service = app/Logic", "ignore-role = app/Legacy").
  A big legacy subtree to leave out entirely (e.g. an old app copy): a path line in .callgraphignore ("sn_monitoring/").

Local usage stats (stays on this computer unless the user turns sending on; no paths, names or search terms):
  bash ~/.claude/skills/callgraph/callgraph.sh stats [--days N]
                                                calls per command / MCP tool, user errors vs internal errors, time and
                                                output size in ranges, locate hit rate; last 7 days (max 90); off: CALLGRAPH_STATS=0
  bash ~/.claude/skills/callgraph/callgraph.sh stats --events [--days N]   local event log (one line per call, max 14 days, never sent) + top command transitions, and whether the next call's file / symbol was in the previous output
  bash ~/.claude/skills/callgraph/callgraph.sh telemetry status|preview|on|off
                                                opt-in sending of these daily counts (closed days only); preview: the exact
                                                JSON; on: asks for a y/N confirmation in a terminal (only the user can turn it
                                                on); hard off: CALLGRAPH_TELEMETRY=0

Suggested next step (opt-in: --next or CALLGRAPH_NEXT=1):
  a result may end with "↪ r7 possible next: [1] …  [2] …" (read-only navigation from names in that output)
  bash ~/.claude/skills/callgraph/callgraph.sh next r7 1 [--project alias]   runs suggestion 1 of result r7 (several: 1,3)

Refresh ahead of time (after a git pull or many edits, so the next query does not have to re-analyse):
  bash ~/.claude/skills/callgraph/callgraph.sh refresh [--project alias]     every changed / new / deleted file of the project
  bash ~/.claude/skills/callgraph/callgraph.sh refresh <file|dir> ... [--project alias]   only these (paths relative to the root)
                                                prints "refresh: N updated, N removed, N unchanged"; --background: returns
                                                at once and refreshes in a detached process; if another refresh is running
                                                it is skipped ("refresh: skipped")
  bash ~/.claude/skills/callgraph/callgraph.sh hook install|uninstall|status   Claude Code hook (~/.claude/settings.json):
                                                after Edit / Write / MultiEdit the edited file is refreshed in the background
                                                (only in registered projects or ones that already have .callgraph/);
                                                other settings are kept, a settings.json.bak backup is written first
  The MCP server (callgraph mcp) watches the projects it has loaded and refreshes changed files by itself
  (off: CALLGRAPH_WATCH=0).
  Register the MCP server for Claude Code: bash ~/.claude/skills/callgraph/install.sh --mcp (asked when run
  interactively; remove: claude mcp remove -s user callgraph). The server sends a short usage guide to the client
  (when to use which tool, how to read the output); its guide tool returns the full SKILL.md.

Language (of the terminal output and the help: en = English, default; hu = Hungarian):
  bash ~/.claude/skills/callgraph/callgraph.sh set-lang                 the current language and where it comes from
  bash ~/.claude/skills/callgraph/callgraph.sh set-lang <en|hu>         save the language (to the skill dir's lang file)
                                                also switches the skill instructions (SKILL.md) to that language;
                                                restart Claude Code to reload the skill
  CALLGRAPH_LANG=<en|hu> bash ~/.claude/skills/callgraph/callgraph.sh …   for one run (overrides the saved one)

Update (from GitHub Releases; projects.json, lang, errors.jsonl, feedback.jsonl, update-check.json are kept):
  bash ~/.claude/skills/callgraph/callgraph.sh update --check         is there a newer release? (changes nothing)
  bash ~/.claude/skills/callgraph/callgraph.sh update                 download and install the newer release
  bash ~/.claude/skills/callgraph/callgraph.sh update --force         reinstall even if up to date
  bash ~/.claude/skills/callgraph/callgraph.sh update --from <zip>    install from a local zip / URL (callgraph-<os>-<arch>.zip)
  bash ~/.claude/skills/callgraph/callgraph.sh update --dev           install the newest dev build of the develop branch
  bash ~/.claude/skills/callgraph/callgraph.sh update --check --dev   is there a newer dev build? (X.Y.Z-dev.<commit>)
  Dev builds may be unstable; a plain update goes back to the latest stable release. The automatic check and
  --auto-update stay on stable releases (on a dev build only a newer stable version counts).
  The download is verified against the release's SHA256SUMS (nothing is installed on a mismatch or if it is missing);
  --insecure-skip-checksum skips this. --from: verified by --sha256 <hex> or a SHA256SUMS next to the zip, else a warning.
  Automatic check: at most once a day, in the background; a newer release adds one "ℹ callgraph X is available" line
  to the end of the output. Off: CALLGRAPH_UPDATE_CHECK=0 (also off when CI is set or outside a skill installation).
  MCP server: "args": ["mcp", "--auto-update"] (recommended) installs a newer release at server start (at most once a
  day, SHA256SUMS required, same files as update) and restarts itself; on any failure it runs the current version and
  writes one line to stderr. Without the flag the first tool result of a session gets the "ℹ callgraph X is available"
  line. Both only write into the skill dir; CALLGRAPH_UPDATE_CHECK=0 turns off all network access.
  Anonymous daily count: once a day, on first use, the version, platform and three yes/no flags go to
  check.callgraph.eu (no ID, no IP stored). Off: CALLGRAPH_COUNT=0 or DO_NOT_TRACK=1 (also with CALLGRAPH_UPDATE_CHECK=0);
  DO_NOT_TRACK=1 also stops the opt-in telemetry.

Output limit: above 400 lines the directory outline switches to summary, the single-file one to a method index;

Engine: the logic (project alias resolution, `show`, error ids) lives in the `callgraph wrap` subcommand;
this wrapper only prints the help and forwards.
