ollama-coding-agent 0.1.0__tar.gz → 0.2.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.
Files changed (28) hide show
  1. ollama_coding_agent-0.2.0/PKG-INFO +143 -0
  2. ollama_coding_agent-0.2.0/PYPI_README.md +122 -0
  3. ollama_coding_agent-0.1.0/ollama_coding_agent.egg-info/PKG-INFO → ollama_coding_agent-0.2.0/README.md +304 -222
  4. ollama_coding_agent-0.2.0/coding_agent/__init__.py +4 -0
  5. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/coding_agent/agent.py +3 -2
  6. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/coding_agent/cli.py +94 -6
  7. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/coding_agent/config.py +10 -0
  8. ollama_coding_agent-0.2.0/coding_agent/mcp_client.py +243 -0
  9. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/coding_agent/mcp_server.py +4 -4
  10. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/coding_agent/tools.py +20 -20
  11. ollama_coding_agent-0.2.0/ollama_coding_agent.egg-info/PKG-INFO +143 -0
  12. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/ollama_coding_agent.egg-info/SOURCES.txt +1 -0
  13. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/pyproject.toml +8 -3
  14. ollama_coding_agent-0.1.0/PKG-INFO +0 -222
  15. ollama_coding_agent-0.1.0/README.md +0 -204
  16. ollama_coding_agent-0.1.0/coding_agent/__init__.py +0 -4
  17. ollama_coding_agent-0.1.0/coding_agent/mcp_client.py +0 -88
  18. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/LICENSE +0 -0
  19. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/coding_agent/__main__.py +0 -0
  20. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/coding_agent/intent.py +0 -0
  21. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/coding_agent/ollama_client.py +0 -0
  22. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/coding_agent/session_store.py +0 -0
  23. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/coding_agent/ui.py +0 -0
  24. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/ollama_coding_agent.egg-info/dependency_links.txt +0 -0
  25. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/ollama_coding_agent.egg-info/entry_points.txt +0 -0
  26. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/ollama_coding_agent.egg-info/requires.txt +0 -0
  27. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/ollama_coding_agent.egg-info/top_level.txt +0 -0
  28. {ollama_coding_agent-0.1.0 → ollama_coding_agent-0.2.0}/setup.cfg +0 -0
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: ollama-coding-agent
3
+ Version: 0.2.0
4
+ Summary: AI coding agent driving Qwen Coder (or any Ollama-compatible model) through a scoped toolset via MCP
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/HarryChen1995/coding_agent
7
+ Project-URL: Repository, https://github.com/HarryChen1995/coding_agent
8
+ Project-URL: Issues, https://github.com/HarryChen1995/coding_agent/issues
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Topic :: Software Development :: Build Tools
13
+ Requires-Python: >=3.10
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: httpx>=0.28
17
+ Requires-Dist: rich>=15.0
18
+ Requires-Dist: typer>=0.27
19
+ Requires-Dist: mcp>=1.27
20
+ Dynamic: license-file
21
+
22
+ # Ollama Coding Agent
23
+
24
+ An AI coding agent that plans, edits, and tests code by driving Qwen Coder
25
+ (or any Ollama-compatible model) through a scoped set of file and shell
26
+ tools, with human approval on every write, edit, or shell command.
27
+
28
+ ## Install
29
+
30
+ ```bash
31
+ pip install ollama-coding-agent
32
+ ollama pull qwen3-coder:30b
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ```bash
38
+ coding-agent "Add type hints to utils.py, then run the test suite" \
39
+ --project-root ./myrepo
40
+ ```
41
+
42
+ Equivalent: `python -m coding_agent "..." --project-root ./myrepo`.
43
+
44
+ Omit the task string to enter an interactive session instead:
45
+
46
+ ```bash
47
+ coding-agent --project-root ./myrepo
48
+ ```
49
+
50
+ Run `coding-agent --help` for the full option list.
51
+
52
+ ## Features
53
+
54
+ - **Structured intent parsing** — the raw task is classified (bug fix,
55
+ feature, refactor, risk level, target files) before any action is taken,
56
+ and high-risk tasks force human approval even under `--auto-approve`.
57
+ - **Session persistence** — every message is saved to SQLite as the run
58
+ happens. Resume a previous run by id or a name you gave it
59
+ (`--resume`), browse saved sessions (`--list-sessions`), or delete one
60
+ (`--delete-session`).
61
+ - **Interactive mode** — drop into a REPL that keeps the model connection
62
+ and tool session alive across turns.
63
+ - **Human-in-the-loop approval** — every write, edit, or shell command
64
+ shows a diff or command preview before you confirm, unless explicitly
65
+ marked safe or run with `--auto-approve`.
66
+ - **Retry and recovery** — transient model failures retry with backoff;
67
+ malformed tool-call output is caught and reported back to the model
68
+ instead of crashing the run.
69
+ - **Codebase exploration tools** — regex content search with glob
70
+ filtering, pattern-based file discovery, directory listing, and git diff,
71
+ all skipping noise directories (`.git`, `node_modules`, build output).
72
+ - **Extensible via custom MCP servers** — point at any MCP server, local
73
+ (stdio) or remote (SSE / Streamable HTTP), and its tools merge into the
74
+ model's toolset automatically, no code changes required. Register one
75
+ permanently (`--add-mcp-server`, available on every future run) or add
76
+ one per run (`--mcp-server`/`--mcp-config`).
77
+
78
+ ## Architecture
79
+
80
+ Tools are served over the Model Context Protocol (MCP), not called
81
+ in-process — the agent is an MCP *client* that talks to a tool server over
82
+ stdio:
83
+
84
+ ```
85
+ ┌───────────┐ ┌────────────┐ ┌──────────────┐
86
+ │ CLI/REPL │ --> │ agent loop │ --> │ intent parser│
87
+ └───────────┘ │ (call model│ │ (task -> │
88
+ │ approve, │ │ structured │
89
+ │ execute, │ │ intent) │
90
+ │ persist) │ └──────────────┘
91
+ └─────┬──────┘
92
+ ┌────────────────┼─────────────────┐
93
+ ▼ ▼ ▼
94
+ ┌───────────────┐ ┌───────────────┐ ┌───────────────────┐
95
+ │ model client │ │ MCP client │ │ session store │
96
+ │ (chat calls) │ │ (MCP session) │ │ (SQLite history) │
97
+ └───────────────┘ └───────┬───────┘ └───────────────────┘
98
+ │ stdio subprocess
99
+
100
+ ┌───────────────┐
101
+ │ MCP server │
102
+ └───────┬───────┘
103
+
104
+ ┌───────────────┐
105
+ │ tools │
106
+ │ (read/write/ │
107
+ │ edit/search/ │
108
+ │ shell) │
109
+ └───────────────┘
110
+ ```
111
+
112
+ Because tools are exposed over MCP, any MCP-compatible client — Claude
113
+ Desktop, another agent framework, a different model entirely — can reach
114
+ the exact same toolset, approval-preview logic, and path scoping. The
115
+ reverse also holds: any additional MCP server — local (stdio) or remote
116
+ (SSE / Streamable HTTP) — can be plugged into this agent, and its tools
117
+ merge into the same list the model already sees —
118
+ ```bash
119
+ coding-agent --add-mcp-server "weather=python -m weather_mcp_server" # local, stdio
120
+ coding-agent --add-mcp-server "weather=https://example.com/mcp/sse" # remote, SSE
121
+ coding-agent "what's the forecast?" # picked up automatically, every run from here on
122
+ ```
123
+ A value after `name=` starting with `http://`/`https://` is treated as a
124
+ remote server (SSE by default, append `,streamable_http` for that transport
125
+ instead); anything else is a local command spawned over stdio — it doesn't
126
+ need to be `-m`-invokable, a standalone script's absolute path works too
127
+ (e.g. `"myserver=python C:/absolute/path/to/mcp_server.py"`).
128
+
129
+ ## Configuration
130
+
131
+ Point at any Ollama-compatible host with `--ollama-host` or the
132
+ `OLLAMA_HOST` env var. If it sits behind an authenticated proxy, set
133
+ `OLLAMA_API_KEY` as an environment variable rather than a CLI flag so the
134
+ key doesn't end up in shell history.
135
+
136
+ ## Links
137
+
138
+ Source, full documentation, and issue tracker:
139
+ https://github.com/HarryChen1995/coding_agent
140
+
141
+ ## License
142
+
143
+ MIT
@@ -0,0 +1,122 @@
1
+ # Ollama Coding Agent
2
+
3
+ An AI coding agent that plans, edits, and tests code by driving Qwen Coder
4
+ (or any Ollama-compatible model) through a scoped set of file and shell
5
+ tools, with human approval on every write, edit, or shell command.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install ollama-coding-agent
11
+ ollama pull qwen3-coder:30b
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ```bash
17
+ coding-agent "Add type hints to utils.py, then run the test suite" \
18
+ --project-root ./myrepo
19
+ ```
20
+
21
+ Equivalent: `python -m coding_agent "..." --project-root ./myrepo`.
22
+
23
+ Omit the task string to enter an interactive session instead:
24
+
25
+ ```bash
26
+ coding-agent --project-root ./myrepo
27
+ ```
28
+
29
+ Run `coding-agent --help` for the full option list.
30
+
31
+ ## Features
32
+
33
+ - **Structured intent parsing** — the raw task is classified (bug fix,
34
+ feature, refactor, risk level, target files) before any action is taken,
35
+ and high-risk tasks force human approval even under `--auto-approve`.
36
+ - **Session persistence** — every message is saved to SQLite as the run
37
+ happens. Resume a previous run by id or a name you gave it
38
+ (`--resume`), browse saved sessions (`--list-sessions`), or delete one
39
+ (`--delete-session`).
40
+ - **Interactive mode** — drop into a REPL that keeps the model connection
41
+ and tool session alive across turns.
42
+ - **Human-in-the-loop approval** — every write, edit, or shell command
43
+ shows a diff or command preview before you confirm, unless explicitly
44
+ marked safe or run with `--auto-approve`.
45
+ - **Retry and recovery** — transient model failures retry with backoff;
46
+ malformed tool-call output is caught and reported back to the model
47
+ instead of crashing the run.
48
+ - **Codebase exploration tools** — regex content search with glob
49
+ filtering, pattern-based file discovery, directory listing, and git diff,
50
+ all skipping noise directories (`.git`, `node_modules`, build output).
51
+ - **Extensible via custom MCP servers** — point at any MCP server, local
52
+ (stdio) or remote (SSE / Streamable HTTP), and its tools merge into the
53
+ model's toolset automatically, no code changes required. Register one
54
+ permanently (`--add-mcp-server`, available on every future run) or add
55
+ one per run (`--mcp-server`/`--mcp-config`).
56
+
57
+ ## Architecture
58
+
59
+ Tools are served over the Model Context Protocol (MCP), not called
60
+ in-process — the agent is an MCP *client* that talks to a tool server over
61
+ stdio:
62
+
63
+ ```
64
+ ┌───────────┐ ┌────────────┐ ┌──────────────┐
65
+ │ CLI/REPL │ --> │ agent loop │ --> │ intent parser│
66
+ └───────────┘ │ (call model│ │ (task -> │
67
+ │ approve, │ │ structured │
68
+ │ execute, │ │ intent) │
69
+ │ persist) │ └──────────────┘
70
+ └─────┬──────┘
71
+ ┌────────────────┼─────────────────┐
72
+ ▼ ▼ ▼
73
+ ┌───────────────┐ ┌───────────────┐ ┌───────────────────┐
74
+ │ model client │ │ MCP client │ │ session store │
75
+ │ (chat calls) │ │ (MCP session) │ │ (SQLite history) │
76
+ └───────────────┘ └───────┬───────┘ └───────────────────┘
77
+ │ stdio subprocess
78
+
79
+ ┌───────────────┐
80
+ │ MCP server │
81
+ └───────┬───────┘
82
+
83
+ ┌───────────────┐
84
+ │ tools │
85
+ │ (read/write/ │
86
+ │ edit/search/ │
87
+ │ shell) │
88
+ └───────────────┘
89
+ ```
90
+
91
+ Because tools are exposed over MCP, any MCP-compatible client — Claude
92
+ Desktop, another agent framework, a different model entirely — can reach
93
+ the exact same toolset, approval-preview logic, and path scoping. The
94
+ reverse also holds: any additional MCP server — local (stdio) or remote
95
+ (SSE / Streamable HTTP) — can be plugged into this agent, and its tools
96
+ merge into the same list the model already sees —
97
+ ```bash
98
+ coding-agent --add-mcp-server "weather=python -m weather_mcp_server" # local, stdio
99
+ coding-agent --add-mcp-server "weather=https://example.com/mcp/sse" # remote, SSE
100
+ coding-agent "what's the forecast?" # picked up automatically, every run from here on
101
+ ```
102
+ A value after `name=` starting with `http://`/`https://` is treated as a
103
+ remote server (SSE by default, append `,streamable_http` for that transport
104
+ instead); anything else is a local command spawned over stdio — it doesn't
105
+ need to be `-m`-invokable, a standalone script's absolute path works too
106
+ (e.g. `"myserver=python C:/absolute/path/to/mcp_server.py"`).
107
+
108
+ ## Configuration
109
+
110
+ Point at any Ollama-compatible host with `--ollama-host` or the
111
+ `OLLAMA_HOST` env var. If it sits behind an authenticated proxy, set
112
+ `OLLAMA_API_KEY` as an environment variable rather than a CLI flag so the
113
+ key doesn't end up in shell history.
114
+
115
+ ## Links
116
+
117
+ Source, full documentation, and issue tracker:
118
+ https://github.com/HarryChen1995/coding_agent
119
+
120
+ ## License
121
+
122
+ MIT