node-walk 0.1.0__tar.gz → 0.1.1__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.
Files changed (41) hide show
  1. node_walk-0.1.1/.github/workflows/release.yml +158 -0
  2. node_walk-0.1.1/PKG-INFO +149 -0
  3. node_walk-0.1.1/README.md +125 -0
  4. {node_walk-0.1.0 → node_walk-0.1.1}/pyproject.toml +4 -1
  5. node_walk-0.1.1/src/node_walk/__init__.py +3 -0
  6. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/cli/main.py +106 -22
  7. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/query/engine.py +229 -31
  8. node_walk-0.1.1/src/node_walk/query/tree_formatter.py +186 -0
  9. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/storage/base.py +5 -0
  10. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/storage/sqlite_store.py +6 -0
  11. {node_walk-0.1.0 → node_walk-0.1.1}/tests/test_query_engine.py +63 -1
  12. node_walk-0.1.0/.github/workflows/release.yml +0 -103
  13. node_walk-0.1.0/PKG-INFO +0 -107
  14. node_walk-0.1.0/README.md +0 -83
  15. node_walk-0.1.0/src/node_walk/__init__.py +0 -3
  16. {node_walk-0.1.0 → node_walk-0.1.1}/.github/workflows/ci.yml +0 -0
  17. {node_walk-0.1.0 → node_walk-0.1.1}/.gitignore +0 -0
  18. {node_walk-0.1.0 → node_walk-0.1.1}/LICENSE +0 -0
  19. {node_walk-0.1.0 → node_walk-0.1.1}/plans/plan.md +0 -0
  20. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/analysis/__init__.py +0 -0
  21. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/analysis/base.py +0 -0
  22. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/analysis/python/__init__.py +0 -0
  23. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/analysis/python/analyzer.py +0 -0
  24. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/analysis/python/scope.py +0 -0
  25. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/analysis/python/visitor.py +0 -0
  26. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/analysis/python_analyzer.py +0 -0
  27. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/cli/__init__.py +0 -0
  28. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/indexer.py +0 -0
  29. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/ir/__init__.py +0 -0
  30. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/ir/enums.py +0 -0
  31. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/ir/models.py +0 -0
  32. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/query/__init__.py +0 -0
  33. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/storage/__init__.py +0 -0
  34. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/storage/repository.py +0 -0
  35. {node_walk-0.1.0 → node_walk-0.1.1}/src/node_walk/storage/schema.py +0 -0
  36. {node_walk-0.1.0 → node_walk-0.1.1}/tests/fixtures/nested_project/base.py +0 -0
  37. {node_walk-0.1.0 → node_walk-0.1.1}/tests/fixtures/nested_project/impl.py +0 -0
  38. {node_walk-0.1.0 → node_walk-0.1.1}/tests/fixtures/simple_project/services.py +0 -0
  39. {node_walk-0.1.0 → node_walk-0.1.1}/tests/test_ir.py +0 -0
  40. {node_walk-0.1.0 → node_walk-0.1.1}/tests/test_python_analyzer.py +0 -0
  41. {node_walk-0.1.0 → node_walk-0.1.1}/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,149 @@
