node-walk 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node_walk-0.2.0/.github/workflows/release.yml +158 -0
- node_walk-0.2.0/CHANGELOG.md +80 -0
- node_walk-0.2.0/PKG-INFO +174 -0
- node_walk-0.2.0/README.md +150 -0
- node_walk-0.2.0/plans/traversable-graph.md +351 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/pyproject.toml +13 -1
- node_walk-0.2.0/src/node_walk/__init__.py +3 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/cli/main.py +141 -22
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/query/engine.py +229 -31
- node_walk-0.2.0/src/node_walk/query/tree_formatter.py +186 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/storage/base.py +5 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/storage/sqlite_store.py +6 -0
- node_walk-0.2.0/src/node_walk/web/__init__.py +3 -0
- node_walk-0.2.0/src/node_walk/web/app.js +704 -0
- node_walk-0.2.0/src/node_walk/web/index.html +157 -0
- node_walk-0.2.0/src/node_walk/web/server.py +337 -0
- node_walk-0.2.0/src/node_walk/web/style.css +555 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/tests/test_query_engine.py +63 -1
- node_walk-0.2.0/tests/test_web_server.py +246 -0
- node_walk-0.1.0/.github/workflows/release.yml +0 -103
- node_walk-0.1.0/PKG-INFO +0 -107
- node_walk-0.1.0/README.md +0 -83
- node_walk-0.1.0/src/node_walk/__init__.py +0 -3
- {node_walk-0.1.0 → node_walk-0.2.0}/.github/workflows/ci.yml +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/.gitignore +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/LICENSE +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/plans/plan.md +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/analysis/__init__.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/analysis/base.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/analysis/python/__init__.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/analysis/python/analyzer.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/analysis/python/scope.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/analysis/python/visitor.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/analysis/python_analyzer.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/cli/__init__.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/indexer.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/ir/__init__.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/ir/enums.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/ir/models.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/query/__init__.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/storage/__init__.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/storage/repository.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/src/node_walk/storage/schema.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/tests/fixtures/nested_project/base.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/tests/fixtures/nested_project/impl.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/tests/fixtures/simple_project/services.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/tests/test_ir.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/tests/test_python_analyzer.py +0 -0
- {node_walk-0.1.0 → node_walk-0.2.0}/tests/test_storage.py +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
name: Release & Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*.*.*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
version:
|
|
10
|
+
description: "Version to publish (e.g. 0.1.1, patch, minor, major) — leave blank to use current __init__.py version"
|
|
11
|
+
required: false
|
|
12
|
+
default: ""
|
|
13
|
+
type: string
|
|
14
|
+
target:
|
|
15
|
+
description: "Target repository to publish to"
|
|
16
|
+
required: true
|
|
17
|
+
default: "pypi"
|
|
18
|
+
type: choice
|
|
19
|
+
options:
|
|
20
|
+
- "pypi"
|
|
21
|
+
- "testpypi"
|
|
22
|
+
create_github_release:
|
|
23
|
+
description: "Create a GitHub Release with built distribution assets"
|
|
24
|
+
required: false
|
|
25
|
+
default: true
|
|
26
|
+
type: boolean
|
|
27
|
+
is_prerelease:
|
|
28
|
+
description: "Mark GitHub Release as pre-release"
|
|
29
|
+
required: false
|
|
30
|
+
default: false
|
|
31
|
+
type: boolean
|
|
32
|
+
|
|
33
|
+
jobs:
|
|
34
|
+
build:
|
|
35
|
+
name: Build source and binary distribution
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
steps:
|
|
38
|
+
- name: Check out repository
|
|
39
|
+
uses: actions/checkout@v4
|
|
40
|
+
with:
|
|
41
|
+
fetch-depth: 0
|
|
42
|
+
|
|
43
|
+
- name: Set up Python
|
|
44
|
+
uses: actions/setup-python@v5
|
|
45
|
+
with:
|
|
46
|
+
python-version: "3.11"
|
|
47
|
+
|
|
48
|
+
- name: Set release version
|
|
49
|
+
id: set_version
|
|
50
|
+
run: |
|
|
51
|
+
python - << 'EOF'
|
|
52
|
+
import os, re
|
|
53
|
+
|
|
54
|
+
tag = os.environ.get("GITHUB_REF_NAME", "")
|
|
55
|
+
input_ver = os.environ.get("INPUT_VERSION", "").strip()
|
|
56
|
+
init_path = "src/node_walk/__init__.py"
|
|
57
|
+
|
|
58
|
+
with open(init_path, "r", encoding="utf-8") as f:
|
|
59
|
+
content = f.read()
|
|
60
|
+
|
|
61
|
+
m = re.search(r'__version__\s*=\s*["\']([^"\']+)["\']', content)
|
|
62
|
+
current_ver = m.group(1) if m else "0.1.0"
|
|
63
|
+
|
|
64
|
+
target_ver = current_ver
|
|
65
|
+
|
|
66
|
+
if input_ver:
|
|
67
|
+
if input_ver in ("patch", "minor", "major"):
|
|
68
|
+
parts = [int(p) for p in re.findall(r'\d+', current_ver)]
|
|
69
|
+
while len(parts) < 3:
|
|
70
|
+
parts.append(0)
|
|
71
|
+
if input_ver == "major":
|
|
72
|
+
target_ver = f"{parts[0]+1}.0.0"
|
|
73
|
+
elif input_ver == "minor":
|
|
74
|
+
target_ver = f"{parts[0]}.{parts[1]+1}.0"
|
|
75
|
+
elif input_ver == "patch":
|
|
76
|
+
target_ver = f"{parts[0]}.{parts[1]}.{parts[2]+1}"
|
|
77
|
+
else:
|
|
78
|
+
target_ver = input_ver.lstrip("v")
|
|
79
|
+
elif os.environ.get("GITHUB_REF_TYPE") == "tag" and tag.startswith("v"):
|
|
80
|
+
target_ver = tag.lstrip("v")
|
|
81
|
+
|
|
82
|
+
print(f"Setting package version to: {target_ver}")
|
|
83
|
+
new_content = re.sub(r'__version__\s*=\s*["\'][^"\']+["\']', f'__version__ = "{target_ver}"', content)
|
|
84
|
+
with open(init_path, "w", encoding="utf-8") as f:
|
|
85
|
+
f.write(new_content)
|
|
86
|
+
|
|
87
|
+
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as out:
|
|
88
|
+
out.write(f"version={target_ver}\n")
|
|
89
|
+
EOF
|
|
90
|
+
env:
|
|
91
|
+
INPUT_VERSION: ${{ inputs.version }}
|
|
92
|
+
|
|
93
|
+
- name: Install build tools
|
|
94
|
+
run: |
|
|
95
|
+
python -m pip install --upgrade pip
|
|
96
|
+
pip install build hatchling
|
|
97
|
+
|
|
98
|
+
- name: Build distributions
|
|
99
|
+
run: python -m build
|
|
100
|
+
|
|
101
|
+
- name: Store distribution packages
|
|
102
|
+
uses: actions/upload-artifact@v4
|
|
103
|
+
with:
|
|
104
|
+
name: python-package-distributions
|
|
105
|
+
path: dist/
|
|
106
|
+
|
|
107
|
+
publish:
|
|
108
|
+
name: Publish distribution
|
|
109
|
+
needs: [build]
|
|
110
|
+
runs-on: ubuntu-latest
|
|
111
|
+
environment:
|
|
112
|
+
name: ${{ inputs.target || 'pypi' }}
|
|
113
|
+
url: ${{ (inputs.target == 'testpypi') && 'https://test.pypi.org/p/node-walk' || 'https://pypi.org/p/node-walk' }}
|
|
114
|
+
permissions:
|
|
115
|
+
id-token: write # Required for Trusted Publishing (OIDC)
|
|
116
|
+
|
|
117
|
+
steps:
|
|
118
|
+
- name: Download distribution packages
|
|
119
|
+
uses: actions/download-artifact@v4
|
|
120
|
+
with:
|
|
121
|
+
name: python-package-distributions
|
|
122
|
+
path: dist/
|
|
123
|
+
|
|
124
|
+
- name: Publish to PyPI / TestPyPI
|
|
125
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
126
|
+
with:
|
|
127
|
+
repository-url: ${{ (inputs.target == 'testpypi') && 'https://test.pypi.org/legacy/' || '' }}
|
|
128
|
+
skip-existing: true
|
|
129
|
+
|
|
130
|
+
github-release:
|
|
131
|
+
name: Create GitHub Release
|
|
132
|
+
needs: [build]
|
|
133
|
+
if: ${{ inputs.create_github_release != false }}
|
|
134
|
+
runs-on: ubuntu-latest
|
|
135
|
+
permissions:
|
|
136
|
+
contents: write
|
|
137
|
+
|
|
138
|
+
steps:
|
|
139
|
+
- name: Download distribution packages
|
|
140
|
+
uses: actions/download-artifact@v4
|
|
141
|
+
with:
|
|
142
|
+
name: python-package-distributions
|
|
143
|
+
path: dist/
|
|
144
|
+
|
|
145
|
+
- name: Extract package version from distribution filename
|
|
146
|
+
id: get_version
|
|
147
|
+
run: |
|
|
148
|
+
FILE=$(ls dist/*.whl | head -n 1)
|
|
149
|
+
VERSION=$(basename "$FILE" | sed -E 's/.*-([0-9]+\.[0-9]+\.[0-9]+[a-zA-Z0-9._]*)-.*/\1/')
|
|
150
|
+
echo "version=v$VERSION" >> $GITHUB_OUTPUT
|
|
151
|
+
|
|
152
|
+
- name: Create GitHub Release
|
|
153
|
+
uses: softprops/action-gh-release@v2
|
|
154
|
+
with:
|
|
155
|
+
tag_name: ${{ steps.get_version.outputs.version }}
|
|
156
|
+
files: dist/*
|
|
157
|
+
generate_release_notes: true
|
|
158
|
+
prerelease: ${{ inputs.is_prerelease || false }}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to **node-walk** will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## [0.2.0] - 2026-08-23
|
|
15
|
+
### Added
|
|
16
|
+
- **`node-walk serve` command**: Launches an embedded local HTTP server (`localhost:7777` by default) and auto-opens the browser to the interactive graph explorer. Accepts `--port`, `--host`, and `--no-open` flags.
|
|
17
|
+
- **Graph Explorer UI** (`src/node_walk/web/`): A single-page browser application (no build step, no npm) that renders the full code graph using Cytoscape.js (CDN):
|
|
18
|
+
- Force-directed layout with manual drag support.
|
|
19
|
+
- Nodes coloured and shaped by `SymbolKind`; edges styled and coloured by `RelationshipType`.
|
|
20
|
+
- Click node → highlight it and direct neighbours + show detail panel (name, kind, file, lines, signature, docstring, source snippet).
|
|
21
|
+
- Double-click node → lazy 1-hop neighbour expansion via `/api/neighbors`.
|
|
22
|
+
- Right-click context menu: expand neighbours, focus subtree, hide node, reset focus.
|
|
23
|
+
- Debounced search bar backed by `/api/search` → centres and selects the top match.
|
|
24
|
+
- Filter panel (checkboxes) to show/hide nodes by `SymbolKind` and edges by `RelationshipType`; `CONTAINS` edges hidden by default.
|
|
25
|
+
- Tooltip on hover for nodes and edges.
|
|
26
|
+
- Fit-to-viewport and re-layout buttons.
|
|
27
|
+
- Status bar showing visible node/edge counts and selected symbol name.
|
|
28
|
+
- **Web API** (`src/node_walk/web/server.py`): Zero-dependency HTTP server (Python `http.server`) exposing:
|
|
29
|
+
- `GET /api/graph[?kinds=…&rels=…]` — full graph for initial render, with optional kind/relationship filters.
|
|
30
|
+
- `GET /api/symbol/{id}` — symbol detail including source snippet, caller/callee counts.
|
|
31
|
+
- `GET /api/neighbors/{id}[?direction=out|in|both&rels=…]` — 1-hop neighbours for lazy canvas expansion.
|
|
32
|
+
- `GET /api/search?q=…` — fuzzy symbol search (reuses `QueryEngine.find_symbol`).
|
|
33
|
+
- `GET /api/stats` — graph statistics.
|
|
34
|
+
- **API tests** (`tests/test_web_server.py`): Full test suite covering all five endpoints (schema validation, filter params, 404 handling, score ranges) plus a full smoke round-trip and static file serving tests.
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
- **`pyproject.toml`**: Added `force-include` entries so `index.html`, `style.css`, and `app.js` are bundled in the installed wheel.
|
|
38
|
+
- **`node-walk help`**: Added "Browser Explorer" section listing the `serve` command.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
## [0.1.1] - 2026-08-20
|
|
42
|
+
|
|
43
|
+
### Added
|
|
44
|
+
- **Dotted-Path Symbol Search**: Support searching for scoped symbols (e.g. `ModelAdapter.chat`, `UserService.create_user`) matching child symbols within parents without needing full module paths.
|
|
45
|
+
- **Fuzzy / Typo Matching**: Added `difflib.SequenceMatcher` fallback across symbols to handle typos (e.g. `ModelAdpater.chat`, `creat_user`), returning match scores and `(fuzzy)` indicators.
|
|
46
|
+
- **Graph Visualizations**: Added ASCII tree, Graphviz DOT (`.dot`), and Mermaid diagram formatters in `tree_formatter.py`.
|
|
47
|
+
- **`graph` Command**: Added `node-walk graph <symbol>` for general BFS neighborhood exploration with customizable direction (`out`, `in`, `both`) and format (`tree`, `dot`, `mermaid`, `table`).
|
|
48
|
+
- **Formatting Options**: Added `--format` / `-f` (`tree`, `dot`, `mermaid`, `table`) and `--output` / `-o` flags to `trace` and `blast-radius` commands.
|
|
49
|
+
- **Automated Versioning in CI**: Updated GitHub Actions release workflow with dynamic version resolution (tag triggers or `patch`/`minor`/`major` dispatch inputs).
|
|
50
|
+
|
|
51
|
+
### Changed
|
|
52
|
+
- **Branding**: Renamed project and CLI binaries from `CodeGraph` to `node-walk`.
|
|
53
|
+
- **Packaging**: Switched `pyproject.toml` to dynamic versioning via Hatchling reading from `src/node_walk/__init__.py`.
|
|
54
|
+
- **CLI Resolution**: Auto-select top candidate when an unambiguous high-confidence match is found instead of prompting unnecessarily.
|
|
55
|
+
- **Documentation**: Updated `README.md` to reflect all currently supported features, traversal modes, and CLI commands.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## [0.1.0] - 2026-08-20
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
- **Tree-sitter Python Analyzer**: High-speed AST analysis extracting files, classes, methods, functions, constants, variables, fields, docstrings, signatures, and call sites.
|
|
63
|
+
- **Language-Independent Code IR**: Pydantic v2 data models for `Symbol`, `Relationship`, `FileInfo`, `SourceLocation`, and `AnalysisResult`.
|
|
64
|
+
- **Typed Semantic Relationships**: Support for `CONTAINS`, `IMPORTS`, `CALLS`, `REFERENCES`, `EXTENDS`, `IMPLEMENTS`, and `OVERRIDES`.
|
|
65
|
+
- **SQLite Storage Backend**: Local SQLite database with WAL mode, foreign keys, and 10 query indexes.
|
|
66
|
+
- **Recursive CTE Query Engine**: In-database bounded graph traversals (`walk`, `trace`, `blast_radius`) using recursive SQL CTEs.
|
|
67
|
+
- **Rich CLI**: Typer-based command-line interface with custom themed tables and syntax highlighting:
|
|
68
|
+
- `index`: Analyze and index a codebase.
|
|
69
|
+
- `find`: Search symbols by name or qualified name.
|
|
70
|
+
- `definition`: Show symbol definition and metadata.
|
|
71
|
+
- `source`: Extract and display the exact source code block of any symbol.
|
|
72
|
+
- `callers` & `callees`: Discover direct upstream and downstream call sites.
|
|
73
|
+
- `refs`: Locate symbol references.
|
|
74
|
+
- `implementations`: Find concrete classes extending or implementing interfaces/ABCs.
|
|
75
|
+
- `imports`: Inspect imported modules and symbols.
|
|
76
|
+
- `trace`: Follow outgoing dependency chains.
|
|
77
|
+
- `blast-radius`: Follow incoming dependent chains.
|
|
78
|
+
- `stats`: Display database statistics and symbol/relationship breakdowns.
|
|
79
|
+
- `export`: Export the complete semantic graph to JSON.
|
|
80
|
+
- `help`: Custom command cheat sheet.
|
node_walk-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: node-walk
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Semantic code intelligence — local-first graph of your codebase for humans and LLMs
|
|
5
|
+
Author: CodeGraph Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: code-analysis,developer-tools,llm,semantic-graph
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Requires-Dist: pydantic>=2.0.0
|
|
16
|
+
Requires-Dist: rich>=13.0.0
|
|
17
|
+
Requires-Dist: tree-sitter-python>=0.23.0
|
|
18
|
+
Requires-Dist: tree-sitter>=0.23.0
|
|
19
|
+
Requires-Dist: typer>=0.12.0
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
22
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# node-walk
|
|
26
|
+
|
|
27
|
+
**Semantic code intelligence and graph navigation for Python codebases.**
|
|
28
|
+
|
|
29
|
+
Local-first · Lightweight · Fast indexing · SQLite backed · CLI & Visualizations
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## What is node-walk?
|
|
34
|
+
|
|
35
|
+
`node-walk` parses your Python codebase into an Intermediate Representation (IR) graph stored locally in SQLite. It lets humans and LLMs query code relationships semantically instead of running repeated `grep` or text searches.
|
|
36
|
+
|
|
37
|
+
### Key Capabilities
|
|
38
|
+
- **Smart Symbol Search**: Find symbols by simple name (`chat`), qualified dotted path (`ModelAdapter.chat`), or fuzzy typo matching (`ModelAdpater.chat`).
|
|
39
|
+
- **Exact Source Retrieval**: View definitions, signatures, and exact source ranges instantly.
|
|
40
|
+
- **Relationship Navigation**: Find callers, callees, references, class implementations / ABCs, and imports.
|
|
41
|
+
- **Graph Traversal & Visualization**: Trace outgoing call chains and incoming blast radiuses rendered in terminal (ASCII tree), exported to Graphviz (`.dot`), or generated as Mermaid diagrams.
|
|
42
|
+
- **Browser Graph Explorer**: `node-walk serve` launches a local interactive Cytoscape.js graph — click nodes, expand neighbours, search symbols, filter by kind/relationship, and inspect source — all without leaving the browser.
|
|
43
|
+
- **Lightweight & Self-Contained**: Pure Python + Tree-sitter + SQLite + stdlib `http.server`. Zero external database services, cloud dependencies, or build steps.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone <repo-url> node-walk
|
|
51
|
+
cd node-walk
|
|
52
|
+
python -m venv .venv
|
|
53
|
+
.venv\Scripts\activate # Windows (.venv/bin/activate on Linux/macOS)
|
|
54
|
+
pip install -e ".[dev]"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## CLI Usage
|
|
60
|
+
|
|
61
|
+
All CLI commands discover the graph database by searching for `.node_walk/graph.db` in the current directory or walking up parent directories.
|
|
62
|
+
|
|
63
|
+
### 1. Index a repository
|
|
64
|
+
```bash
|
|
65
|
+
cd /path/to/your/project
|
|
66
|
+
node-walk index .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. Search & Inspect Symbols
|
|
70
|
+
```bash
|
|
71
|
+
# Search by name, dotted path, or fuzzy typo
|
|
72
|
+
node-walk find UserService
|
|
73
|
+
node-walk find ModelAdapter.chat
|
|
74
|
+
node-walk find creat_user
|
|
75
|
+
|
|
76
|
+
# View symbol definition metadata
|
|
77
|
+
node-walk definition UserService.create_user
|
|
78
|
+
|
|
79
|
+
# View the exact source code block
|
|
80
|
+
node-walk source UserService.create_user
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 3. Explore Relationships
|
|
84
|
+
```bash
|
|
85
|
+
# Find callers of a function or method
|
|
86
|
+
node-walk callers UserService.create_user
|
|
87
|
+
|
|
88
|
+
# Find callees (what does this method call?)
|
|
89
|
+
node-walk callees UserService.create_user
|
|
90
|
+
|
|
91
|
+
# Find references/usages
|
|
92
|
+
node-walk refs User
|
|
93
|
+
|
|
94
|
+
# Find implementations / subclasses of an ABC or class
|
|
95
|
+
node-walk implementations BaseRepository
|
|
96
|
+
|
|
97
|
+
# Inspect imports
|
|
98
|
+
node-walk imports services.py
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 4. Graph Traversals & Visualizations
|
|
102
|
+
```bash
|
|
103
|
+
# Trace outgoing dependencies (tree, table, dot, mermaid)
|
|
104
|
+
node-walk trace UserService.create_user --depth 4 --format tree
|
|
105
|
+
node-walk trace UserService.create_user --format dot -o trace.dot
|
|
106
|
+
node-walk trace UserService.create_user --format mermaid
|
|
107
|
+
|
|
108
|
+
# Assess blast radius (what calls/depends on this?)
|
|
109
|
+
node-walk blast-radius UserService.create_user --format tree
|
|
110
|
+
|
|
111
|
+
# General graph exploration around any symbol
|
|
112
|
+
node-walk graph ModelAdapter --depth 3 --format tree
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 5. Browser Graph Explorer
|
|
116
|
+
```bash
|
|
117
|
+
# Launch the interactive graph explorer in your browser
|
|
118
|
+
node-walk serve # default: http://localhost:7777
|
|
119
|
+
node-walk serve --port 8888 # custom port
|
|
120
|
+
node-walk serve --no-open # start server only, don't auto-open
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The explorer visualises **all** symbols and relationships as a force-directed interactive graph:
|
|
124
|
+
|
|
125
|
+
| Action | Result |
|
|
126
|
+
|---|---|
|
|
127
|
+
| Click node | Highlight node + direct neighbours; open detail panel |
|
|
128
|
+
| Double-click node | Lazy-expand 1-hop neighbours from the server |
|
|
129
|
+
| Right-click node | Context menu: expand, focus subtree, hide, reset |
|
|
130
|
+
| Search bar | Debounced fuzzy search → centre + select result |
|
|
131
|
+
| Filter panel | Toggle visibility by SymbolKind / RelationshipType |
|
|
132
|
+
|
|
133
|
+
### 6. Utilities
|
|
134
|
+
```bash
|
|
135
|
+
# Show database statistics (symbol kinds, relationship counts)
|
|
136
|
+
node-walk stats
|
|
137
|
+
|
|
138
|
+
# Export the entire graph to JSON
|
|
139
|
+
node-walk export --output graph.json
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Architecture
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
Source Files (.py) ──► Tree-sitter Parser ──► Code IR (Pydantic v2) ──► SQLite Graph ──► Query Engine ──► CLI / Visualizers
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
- **Analysis**: Tree-sitter for robust AST parsing and symbol/call-site extraction.
|
|
151
|
+
- **Data Model**: Structured `Symbol`, `Relationship`, and `FileInfo` models.
|
|
152
|
+
- **Storage**: SQLite with WAL mode and indexes on names, qualified names, and relationships.
|
|
153
|
+
- **Traversals**: Recursive Common Table Expressions (CTEs) for fast BFS graph walks without loading graphs into memory.
|
|
154
|
+
- **Visualization Formats**: ASCII Tree, Graphviz DOT, and Mermaid markdown diagrams.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Running Tests
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
pytest tests/ -v
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Graph Storage & Lifecycle
|
|
167
|
+
|
|
168
|
+
The generated graph is stored in `.node_walk/graph.db` inside your indexed repository. It is disposable and can be re-indexed at any time with `node-walk index .`.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Changelog
|
|
173
|
+
|
|
174
|
+
See [CHANGELOG.md](file:///c:/Users/nshri/Github/CodeGraph/CHANGELOG.md) for full release history and notes.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# node-walk
|
|
2
|
+
|
|
3
|
+
**Semantic code intelligence and graph navigation for Python codebases.**
|
|
4
|
+
|
|
5
|
+
Local-first · Lightweight · Fast indexing · SQLite backed · CLI & Visualizations
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What is node-walk?
|
|
10
|
+
|
|
11
|
+
`node-walk` parses your Python codebase into an Intermediate Representation (IR) graph stored locally in SQLite. It lets humans and LLMs query code relationships semantically instead of running repeated `grep` or text searches.
|
|
12
|
+
|
|
13
|
+
### Key Capabilities
|
|
14
|
+
- **Smart Symbol Search**: Find symbols by simple name (`chat`), qualified dotted path (`ModelAdapter.chat`), or fuzzy typo matching (`ModelAdpater.chat`).
|
|
15
|
+
- **Exact Source Retrieval**: View definitions, signatures, and exact source ranges instantly.
|
|
16
|
+
- **Relationship Navigation**: Find callers, callees, references, class implementations / ABCs, and imports.
|
|
17
|
+
- **Graph Traversal & Visualization**: Trace outgoing call chains and incoming blast radiuses rendered in terminal (ASCII tree), exported to Graphviz (`.dot`), or generated as Mermaid diagrams.
|
|
18
|
+
- **Browser Graph Explorer**: `node-walk serve` launches a local interactive Cytoscape.js graph — click nodes, expand neighbours, search symbols, filter by kind/relationship, and inspect source — all without leaving the browser.
|
|
19
|
+
- **Lightweight & Self-Contained**: Pure Python + Tree-sitter + SQLite + stdlib `http.server`. Zero external database services, cloud dependencies, or build steps.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
git clone <repo-url> node-walk
|
|
27
|
+
cd node-walk
|
|
28
|
+
python -m venv .venv
|
|
29
|
+
.venv\Scripts\activate # Windows (.venv/bin/activate on Linux/macOS)
|
|
30
|
+
pip install -e ".[dev]"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## CLI Usage
|
|
36
|
+
|
|
37
|
+
All CLI commands discover the graph database by searching for `.node_walk/graph.db` in the current directory or walking up parent directories.
|
|
38
|
+
|
|
39
|
+
### 1. Index a repository
|
|
40
|
+
```bash
|
|
41
|
+
cd /path/to/your/project
|
|
42
|
+
node-walk index .
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 2. Search & Inspect Symbols
|
|
46
|
+
```bash
|
|
47
|
+
# Search by name, dotted path, or fuzzy typo
|
|
48
|
+
node-walk find UserService
|
|
49
|
+
node-walk find ModelAdapter.chat
|
|
50
|
+
node-walk find creat_user
|
|
51
|
+
|
|
52
|
+
# View symbol definition metadata
|
|
53
|
+
node-walk definition UserService.create_user
|
|
54
|
+
|
|
55
|
+
# View the exact source code block
|
|
56
|
+
node-walk source UserService.create_user
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3. Explore Relationships
|
|
60
|
+
```bash
|
|
61
|
+
# Find callers of a function or method
|
|
62
|
+
node-walk callers UserService.create_user
|
|
63
|
+
|
|
64
|
+
# Find callees (what does this method call?)
|
|
65
|
+
node-walk callees UserService.create_user
|
|
66
|
+
|
|
67
|
+
# Find references/usages
|
|
68
|
+
node-walk refs User
|
|
69
|
+
|
|
70
|
+
# Find implementations / subclasses of an ABC or class
|
|
71
|
+
node-walk implementations BaseRepository
|
|
72
|
+
|
|
73
|
+
# Inspect imports
|
|
74
|
+
node-walk imports services.py
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 4. Graph Traversals & Visualizations
|
|
78
|
+
```bash
|
|
79
|
+
# Trace outgoing dependencies (tree, table, dot, mermaid)
|
|
80
|
+
node-walk trace UserService.create_user --depth 4 --format tree
|
|
81
|
+
node-walk trace UserService.create_user --format dot -o trace.dot
|
|
82
|
+
node-walk trace UserService.create_user --format mermaid
|
|
83
|
+
|
|
84
|
+
# Assess blast radius (what calls/depends on this?)
|
|
85
|
+
node-walk blast-radius UserService.create_user --format tree
|
|
86
|
+
|
|
87
|
+
# General graph exploration around any symbol
|
|
88
|
+
node-walk graph ModelAdapter --depth 3 --format tree
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 5. Browser Graph Explorer
|
|
92
|
+
```bash
|
|
93
|
+
# Launch the interactive graph explorer in your browser
|
|
94
|
+
node-walk serve # default: http://localhost:7777
|
|
95
|
+
node-walk serve --port 8888 # custom port
|
|
96
|
+
node-walk serve --no-open # start server only, don't auto-open
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The explorer visualises **all** symbols and relationships as a force-directed interactive graph:
|
|
100
|
+
|
|
101
|
+
| Action | Result |
|
|
102
|
+
|---|---|
|
|
103
|
+
| Click node | Highlight node + direct neighbours; open detail panel |
|
|
104
|
+
| Double-click node | Lazy-expand 1-hop neighbours from the server |
|
|
105
|
+
| Right-click node | Context menu: expand, focus subtree, hide, reset |
|
|
106
|
+
| Search bar | Debounced fuzzy search → centre + select result |
|
|
107
|
+
| Filter panel | Toggle visibility by SymbolKind / RelationshipType |
|
|
108
|
+
|
|
109
|
+
### 6. Utilities
|
|
110
|
+
```bash
|
|
111
|
+
# Show database statistics (symbol kinds, relationship counts)
|
|
112
|
+
node-walk stats
|
|
113
|
+
|
|
114
|
+
# Export the entire graph to JSON
|
|
115
|
+
node-walk export --output graph.json
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Architecture
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
Source Files (.py) ──► Tree-sitter Parser ──► Code IR (Pydantic v2) ──► SQLite Graph ──► Query Engine ──► CLI / Visualizers
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
- **Analysis**: Tree-sitter for robust AST parsing and symbol/call-site extraction.
|
|
127
|
+
- **Data Model**: Structured `Symbol`, `Relationship`, and `FileInfo` models.
|
|
128
|
+
- **Storage**: SQLite with WAL mode and indexes on names, qualified names, and relationships.
|
|
129
|
+
- **Traversals**: Recursive Common Table Expressions (CTEs) for fast BFS graph walks without loading graphs into memory.
|
|
130
|
+
- **Visualization Formats**: ASCII Tree, Graphviz DOT, and Mermaid markdown diagrams.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Running Tests
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pytest tests/ -v
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Graph Storage & Lifecycle
|
|
143
|
+
|
|
144
|
+
The generated graph is stored in `.node_walk/graph.db` inside your indexed repository. It is disposable and can be re-indexed at any time with `node-walk index .`.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Changelog
|
|
149
|
+
|
|
150
|
+
See [CHANGELOG.md](file:///c:/Users/nshri/Github/CodeGraph/CHANGELOG.md) for full release history and notes.
|