ctx-bridge 0.1.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.
- ctx_bridge-0.1.0/LICENSE +21 -0
- ctx_bridge-0.1.0/PKG-INFO +262 -0
- ctx_bridge-0.1.0/README.md +242 -0
- ctx_bridge-0.1.0/pyproject.toml +35 -0
- ctx_bridge-0.1.0/setup.cfg +4 -0
- ctx_bridge-0.1.0/src/ctx_bridge.egg-info/PKG-INFO +262 -0
- ctx_bridge-0.1.0/src/ctx_bridge.egg-info/SOURCES.txt +23 -0
- ctx_bridge-0.1.0/src/ctx_bridge.egg-info/dependency_links.txt +1 -0
- ctx_bridge-0.1.0/src/ctx_bridge.egg-info/entry_points.txt +3 -0
- ctx_bridge-0.1.0/src/ctx_bridge.egg-info/requires.txt +8 -0
- ctx_bridge-0.1.0/src/ctx_bridge.egg-info/top_level.txt +1 -0
- ctx_bridge-0.1.0/src/ctx_tool/__init__.py +2 -0
- ctx_bridge-0.1.0/src/ctx_tool/__main__.py +4 -0
- ctx_bridge-0.1.0/src/ctx_tool/cli.py +235 -0
- ctx_bridge-0.1.0/src/ctx_tool/config.py +102 -0
- ctx_bridge-0.1.0/src/ctx_tool/detector.py +113 -0
- ctx_bridge-0.1.0/src/ctx_tool/exporter.py +176 -0
- ctx_bridge-0.1.0/src/ctx_tool/git_utils.py +140 -0
- ctx_bridge-0.1.0/src/ctx_tool/session.py +59 -0
- ctx_bridge-0.1.0/src/ctx_tool/templates.py +20 -0
- ctx_bridge-0.1.0/src/ctx_tool/tree.py +71 -0
- ctx_bridge-0.1.0/tests/test_cli.py +58 -0
- ctx_bridge-0.1.0/tests/test_detector.py +25 -0
- ctx_bridge-0.1.0/tests/test_exporter.py +40 -0
- ctx_bridge-0.1.0/tests/test_git_utils.py +27 -0
ctx_bridge-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Maaz Korejo
|
|
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.
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ctx-bridge
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI tool to snapshot project context, git state, diffs, and progress logs for AI assistant session handoffs.
|
|
5
|
+
Author: Maaz Korejo
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/Maazkorejo/CTX-Bridge
|
|
8
|
+
Keywords: ai,cli,context,prompt,git,developer-tools,handoff,bridge
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Requires-Dist: click>=8.0.0
|
|
13
|
+
Requires-Dist: rich>=13.0.0
|
|
14
|
+
Requires-Dist: gitpython>=3.1.0
|
|
15
|
+
Requires-Dist: pyperclip>=1.8.0
|
|
16
|
+
Requires-Dist: pathspec>=0.11.0
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# ๐ CTX-Bridge (`ctx-bridge` / `bridge`)
|
|
22
|
+
|
|
23
|
+
[](https://opensource.org/licenses/MIT)
|
|
24
|
+
[](https://www.python.org/downloads/)
|
|
25
|
+
[](https://github.com/psf/black)
|
|
26
|
+
|
|
27
|
+
> **Bridge the context gap between AI coding assistants.**
|
|
28
|
+
> Snapshot your git state, code diffs, directory structure, project metadata, and running progress logs into a clean, paste-ready handoff summary โ so your next AI session picks up **exactly where the last one left off.**
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## โก The Problem
|
|
33
|
+
|
|
34
|
+
When coding with AI assistants (**Cursor, GitHub Copilot, Windsurf, Claude Code, ChatGPT**), you inevitably hit context window limits or session resets mid-task. Switching tools or starting a fresh chat forces you to re-explain everything from scratch โ wasting **time, tokens, and focus**.
|
|
35
|
+
|
|
36
|
+
## ๐ The Solution: `CTX-Bridge`
|
|
37
|
+
|
|
38
|
+
`CTX-Bridge` acts as persistent cognitive memory for your developer workspace. With simple terminal commands, it captures what was done, what files were touched, uncommitted git diffs, project dependencies, and an ASCII tree structure โ framing it instantly into your clipboard and a saved snapshot document.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
[ AI Assistant Session 1 ]
|
|
42
|
+
โ
|
|
43
|
+
โผ (Run: bridge export)
|
|
44
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
45
|
+
โ CTX-Bridge Engine โ โโโบ Saved .ctx/exports/handoff.md
|
|
46
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโ โโโบ Copied to Clipboard
|
|
47
|
+
โ
|
|
48
|
+
โผ (Paste into New Chat)
|
|
49
|
+
[ AI Assistant Session 2 ]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## โจ Features
|
|
55
|
+
|
|
56
|
+
- ๐ **Web Chat Session Handoff (`bridge chat`)**: Purpose-built for web browser AI chats. Wrap copied code/notes into a formatted prompt instantly.
|
|
57
|
+
- ๐ฟ **Git State Integration**: Extracts active branch, recent commit logs, staged, unstaged, and untracked files.
|
|
58
|
+
- ๐ **Code Diff Capture**: Captures working tree `git diff` output with configurable line limit truncation.
|
|
59
|
+
- ๐ฒ **Smart Directory Tree**: Generates ASCII project structure respecting `.gitignore` patterns with directory symlink loop protection.
|
|
60
|
+
- ๐ **Multi-Language Auto-Detection**: Automatically identifies project language and framework:
|
|
61
|
+
- **Python** (FastAPI, Django, Flask, `pyproject.toml`, `requirements.txt`)
|
|
62
|
+
- **JavaScript / TypeScript** (Next.js, React, Vue, Express, NestJS)
|
|
63
|
+
- **Rust** (`Cargo.toml`) | **Go** (`go.mod`) | **Java/Kotlin** (Maven, Gradle)
|
|
64
|
+
- **C# / .NET** (`*.csproj`, `*.sln`) | **Ruby** (`Gemfile`) | **PHP** (`composer.json`)
|
|
65
|
+
- ๐ **Running Session Logs**: Add timestamped progress notes while coding (`bridge log "..."`).
|
|
66
|
+
- ๐ค **AI Assistant Presets**: Tailored prompt framing preambles for **Cursor**, **GitHub Copilot**, **Claude**, **ChatGPT**, and **Generic AI**.
|
|
67
|
+
- ๐ก๏ธ **Security Safeguards**:
|
|
68
|
+
- Automatically appends `.ctx/` to `.gitignore` on initialization.
|
|
69
|
+
- Automatically redacts sensitive files (`.env*`, `*.pem`, `*.key`, `id_rsa*`, `credentials.json`) from diffs and status reports.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## ๐ฆ Installation
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Clone repository
|
|
77
|
+
git clone https://github.com/Maazkorejo/CTX-Bridge.git
|
|
78
|
+
cd CTX-Bridge
|
|
79
|
+
|
|
80
|
+
# Install locally in editable mode
|
|
81
|
+
pip install -e .
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
After installation, both `ctx-bridge` and the shortcut `bridge` are available in your terminal:
|
|
85
|
+
```bash
|
|
86
|
+
bridge --version
|
|
87
|
+
# Output: ctx-bridge, version 0.1.0
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## ๐ ๏ธ Detailed Command Reference
|
|
93
|
+
|
|
94
|
+
You can invoke commands using either `bridge` or `ctx-bridge`.
|
|
95
|
+
|
|
96
|
+
### 1. `bridge chat`
|
|
97
|
+
Purpose-built for web browser AI chat sessions (no repository required). Formats copied code and task goals into a paste-ready handoff prompt and copies it to your clipboard.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Interactive mode (prompts for goal, code/clipboard, and next task)
|
|
101
|
+
bridge chat
|
|
102
|
+
|
|
103
|
+
# Auto-grab whatever you just copied from your browser chat:
|
|
104
|
+
bridge chat --from-clipboard
|
|
105
|
+
|
|
106
|
+
# Command-line flags mode:
|
|
107
|
+
bridge chat --goal "FastAPI Auth Service" --task "Add password hashing" --template claude
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 2. `bridge init`
|
|
111
|
+
Initializes `.ctx/` configuration directory and `progress.md` in your project root. Automatically appends `.ctx/` to `.gitignore`.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
bridge init
|
|
115
|
+
# Custom project name:
|
|
116
|
+
bridge init --name "my-awesome-service"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 2. `bridge log <message>`
|
|
120
|
+
Appends a timestamped progress note to `.ctx/progress.md` so the AI knows what has already been accomplished.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
bridge log "Created user authentication endpoints in /api/auth"
|
|
124
|
+
bridge log "Fixed JWT token verification bug in middleware"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 3. `bridge status`
|
|
128
|
+
Displays a rich terminal table showing project metadata, active git branch, modified files count, and logged entries.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
bridge status
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 4. `bridge export`
|
|
135
|
+
Generates the complete context snapshot markdown report, copies it to your **system clipboard**, and saves a snapshot copy to `.ctx/exports/handoff_<timestamp>.md`.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Export with default generic AI framing
|
|
139
|
+
bridge export
|
|
140
|
+
|
|
141
|
+
# Export framed specifically for Cursor IDE or Claude
|
|
142
|
+
bridge export --template cursor
|
|
143
|
+
bridge export --template claude
|
|
144
|
+
|
|
145
|
+
# Export Flags:
|
|
146
|
+
bridge export --no-clipboard # Do not copy to system clipboard
|
|
147
|
+
bridge export --no-file # Do not save .md file to disk
|
|
148
|
+
bridge export --stdout # Output markdown directly to stdout
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 5. `bridge reset`
|
|
152
|
+
Clears current progress entries in `.ctx/progress.md` for a fresh session.
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
bridge reset
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## ๐ Example Export Snapshot Output
|
|
161
|
+
|
|
162
|
+
Here is what `bridge export` copies to your clipboard:
|
|
163
|
+
|
|
164
|
+
```markdown
|
|
165
|
+
# ๐ Context Handoff โ my-fastapi-app
|
|
166
|
+
|
|
167
|
+
> **Generated at**: 2026-08-13 05:15:00
|
|
168
|
+
> [CURSOR HANDOFF SESSION] You are Cursor AI assistant. Resume the active coding task using the project context below.
|
|
169
|
+
|
|
170
|
+
## ๐ Session Progress Log
|
|
171
|
+
- **[2026-08-13 04:30:12]** Created database schema for users and auth tokens
|
|
172
|
+
- **[2026-08-13 05:10:45]** Implemented JWT token verification middleware
|
|
173
|
+
|
|
174
|
+
## ๐ฟ Git State
|
|
175
|
+
- **Branch**: `feature/auth`
|
|
176
|
+
- **Staged Files**: `app/auth.py`, `app/main.py`
|
|
177
|
+
- **Unstaged Files**: `tests/test_auth.py`
|
|
178
|
+
|
|
179
|
+
**Recent Commits**:
|
|
180
|
+
- `a1b2c3d` โ Initial project structure
|
|
181
|
+
- `e5f6g7h` โ Add database config
|
|
182
|
+
|
|
183
|
+
## ๐ Code Changes (git diff)
|
|
184
|
+
```diff
|
|
185
|
+
--- a/app/auth.py
|
|
186
|
+
+++ b/app/auth.py
|
|
187
|
+
@@ -12,4 +12,4 @@ def verify_token(token: str):
|
|
188
|
+
- return jwt.decode(token, SECRET)
|
|
189
|
+
+ return jwt.decode(token, SECRET, algorithms=["HS256"])
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## ๐ Project Structure (`*` = modified)
|
|
193
|
+
```
|
|
194
|
+
my-fastapi-app/
|
|
195
|
+
โโโ app/
|
|
196
|
+
โ โโโ __init__.py
|
|
197
|
+
โ โโโ auth.py *
|
|
198
|
+
โ โโโ main.py *
|
|
199
|
+
โโโ tests/
|
|
200
|
+
โ โโโ test_auth.py *
|
|
201
|
+
โโโ pyproject.toml
|
|
202
|
+
โโโ requirements.txt
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## ๐ง Project Info
|
|
206
|
+
- **Type**: Python
|
|
207
|
+
- **Framework**: FastAPI
|
|
208
|
+
- **Key Dependencies**: fastapi, uvicorn, pyjwt, pydantic
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## โ๏ธ Configuration (`.ctx/config.json`)
|
|
214
|
+
|
|
215
|
+
When you run `bridge init`, `.ctx/config.json` is created:
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"project_name": "my-project",
|
|
220
|
+
"project_type": "Python",
|
|
221
|
+
"template": "generic",
|
|
222
|
+
"export_format": "markdown",
|
|
223
|
+
"max_diff_lines": 300,
|
|
224
|
+
"max_tree_depth": 4,
|
|
225
|
+
"ignore_patterns": [
|
|
226
|
+
"node_modules",
|
|
227
|
+
".git",
|
|
228
|
+
"__pycache__",
|
|
229
|
+
".venv",
|
|
230
|
+
"venv",
|
|
231
|
+
"dist",
|
|
232
|
+
"build",
|
|
233
|
+
".ctx"
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## ๐งช Running Tests
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
# Install development dependencies
|
|
244
|
+
pip install -e .[dev]
|
|
245
|
+
|
|
246
|
+
# Run full test suite
|
|
247
|
+
python -m pytest tests/ -v
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## ๐ค Author & Maintainer
|
|
253
|
+
|
|
254
|
+
**Maaz Korejo**
|
|
255
|
+
- GitHub: [@Maazkorejo](https://github.com/Maazkorejo)
|
|
256
|
+
- Repository: [CTX-Bridge](https://github.com/Maazkorejo/CTX-Bridge)
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## ๐ License
|
|
261
|
+
|
|
262
|
+
Distributed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# ๐ CTX-Bridge (`ctx-bridge` / `bridge`)
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.python.org/downloads/)
|
|
5
|
+
[](https://github.com/psf/black)
|
|
6
|
+
|
|
7
|
+
> **Bridge the context gap between AI coding assistants.**
|
|
8
|
+
> Snapshot your git state, code diffs, directory structure, project metadata, and running progress logs into a clean, paste-ready handoff summary โ so your next AI session picks up **exactly where the last one left off.**
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## โก The Problem
|
|
13
|
+
|
|
14
|
+
When coding with AI assistants (**Cursor, GitHub Copilot, Windsurf, Claude Code, ChatGPT**), you inevitably hit context window limits or session resets mid-task. Switching tools or starting a fresh chat forces you to re-explain everything from scratch โ wasting **time, tokens, and focus**.
|
|
15
|
+
|
|
16
|
+
## ๐ The Solution: `CTX-Bridge`
|
|
17
|
+
|
|
18
|
+
`CTX-Bridge` acts as persistent cognitive memory for your developer workspace. With simple terminal commands, it captures what was done, what files were touched, uncommitted git diffs, project dependencies, and an ASCII tree structure โ framing it instantly into your clipboard and a saved snapshot document.
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
[ AI Assistant Session 1 ]
|
|
22
|
+
โ
|
|
23
|
+
โผ (Run: bridge export)
|
|
24
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
25
|
+
โ CTX-Bridge Engine โ โโโบ Saved .ctx/exports/handoff.md
|
|
26
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโ โโโบ Copied to Clipboard
|
|
27
|
+
โ
|
|
28
|
+
โผ (Paste into New Chat)
|
|
29
|
+
[ AI Assistant Session 2 ]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## โจ Features
|
|
35
|
+
|
|
36
|
+
- ๐ **Web Chat Session Handoff (`bridge chat`)**: Purpose-built for web browser AI chats. Wrap copied code/notes into a formatted prompt instantly.
|
|
37
|
+
- ๐ฟ **Git State Integration**: Extracts active branch, recent commit logs, staged, unstaged, and untracked files.
|
|
38
|
+
- ๐ **Code Diff Capture**: Captures working tree `git diff` output with configurable line limit truncation.
|
|
39
|
+
- ๐ฒ **Smart Directory Tree**: Generates ASCII project structure respecting `.gitignore` patterns with directory symlink loop protection.
|
|
40
|
+
- ๐ **Multi-Language Auto-Detection**: Automatically identifies project language and framework:
|
|
41
|
+
- **Python** (FastAPI, Django, Flask, `pyproject.toml`, `requirements.txt`)
|
|
42
|
+
- **JavaScript / TypeScript** (Next.js, React, Vue, Express, NestJS)
|
|
43
|
+
- **Rust** (`Cargo.toml`) | **Go** (`go.mod`) | **Java/Kotlin** (Maven, Gradle)
|
|
44
|
+
- **C# / .NET** (`*.csproj`, `*.sln`) | **Ruby** (`Gemfile`) | **PHP** (`composer.json`)
|
|
45
|
+
- ๐ **Running Session Logs**: Add timestamped progress notes while coding (`bridge log "..."`).
|
|
46
|
+
- ๐ค **AI Assistant Presets**: Tailored prompt framing preambles for **Cursor**, **GitHub Copilot**, **Claude**, **ChatGPT**, and **Generic AI**.
|
|
47
|
+
- ๐ก๏ธ **Security Safeguards**:
|
|
48
|
+
- Automatically appends `.ctx/` to `.gitignore` on initialization.
|
|
49
|
+
- Automatically redacts sensitive files (`.env*`, `*.pem`, `*.key`, `id_rsa*`, `credentials.json`) from diffs and status reports.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## ๐ฆ Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Clone repository
|
|
57
|
+
git clone https://github.com/Maazkorejo/CTX-Bridge.git
|
|
58
|
+
cd CTX-Bridge
|
|
59
|
+
|
|
60
|
+
# Install locally in editable mode
|
|
61
|
+
pip install -e .
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
After installation, both `ctx-bridge` and the shortcut `bridge` are available in your terminal:
|
|
65
|
+
```bash
|
|
66
|
+
bridge --version
|
|
67
|
+
# Output: ctx-bridge, version 0.1.0
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## ๐ ๏ธ Detailed Command Reference
|
|
73
|
+
|
|
74
|
+
You can invoke commands using either `bridge` or `ctx-bridge`.
|
|
75
|
+
|
|
76
|
+
### 1. `bridge chat`
|
|
77
|
+
Purpose-built for web browser AI chat sessions (no repository required). Formats copied code and task goals into a paste-ready handoff prompt and copies it to your clipboard.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Interactive mode (prompts for goal, code/clipboard, and next task)
|
|
81
|
+
bridge chat
|
|
82
|
+
|
|
83
|
+
# Auto-grab whatever you just copied from your browser chat:
|
|
84
|
+
bridge chat --from-clipboard
|
|
85
|
+
|
|
86
|
+
# Command-line flags mode:
|
|
87
|
+
bridge chat --goal "FastAPI Auth Service" --task "Add password hashing" --template claude
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 2. `bridge init`
|
|
91
|
+
Initializes `.ctx/` configuration directory and `progress.md` in your project root. Automatically appends `.ctx/` to `.gitignore`.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
bridge init
|
|
95
|
+
# Custom project name:
|
|
96
|
+
bridge init --name "my-awesome-service"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 2. `bridge log <message>`
|
|
100
|
+
Appends a timestamped progress note to `.ctx/progress.md` so the AI knows what has already been accomplished.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
bridge log "Created user authentication endpoints in /api/auth"
|
|
104
|
+
bridge log "Fixed JWT token verification bug in middleware"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 3. `bridge status`
|
|
108
|
+
Displays a rich terminal table showing project metadata, active git branch, modified files count, and logged entries.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
bridge status
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 4. `bridge export`
|
|
115
|
+
Generates the complete context snapshot markdown report, copies it to your **system clipboard**, and saves a snapshot copy to `.ctx/exports/handoff_<timestamp>.md`.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Export with default generic AI framing
|
|
119
|
+
bridge export
|
|
120
|
+
|
|
121
|
+
# Export framed specifically for Cursor IDE or Claude
|
|
122
|
+
bridge export --template cursor
|
|
123
|
+
bridge export --template claude
|
|
124
|
+
|
|
125
|
+
# Export Flags:
|
|
126
|
+
bridge export --no-clipboard # Do not copy to system clipboard
|
|
127
|
+
bridge export --no-file # Do not save .md file to disk
|
|
128
|
+
bridge export --stdout # Output markdown directly to stdout
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 5. `bridge reset`
|
|
132
|
+
Clears current progress entries in `.ctx/progress.md` for a fresh session.
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
bridge reset
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## ๐ Example Export Snapshot Output
|
|
141
|
+
|
|
142
|
+
Here is what `bridge export` copies to your clipboard:
|
|
143
|
+
|
|
144
|
+
```markdown
|
|
145
|
+
# ๐ Context Handoff โ my-fastapi-app
|
|
146
|
+
|
|
147
|
+
> **Generated at**: 2026-08-13 05:15:00
|
|
148
|
+
> [CURSOR HANDOFF SESSION] You are Cursor AI assistant. Resume the active coding task using the project context below.
|
|
149
|
+
|
|
150
|
+
## ๐ Session Progress Log
|
|
151
|
+
- **[2026-08-13 04:30:12]** Created database schema for users and auth tokens
|
|
152
|
+
- **[2026-08-13 05:10:45]** Implemented JWT token verification middleware
|
|
153
|
+
|
|
154
|
+
## ๐ฟ Git State
|
|
155
|
+
- **Branch**: `feature/auth`
|
|
156
|
+
- **Staged Files**: `app/auth.py`, `app/main.py`
|
|
157
|
+
- **Unstaged Files**: `tests/test_auth.py`
|
|
158
|
+
|
|
159
|
+
**Recent Commits**:
|
|
160
|
+
- `a1b2c3d` โ Initial project structure
|
|
161
|
+
- `e5f6g7h` โ Add database config
|
|
162
|
+
|
|
163
|
+
## ๐ Code Changes (git diff)
|
|
164
|
+
```diff
|
|
165
|
+
--- a/app/auth.py
|
|
166
|
+
+++ b/app/auth.py
|
|
167
|
+
@@ -12,4 +12,4 @@ def verify_token(token: str):
|
|
168
|
+
- return jwt.decode(token, SECRET)
|
|
169
|
+
+ return jwt.decode(token, SECRET, algorithms=["HS256"])
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## ๐ Project Structure (`*` = modified)
|
|
173
|
+
```
|
|
174
|
+
my-fastapi-app/
|
|
175
|
+
โโโ app/
|
|
176
|
+
โ โโโ __init__.py
|
|
177
|
+
โ โโโ auth.py *
|
|
178
|
+
โ โโโ main.py *
|
|
179
|
+
โโโ tests/
|
|
180
|
+
โ โโโ test_auth.py *
|
|
181
|
+
โโโ pyproject.toml
|
|
182
|
+
โโโ requirements.txt
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## ๐ง Project Info
|
|
186
|
+
- **Type**: Python
|
|
187
|
+
- **Framework**: FastAPI
|
|
188
|
+
- **Key Dependencies**: fastapi, uvicorn, pyjwt, pydantic
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## โ๏ธ Configuration (`.ctx/config.json`)
|
|
194
|
+
|
|
195
|
+
When you run `bridge init`, `.ctx/config.json` is created:
|
|
196
|
+
|
|
197
|
+
```json
|
|
198
|
+
{
|
|
199
|
+
"project_name": "my-project",
|
|
200
|
+
"project_type": "Python",
|
|
201
|
+
"template": "generic",
|
|
202
|
+
"export_format": "markdown",
|
|
203
|
+
"max_diff_lines": 300,
|
|
204
|
+
"max_tree_depth": 4,
|
|
205
|
+
"ignore_patterns": [
|
|
206
|
+
"node_modules",
|
|
207
|
+
".git",
|
|
208
|
+
"__pycache__",
|
|
209
|
+
".venv",
|
|
210
|
+
"venv",
|
|
211
|
+
"dist",
|
|
212
|
+
"build",
|
|
213
|
+
".ctx"
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## ๐งช Running Tests
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# Install development dependencies
|
|
224
|
+
pip install -e .[dev]
|
|
225
|
+
|
|
226
|
+
# Run full test suite
|
|
227
|
+
python -m pytest tests/ -v
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## ๐ค Author & Maintainer
|
|
233
|
+
|
|
234
|
+
**Maaz Korejo**
|
|
235
|
+
- GitHub: [@Maazkorejo](https://github.com/Maazkorejo)
|
|
236
|
+
- Repository: [CTX-Bridge](https://github.com/Maazkorejo/CTX-Bridge)
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## ๐ License
|
|
241
|
+
|
|
242
|
+
Distributed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ctx-bridge"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "CLI tool to snapshot project context, git state, diffs, and progress logs for AI assistant session handoffs."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "Maaz Korejo" }
|
|
12
|
+
]
|
|
13
|
+
urls = { Repository = "https://github.com/Maazkorejo/CTX-Bridge" }
|
|
14
|
+
license = "MIT"
|
|
15
|
+
keywords = ["ai", "cli", "context", "prompt", "git", "developer-tools", "handoff", "bridge"]
|
|
16
|
+
requires-python = ">=3.8"
|
|
17
|
+
dependencies = [
|
|
18
|
+
"click>=8.0.0",
|
|
19
|
+
"rich>=13.0.0",
|
|
20
|
+
"gitpython>=3.1.0",
|
|
21
|
+
"pyperclip>=1.8.0",
|
|
22
|
+
"pathspec>=0.11.0",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
dev = [
|
|
27
|
+
"pytest>=7.0.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
ctx-bridge = "ctx_tool.cli:cli"
|
|
32
|
+
bridge = "ctx_tool.cli:cli"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.packages.find]
|
|
35
|
+
where = ["src"]
|