nogic 0.0.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. nogic-0.0.1/.claude/settings.local.json +22 -0
  2. nogic-0.0.1/.gitignore +39 -0
  3. nogic-0.0.1/.python-version +1 -0
  4. nogic-0.0.1/DEVELOPMENT.md +213 -0
  5. nogic-0.0.1/LICENSE +21 -0
  6. nogic-0.0.1/PKG-INFO +201 -0
  7. nogic-0.0.1/README.md +164 -0
  8. nogic-0.0.1/pyproject.toml +63 -0
  9. nogic-0.0.1/src/nogic/__init__.py +3 -0
  10. nogic-0.0.1/src/nogic/api/__init__.py +23 -0
  11. nogic-0.0.1/src/nogic/api/client.py +390 -0
  12. nogic-0.0.1/src/nogic/commands/__init__.py +1 -0
  13. nogic-0.0.1/src/nogic/commands/init.py +125 -0
  14. nogic-0.0.1/src/nogic/commands/login.py +75 -0
  15. nogic-0.0.1/src/nogic/commands/projects.py +138 -0
  16. nogic-0.0.1/src/nogic/commands/reindex.py +117 -0
  17. nogic-0.0.1/src/nogic/commands/status.py +165 -0
  18. nogic-0.0.1/src/nogic/commands/sync.py +72 -0
  19. nogic-0.0.1/src/nogic/commands/telemetry_cmd.py +65 -0
  20. nogic-0.0.1/src/nogic/commands/watch.py +167 -0
  21. nogic-0.0.1/src/nogic/config.py +157 -0
  22. nogic-0.0.1/src/nogic/ignore.py +109 -0
  23. nogic-0.0.1/src/nogic/main.py +58 -0
  24. nogic-0.0.1/src/nogic/parsing/__init__.py +22 -0
  25. nogic-0.0.1/src/nogic/parsing/js_extractor.py +674 -0
  26. nogic-0.0.1/src/nogic/parsing/parser.py +220 -0
  27. nogic-0.0.1/src/nogic/parsing/python_extractor.py +484 -0
  28. nogic-0.0.1/src/nogic/parsing/types.py +80 -0
  29. nogic-0.0.1/src/nogic/storage/__init__.py +14 -0
  30. nogic-0.0.1/src/nogic/storage/relationships.py +322 -0
  31. nogic-0.0.1/src/nogic/storage/schema.py +154 -0
  32. nogic-0.0.1/src/nogic/storage/symbols.py +203 -0
  33. nogic-0.0.1/src/nogic/telemetry.py +142 -0
  34. nogic-0.0.1/src/nogic/ui.py +60 -0
  35. nogic-0.0.1/src/nogic/watcher/__init__.py +7 -0
  36. nogic-0.0.1/src/nogic/watcher/monitor.py +80 -0
  37. nogic-0.0.1/src/nogic/watcher/storage.py +185 -0
  38. nogic-0.0.1/src/nogic/watcher/sync.py +879 -0
  39. nogic-0.0.1/tests/test_e2e.py +1205 -0
  40. nogic-0.0.1/tests/test_ignore.py +146 -0
  41. nogic-0.0.1/tests/test_sync_batching.py +326 -0