1
+ Metadata-Version: 2.5
2
+ Name: node-walk
3
+ Version: 0.1.1
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 directly in terminal (ASCII tree), exported to Graphviz (`.dot`), or generated as Mermaid diagrams.
42
+ - **Lightweight & Self-Contained**: Pure Python + Tree-sitter + SQLite. Zero external database services or cloud dependencies.
43
+
44
+ ---
45
+
46
+ ## Installation
47
+
48
+ ```bash
49
+ git clone <repo-url> node-walk
50
+ cd node-walk
51
+ python -m venv .venv
52
+ .venv\Scripts\activate # Windows (.venv/bin/activate on Linux/macOS)
53
+ pip install -e ".[dev]"
54
+ ```
55
+
56
+ ---
57
+
58
+ ## CLI Usage
59
+
60
+ All CLI commands discover the graph database by searching for `.node_walk/graph.db` in the current directory or walking up parent directories.
61
+
62
+ ### 1. Index a repository
63
+ ```bash
64
+ cd /path/to/your/project
65
+ node-walk index .
66
+ ```
67
+
68
+ ### 2. Search & Inspect Symbols
69
+ ```bash
70
+ # Search by name, dotted path, or fuzzy typo
71
+ node-walk find UserService
72
+ node-walk find ModelAdapter.chat
73
+ node-walk find creat_user
74
+
75
+ # View symbol definition metadata
76
+ node-walk definition UserService.create_user
77
+
78
+ # View the exact source code block
79
+ node-walk source UserService.create_user
80
+ ```
81
+
82
+ ### 3. Explore Relationships
83
+ ```bash
84
+ # Find callers of a function or method
85
+ node-walk callers UserService.create_user
86
+
87
+ # Find callees (what does this method call?)
88
+ node-walk callees UserService.create_user
89
+
90
+ # Find references/usages
91
+ node-walk refs User
92
+
93
+ # Find implementations / subclasses of an ABC or class
94
+ node-walk implementations BaseRepository
95
+
96
+ # Inspect imports
97
+ node-walk imports services.py
98
+ ```
99
+
100
+ ### 4. Graph Traversals & Visualizations
101
+ ```bash
102
+ # Trace outgoing dependencies (tree, table, dot, mermaid)
103
+ node-walk trace UserService.create_user --depth 4 --format tree
104
+ node-walk trace UserService.create_user --format dot -o trace.dot
105
+ node-walk trace UserService.create_user --format mermaid
106
+
107
+ # Assess blast radius (what calls/depends on this?)
108
+ node-walk blast-radius UserService.create_user --format tree
109
+
110
+ # General graph exploration around any symbol
111
+ node-walk graph ModelAdapter --depth 3 --format tree
112
+ ```
113
+
114
+ ### 5. Utilities
115
+ ```bash
116
+ # Show database statistics (symbol kinds, relationship counts)
117
+ node-walk stats
118
+
119
+ # Export the entire graph to JSON
120
+ node-walk export --output graph.json
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Architecture
126
+
127
+ ```
128
+ Source Files (.py) ──► Tree-sitter Parser ──► Code IR (Pydantic v2) ──► SQLite Graph ──► Query Engine ──► CLI / Visualizers
129
+ ```
130
+
131
+ - **Analysis**: Tree-sitter for robust AST parsing and symbol/call-site extraction.
132
+ - **Data Model**: Structured `Symbol`, `Relationship`, and `FileInfo` models.
133
+ - **Storage**: SQLite with WAL mode and indexes on names, qualified names, and relationships.
134
+ - **Traversals**: Recursive Common Table Expressions (CTEs) for fast BFS graph walks without loading graphs into memory.
135
+ - **Visualization Formats**: ASCII Tree, Graphviz DOT, and Mermaid markdown diagrams.
136
+
137
+ ---
138
+
139
+ ## Running Tests
140
+
141
+ ```bash
142
+ pytest tests/ -v
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Graph Storage & Lifecycle
148
+
149
+ 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 .`.
@@ -0,0 +1,125 @@
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 directly in terminal (ASCII tree), exported to Graphviz (`.dot`), or generated as Mermaid diagrams.
18
+ - **Lightweight & Self-Contained**: Pure Python + Tree-sitter + SQLite. Zero external database services or cloud dependencies.
19
+
20
+ ---
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ git clone <repo-url> node-walk
26
+ cd node-walk
27
+ python -m venv .venv
28
+ .venv\Scripts\activate # Windows (.venv/bin/activate on Linux/macOS)
29
+ pip install -e ".[dev]"
30
+ ```
31
+
32
+ ---
33
+
34
+ ## CLI Usage
35
+
36
+ All CLI commands discover the graph database by searching for `.node_walk/graph.db` in the current directory or walking up parent directories.
37
+
38
+ ### 1. Index a repository
39
+ ```bash
40
+ cd /path/to/your/project
41
+ node-walk index .
42
+ ```
43
+
44
+ ### 2. Search & Inspect Symbols
45
+ ```bash
46
+ # Search by name, dotted path, or fuzzy typo
47
+ node-walk find UserService
48
+ node-walk find ModelAdapter.chat
49
+ node-walk find creat_user
50
+
51
+ # View symbol definition metadata
52
+ node-walk definition UserService.create_user
53
+
54
+ # View the exact source code block
55
+ node-walk source UserService.create_user
56
+ ```
57
+
58
+ ### 3. Explore Relationships
59
+ ```bash
60
+ # Find callers of a function or method
61
+ node-walk callers UserService.create_user
62
+
63
+ # Find callees (what does this method call?)
64
+ node-walk callees UserService.create_user
65
+
66
+ # Find references/usages
67
+ node-walk refs User
68
+
69
+ # Find implementations / subclasses of an ABC or class
70
+ node-walk implementations BaseRepository
71
+
72
+ # Inspect imports
73
+ node-walk imports services.py
74
+ ```
75
+
76
+ ### 4. Graph Traversals & Visualizations
77
+ ```bash
78
+ # Trace outgoing dependencies (tree, table, dot, mermaid)
79
+ node-walk trace UserService.create_user --depth 4 --format tree
80
+ node-walk trace UserService.create_user --format dot -o trace.dot
81
+ node-walk trace UserService.create_user --format mermaid
82
+
83
+ # Assess blast radius (what calls/depends on this?)
84
+ node-walk blast-radius UserService.create_user --format tree
85
+
86
+ # General graph exploration around any symbol
87
+ node-walk graph ModelAdapter --depth 3 --format tree
88
+ ```
89
+
90
+ ### 5. Utilities
91
+ ```bash
92
+ # Show database statistics (symbol kinds, relationship counts)
93
+ node-walk stats
94
+
95
+ # Export the entire graph to JSON
96
+ node-walk export --output graph.json
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Architecture
102
+
103
+ ```
104
+ Source Files (.py) ──► Tree-sitter Parser ──► Code IR (Pydantic v2) ──► SQLite Graph ──► Query Engine ──► CLI / Visualizers
105
+ ```
106
+
107
+ - **Analysis**: Tree-sitter for robust AST parsing and symbol/call-site extraction.
108
+ - **Data Model**: Structured `Symbol`, `Relationship`, and `FileInfo` models.
109
+ - **Storage**: SQLite with WAL mode and indexes on names, qualified names, and relationships.
110
+ - **Traversals**: Recursive Common Table Expressions (CTEs) for fast BFS graph walks without loading graphs into memory.
111
+ - **Visualization Formats**: ASCII Tree, Graphviz DOT, and Mermaid markdown diagrams.
112
+
113
+ ---
114
+
115
+ ## Running Tests
116
+
117
+ ```bash
118
+ pytest tests/ -v
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Graph Storage & Lifecycle
124
+
125
+ 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 .`.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "node-walk"
7
- version = "0.1.0"
7
+ dynamic = ["version"]
8
8
  description = "Semantic code intelligence — local-first graph of your codebase for humans and LLMs"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -38,6 +38,9 @@ node-walk = "node_walk.cli.main:app"
38
38
  nodewalk = "node_walk.cli.main:app"
39
39
  node_walk = "node_walk.cli.main:app"
40
40
 
41
+ [tool.hatch.version]
42
+ path = "src/node_walk/__init__.py"
43
+
41
44
  [tool.hatch.build.targets.wheel]
42
45
  packages = ["src/node_walk"]
43
46
 
@@ -0,0 +1,3 @@
1
+ """node-walk — Semantic code intelligence for humans and LLMs."""
2
+
3
+ __version__ = "0.1.1"