github-sync-agent 0.2.0__tar.gz → 0.3.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.
- github_sync_agent-0.3.0/PKG-INFO +391 -0
- github_sync_agent-0.3.0/README.md +365 -0
- github_sync_agent-0.3.0/github_sync/__init__.py +1 -0
- github_sync_agent-0.3.0/github_sync/api.py +169 -0
- github_sync_agent-0.3.0/github_sync/cli.py +701 -0
- {github_sync_agent-0.2.0 → github_sync_agent-0.3.0}/github_sync/config.py +3 -0
- github_sync_agent-0.3.0/github_sync/llm.py +218 -0
- github_sync_agent-0.3.0/github_sync/mcp_server.py +81 -0
- github_sync_agent-0.3.0/github_sync/static/chat.html +434 -0
- github_sync_agent-0.3.0/github_sync/tools.py +179 -0
- github_sync_agent-0.3.0/github_sync_agent.egg-info/PKG-INFO +391 -0
- {github_sync_agent-0.2.0 → github_sync_agent-0.3.0}/github_sync_agent.egg-info/SOURCES.txt +4 -0
- {github_sync_agent-0.2.0 → github_sync_agent-0.3.0}/github_sync_agent.egg-info/entry_points.txt +1 -0
- {github_sync_agent-0.2.0 → github_sync_agent-0.3.0}/github_sync_agent.egg-info/requires.txt +6 -0
- {github_sync_agent-0.2.0 → github_sync_agent-0.3.0}/pyproject.toml +16 -5
- github_sync_agent-0.2.0/PKG-INFO +0 -175
- github_sync_agent-0.2.0/README.md +0 -153
- github_sync_agent-0.2.0/github_sync/__init__.py +0 -1
- github_sync_agent-0.2.0/github_sync/api.py +0 -111
- github_sync_agent-0.2.0/github_sync/cli.py +0 -299
- github_sync_agent-0.2.0/github_sync_agent.egg-info/PKG-INFO +0 -175
- {github_sync_agent-0.2.0 → github_sync_agent-0.3.0}/github_sync/agent.py +0 -0
- {github_sync_agent-0.2.0 → github_sync_agent-0.3.0}/github_sync/setup.py +0 -0
- {github_sync_agent-0.2.0 → github_sync_agent-0.3.0}/github_sync_agent.egg-info/dependency_links.txt +0 -0
- {github_sync_agent-0.2.0 → github_sync_agent-0.3.0}/github_sync_agent.egg-info/top_level.txt +0 -0
- {github_sync_agent-0.2.0 → github_sync_agent-0.3.0}/setup.cfg +0 -0
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: github-sync-agent
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Sync all your local projects to GitHub automatically
|
|
5
|
+
Author-email: GitHub Sync Agent Maintainers <yuvalavni@users.noreply.github.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/yuvalavni/Agents
|
|
8
|
+
Project-URL: Repository, https://github.com/yuvalavni/Agents
|
|
9
|
+
Project-URL: Issues, https://github.com/yuvalavni/Agents/issues
|
|
10
|
+
Keywords: github,git,sync,backup,automation,cli,api
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: pyyaml>=6.0
|
|
18
|
+
Requires-Dist: click>=8.0
|
|
19
|
+
Provides-Extra: api
|
|
20
|
+
Requires-Dist: fastapi>=0.100; extra == "api"
|
|
21
|
+
Requires-Dist: uvicorn>=0.23; extra == "api"
|
|
22
|
+
Provides-Extra: mcp
|
|
23
|
+
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
24
|
+
Provides-Extra: llm
|
|
25
|
+
Requires-Dist: httpx>=0.27; extra == "llm"
|
|
26
|
+
|
|
27
|
+
# GitHub Sync Agent
|
|
28
|
+
|
|
29
|
+
Automatically syncs every local project directory to its own GitHub repository.
|
|
30
|
+
|
|
31
|
+
For each project it will:
|
|
32
|
+
1. `git init` if not already a repo
|
|
33
|
+
2. Create the GitHub repo if it doesn't exist yet
|
|
34
|
+
3. Ensure the remote uses SSH
|
|
35
|
+
4. Stage + commit any uncommitted changes
|
|
36
|
+
5. Push to `origin`
|
|
37
|
+
|
|
38
|
+
Runs daily via a systemd user timer, and on-demand via CLI.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install github-sync-agent # CLI + tools (base)
|
|
46
|
+
pip install 'github-sync-agent[api]' # + web chat UI & HTTP API
|
|
47
|
+
pip install 'github-sync-agent[mcp]' # + MCP server (Cursor / Claude Desktop)
|
|
48
|
+
pip install 'github-sync-agent[llm]' # + ask command (requires Ollama)
|
|
49
|
+
pip install 'github-sync-agent[api,mcp,llm]' # everything
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Prerequisites (all platforms):**
|
|
53
|
+
- Python 3.10+
|
|
54
|
+
- `git` — [git-scm.com](https://git-scm.com)
|
|
55
|
+
- `gh` (GitHub CLI) — [cli.github.com](https://cli.github.com)
|
|
56
|
+
|
|
57
|
+
**For `ask` command and web chat:**
|
|
58
|
+
- [Ollama](https://ollama.com) running locally (`ollama serve`)
|
|
59
|
+
- A downloaded model: `ollama pull gemma3:4b`
|
|
60
|
+
|
|
61
|
+
## First-time setup
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
github-sync init
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The wizard will:
|
|
68
|
+
- Check `git` and `gh` are installed
|
|
69
|
+
- Authenticate with GitHub (`gh auth login`)
|
|
70
|
+
- Ask which folder to scan for projects
|
|
71
|
+
- Set up your SSH key automatically
|
|
72
|
+
- **Verify SSH works** (auto-fixes port 443 and ssh-agent if needed)
|
|
73
|
+
- Write a config file to `~/.config/github-sync/config.yaml`
|
|
74
|
+
|
|
75
|
+
Setup will **not** complete until `ssh -T git@github.com` succeeds.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Usage
|
|
80
|
+
|
|
81
|
+
### Service management
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Check all prerequisites and service status
|
|
85
|
+
github-sync doctor
|
|
86
|
+
|
|
87
|
+
# Start everything (Ollama + HTTP API / web chat)
|
|
88
|
+
github-sync start
|
|
89
|
+
|
|
90
|
+
# Stop everything
|
|
91
|
+
github-sync stop
|
|
92
|
+
|
|
93
|
+
# If Ollama was installed as a system service and start/stop fails:
|
|
94
|
+
sudo systemctl start ollama
|
|
95
|
+
sudo systemctl stop ollama
|
|
96
|
+
|
|
97
|
+
# Fine-grained control
|
|
98
|
+
github-sync start --no-ollama # start API only (Ollama already running)
|
|
99
|
+
github-sync stop --no-ollama # stop API only, leave Ollama running
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Sync
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Sync all projects
|
|
106
|
+
github-sync sync
|
|
107
|
+
|
|
108
|
+
# Sync a single project
|
|
109
|
+
github-sync sync --project my-project
|
|
110
|
+
|
|
111
|
+
# Preview without making changes
|
|
112
|
+
github-sync sync --dry-run
|
|
113
|
+
|
|
114
|
+
# Show status of all projects
|
|
115
|
+
github-sync status
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Shared tools layer
|
|
121
|
+
|
|
122
|
+
`github_sync/tools.py` defines the core operations used by the API, MCP server, `ask` command, and web chat:
|
|
123
|
+
|
|
124
|
+
| Tool | Description |
|
|
125
|
+
|------|-------------|
|
|
126
|
+
| `list_projects` | List discoverable project directories |
|
|
127
|
+
| `get_status` | Git/remote/changes/GitHub status for all projects |
|
|
128
|
+
| `sync_all` | Sync every project (`dry_run` optional) |
|
|
129
|
+
| `sync_project` | Sync one project by name (`dry_run` optional) |
|
|
130
|
+
|
|
131
|
+
Inspect and test from CLI:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
github-sync tool list
|
|
135
|
+
github-sync tool run list_projects
|
|
136
|
+
github-sync tool run get_status
|
|
137
|
+
github-sync tool run sync_project --arg project=Agents --arg dry_run=true
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Each tool returns JSON: `{"ok": true/false, "message": "...", "data": {...}}`.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## MCP Server (Cursor / Claude Desktop)
|
|
145
|
+
|
|
146
|
+
Exposes the 4 tools above to any MCP host via stdio.
|
|
147
|
+
|
|
148
|
+
### Install
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
pip install 'github-sync-agent[mcp]'
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Register in Cursor
|
|
155
|
+
|
|
156
|
+
Add to `~/.cursor/mcp.json` (create if it doesn't exist):
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"mcpServers": {
|
|
161
|
+
"github-sync": {
|
|
162
|
+
"command": "/path/to/.venv/bin/github-sync-mcp",
|
|
163
|
+
"args": [],
|
|
164
|
+
"env": {}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
If you installed with pipx, the command is just `github-sync-mcp`.
|
|
171
|
+
With a venv, find the path with:
|
|
172
|
+
```bash
|
|
173
|
+
which github-sync-mcp
|
|
174
|
+
# or: github-sync doctor
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Then **reload Cursor** (`Ctrl+Shift+P` → *Reload Window*). The 4 tools will appear and the AI can call them directly.
|
|
178
|
+
|
|
179
|
+
### Run manually
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
github-sync-mcp
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Ask command (natural language via Ollama)
|
|
188
|
+
|
|
189
|
+
Install and start Ollama first (see [Local LLM](#local-llm-ollama--gemma) below), then:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
pip install 'github-sync-agent[llm]'
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
github-sync ask what is the status of my projects
|
|
197
|
+
github-sync ask are there any uncommitted changes
|
|
198
|
+
github-sync ask sync the Agents project
|
|
199
|
+
github-sync ask sync everything dry run
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The agent calls the appropriate tool (`get_status`, `sync_project`, etc.), gets real data, and answers in plain English. No cloud — runs entirely on your machine.
|
|
203
|
+
|
|
204
|
+
Override model or URL:
|
|
205
|
+
```bash
|
|
206
|
+
github-sync ask --model llama3.2 --ollama-url http://localhost:11434 "sync all"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Web chat UI
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
pip install 'github-sync-agent[api,llm]'
|
|
215
|
+
|
|
216
|
+
# Start everything in one command
|
|
217
|
+
github-sync start
|
|
218
|
+
# → Open http://127.0.0.1:8741
|
|
219
|
+
|
|
220
|
+
# Or manually:
|
|
221
|
+
sudo systemctl start ollama # start Ollama (system service)
|
|
222
|
+
github-sync serve # start the web server
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Features:
|
|
226
|
+
- Live project status strip (synced / unsynced / GitHub ✓)
|
|
227
|
+
- Chat interface — type naturally, press Enter
|
|
228
|
+
- Tool calls shown inline as collapsible cards
|
|
229
|
+
- Streaming responses from the local LLM
|
|
230
|
+
- Works entirely offline (no cloud)
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## HTTP API
|
|
235
|
+
|
|
236
|
+
Install API dependencies:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
pip install 'github-sync-agent[api]'
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Start the server:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
github-sync serve
|
|
246
|
+
# → http://127.0.0.1:8741
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Endpoints
|
|
250
|
+
|
|
251
|
+
| Method | Path | Description |
|
|
252
|
+
|--------|------|-------------|
|
|
253
|
+
| `GET` | `/health` | Health check (no auth) |
|
|
254
|
+
| `GET` | `/tools` | List available tools and JSON schemas |
|
|
255
|
+
| `GET` | `/status` | Sync status for all projects |
|
|
256
|
+
| `POST` | `/sync` | Sync all projects |
|
|
257
|
+
| `POST` | `/sync/{project}` | Sync one project |
|
|
258
|
+
|
|
259
|
+
Optional body for POST: `{"dry_run": false}`
|
|
260
|
+
|
|
261
|
+
### Examples
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
curl http://127.0.0.1:8741/health
|
|
265
|
+
curl http://127.0.0.1:8741/tools
|
|
266
|
+
curl http://127.0.0.1:8741/status
|
|
267
|
+
curl -X POST http://127.0.0.1:8741/sync
|
|
268
|
+
curl -X POST http://127.0.0.1:8741/sync/Agents
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### API authentication (optional)
|
|
272
|
+
|
|
273
|
+
Add to `config.yaml`:
|
|
274
|
+
|
|
275
|
+
```yaml
|
|
276
|
+
api_key: "your-secret-key"
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Then pass the key on every request (except `/health`):
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
curl -H "Authorization: Bearer your-secret-key" http://127.0.0.1:8741/status
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Run as a systemd service
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
cp systemd/github-sync-api.service ~/.config/systemd/user/
|
|
289
|
+
systemctl --user enable --now github-sync-api.service
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Configuration (`~/.config/github-sync/config.yaml`)
|
|
295
|
+
|
|
296
|
+
Generated by `github-sync init`. You can edit it at any time.
|
|
297
|
+
|
|
298
|
+
| Key | Default | Description |
|
|
299
|
+
|-----|---------|-------------|
|
|
300
|
+
| `github_user` | _(detected from gh auth)_ | Your GitHub username |
|
|
301
|
+
| `projects_root` | `~/projects` | Scans all subdirectories here |
|
|
302
|
+
| `schedule_time` | `02:00` | Daily run time |
|
|
303
|
+
| `default_visibility` | `private` | `private` or `public` for new repos |
|
|
304
|
+
| `auto_commit_message` | `chore: auto-sync` | Commit message for auto-commits |
|
|
305
|
+
| `exclude` | `[]` | Directory names to skip |
|
|
306
|
+
| `log_file` | `~/.local/share/github-sync/github-sync.log` | Log file path |
|
|
307
|
+
| `log_level` | `INFO` | `DEBUG` / `INFO` / `WARNING` / `ERROR` |
|
|
308
|
+
| `api_host` | `127.0.0.1` | API bind address |
|
|
309
|
+
| `api_port` | `8741` | API port |
|
|
310
|
+
| `api_key` | _(empty)_ | Optional Bearer token for API auth |
|
|
311
|
+
| `ollama_url` | `http://localhost:11434` | Ollama base URL for `ask` and web chat |
|
|
312
|
+
| `llm_model` | `gemma3:4b` | Ollama model name |
|
|
313
|
+
| `llm_timeout` | `120` | Seconds to wait for LLM response |
|
|
314
|
+
|
|
315
|
+
### Excluding a project
|
|
316
|
+
|
|
317
|
+
```yaml
|
|
318
|
+
exclude:
|
|
319
|
+
- SomeProjectToSkip
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Local LLM (Ollama + Gemma)
|
|
325
|
+
|
|
326
|
+
The agent can use a local LLM via [Ollama](https://ollama.com). Gemma runs **inside** Ollama — you start/stop **Ollama**, not Gemma separately.
|
|
327
|
+
|
|
328
|
+
### Install (WSL / Linux, once)
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
sudo apt-get install -y zstd
|
|
332
|
+
curl -fsSL https://ollama.com/install.sh | sh
|
|
333
|
+
ollama pull gemma3:4b
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Start / stop Ollama
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
# Check if running
|
|
340
|
+
curl -s http://localhost:11434 && echo "Ollama is running"
|
|
341
|
+
|
|
342
|
+
# Start (systemd — typical after install)
|
|
343
|
+
sudo systemctl start ollama
|
|
344
|
+
sudo systemctl enable ollama # optional: start on boot
|
|
345
|
+
|
|
346
|
+
# Stop
|
|
347
|
+
sudo systemctl stop ollama
|
|
348
|
+
|
|
349
|
+
# Start manually (foreground — Ctrl+C to stop)
|
|
350
|
+
ollama serve
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
On WSL with user systemd:
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
systemctl status ollama
|
|
357
|
+
systemctl start ollama
|
|
358
|
+
systemctl stop ollama
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Use the model
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
# Interactive chat
|
|
365
|
+
ollama run gemma3:4b
|
|
366
|
+
|
|
367
|
+
# One-shot prompt
|
|
368
|
+
ollama run gemma3:4b "Hello"
|
|
369
|
+
|
|
370
|
+
# List downloaded models
|
|
371
|
+
ollama list
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Quick reference
|
|
375
|
+
|
|
376
|
+
| Action | Command |
|
|
377
|
+
|--------|---------|
|
|
378
|
+
| Is it running? | `curl http://localhost:11434` |
|
|
379
|
+
| Start (service) | `sudo systemctl start ollama` |
|
|
380
|
+
| Stop (service) | `sudo systemctl stop ollama` |
|
|
381
|
+
| Start (manual) | `ollama serve` |
|
|
382
|
+
| Stop (manual) | `Ctrl+C` |
|
|
383
|
+
| Chat with Gemma | `ollama run gemma3:4b` |
|
|
384
|
+
|
|
385
|
+
Ollama listens on `http://localhost:11434` — used by `github-sync ask` and the web chat UI.
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## License
|
|
390
|
+
|
|
391
|
+
MIT
|