@@ -0,0 +1,22 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(uv run:*)",
5
+ "Bash(uv add:*)",
6
+ "mcp__nogic__find_symbol",
7
+ "mcp__nogic__before_writing",
8
+ "mcp__nogic__get_file_structure",
9
+ "mcp__nogic__find_similar",
10
+ "mcp__nogic__find_by_framework",
11
+ "mcp__nogic__get_file_dependencies",
12
+ "mcp__nogic__find_tests",
13
+ "mcp__nogic__describe_project",
14
+ "mcp__nogic__list_files",
15
+ "mcp__nogic__get_conventions",
16
+ "mcp__nogic__get_dependencies",
17
+ "mcp__nogic__assess_impact",
18
+ "mcp__nogic__get_class_structure",
19
+ "mcp__nogic__get_references"
20
+ ]
21
+ }
22
+ }
nogic-0.0.1/.gitignore ADDED
@@ -0,0 +1,39 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Virtual environments
7
+ .venv/
8
+ venv/
9
+ ENV/
10
+
11
+ # Distribution / packaging
12
+ dist/
13
+ build/
14
+ *.egg-info/
15
+ *.egg
16
+
17
+ # UV
18
+ uv.lock
19
+
20
+ # IDE
21
+ .idea/
22
+ .vscode/
23
+ *.swp
24
+ *.swo
25
+
26
+ # Testing
27
+ .pytest_cache/
28
+ .coverage
29
+ htmlcov/
30
+
31
+ # Misc
32
+ .DS_Store
33
+ *.log
34
+
35
+ .env.*
36
+ .env.example
37
+ .env
38
+
39
+ .nogic
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,213 @@
1
+ # Development Guide
2
+
3
+ This guide covers setting up the development environment for contributing to the Nogic CLI.
4
+
5
+ ## Prerequisites
6
+
7
+ - Python 3.11+
8
+ - [UV](https://docs.astral.sh/uv/) package manager
9
+
10
+ ### Installing UV
11
+
12
+ ```bash
13
+ # macOS/Linux
14
+ curl -LsSf https://astral.sh/uv/install.sh | sh
15
+
16
+ # Or with Homebrew
17
+ brew install uv
18
+ ```
19
+
20
+ ## Setup
21
+
22
+ ### 1. Clone the repository
23
+
24
+ ```bash
25
+ git clone https://github.com/nogic/cli.git
26
+ cd cli
27
+ ```
28
+
29
+ ### 2. Install dependencies
30
+
31
+ ```bash
32
+ uv sync
33
+ ```
34
+
35
+ This creates a virtual environment in `.venv/` and installs all dependencies.
36
+
37
+ ### 3. Configure environment
38
+
39
+ Copy the example environment file:
40
+
41
+ ```bash
42
+ cp .env.example .env
43
+ ```
44
+
45
+ Edit `.env` with your development settings:
46
+
47
+ ```bash
48
+ NOGIC_API_URL=http://localhost:8000
49
+ NOGIC_API_KEY=your-dev-api-key
50
+ ```
51
+
52
+ ## Running the CLI
53
+
54
+ ### Using UV (recommended)
55
+
56
+ ```bash
57
+ uv run nogic --help
58
+ uv run nogic hello world
59
+ ```
60
+
61
+ ### Using the virtual environment directly
62
+
63
+ ```bash
64
+ source .venv/bin/activate
65
+ python -m nogic.main --help
66
+ ```
67
+
68
+ ### As an editable install
69
+
70
+ ```bash
71
+ uv pip install -e .
72
+ nogic --help
73
+ ```
74
+
75
+ ## Project Structure
76
+
77
+ ```
78
+ cli/
79
+ ├── src/nogic/
80
+ │ ├── __init__.py # Package version
81
+ │ ├── main.py # CLI entry point
82
+ │ ├── config.py # Configuration management
83
+ │ ├── api/
84
+ │ │ └── client.py # Backend API client
85
+ │ ├── commands/
86
+ │ │ ├── hello.py # Demo commands
87
+ │ │ ├── login.py # Authentication
88
+ │ │ ├── projects.py # Project management
89
+ │ │ ├── init.py # Project initialization
90
+ │ │ ├── sync.py # One-time sync
91
+ │ │ └── watch.py # File watcher
92
+ │ └── watcher/
93
+ │ ├── monitor.py # Filesystem monitoring
94
+ │ ├── storage.py # SQLite file tracking
95
+ │ └── sync.py # Sync service
96
+ ├── pyproject.toml # Package configuration
97
+ ├── uv.lock # Dependency lock file
98
+ └── .env.example # Environment template
99
+ ```
100
+
101
+ ## Adding a New Command
102
+
103
+ 1. Create a new file in `src/nogic/commands/`:
104
+
105
+ ```python
106
+ # src/nogic/commands/mycommand.py
107
+ import click
108
+
109
+ @click.command()
110
+ @click.argument("name", default="World")
111
+ def mycommand(name: str):
112
+ """Description of my command."""
113
+ click.echo(f"Hello, {name}!")
114
+ ```
115
+
116
+ 2. Register it in `src/nogic/main.py`:
117
+
118
+ ```python
119
+ from nogic.commands import mycommand
120
+
121
+ cli.add_command(mycommand.mycommand)
122
+ ```
123
+
124
+ 3. Test the command:
125
+
126
+ ```bash
127
+ uv run nogic mycommand --help
128
+ ```
129
+
130
+ ## Dependencies
131
+
132
+ ### Core Dependencies
133
+
134
+ | Package | Purpose |
135
+ |---------|---------|
136
+ | `click` | CLI framework |
137
+ | `watchdog` | Filesystem monitoring |
138
+ | `httpx` | HTTP client |
139
+ | `python-dotenv` | Environment configuration |
140
+
141
+ ### Adding Dependencies
142
+
143
+ ```bash
144
+ uv add package-name
145
+ ```
146
+
147
+ ### Removing Dependencies
148
+
149
+ ```bash
150
+ uv remove package-name
151
+ ```
152
+
153
+ ## Building
154
+
155
+ ### Build a wheel
156
+
157
+ ```bash
158
+ uv build
159
+ ```
160
+
161
+ Output will be in `dist/`.
162
+
163
+ ### Install from built wheel
164
+
165
+ ```bash
166
+ uv pip install dist/nogic-*.whl
167
+ ```
168
+
169
+ ## Code Style
170
+
171
+ - Follow PEP 8 guidelines
172
+ - Use type hints where possible
173
+ - Keep functions focused and small
174
+ - Use Click's built-in error handling
175
+
176
+ ## Testing Commands Locally
177
+
178
+ ```bash
179
+ # Test login flow
180
+ uv run nogic login
181
+
182
+ # Test project initialization
183
+ uv run nogic init /tmp/test-project --name "Test"
184
+
185
+ # Test file watching
186
+ uv run nogic watch /tmp/test-project
187
+
188
+ # Test sync
189
+ uv run nogic sync /tmp/test-project
190
+ ```
191
+
192
+ ## Debugging
193
+
194
+ ### Enable verbose output
195
+
196
+ Most commands will print status information. For debugging API calls, check the backend logs.
197
+
198
+ ### Check configuration
199
+
200
+ ```bash
201
+ # View global config
202
+ cat ~/.nogic/config.json
203
+
204
+ # View project config
205
+ cat .nogic/config.json
206
+ ```
207
+
208
+ ### Inspect the local database
209
+
210
+ ```bash
211
+ sqlite3 .nogic/nogic.db ".tables"
212
+ sqlite3 .nogic/nogic.db "SELECT * FROM files LIMIT 10;"
213
+ ```
nogic-0.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Nogic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
nogic-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,201 @@
1
+ Metadata-Version: 2.4
2
+ Name: nogic
3
+ Version: 0.0.1
4
+ Summary: Code intelligence CLI for AI agents — index, search, and understand codebases via graph + vector embeddings.
5
+ Project-URL: Homepage, https://nogic.dev
6
+ Project-URL: Repository, https://github.com/nogic-dev/cli
7
+ Project-URL: Documentation, https://docs.nogic.dev
8
+ Author-email: Nogic <support@nogic.dev>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: ai-agents,code-graph,code-intelligence,embeddings,mcp,tree-sitter
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Libraries
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.11
25
+ Requires-Dist: httpx>=0.27.0
26
+ Requires-Dist: pathspec>=0.12.0
27
+ Requires-Dist: posthog>=3.0.0
28
+ Requires-Dist: python-dotenv>=1.0.0
29
+ Requires-Dist: rich>=13.0.0
30
+ Requires-Dist: tree-sitter-javascript>=0.23.0
31
+ Requires-Dist: tree-sitter-python>=0.23.0
32
+ Requires-Dist: tree-sitter-typescript>=0.23.0
33
+ Requires-Dist: tree-sitter>=0.24.0
34
+ Requires-Dist: typer>=0.12.0
35
+ Requires-Dist: watchdog>=6.0.0
36
+ Description-Content-Type: text/markdown
37
+
38
+ # Nogic CLI
39
+
40
+ Graph visualization for Developers and AI Agents.
41
+
42
+ ## Installation
43
+
44
+ ### Prerequisites
45
+
46
+ - Python 3.11 or higher
47
+
48
+ ### Install from PyPI
49
+
50
+ ```bash
51
+ pip install nogic
52
+ ```
53
+
54
+ ### Install from Source
55
+
56
+ ```bash
57
+ git clone https://github.com/nogic/cli.git
58
+ cd cli
59
+ pip install .
60
+ ```
61
+
62
+ ## Quick Start
63
+
64
+ ### 1. Login with your API key
65
+
66
+ ```bash
67
+ nogic login
68
+ ```
69
+
70
+ You'll be prompted to enter your API key from the Nogic dashboard.
71
+
72
+ ### 2. Initialize a project
73
+
74
+ ```bash
75
+ cd /path/to/your/project
76
+ nogic init
77
+ ```
78
+
79
+ This creates a `.nogic/` directory with project configuration.
80
+
81
+ ### 3. Sync your codebase
82
+
83
+ One-time sync:
84
+
85
+ ```bash
86
+ nogic sync
87
+ ```
88
+
89
+ Or watch for continuous syncing:
90
+
91
+ ```bash
92
+ nogic watch
93
+ ```
94
+
95
+ ## Commands
96
+
97
+ ### `nogic login`
98
+
99
+ Authenticate with the Nogic API.
100
+
101
+ ```bash
102
+ nogic login
103
+ nogic login --api-key YOUR_API_KEY
104
+ ```
105
+
106
+ ### `nogic init`
107
+
108
+ Initialize a project for Nogic tracking.
109
+
110
+ ```bash
111
+ nogic init # Initialize current directory
112
+ nogic init /path/to/project # Initialize specific directory
113
+ nogic init --name "My Project" # Set project name
114
+ nogic init --project-id UUID # Use existing project ID
115
+ ```
116
+
117
+ ### `nogic sync`
118
+
119
+ Perform a one-time full sync of your codebase.
120
+
121
+ ```bash
122
+ nogic sync # Sync current directory
123
+ nogic sync /path/to/project # Sync specific directory
124
+ nogic sync --ignore "*.log" # Ignore specific patterns
125
+ ```
126
+
127
+ ### `nogic watch`
128
+
129
+ Continuously monitor and sync file changes.
130
+
131
+ ```bash
132
+ nogic watch # Watch current directory
133
+ nogic watch /path/to/project # Watch specific directory
134
+ nogic watch --ignore "*.log" # Ignore specific patterns
135
+ ```
136
+
137
+ Press `Ctrl+C` to stop watching.
138
+
139
+ ### `nogic projects`
140
+
141
+ Manage your Nogic projects.
142
+
143
+ ```bash
144
+ nogic projects list # List all projects
145
+ nogic projects create "Project Name" # Create new project
146
+ nogic projects create "Name" --use # Create and set as current
147
+ nogic projects use PROJECT_ID # Set current project
148
+ ```
149
+
150
+ ## Configuration
151
+
152
+ ### Environment Variables
153
+
154
+ Create a `.env` file or set environment variables:
155
+
156
+ ```bash
157
+ NOGIC_API_URL=http://localhost:8000 # Backend API URL
158
+ NOGIC_API_KEY=your-api-key # API key (alternative to login)
159
+ ```
160
+
161
+ ### Config Files
162
+
163
+ - **Global config**: `~/.nogic/config.json` - Stores API key and telemetry preference
164
+ - **Project config**: `.nogic/config.json` - Stores project ID
165
+
166
+ ## Telemetry
167
+
168
+ Nogic collects anonymous usage data to improve the product. All data is anonymized.
169
+
170
+ ### Manage Telemetry
171
+
172
+ ```bash
173
+ nogic telemetry status # Check current status
174
+ nogic telemetry disable # Opt out
175
+ nogic telemetry enable # Opt back in
176
+ ```
177
+
178
+ ### Environment Variables
179
+
180
+ ```bash
181
+ NOGIC_TELEMETRY_DISABLED=1 # Disable telemetry
182
+ DO_NOT_TRACK=1 # Standard opt-out (also works)
183
+ ```
184
+
185
+ ### Default Ignore Patterns
186
+
187
+ The following patterns are ignored by default:
188
+
189
+ - `.git/`
190
+ - `__pycache__/`
191
+ - `node_modules/`
192
+ - `.venv/`
193
+ - `.nogic/`
194
+ - `*.pyc`
195
+ - `.DS_Store`
196
+
197
+ Add custom patterns with the `--ignore` flag.
198
+
199
+ ## License
200
+
201
+ MIT
nogic-0.0.1/README.md ADDED
@@ -0,0 +1,164 @@
1
+ # Nogic CLI
2
+
3
+ Graph visualization for Developers and AI Agents.
4
+
5
+ ## Installation
6
+
7
+ ### Prerequisites
8
+
9
+ - Python 3.11 or higher
10
+
11
+ ### Install from PyPI
12
+
13
+ ```bash
14
+ pip install nogic
15
+ ```
16
+
17
+ ### Install from Source
18
+
19
+ ```bash
20
+ git clone https://github.com/nogic/cli.git
21
+ cd cli
22
+ pip install .
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ### 1. Login with your API key
28
+
29
+ ```bash
30
+ nogic login
31
+ ```
32
+
33
+ You'll be prompted to enter your API key from the Nogic dashboard.
34
+
35
+ ### 2. Initialize a project
36
+
37
+ ```bash
38
+ cd /path/to/your/project
39
+ nogic init
40
+ ```
41
+
42
+ This creates a `.nogic/` directory with project configuration.
43
+
44
+ ### 3. Sync your codebase
45
+
46
+ One-time sync:
47
+
48
+ ```bash
49
+ nogic sync
50
+ ```
51
+
52
+ Or watch for continuous syncing:
53
+
54
+ ```bash
55
+ nogic watch
56
+ ```
57
+
58
+ ## Commands
59
+
60
+ ### `nogic login`
61
+
62
+ Authenticate with the Nogic API.
63
+
64
+ ```bash
65
+ nogic login
66
+ nogic login --api-key YOUR_API_KEY
67
+ ```
68
+
69
+ ### `nogic init`
70
+
71
+ Initialize a project for Nogic tracking.
72
+
73
+ ```bash
74
+ nogic init # Initialize current directory
75
+ nogic init /path/to/project # Initialize specific directory
76
+ nogic init --name "My Project" # Set project name
77
+ nogic init --project-id UUID # Use existing project ID
78
+ ```
79
+
80
+ ### `nogic sync`
81
+
82
+ Perform a one-time full sync of your codebase.
83
+
84
+ ```bash
85
+ nogic sync # Sync current directory
86
+ nogic sync /path/to/project # Sync specific directory
87
+ nogic sync --ignore "*.log" # Ignore specific patterns
88
+ ```
89
+
90
+ ### `nogic watch`
91
+
92
+ Continuously monitor and sync file changes.
93
+
94
+ ```bash
95
+ nogic watch # Watch current directory
96
+ nogic watch /path/to/project # Watch specific directory
97
+ nogic watch --ignore "*.log" # Ignore specific patterns
98
+ ```
99
+
100
+ Press `Ctrl+C` to stop watching.
101
+
102
+ ### `nogic projects`
103
+
104
+ Manage your Nogic projects.
105
+
106
+ ```bash
107
+ nogic projects list # List all projects
108
+ nogic projects create "Project Name" # Create new project
109
+ nogic projects create "Name" --use # Create and set as current
110
+ nogic projects use PROJECT_ID # Set current project
111
+ ```
112
+
113
+ ## Configuration
114
+
115
+ ### Environment Variables
116
+
117
+ Create a `.env` file or set environment variables:
118
+
119
+ ```bash
120
+ NOGIC_API_URL=http://localhost:8000 # Backend API URL
121
+ NOGIC_API_KEY=your-api-key # API key (alternative to login)
122
+ ```
123
+
124
+ ### Config Files
125
+
126
+ - **Global config**: `~/.nogic/config.json` - Stores API key and telemetry preference
127
+ - **Project config**: `.nogic/config.json` - Stores project ID
128
+
129
+ ## Telemetry
130
+
131
+ Nogic collects anonymous usage data to improve the product. All data is anonymized.
132
+
133
+ ### Manage Telemetry
134
+
135
+ ```bash
136
+ nogic telemetry status # Check current status
137
+ nogic telemetry disable # Opt out
138
+ nogic telemetry enable # Opt back in
139
+ ```
140
+
141
+ ### Environment Variables
142
+
143
+ ```bash
144
+ NOGIC_TELEMETRY_DISABLED=1 # Disable telemetry
145
+ DO_NOT_TRACK=1 # Standard opt-out (also works)
146
+ ```
147
+
148
+ ### Default Ignore Patterns
149
+
150
+ The following patterns are ignored by default:
151
+
152
+ - `.git/`
153
+ - `__pycache__/`
154
+ - `node_modules/`
155
+ - `.venv/`
156
+ - `.nogic/`
157
+ - `*.pyc`
158
+ - `.DS_Store`
159
+
160
+ Add custom patterns with the `--ignore` flag.
161
+
162
+ ## License
163
+
164
+ MIT