xcoding 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.
xcoding-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 c7s89r (nzv)
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.
xcoding-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,190 @@
1
+ Metadata-Version: 2.4
2
+ Name: xcoding
3
+ Version: 0.1.0
4
+ Summary: A local-model coding agent — Claude Code, but powered by Ollama or llama.cpp.
5
+ Author: c7s89r nzv
6
+ Maintainer: c7s89r nzv
7
+ License: MIT
8
+ Project-URL: Homepage, https://github.com/c7s89r/xcode
9
+ Project-URL: Repository, https://github.com/c7s89r/xcode
10
+ Project-URL: Issues, https://github.com/c7s89r/xcode/issues
11
+ Keywords: cli,coding-agent,ollama,llama.cpp,ai,local-llm
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Software Development
18
+ Requires-Python: >=3.9
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: openai>=1.30.0
22
+ Requires-Dist: httpx>=0.27.0
23
+ Requires-Dist: rich>=13.7.0
24
+ Requires-Dist: prompt_toolkit>=3.0.0
25
+ Requires-Dist: discord.py>=2.3.0
26
+ Dynamic: license-file
27
+
28
+ # xcode
29
+
30
+ A local-model coding agent — like Claude Code, but it talks to a model
31
+ running on your own machine instead of a cloud API.
32
+
33
+ > **✅ Works with [Ollama](https://ollama.com) for now.** Just install Ollama,
34
+ > pull a tool-capable model, then `pip install xcode` and run `xcode`.
35
+ > (llama.cpp support is in too, but Ollama is the tested path.)
36
+
37
+ It auto-detects whichever backend is running, gives the model tools to read/write
38
+ files and run shell commands, and loops until your task is done. Every file write
39
+ and every shell command asks for your approval first.
40
+
41
+ ### Quick start (Ollama)
42
+
43
+ ```bash
44
+ ollama serve
45
+ ollama pull qwen2.5-coder # a model that's good at tool use
46
+ pip install xcode
47
+ xcode
48
+ ```
49
+
50
+ ## Install
51
+
52
+ ```bash
53
+ pip install xcode
54
+ ```
55
+
56
+ Then just run `xcode` from any project folder.
57
+
58
+ Or from source:
59
+
60
+ ```bash
61
+ pip install -e .
62
+ ```
63
+
64
+ (Python 3.9+. Pulls in `openai`, `httpx`, `rich`.)
65
+
66
+ ## Run a backend
67
+
68
+ **Ollama** (easiest — supports tool-calling natively):
69
+
70
+ ```bash
71
+ ollama serve
72
+ ollama pull qwen2.5-coder # a model that's good at tool use
73
+ ```
74
+
75
+ **llama.cpp** (raw GGUF files):
76
+
77
+ ```bash
78
+ llama-server -m your-model.gguf # listens on :8080, OpenAI-compatible
79
+ ```
80
+
81
+ > Tool-calling quality depends heavily on the model. Use a model trained for it
82
+ > (e.g. `qwen2.5-coder`, `llama3.1`, `mistral-nemo`). Tiny models will struggle.
83
+
84
+ ## Use it
85
+
86
+ ```bash
87
+ xcode
88
+ # or: python -m xcode
89
+ ```
90
+
91
+ Then just talk to it:
92
+
93
+ ```
94
+ › add a /health endpoint to app.py that returns {"ok": true}
95
+ ```
96
+
97
+ In-REPL commands: `/help`, `/models`, `/model`, `/init`, `/todos`, `/perms`,
98
+ `/compact`, `/sessions`, `/resume`, `/reset`, `/exit`.
99
+
100
+ - Replies **stream** live; the prompt shows a **context meter** (`~3.2k/8k`).
101
+ - Writes/commands ask `y / n / a`; **a** ("always") is saved to
102
+ `.xcode/permissions.json`. Edits show a **colored diff** preview.
103
+ - Attach files inline with `@path` (e.g. `explain @xcode/agent.py`).
104
+ - The agent tracks a **todo list** for multi-step work (`/todos` to view).
105
+ - Old turns are **auto-compacted** when the context meter fills; `/compact`
106
+ forces it. Conversations are **saved** per project — `xcode --resume` or
107
+ `/resume` to pick up where you left off.
108
+ - Drop an **XCODE.md** at the repo root (or run `/init`) and it's auto-loaded
109
+ as project memory.
110
+
111
+ ### Modes (shift+tab to cycle)
112
+
113
+ - **·· normal** — asks before writes/commands
114
+ - **⏵⏵ auto** — runs & writes without asking
115
+ - **◷ plan** — read-only; explores but makes no changes
116
+
117
+ ### Sub-agents, web, MCP, hooks
118
+
119
+ - `spawn_agent` lets the model delegate an isolated subtask to a fresh context.
120
+ - `web_search` (DuckDuckGo) and `web_fetch` give it internet access.
121
+ - Drop a `.xcode/settings.json` to add **hooks** (run a formatter after every
122
+ edit), **env** vars, seed **permissions**, and declare **MCP servers**:
123
+
124
+ ```json
125
+ {
126
+ "hooks": { "after_edit": ["ruff format {path}"] },
127
+ "permissions": { "commands": ["git", "ls", "python"] },
128
+ "mcpServers": {
129
+ "fs": { "command": "npx",
130
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "."] }
131
+ }
132
+ }
133
+ ```
134
+
135
+ MCP tools show up to the model as `mcp__<server>__<tool>`.
136
+
137
+ ### Headless / scripting
138
+
139
+ ```bash
140
+ xcode -p "summarize what this repo does" # read-only, prints, exits
141
+ xcode -p "bump the version to 0.2.0" --yes # auto-approve writes
142
+ xcode -p "what changed?" --resume # continue last session
143
+ ```
144
+
145
+ ## Configuration (env vars)
146
+
147
+ | var | meaning |
148
+ |------------------|------------------------------------------------------|
149
+ | `XCODE_BASE_URL` | point straight at any OpenAI-compatible `/v1` URL |
150
+ | `XCODE_MODEL` | force a specific model name |
151
+ | `XCODE_API_KEY` | token if your endpoint needs one (default `local`) |
152
+ | `XCODE_MAX_STEPS`| max tool round-trips per turn (default 25) |
153
+
154
+ ## How it works
155
+
156
+ ```
157
+ cli.py REPL + permission prompts (the only UI code)
158
+ agent.py the loop: model ⇄ tools until it stops calling tools
159
+ backends.py auto-detect Ollama (:11434) / llama.cpp (:8080)
160
+ tools.py read_file, write_file, list_dir, run_command + JSON schemas
161
+ config.py system prompt + knobs
162
+ ```
163
+
164
+ ## Roadmap
165
+
166
+ - [x] Streaming token output
167
+ - [x] `edit_file` (targeted edits instead of full rewrites)
168
+ - [x] `grep` / `glob_files` search tools
169
+ - [x] Persistent permission rules ("always allow `git …`")
170
+ - [x] `/model` picker + smart default-model selection
171
+ - [x] Context compaction for long sessions + context meter
172
+ - [x] Diff-style preview when confirming edits
173
+ - [x] Project memory (XCODE.md) + `/init`
174
+ - [x] Todo/task tracking
175
+ - [x] Session save + `--resume`
176
+ - [x] Headless mode (`-p`) + `@file` mentions
177
+ - [x] Web fetch / web search tools
178
+ - [x] Sub-agents (delegate a subtask to a fresh context)
179
+ - [x] MCP server support
180
+ - [x] Hooks + settings.json
181
+ - [x] Themes + ghost logo, shift+tab mode cycling (normal/auto/plan)
182
+
183
+ ## Made by
184
+
185
+ Built by **@c7s89r** (nzv).
186
+
187
+ - GitHub: [@c7s89r](https://github.com/c7s89r)
188
+ - Discord: `c7s89r`
189
+
190
+ MIT licensed — see [LICENSE](LICENSE).
@@ -0,0 +1,163 @@
1
+ # xcode
2
+
3
+ A local-model coding agent — like Claude Code, but it talks to a model
4
+ running on your own machine instead of a cloud API.
5
+
6
+ > **✅ Works with [Ollama](https://ollama.com) for now.** Just install Ollama,
7
+ > pull a tool-capable model, then `pip install xcode` and run `xcode`.
8
+ > (llama.cpp support is in too, but Ollama is the tested path.)
9
+
10
+ It auto-detects whichever backend is running, gives the model tools to read/write
11
+ files and run shell commands, and loops until your task is done. Every file write
12
+ and every shell command asks for your approval first.
13
+
14
+ ### Quick start (Ollama)
15
+
16
+ ```bash
17
+ ollama serve
18
+ ollama pull qwen2.5-coder # a model that's good at tool use
19
+ pip install xcode
20
+ xcode
21
+ ```
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ pip install xcode
27
+ ```
28
+
29
+ Then just run `xcode` from any project folder.
30
+
31
+ Or from source:
32
+
33
+ ```bash
34
+ pip install -e .
35
+ ```
36
+
37
+ (Python 3.9+. Pulls in `openai`, `httpx`, `rich`.)
38
+
39
+ ## Run a backend
40
+
41
+ **Ollama** (easiest — supports tool-calling natively):
42
+
43
+ ```bash
44
+ ollama serve
45
+ ollama pull qwen2.5-coder # a model that's good at tool use
46
+ ```
47
+
48
+ **llama.cpp** (raw GGUF files):
49
+
50
+ ```bash
51
+ llama-server -m your-model.gguf # listens on :8080, OpenAI-compatible
52
+ ```
53
+
54
+ > Tool-calling quality depends heavily on the model. Use a model trained for it
55
+ > (e.g. `qwen2.5-coder`, `llama3.1`, `mistral-nemo`). Tiny models will struggle.
56
+
57
+ ## Use it
58
+
59
+ ```bash
60
+ xcode
61
+ # or: python -m xcode
62
+ ```
63
+
64
+ Then just talk to it:
65
+
66
+ ```
67
+ › add a /health endpoint to app.py that returns {"ok": true}
68
+ ```
69
+
70
+ In-REPL commands: `/help`, `/models`, `/model`, `/init`, `/todos`, `/perms`,
71
+ `/compact`, `/sessions`, `/resume`, `/reset`, `/exit`.
72
+
73
+ - Replies **stream** live; the prompt shows a **context meter** (`~3.2k/8k`).
74
+ - Writes/commands ask `y / n / a`; **a** ("always") is saved to
75
+ `.xcode/permissions.json`. Edits show a **colored diff** preview.
76
+ - Attach files inline with `@path` (e.g. `explain @xcode/agent.py`).
77
+ - The agent tracks a **todo list** for multi-step work (`/todos` to view).
78
+ - Old turns are **auto-compacted** when the context meter fills; `/compact`
79
+ forces it. Conversations are **saved** per project — `xcode --resume` or
80
+ `/resume` to pick up where you left off.
81
+ - Drop an **XCODE.md** at the repo root (or run `/init`) and it's auto-loaded
82
+ as project memory.
83
+
84
+ ### Modes (shift+tab to cycle)
85
+
86
+ - **·· normal** — asks before writes/commands
87
+ - **⏵⏵ auto** — runs & writes without asking
88
+ - **◷ plan** — read-only; explores but makes no changes
89
+
90
+ ### Sub-agents, web, MCP, hooks
91
+
92
+ - `spawn_agent` lets the model delegate an isolated subtask to a fresh context.
93
+ - `web_search` (DuckDuckGo) and `web_fetch` give it internet access.
94
+ - Drop a `.xcode/settings.json` to add **hooks** (run a formatter after every
95
+ edit), **env** vars, seed **permissions**, and declare **MCP servers**:
96
+
97
+ ```json
98
+ {
99
+ "hooks": { "after_edit": ["ruff format {path}"] },
100
+ "permissions": { "commands": ["git", "ls", "python"] },
101
+ "mcpServers": {
102
+ "fs": { "command": "npx",
103
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "."] }
104
+ }
105
+ }
106
+ ```
107
+
108
+ MCP tools show up to the model as `mcp__<server>__<tool>`.
109
+
110
+ ### Headless / scripting
111
+
112
+ ```bash
113
+ xcode -p "summarize what this repo does" # read-only, prints, exits
114
+ xcode -p "bump the version to 0.2.0" --yes # auto-approve writes
115
+ xcode -p "what changed?" --resume # continue last session
116
+ ```
117
+
118
+ ## Configuration (env vars)
119
+
120
+ | var | meaning |
121
+ |------------------|------------------------------------------------------|
122
+ | `XCODE_BASE_URL` | point straight at any OpenAI-compatible `/v1` URL |
123
+ | `XCODE_MODEL` | force a specific model name |
124
+ | `XCODE_API_KEY` | token if your endpoint needs one (default `local`) |
125
+ | `XCODE_MAX_STEPS`| max tool round-trips per turn (default 25) |
126
+
127
+ ## How it works
128
+
129
+ ```
130
+ cli.py REPL + permission prompts (the only UI code)
131
+ agent.py the loop: model ⇄ tools until it stops calling tools
132
+ backends.py auto-detect Ollama (:11434) / llama.cpp (:8080)
133
+ tools.py read_file, write_file, list_dir, run_command + JSON schemas
134
+ config.py system prompt + knobs
135
+ ```
136
+
137
+ ## Roadmap
138
+
139
+ - [x] Streaming token output
140
+ - [x] `edit_file` (targeted edits instead of full rewrites)
141
+ - [x] `grep` / `glob_files` search tools
142
+ - [x] Persistent permission rules ("always allow `git …`")
143
+ - [x] `/model` picker + smart default-model selection
144
+ - [x] Context compaction for long sessions + context meter
145
+ - [x] Diff-style preview when confirming edits
146
+ - [x] Project memory (XCODE.md) + `/init`
147
+ - [x] Todo/task tracking
148
+ - [x] Session save + `--resume`
149
+ - [x] Headless mode (`-p`) + `@file` mentions
150
+ - [x] Web fetch / web search tools
151
+ - [x] Sub-agents (delegate a subtask to a fresh context)
152
+ - [x] MCP server support
153
+ - [x] Hooks + settings.json
154
+ - [x] Themes + ghost logo, shift+tab mode cycling (normal/auto/plan)
155
+
156
+ ## Made by
157
+
158
+ Built by **@c7s89r** (nzv).
159
+
160
+ - GitHub: [@c7s89r](https://github.com/c7s89r)
161
+ - Discord: `c7s89r`
162
+
163
+ MIT licensed — see [LICENSE](LICENSE).
@@ -0,0 +1,41 @@
1
+ [project]
2
+ name = "xcoding"
3
+ version = "0.1.0"
4
+ description = "A local-model coding agent — Claude Code, but powered by Ollama or llama.cpp."
5
+ readme = "README.md"
6
+ requires-python = ">=3.9"
7
+ license = { text = "MIT" }
8
+ authors = [{ name = "c7s89r nzv" }]
9
+ maintainers = [{ name = "c7s89r nzv" }]
10
+ keywords = ["cli", "coding-agent", "ollama", "llama.cpp", "ai", "local-llm"]
11
+ classifiers = [
12
+ "Development Status :: 4 - Beta",
13
+ "Environment :: Console",
14
+ "Intended Audience :: Developers",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Programming Language :: Python :: 3",
17
+ "Topic :: Software Development",
18
+ ]
19
+ dependencies = [
20
+ "openai>=1.30.0",
21
+ "httpx>=0.27.0",
22
+ "rich>=13.7.0",
23
+ "prompt_toolkit>=3.0.0",
24
+ "discord.py>=2.3.0",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/c7s89r/xcode"
29
+ Repository = "https://github.com/c7s89r/xcode"
30
+ Issues = "https://github.com/c7s89r/xcode/issues"
31
+
32
+ [project.scripts]
33
+ xcode = "xcode.cli:main"
34
+
35
+ [build-system]
36
+ requires = ["setuptools>=68"]
37
+ build-backend = "setuptools.build_meta"
38
+
39
+ [tool.setuptools.packages.find]
40
+ where = ["."]
41
+ include = ["xcode*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """xcode — a local-model coding agent (Claude Code, but on Ollama / llama.cpp)."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,4 @@
1
+ from .cli import main
2
+
3
+ if __name__ == "__main__":
4
+ main()