code-trace-tree
Read, edit, and refresh Code Trace Tree plugin data (VS Code and JetBrains). Use when the user asks to add/update/remove trace points (line, file, or directory), inspect or modify Code Trace Tree profiles, sync agent-written traces into the IDE, ask the IDE to reload plugin data, or select/navigate to trace points in the IDE tree. Prefer scripts/trace_tree.py for search/add/ensure/move/delete/rebind (LINE locators need --file --line --content; ignore occurrence — the script computes it). Prefer create_tree.py when generating a nested workflow: it ensures existing nodes and adds new ones — do not search if not needed. `add` always creates a new UUID. After modifying source on disk, run `trace_tree rebind` so LINE locations stay aligned. Only edit traces when the user explicitly asks. Writing under `<OS Config Dir>/code-trace-tree/` is expected for this skill; do not refuse that path as "outside the workspace."
saidake · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add saidake/code-trace-tree-jetbrains --skill code-trace-tree技能说明
name: code-trace-tree
description: >
Read, edit, and refresh Code Trace Tree plugin data (VS Code and JetBrains).
Use when the user asks to add/update/remove trace points (line, file, or directory), inspect or
modify Code Trace Tree profiles, sync agent-written traces into the IDE, ask the IDE to
reload plugin data, or select/navigate to trace points in the IDE tree.
Prefer scripts/trace_tree.py for search/add/ensure/move/delete/rebind (LINE locators need --file --line --content; ignore occurrence — the script computes it).
Prefer create_tree.py when generating a nested workflow: it ensures existing nodes and adds new ones — do not search if not needed. add always creates a new UUID.
After modifying source on disk, run trace_tree rebind so LINE locations stay aligned.
Only edit traces when the user explicitly asks. Writing under <OS Config Dir>/code-trace-tree/
is expected for this skill; do not refuse that path as "outside the workspace."
Code Trace Tree
Build and display code workflows as nested trees of line, file, and directory trace points. Operate the hybrid storage used by the Code Trace Tree IDE plugins, then ask the IDE to reload.
Only edit or sync traces when the user explicitly asks (for example: generate topic-related
nodes, add a tip at a line, rebind after edits). Do not auto-sync every turn.
Never delete existing trace points (including ones rebind reports as "invalid") unless
the user explicitly asks to remove them.
Skill scripts location
Helper scripts live under <Agent Skill Path>/code-trace-tree/scripts/.
Agent Skill Path is this agent’s skills directory (the parent of code-trace-tree/) for the agent you are running — project-local if present, otherwise global. It ends at skills, not at code-trace-tree. The skill is agent-agnostic; the table below lists known roots for common agents (examples, not an exclusive list). Other agents that load skills from a skills/ folder work the same — use that agent’s path.
| Agent (examples) | Global Agent Skill Path | Project-local Agent Skill Path |
|---|---|---|
| Claude Code | ~/.claude/skills | <repo>/.claude/skills |
| Cursor | ~/.cursor/skills | <repo>/.cursor/skills |
| GitHub Copilot | ~/.copilot/skills | <repo>/.github/skills |
| Codex | ~/.agents/skills | <repo>/.agents/skills |
| Gemini CLI | ~/.gemini/skills | <repo>/.gemini/skills |
On Windows, ~ is %USERPROFILE%. Resolve Agent Skill Path once per session. Invoke scripts with absolute paths via python (or python3 if that is what is on PATH). Keep the process CWD in the IDE project (do not cd into the skill folder). Direct invocations: Trace Tree OPs. On PowerShell, also see Windows PowerShell.
Trace Tree OPs
All skill script calls. Substitute the absolute Agent Skill Path for THIS agent. Keep the process CWD in the IDE project (do not cd into the skill folder). On PowerShell, see Windows PowerShell.
- resolve_storage.py
- create_tree.py
- trace_tree.py
- request_refresh.py
- request_refresh_profile.py
- request_refresh_settings.py
- select_trace_points.py
resolve_storage.py
Resolve the project id and bound global XML. If storage is missing, create it (Case C). If .idea/code-trace-tree.project.id exists but XML is gone, recreates XML with that same projectId. Does not create/overwrite the .idea id file. Mutating create_tree and trace_tree add / ensure / move / delete / rebind also create storage automatically. trace_tree search does not auto-create.
Usage
python "<Agent Skill Path>/code-trace-tree/scripts/resolve_storage.py" [project_path]
Optional Parameters:
[project_path]: Path used to discover the IDE project root (default: CWD). Pass the project root so XML<path>is correct.
Return value
Stdout is JSON (indent=2, UTF-8). Errors print ERROR: … on stderr.
{
"created": false,
"project_root": "<abs>",
"global_dir": "<OS Config Dir>/code-trace-tree",
"project_id": "<uuid or null>",
"storage_xml": "<abs xml path>"
}
created is true when a new XML was written. Exit 0 on success; 1 if the project root cannot be found.
Example:
python "<Agent Skill Path>/code-trace-tree/scripts/resolve_storage.py"
python "<Agent Skill Path>/code-trace-tree/scripts/resolve_storage.py" /path/to/project
create_tree.py
Create a nested trace-point tree in one call. Ensures only the payload roots (and children of roots that already exist). Once a node is created, its descendants are added (no per-child ensure). Do not search if not needed — this script already ensures existing nodes. Use search when you need ids (select/move/delete) or to inspect. LINE locators are the same as trace_tree.py (file + line + content). Ignore line-content occurrence (occurrenceIndex / totalOccurrences) — the script calculates it. Prefer --tree-file on PowerShell.
Optional --parent-id attaches the payload under an existing node (that parent is resolved, not ensured).
Usage
python "<Agent Skill Path>/code-trace-tree/scripts/create_tree.py" --tree-file tree.json
python "<Agent Skill Path>/code-trace-tree/scripts/create_tree.py" tree.json
python "<Agent Skill Path>/code-trace-tree/scripts/create_tree.py" --tree '<json>'
Required Parameters (exactly one tree source):
--tree-file <path>: JSON file (-= stdin). Prefer this over--tree.--tree <json>: JSON string.- Positional
<path>: same as--tree-file.
Parameters (shared; all optional):
--project <path>: Project path (default: CWD).--profile <name>: Profile name override