contextly 0.1.7__tar.gz → 1.0.2__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.
- contextly-1.0.2/PKG-INFO +294 -0
- contextly-1.0.2/README.md +272 -0
- contextly-1.0.2/contextly/__init__.py +1 -0
- contextly-1.0.2/contextly/commands/__init__.py +1 -0
- contextly-1.0.2/contextly/commands/analyze.py +49 -0
- contextly-1.0.2/contextly/commands/discover.py +51 -0
- contextly-1.0.2/contextly/commands/export.py +42 -0
- contextly-1.0.2/contextly/commands/init.py +24 -0
- contextly-1.0.2/contextly/commands/inspect.py +39 -0
- contextly-1.0.2/contextly/commands/learn.py +61 -0
- contextly-1.0.2/contextly/commands/memory.py +47 -0
- contextly-1.0.2/contextly/commands/pack.py +57 -0
- contextly-1.0.2/contextly/core/__init__.py +1 -0
- contextly-1.0.2/contextly/core/analyzer/__init__.py +1 -0
- contextly-1.0.2/contextly/core/analyzer/engine.py +53 -0
- contextly-1.0.2/contextly/core/discovery/__init__.py +1 -0
- contextly-1.0.2/contextly/core/discovery/engine.py +22 -0
- contextly-1.0.2/contextly/core/exporter/__init__.py +1 -0
- contextly-1.0.2/contextly/core/exporter/engine.py +68 -0
- contextly-1.0.2/contextly/core/initializer/__init__.py +1 -0
- contextly-1.0.2/contextly/core/initializer/engine.py +49 -0
- contextly-1.0.2/contextly/core/inspector/__init__.py +1 -0
- contextly-1.0.2/contextly/core/inspector/engine.py +28 -0
- contextly-1.0.2/contextly/core/learner/__init__.py +1 -0
- contextly-1.0.2/contextly/core/learner/engine.py +34 -0
- contextly-1.0.2/contextly/core/memory/__init__.py +1 -0
- contextly-1.0.2/contextly/core/memory/engine.py +70 -0
- contextly-1.0.2/contextly/core/packer/__init__.py +1 -0
- contextly-1.0.2/contextly/core/packer/engine.py +84 -0
- contextly-1.0.2/contextly/generators/__init__.py +1 -0
- contextly-1.0.2/contextly/generators/base.py +63 -0
- contextly-1.0.2/contextly/generators/chatgpt.py +63 -0
- contextly-1.0.2/contextly/generators/claude.py +69 -0
- contextly-1.0.2/contextly/main.py +42 -0
- contextly-1.0.2/contextly/scanners/__init__.py +4 -0
- contextly-1.0.2/contextly/scanners/base.py +28 -0
- contextly-1.0.2/contextly/scanners/dependencies.py +91 -0
- contextly-1.0.2/contextly/scanners/framework.py +53 -0
- contextly-1.0.2/contextly/scanners/language.py +51 -0
- contextly-1.0.2/contextly/scanners/patterns.py +79 -0
- contextly-1.0.2/contextly/types/__init__.py +1 -0
- contextly-1.0.2/contextly/types/models.py +42 -0
- contextly-1.0.2/contextly/utils/__init__.py +1 -0
- contextly-1.0.2/contextly/utils/console.py +3 -0
- contextly-1.0.2/contextly/utils/exceptions.py +15 -0
- contextly-1.0.2/contextly/utils/ignore.py +74 -0
- contextly-1.0.2/contextly/utils/validation.py +26 -0
- contextly-1.0.2/contextly.egg-info/PKG-INFO +294 -0
- contextly-1.0.2/contextly.egg-info/SOURCES.txt +68 -0
- contextly-1.0.2/contextly.egg-info/dependency_links.txt +1 -0
- contextly-1.0.2/contextly.egg-info/entry_points.txt +2 -0
- contextly-1.0.2/contextly.egg-info/requires.txt +12 -0
- contextly-1.0.2/contextly.egg-info/top_level.txt +1 -0
- contextly-1.0.2/pyproject.toml +37 -0
- contextly-1.0.2/setup.cfg +4 -0
- contextly-1.0.2/tests/test_analyze.py +111 -0
- contextly-1.0.2/tests/test_core.py +77 -0
- contextly-1.0.2/tests/test_discover.py +110 -0
- contextly-1.0.2/tests/test_export.py +132 -0
- contextly-1.0.2/tests/test_generators.py +147 -0
- contextly-1.0.2/tests/test_init.py +42 -0
- contextly-1.0.2/tests/test_inspect.py +100 -0
- contextly-1.0.2/tests/test_learn.py +126 -0
- contextly-1.0.2/tests/test_memory.py +103 -0
- contextly-1.0.2/tests/test_pack.py +162 -0
- contextly-1.0.2/tests/test_scanner_base.py +22 -0
- contextly-1.0.2/tests/test_scanner_dependencies.py +163 -0
- contextly-1.0.2/tests/test_scanner_framework.py +40 -0
- contextly-1.0.2/tests/test_scanner_language.py +64 -0
- contextly-1.0.2/tests/test_scanner_patterns.py +50 -0
- contextly-0.1.7/.gitignore +0 -42
- contextly-0.1.7/LICENSE +0 -21
- contextly-0.1.7/PKG-INFO +0 -204
- contextly-0.1.7/README.md +0 -150
- contextly-0.1.7/pyproject.toml +0 -103
- contextly-0.1.7/requirements.txt +0 -19
- contextly-0.1.7/src/contextly/__init__.py +0 -5
- contextly-0.1.7/src/contextly/app.py +0 -111
- contextly-0.1.7/src/contextly/cli.py +0 -237
- contextly-0.1.7/src/contextly/core/__init__.py +0 -0
- contextly-0.1.7/src/contextly/core/analyzer.py +0 -118
- contextly-0.1.7/src/contextly/core/embeddings.py +0 -129
- contextly-0.1.7/src/contextly/core/sync.py +0 -89
- contextly-0.1.7/src/contextly/llm/__init__.py +0 -13
- contextly-0.1.7/src/contextly/llm/base.py +0 -19
- contextly-0.1.7/src/contextly/llm/manager.py +0 -139
- contextly-0.1.7/src/contextly/llm/models.py +0 -237
- contextly-0.1.7/src/contextly/llm/ollama.py +0 -78
- contextly-0.1.7/src/contextly/llm/openai.py +0 -41
- contextly-0.1.7/src/contextly/parsers/base.py +0 -39
- contextly-0.1.7/src/contextly/parsers/config.py +0 -79
- contextly-0.1.7/src/contextly/parsers/javascript.py +0 -122
- contextly-0.1.7/src/contextly/parsers/python.py +0 -60
- contextly-0.1.7/tests/conftest.py +0 -33
- contextly-0.1.7/tests/test_core.py +0 -156
- contextly-0.1.7/tests/test_integration.py +0 -170
contextly-1.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: contextly
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: The ultimate context-engineering workspace CLI for LLMs.
|
|
5
|
+
Author: Contextly Team
|
|
6
|
+
Project-URL: Homepage, https://github.com/vutikurishanmukha9/Contextly
|
|
7
|
+
Project-URL: Repository, https://github.com/vutikurishanmukha9/Contextly.git
|
|
8
|
+
Project-URL: Changelog, https://github.com/vutikurishanmukha9/Contextly/blob/main/cli/CHANGELOG.md
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: typer>=0.12.0
|
|
12
|
+
Requires-Dist: rich>=13.7.0
|
|
13
|
+
Requires-Dist: pyyaml>=6.0.1
|
|
14
|
+
Requires-Dist: pydantic>=2.0.0
|
|
15
|
+
Requires-Dist: pathspec>=0.12.0
|
|
16
|
+
Requires-Dist: pyperclip>=1.8.2
|
|
17
|
+
Requires-Dist: tomli>=2.0.1
|
|
18
|
+
Requires-Dist: tiktoken>=0.7.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
22
|
+
|
|
23
|
+
# Context-Ly CLI
|
|
24
|
+
|
|
25
|
+
**Context-Ly CLI** is an open-source Context Intelligence Engine designed to help developers generate high-quality, token-efficient context for Large Language Models (LLMs).
|
|
26
|
+
|
|
27
|
+
Rather than manually explaining your project to an AI assistant in every session, Context-Ly analyzes your repository, discovers conventions, learns team rules, and generates structured context files that help AI tools understand your codebase more effectively.
|
|
28
|
+
|
|
29
|
+
The CLI acts as a persistent **Context Memory Layer** for your repository, enabling consistent AI interactions across development workflows.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
* Repository analysis and context generation
|
|
36
|
+
* Automatic framework and dependency detection
|
|
37
|
+
* Architecture visualization through project structure analysis
|
|
38
|
+
* Team convention discovery and memory management
|
|
39
|
+
* Persistent project-specific context storage
|
|
40
|
+
* LLM-ready Context Pack generation
|
|
41
|
+
* Repository complexity and token usage inspection
|
|
42
|
+
* Context-as-Code workflow with version-controlled project memory
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
Install Context-Ly directly from PyPI:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install contextly
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Verify the installation:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
contextly --help
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Prerequisites
|
|
63
|
+
|
|
64
|
+
* Python 3.9 or later
|
|
65
|
+
* A local Git repository or project directory to analyze
|
|
66
|
+
|
|
67
|
+
No external services or API keys are required for the core functionality.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Quick Start
|
|
72
|
+
|
|
73
|
+
Initialize Context-Ly in your project:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
contextly init
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Analyze your repository and generate a complete project context:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
contextly analyze
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
This command automatically:
|
|
86
|
+
|
|
87
|
+
* Reads your README documentation
|
|
88
|
+
* Scans the project structure
|
|
89
|
+
* Detects frameworks and dependencies
|
|
90
|
+
* Discovers conventions and stored memory
|
|
91
|
+
* Generates a comprehensive `PROJECT_CONTEXT.md`
|
|
92
|
+
|
|
93
|
+
The generated file can be used directly with AI coding assistants and LLMs.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Commands
|
|
98
|
+
|
|
99
|
+
### `contextly init`
|
|
100
|
+
|
|
101
|
+
Initialize Context-Ly in the current project.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
contextly init
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Creates:
|
|
108
|
+
|
|
109
|
+
```text
|
|
110
|
+
.contextly/
|
|
111
|
+
├── config.yaml
|
|
112
|
+
├── memory/
|
|
113
|
+
└── packs/
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### `contextly analyze`
|
|
119
|
+
|
|
120
|
+
Generate a complete repository context file.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
contextly analyze
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
This command:
|
|
127
|
+
|
|
128
|
+
* Reads project documentation
|
|
129
|
+
* Analyzes repository structure
|
|
130
|
+
* Detects frameworks and technologies
|
|
131
|
+
* Loads stored team conventions
|
|
132
|
+
* Generates `PROJECT_CONTEXT.md`
|
|
133
|
+
|
|
134
|
+
Output:
|
|
135
|
+
|
|
136
|
+
```text
|
|
137
|
+
PROJECT_CONTEXT.md
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### `contextly discover`
|
|
143
|
+
|
|
144
|
+
Run the Pattern Discovery Engine.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
contextly discover
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Discovers repository conventions such as:
|
|
151
|
+
|
|
152
|
+
* TailwindCSS usage
|
|
153
|
+
* Zustand state management
|
|
154
|
+
* React Query patterns
|
|
155
|
+
* Service-layer architecture hints
|
|
156
|
+
* Framework-specific conventions
|
|
157
|
+
|
|
158
|
+
The command provides insight into patterns already present within the codebase.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### `contextly learn --auto`
|
|
163
|
+
|
|
164
|
+
Convert discovered conventions into permanent project memory.
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
contextly learn --auto
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Example:
|
|
171
|
+
|
|
172
|
+
```text
|
|
173
|
+
Save convention: TailwindCSS (Uses TailwindCSS for styling.)? [y/N]
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Approved conventions are stored in:
|
|
177
|
+
|
|
178
|
+
```text
|
|
179
|
+
.contextly/memory/rules.yaml
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
This creates a persistent memory layer that can be committed to source control and shared across teams.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
### `contextly memory`
|
|
187
|
+
|
|
188
|
+
Inspect all stored project memory and conventions.
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
contextly memory
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Displays all saved rules, conventions, and architectural preferences currently remembered by Context-Ly.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### `contextly pack <directory>`
|
|
199
|
+
|
|
200
|
+
Generate an LLM-ready Context Pack from a specific directory.
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
contextly pack src/components
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The command:
|
|
207
|
+
|
|
208
|
+
* Reads all files in the target directory
|
|
209
|
+
* Calculates token usage
|
|
210
|
+
* Bundles the content into a reusable Context Pack
|
|
211
|
+
|
|
212
|
+
Output location:
|
|
213
|
+
|
|
214
|
+
```text
|
|
215
|
+
.contextly/packs/
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Useful for sharing focused portions of a large codebase with an LLM.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
### `contextly inspect`
|
|
223
|
+
|
|
224
|
+
Analyze repository complexity and token consumption.
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
contextly inspect
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Provides visibility into:
|
|
231
|
+
|
|
232
|
+
* Large files
|
|
233
|
+
* Potential token-heavy directories
|
|
234
|
+
* Context window bottlenecks
|
|
235
|
+
* Repository complexity hotspots
|
|
236
|
+
|
|
237
|
+
This helps identify areas that may negatively impact AI context quality.
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Example Workflow
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
contextly init
|
|
245
|
+
|
|
246
|
+
contextly discover
|
|
247
|
+
|
|
248
|
+
contextly learn --auto
|
|
249
|
+
|
|
250
|
+
contextly analyze
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Result:
|
|
254
|
+
|
|
255
|
+
```text
|
|
256
|
+
.contextly/
|
|
257
|
+
PROJECT_CONTEXT.md
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Your repository now has a persistent memory layer and an AI-ready context file generated from both repository analysis and learned team conventions.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Why Context-Ly?
|
|
265
|
+
|
|
266
|
+
Modern AI coding tools are powerful, but they often lack project-specific context.
|
|
267
|
+
|
|
268
|
+
Context-Ly bridges that gap by transforming repository knowledge, team conventions, and architectural patterns into structured context that can be consistently shared with LLMs.
|
|
269
|
+
|
|
270
|
+
The goal is simple:
|
|
271
|
+
|
|
272
|
+
**Build context once. Use it everywhere.**
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Changelog
|
|
277
|
+
|
|
278
|
+
For all release notes and version history, please see the [CHANGELOG.md](https://github.com/vutikurishanmukha9/Contextly/blob/main/cli/CHANGELOG.md).
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Contributing
|
|
283
|
+
|
|
284
|
+
Contributions, issues, and feature requests are welcome.
|
|
285
|
+
|
|
286
|
+
If you discover a bug, have an idea for improving repository intelligence, or want to contribute new scanners and analysis capabilities, please open an issue or submit a pull request.
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## License
|
|
291
|
+
|
|
292
|
+
This project is open source and distributed under the terms of its license.
|
|
293
|
+
|
|
294
|
+
See the LICENSE file for details.
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# Context-Ly CLI
|
|
2
|
+
|
|
3
|
+
**Context-Ly CLI** is an open-source Context Intelligence Engine designed to help developers generate high-quality, token-efficient context for Large Language Models (LLMs).
|
|
4
|
+
|
|
5
|
+
Rather than manually explaining your project to an AI assistant in every session, Context-Ly analyzes your repository, discovers conventions, learns team rules, and generates structured context files that help AI tools understand your codebase more effectively.
|
|
6
|
+
|
|
7
|
+
The CLI acts as a persistent **Context Memory Layer** for your repository, enabling consistent AI interactions across development workflows.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
* Repository analysis and context generation
|
|
14
|
+
* Automatic framework and dependency detection
|
|
15
|
+
* Architecture visualization through project structure analysis
|
|
16
|
+
* Team convention discovery and memory management
|
|
17
|
+
* Persistent project-specific context storage
|
|
18
|
+
* LLM-ready Context Pack generation
|
|
19
|
+
* Repository complexity and token usage inspection
|
|
20
|
+
* Context-as-Code workflow with version-controlled project memory
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
Install Context-Ly directly from PyPI:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install contextly
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Verify the installation:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
contextly --help
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Prerequisites
|
|
41
|
+
|
|
42
|
+
* Python 3.9 or later
|
|
43
|
+
* A local Git repository or project directory to analyze
|
|
44
|
+
|
|
45
|
+
No external services or API keys are required for the core functionality.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
Initialize Context-Ly in your project:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
contextly init
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Analyze your repository and generate a complete project context:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
contextly analyze
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This command automatically:
|
|
64
|
+
|
|
65
|
+
* Reads your README documentation
|
|
66
|
+
* Scans the project structure
|
|
67
|
+
* Detects frameworks and dependencies
|
|
68
|
+
* Discovers conventions and stored memory
|
|
69
|
+
* Generates a comprehensive `PROJECT_CONTEXT.md`
|
|
70
|
+
|
|
71
|
+
The generated file can be used directly with AI coding assistants and LLMs.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Commands
|
|
76
|
+
|
|
77
|
+
### `contextly init`
|
|
78
|
+
|
|
79
|
+
Initialize Context-Ly in the current project.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
contextly init
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Creates:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
.contextly/
|
|
89
|
+
├── config.yaml
|
|
90
|
+
├── memory/
|
|
91
|
+
└── packs/
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### `contextly analyze`
|
|
97
|
+
|
|
98
|
+
Generate a complete repository context file.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
contextly analyze
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This command:
|
|
105
|
+
|
|
106
|
+
* Reads project documentation
|
|
107
|
+
* Analyzes repository structure
|
|
108
|
+
* Detects frameworks and technologies
|
|
109
|
+
* Loads stored team conventions
|
|
110
|
+
* Generates `PROJECT_CONTEXT.md`
|
|
111
|
+
|
|
112
|
+
Output:
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
PROJECT_CONTEXT.md
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
### `contextly discover`
|
|
121
|
+
|
|
122
|
+
Run the Pattern Discovery Engine.
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
contextly discover
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Discovers repository conventions such as:
|
|
129
|
+
|
|
130
|
+
* TailwindCSS usage
|
|
131
|
+
* Zustand state management
|
|
132
|
+
* React Query patterns
|
|
133
|
+
* Service-layer architecture hints
|
|
134
|
+
* Framework-specific conventions
|
|
135
|
+
|
|
136
|
+
The command provides insight into patterns already present within the codebase.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### `contextly learn --auto`
|
|
141
|
+
|
|
142
|
+
Convert discovered conventions into permanent project memory.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
contextly learn --auto
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Example:
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
Save convention: TailwindCSS (Uses TailwindCSS for styling.)? [y/N]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Approved conventions are stored in:
|
|
155
|
+
|
|
156
|
+
```text
|
|
157
|
+
.contextly/memory/rules.yaml
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
This creates a persistent memory layer that can be committed to source control and shared across teams.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### `contextly memory`
|
|
165
|
+
|
|
166
|
+
Inspect all stored project memory and conventions.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
contextly memory
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Displays all saved rules, conventions, and architectural preferences currently remembered by Context-Ly.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### `contextly pack <directory>`
|
|
177
|
+
|
|
178
|
+
Generate an LLM-ready Context Pack from a specific directory.
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
contextly pack src/components
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The command:
|
|
185
|
+
|
|
186
|
+
* Reads all files in the target directory
|
|
187
|
+
* Calculates token usage
|
|
188
|
+
* Bundles the content into a reusable Context Pack
|
|
189
|
+
|
|
190
|
+
Output location:
|
|
191
|
+
|
|
192
|
+
```text
|
|
193
|
+
.contextly/packs/
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Useful for sharing focused portions of a large codebase with an LLM.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
### `contextly inspect`
|
|
201
|
+
|
|
202
|
+
Analyze repository complexity and token consumption.
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
contextly inspect
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Provides visibility into:
|
|
209
|
+
|
|
210
|
+
* Large files
|
|
211
|
+
* Potential token-heavy directories
|
|
212
|
+
* Context window bottlenecks
|
|
213
|
+
* Repository complexity hotspots
|
|
214
|
+
|
|
215
|
+
This helps identify areas that may negatively impact AI context quality.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Example Workflow
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
contextly init
|
|
223
|
+
|
|
224
|
+
contextly discover
|
|
225
|
+
|
|
226
|
+
contextly learn --auto
|
|
227
|
+
|
|
228
|
+
contextly analyze
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Result:
|
|
232
|
+
|
|
233
|
+
```text
|
|
234
|
+
.contextly/
|
|
235
|
+
PROJECT_CONTEXT.md
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Your repository now has a persistent memory layer and an AI-ready context file generated from both repository analysis and learned team conventions.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Why Context-Ly?
|
|
243
|
+
|
|
244
|
+
Modern AI coding tools are powerful, but they often lack project-specific context.
|
|
245
|
+
|
|
246
|
+
Context-Ly bridges that gap by transforming repository knowledge, team conventions, and architectural patterns into structured context that can be consistently shared with LLMs.
|
|
247
|
+
|
|
248
|
+
The goal is simple:
|
|
249
|
+
|
|
250
|
+
**Build context once. Use it everywhere.**
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Changelog
|
|
255
|
+
|
|
256
|
+
For all release notes and version history, please see the [CHANGELOG.md](https://github.com/vutikurishanmukha9/Contextly/blob/main/cli/CHANGELOG.md).
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Contributing
|
|
261
|
+
|
|
262
|
+
Contributions, issues, and feature requests are welcome.
|
|
263
|
+
|
|
264
|
+
If you discover a bug, have an idea for improving repository intelligence, or want to contribute new scanners and analysis capabilities, please open an issue or submit a pull request.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## License
|
|
269
|
+
|
|
270
|
+
This project is open source and distributed under the terms of its license.
|
|
271
|
+
|
|
272
|
+
See the LICENSE file for details.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Contextly CLI Package
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Init commands
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
from rich.table import Table
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from ..utils.console import console
|
|
6
|
+
from ..scanners.base import ScannerError
|
|
7
|
+
from ..utils.exceptions import ContextlyError
|
|
8
|
+
from ..core.analyzer.engine import AnalyzerEngine
|
|
9
|
+
|
|
10
|
+
def analyze_cmd(model: str = typer.Option("chatgpt", "--model", "-m", help="Target LLM format ('chatgpt' or 'claude')")):
|
|
11
|
+
"""Automatically analyze and map the repository"""
|
|
12
|
+
root_dir = Path.cwd()
|
|
13
|
+
engine = AnalyzerEngine(root_dir)
|
|
14
|
+
|
|
15
|
+
with console.status("[bold blue]Scanning repository intelligence (Max Level)...", spinner="dots"):
|
|
16
|
+
try:
|
|
17
|
+
intelligence = engine.analyze(model)
|
|
18
|
+
except ScannerError as e:
|
|
19
|
+
console.print(f"\n[bold red]Scanner Error:[/bold red] {e}")
|
|
20
|
+
raise typer.Exit(1)
|
|
21
|
+
except ContextlyError as e:
|
|
22
|
+
console.print(f"\n[bold red]Context-Ly Error:[/bold red] {e}")
|
|
23
|
+
raise typer.Exit(1)
|
|
24
|
+
except Exception as e:
|
|
25
|
+
console.print(f"\n[bold red]Unexpected Error:[/bold red] {e}")
|
|
26
|
+
raise typer.Exit(1)
|
|
27
|
+
|
|
28
|
+
console.print("\n[bold green][OK][/bold green] Repository scan complete!\n")
|
|
29
|
+
|
|
30
|
+
table = Table(title="Repository Intelligence (Max Level)", show_header=False, box=None)
|
|
31
|
+
table.add_column("Category", style="cyan", justify="right")
|
|
32
|
+
table.add_column("Value", style="magenta")
|
|
33
|
+
|
|
34
|
+
table.add_row("Primary Language", f"[bold]{intelligence.language.primary}[/bold]")
|
|
35
|
+
table.add_row("Frontend Framework", intelligence.frameworks.frontend)
|
|
36
|
+
table.add_row("Backend/Tooling", intelligence.frameworks.backend)
|
|
37
|
+
|
|
38
|
+
npm_count = len(intelligence.dependencies.npm)
|
|
39
|
+
py_count = len(intelligence.dependencies.python)
|
|
40
|
+
|
|
41
|
+
if npm_count > 0:
|
|
42
|
+
table.add_row("NPM Dependencies", str(npm_count))
|
|
43
|
+
if py_count > 0:
|
|
44
|
+
table.add_row("Python Dependencies", str(py_count))
|
|
45
|
+
|
|
46
|
+
console.print(table)
|
|
47
|
+
console.print()
|
|
48
|
+
console.print(f"[dim]Generated advanced PROJECT_CONTEXT.md ({model.lower()} format) in current directory.[/dim]")
|
|
49
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
import typer
|
|
3
|
+
|
|
4
|
+
from ..utils.console import console
|
|
5
|
+
from ..core.discovery.engine import DiscoveryEngine
|
|
6
|
+
from ..scanners.base import ScannerError
|
|
7
|
+
from ..utils.exceptions import ValidationError, ContextlyError
|
|
8
|
+
from ..utils.validation import require_contextly_initialized
|
|
9
|
+
|
|
10
|
+
def discover_cmd():
|
|
11
|
+
"""Statically analyze the repository to discover architectural patterns and conventions"""
|
|
12
|
+
root_dir = Path.cwd()
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
require_contextly_initialized(root_dir)
|
|
16
|
+
except ValidationError as e:
|
|
17
|
+
console.print(f"[bold red]Error:[/bold red] {e}")
|
|
18
|
+
raise typer.Exit(code=1)
|
|
19
|
+
|
|
20
|
+
engine = DiscoveryEngine(root_dir)
|
|
21
|
+
|
|
22
|
+
with console.status("[bold blue]Running Pattern Discovery Engine...", spinner="dots"):
|
|
23
|
+
try:
|
|
24
|
+
patterns_result = engine.discover()
|
|
25
|
+
except ScannerError as e:
|
|
26
|
+
console.print(f"\n[bold red]Scanner Error:[/bold red] {e}")
|
|
27
|
+
raise typer.Exit(code=1)
|
|
28
|
+
except ContextlyError as e:
|
|
29
|
+
console.print(f"\n[bold red]Context-Ly Error:[/bold red] {e}")
|
|
30
|
+
raise typer.Exit(code=1)
|
|
31
|
+
|
|
32
|
+
console.print("[bold green][OK][/bold green] Pattern Discovery Complete:\n")
|
|
33
|
+
|
|
34
|
+
if not patterns_result.patterns:
|
|
35
|
+
console.print("[yellow]No recognizable architectural patterns or conventions discovered.[/yellow]")
|
|
36
|
+
return
|
|
37
|
+
|
|
38
|
+
# Group by category
|
|
39
|
+
categories = {}
|
|
40
|
+
for p in patterns_result.patterns:
|
|
41
|
+
if p.category not in categories:
|
|
42
|
+
categories[p.category] = []
|
|
43
|
+
categories[p.category].append(p)
|
|
44
|
+
|
|
45
|
+
for category, patterns in sorted(categories.items()):
|
|
46
|
+
console.print(f"[bold cyan]{category}:[/bold cyan]")
|
|
47
|
+
# Sort by confidence descending (High -> Medium -> Low)
|
|
48
|
+
sorted_patterns = sorted(patterns, key=lambda p: {"high": 0, "medium": 1, "low": 2}.get(p.confidence.lower(), 3))
|
|
49
|
+
for p in sorted_patterns:
|
|
50
|
+
console.print(f" [green]\\[OK][/green] [bold]{p.name}[/bold] ({p.description})")
|
|
51
|
+
console.print()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import typer
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from ..utils.console import console
|
|
4
|
+
from ..core.exporter.engine import ExporterEngine
|
|
5
|
+
from ..utils.validation import require_contextly_initialized
|
|
6
|
+
from ..utils.exceptions import ValidationError, ContextlyError
|
|
7
|
+
|
|
8
|
+
def export_cmd(
|
|
9
|
+
pack_name: str = typer.Argument(..., help="The name of the context pack to export (e.g., 'frontend')")
|
|
10
|
+
):
|
|
11
|
+
"""Fuses intelligence and context packs, copying the result to your clipboard."""
|
|
12
|
+
root_dir = Path.cwd()
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
require_contextly_initialized(root_dir)
|
|
16
|
+
except ValidationError as e:
|
|
17
|
+
console.print(f"[bold red]Error:[/bold red] {e}")
|
|
18
|
+
raise typer.Exit(code=1)
|
|
19
|
+
|
|
20
|
+
engine = ExporterEngine(root_dir)
|
|
21
|
+
|
|
22
|
+
try:
|
|
23
|
+
export_path, clipboard_success = engine.export(pack_name)
|
|
24
|
+
except ContextlyError as e:
|
|
25
|
+
console.print(f"[bold red]Error:[/bold red] {e}")
|
|
26
|
+
raise typer.Exit(code=1)
|
|
27
|
+
|
|
28
|
+
if clipboard_success:
|
|
29
|
+
clipboard_status = "[green]Successfully copied to clipboard![/green]"
|
|
30
|
+
else:
|
|
31
|
+
clipboard_status = "[yellow]Could not copy to clipboard. The export file was saved successfully.[/yellow]"
|
|
32
|
+
|
|
33
|
+
console.print(f"\n[bold green][OK][/bold green] Export Generation Complete!")
|
|
34
|
+
console.print(f" - [cyan]Intelligence:[/cyan] PROJECT_CONTEXT.md")
|
|
35
|
+
console.print(f" - [cyan]Context Pack:[/cyan] {pack_name}")
|
|
36
|
+
console.print(f" - [cyan]Local Export:[/cyan] {export_path.relative_to(root_dir)}")
|
|
37
|
+
console.print(f"\n{clipboard_status}")
|
|
38
|
+
if clipboard_success:
|
|
39
|
+
console.print("\nYou can now paste the contents directly into Claude or ChatGPT.")
|
|
40
|
+
else:
|
|
41
|
+
console.print("\nOpen the local export file to copy the contents manually.")
|
|
42
|
+
|