devvy 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.
- devvy-0.1.0/.azuredevops/pull_request_template.md +22 -0
- devvy-0.1.0/.gitignore +41 -0
- devvy-0.1.0/LICENSE +21 -0
- devvy-0.1.0/PKG-INFO +260 -0
- devvy-0.1.0/README.md +215 -0
- devvy-0.1.0/database/db_create.sql +57 -0
- devvy-0.1.0/database/dockerfile +9 -0
- devvy-0.1.0/database/entrypoint.sh +3 -0
- devvy-0.1.0/database/setup-db.sh +18 -0
- devvy-0.1.0/docker-compose.yml +13 -0
- devvy-0.1.0/pyproject.toml +39 -0
- devvy-0.1.0/sample.env +40 -0
- devvy-0.1.0/src/cli/__init__.py +1 -0
- devvy-0.1.0/src/cli/__main__.py +9 -0
- devvy-0.1.0/src/cli/ado_client.py +212 -0
- devvy-0.1.0/src/cli/commands/__init__.py +1 -0
- devvy-0.1.0/src/cli/commands/init.py +107 -0
- devvy-0.1.0/src/cli/commands/logs.py +36 -0
- devvy-0.1.0/src/cli/commands/ps.py +72 -0
- devvy-0.1.0/src/cli/commands/resume.py +105 -0
- devvy-0.1.0/src/cli/commands/run.py +135 -0
- devvy-0.1.0/src/cli/commands/status.py +35 -0
- devvy-0.1.0/src/cli/config.py +69 -0
- devvy-0.1.0/src/cli/db.py +138 -0
- devvy-0.1.0/src/cli/fsm.py +87 -0
- devvy-0.1.0/src/cli/local_runner/__init__.py +85 -0
- devvy-0.1.0/src/cli/local_runner/credentials.py +101 -0
- devvy-0.1.0/src/cli/local_runner/docker_primitives.py +142 -0
- devvy-0.1.0/src/cli/local_runner/repo_detection.py +182 -0
- devvy-0.1.0/src/cli/local_runner/validation.py +203 -0
- devvy-0.1.0/src/cli/local_runner/workspace.py +295 -0
- devvy-0.1.0/src/cli/main.py +22 -0
- devvy-0.1.0/src/cli/models.py +83 -0
- devvy-0.1.0/src/cli/orchestrator.py +530 -0
- devvy-0.1.0/src/cli/prompts.py +42 -0
- devvy-0.1.0/src/cli/ui/__init__.py +55 -0
- devvy-0.1.0/src/cli/ui/picker.py +179 -0
- devvy-0.1.0/src/cli/ui/rendering.py +350 -0
- devvy-0.1.0/src/scripts/code-checks.sh +29 -0
- devvy-0.1.0/src/scripts/format.sh +12 -0
- devvy-0.1.0/src/scripts/run-tests.sh +5 -0
- devvy-0.1.0/src/scripts/scan.sh +6 -0
- devvy-0.1.0/src/tests/__init__.py +0 -0
- devvy-0.1.0/src/tests/integration/__init__.py +0 -0
- devvy-0.1.0/src/tests/integration/conftest.py +66 -0
- devvy-0.1.0/src/tests/integration/test_cli_commands.py +610 -0
- devvy-0.1.0/src/tests/unit/test_ado_client.py +275 -0
- devvy-0.1.0/src/tests/unit/test_fsm.py +154 -0
- devvy-0.1.0/src/tests/unit/test_local_runner.py +311 -0
- devvy-0.1.0/src/tests/unit/test_orchestrator.py +271 -0
- devvy-0.1.0/worker.dockerfile +37 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
<!-- Describe the changes in this PR -->
|
|
3
|
+
|
|
4
|
+
## Changes Made
|
|
5
|
+
<!-- List the key changes -->
|
|
6
|
+
-
|
|
7
|
+
-
|
|
8
|
+
|
|
9
|
+
## Type of Change
|
|
10
|
+
- [ ] Bug fix
|
|
11
|
+
- [ ] New feature
|
|
12
|
+
- [ ] Refactoring
|
|
13
|
+
- [ ] Documentation
|
|
14
|
+
|
|
15
|
+
## Testing
|
|
16
|
+
<!-- Describe how you tested these changes -->
|
|
17
|
+
|
|
18
|
+
## Checklist
|
|
19
|
+
- [ ] Code passes `code_checks` (ruff + pyrefly)
|
|
20
|
+
- [ ] Code is formatted with `format`
|
|
21
|
+
- [ ] New modules have appropriate exceptions and are registered in `start.py`
|
|
22
|
+
- [ ] Alembic migration created if schema changed
|
devvy-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.pyo
|
|
6
|
+
*.pyd
|
|
7
|
+
.Python
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv/
|
|
11
|
+
venv/
|
|
12
|
+
env/
|
|
13
|
+
|
|
14
|
+
# uv
|
|
15
|
+
uv.lock
|
|
16
|
+
|
|
17
|
+
# Environment variables
|
|
18
|
+
.env
|
|
19
|
+
|
|
20
|
+
# Coverage
|
|
21
|
+
.coverage
|
|
22
|
+
htmlcov/
|
|
23
|
+
coverage.xml
|
|
24
|
+
|
|
25
|
+
# Distribution / packaging
|
|
26
|
+
dist/
|
|
27
|
+
build/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
|
|
30
|
+
# IDE
|
|
31
|
+
.vscode/
|
|
32
|
+
.idea/
|
|
33
|
+
*.swp
|
|
34
|
+
*.swo
|
|
35
|
+
|
|
36
|
+
# OS
|
|
37
|
+
.DS_Store
|
|
38
|
+
Thumbs.db
|
|
39
|
+
|
|
40
|
+
# Docker
|
|
41
|
+
data/
|
devvy-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Devvy
|
|
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.
|
devvy-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: devvy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Autonomous coding agent CLI — plans, implements, validates, and opens pull requests
|
|
5
|
+
Project-URL: Homepage, https://pypi.org/project/devvy/
|
|
6
|
+
Author-email: Devvy <nirmalfalzoni@hotmail.co.uk>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2026 Devvy
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Keywords: ai,cli,coding-agent,devops,opencode
|
|
30
|
+
Classifier: Development Status :: 3 - Alpha
|
|
31
|
+
Classifier: Environment :: Console
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Programming Language :: Python :: 3
|
|
35
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
37
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
38
|
+
Requires-Python: >=3.11
|
|
39
|
+
Requires-Dist: aiosqlite>=0.20.0
|
|
40
|
+
Requires-Dist: httpx>=0.27.0
|
|
41
|
+
Requires-Dist: pyyaml>=6.0
|
|
42
|
+
Requires-Dist: sqlalchemy>=2.0.45
|
|
43
|
+
Requires-Dist: typer[all]>=0.12.0
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
|
|
46
|
+
# devvy
|
|
47
|
+
|
|
48
|
+
An autonomous coding agent CLI. Give it a task - it plans, implements, validates, and opens a pull request, then responds to review comments until the PR is merged.
|
|
49
|
+
|
|
50
|
+
Everything runs locally inside Docker containers. No server required.
|
|
51
|
+
|
|
52
|
+
> **Requires [opencode](https://opencode.ai) and an opencode-compatible AI provider** (e.g. GitHub Copilot, Anthropic, OpenAI). opencode is the AI backbone devvy uses to plan and write code. You must have it installed and authenticated before running devvy.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## How devvy works
|
|
57
|
+
|
|
58
|
+
devvy drives a ticket through a finite state machine. Each state maps to a concrete action:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
RECEIVED → PREPARE_ENV → PLAN → IMPLEMENT → VALIDATE → CREATE_PR → WAIT_FOR_REVIEW
|
|
62
|
+
↑ |
|
|
63
|
+
| ← RESPOND_TO_REVIEW ←|
|
|
64
|
+
|____________↑____________/
|
|
65
|
+
(re-validates after each review response)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
| State | What happens |
|
|
69
|
+
|---|---|
|
|
70
|
+
| `RECEIVED` | Validates that a repo URL is present |
|
|
71
|
+
| `PREPARE_ENV` | Clones the repo into `~/.devvy/workspaces/<ticket-id>/`, starts a `devvy-worker` container with the workspace bind-mounted |
|
|
72
|
+
| `PLAN` | Runs opencode in the container — explores the codebase and produces a detailed implementation plan (no code changes yet) |
|
|
73
|
+
| `IMPLEMENT` | Continues the same opencode session — implements the plan, then self-verifies by running the project's own validation scripts inside the container |
|
|
74
|
+
| `VALIDATE` | Builds the repo's Docker image and runs its validation scripts (`format.sh`, `code-checks.sh`, `run-tests.sh`). On failure, re-prompts opencode to fix the issues. Up to 3 fix attempts before the ticket is marked `FAILED`. |
|
|
75
|
+
| `CREATE_PR` | Pushes the branch to ADO and opens a pull request. If the repo has a PR template (`.azuredevops/pull_request_template.md` or `docs/pull_request_template.md`), opencode fills it in. |
|
|
76
|
+
| `WAIT_FOR_REVIEW` | Polls ADO every 30 seconds. On `completed` → `MERGED`. On new review comments → `RESPOND_TO_REVIEW`. |
|
|
77
|
+
| `RESPOND_TO_REVIEW` | Re-reads all review threads, prompts opencode to address each one (code changes or a written reply), posts replies back to ADO. If code changed, re-runs `VALIDATE` before returning to `WAIT_FOR_REVIEW`. |
|
|
78
|
+
| `MERGED` | Stops the container and deletes the workspace. Done. |
|
|
79
|
+
| `FAILED` | Stops the container and deletes the workspace. Error stored in the DB. |
|
|
80
|
+
|
|
81
|
+
### Validation in detail
|
|
82
|
+
|
|
83
|
+
devvy does not have a fixed linter/test runner. Instead it looks for three shell scripts **in the repo being worked on**:
|
|
84
|
+
|
|
85
|
+
| Script | Fatal on failure? |
|
|
86
|
+
|---|---|
|
|
87
|
+
| `src/scripts/format.sh` | No — runs first; any formatting changes land in the workspace for the next commit |
|
|
88
|
+
| `src/scripts/code-checks.sh` | Yes — linting/type-checking |
|
|
89
|
+
| `src/scripts/run-tests.sh` | Yes — test suite |
|
|
90
|
+
|
|
91
|
+
These scripts are run inside a temporary container built from the repo's own `Dockerfile` or `docker-compose.yml`, so the validation environment exactly mirrors production. The container and its image are removed immediately after validation to avoid filling disk.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Requirements
|
|
96
|
+
|
|
97
|
+
- Python 3.11+
|
|
98
|
+
- Docker
|
|
99
|
+
- [opencode](https://opencode.ai) — installed and authenticated with an AI provider
|
|
100
|
+
- An Azure DevOps repository
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Installation
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pip install devvy
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Or with [uv](https://docs.astral.sh/uv/):
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
uv tool install devvy
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Setup
|
|
119
|
+
|
|
120
|
+
### 1. Install and authenticate opencode
|
|
121
|
+
|
|
122
|
+
Follow the [opencode getting started guide](https://opencode.ai/docs) to install opencode and sign in to your AI provider. devvy mounts your opencode credentials (`~/.local/share/opencode/auth.json`) into the worker container automatically.
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
opencode auth login
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 2. Build the worker image
|
|
129
|
+
|
|
130
|
+
The `devvy-worker` Docker image contains git, Node.js 22, and opencode. devvy builds it automatically the first time you run `devvy run` if it isn't already present.
|
|
131
|
+
|
|
132
|
+
To build it manually in advance (optional):
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
docker build -f worker.dockerfile -t devvy-worker:latest .
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
> The `worker.dockerfile` is included in this repository. If you installed devvy via pip, clone the repo first:
|
|
139
|
+
> ```bash
|
|
140
|
+
> git clone https://github.com/anomalyco/devvy && cd devvy
|
|
141
|
+
> docker build -f worker.dockerfile -t devvy-worker:latest .
|
|
142
|
+
> ```
|
|
143
|
+
|
|
144
|
+
### 3. Configure devvy
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
devvy init
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
You will be prompted for:
|
|
151
|
+
|
|
152
|
+
| Prompt | Description |
|
|
153
|
+
|---|---|
|
|
154
|
+
| Model | Arrow-key picker of 16 GitHub Copilot models (or type any `provider/model` string) |
|
|
155
|
+
| Azure DevOps org URL | e.g. `https://dev.azure.com/myorg` |
|
|
156
|
+
| Azure DevOps project name | e.g. `MyProject` |
|
|
157
|
+
| Azure DevOps personal access token | Needs Code (Read & Write) and Pull Requests (Read & Write) scopes |
|
|
158
|
+
| Repository URL | e.g. `https://dev.azure.com/myorg/myproject/_git/myrepo` — used as the default for `devvy run` |
|
|
159
|
+
| Path to `.env` file | Optional — copied into each workspace so the validation environment can reach databases, APIs, etc. |
|
|
160
|
+
|
|
161
|
+
Config is written to `~/.coding-agent.toml` (mode `600`).
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Usage
|
|
166
|
+
|
|
167
|
+
### Run a task (foreground)
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
devvy run --title "Fix login bug" --description "Users cannot log in with SSO after the OAuth refactor"
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Both flags are optional — omit either to be prompted interactively:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
devvy run
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
devvy runs in the foreground, printing each state transition as it progresses. On success it exits 0; on failure it exits 1.
|
|
180
|
+
|
|
181
|
+
### Run a task in the background
|
|
182
|
+
|
|
183
|
+
Add `--background` (or `-d`) to detach immediately. The command returns as soon as the ticket is queued:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
devvy run -d --title "Fix login bug" --description "Users can't log in with SSO"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Multiple tickets can run in parallel — each gets its own Docker worker container and workspace:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
devvy run -d --title "Add dark mode" --description "..."
|
|
193
|
+
devvy run -d --title "Fix payment bug" --description "..."
|
|
194
|
+
devvy run -d --title "Update README" --description "..."
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### List active tickets
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
devvy ps
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Shows all non-terminal tickets with their current state and whether the background process is still running:
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
ID TITLE STATE PROCESS BRANCH
|
|
207
|
+
a1b2c3 Fix login bug ● VALIDATE Running (pid 48291) agent/a1b2c3
|
|
208
|
+
d4e5f6 Add dark mode ● IMPLEMENT Running (pid 48355) agent/d4e5f6
|
|
209
|
+
7g8h9i Update README ● CREATE_PR Idle / resumable agent/7g8h9i
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
If a ticket shows **Idle / resumable**, use `devvy resume <id>` to continue from where it left off.
|
|
213
|
+
|
|
214
|
+
### Resume an interrupted task
|
|
215
|
+
|
|
216
|
+
If devvy is killed mid-run (Ctrl-C, system restart, etc.) the ticket state is preserved in the local database. Resume from where it left off:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
devvy resume <ticket-id>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
devvy re-attaches to the running container if it is still alive, or spawns a fresh container over the existing workspace directory if not. The cloned repo and any code changes are preserved.
|
|
223
|
+
|
|
224
|
+
### Check task status
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
devvy status <ticket-id>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Shows the current FSM state, branch name, PR number, retry count, timestamps, and any error message.
|
|
231
|
+
|
|
232
|
+
### View task logs
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
devvy logs <ticket-id>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Renders the full timestamped log for a ticket, grouped by phase.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Storage
|
|
243
|
+
|
|
244
|
+
All state is stored locally:
|
|
245
|
+
|
|
246
|
+
| Path | Contents |
|
|
247
|
+
|---|---|
|
|
248
|
+
| `~/.devvy/devvy.db` | SQLite database — tickets, FSM state, opencode session IDs, PR numbers, logs |
|
|
249
|
+
| `~/.devvy/workspaces/<ticket-id>/` | Cloned repo for each active ticket — deleted on `MERGED` or `FAILED` |
|
|
250
|
+
| `~/.coding-agent.toml` | devvy config (mode 600) |
|
|
251
|
+
|
|
252
|
+
### Supported models
|
|
253
|
+
|
|
254
|
+
Any model that opencode supports can be used. The `devvy init` picker lists 16 GitHub Copilot models. Models from other providers can be typed in manually. The format is `provider/model`, e.g.:
|
|
255
|
+
|
|
256
|
+
- `github-copilot/claude-sonnet-4.6` (default)
|
|
257
|
+
- `github-copilot/gpt-4.1`
|
|
258
|
+
- `github-copilot/gemini-2.5-pro`
|
|
259
|
+
- `anthropic/claude-opus-4-5`
|
|
260
|
+
- `openai/gpt-4o`
|
devvy-0.1.0/README.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# devvy
|
|
2
|
+
|
|
3
|
+
An autonomous coding agent CLI. Give it a task - it plans, implements, validates, and opens a pull request, then responds to review comments until the PR is merged.
|
|
4
|
+
|
|
5
|
+
Everything runs locally inside Docker containers. No server required.
|
|
6
|
+
|
|
7
|
+
> **Requires [opencode](https://opencode.ai) and an opencode-compatible AI provider** (e.g. GitHub Copilot, Anthropic, OpenAI). opencode is the AI backbone devvy uses to plan and write code. You must have it installed and authenticated before running devvy.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## How devvy works
|
|
12
|
+
|
|
13
|
+
devvy drives a ticket through a finite state machine. Each state maps to a concrete action:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
RECEIVED → PREPARE_ENV → PLAN → IMPLEMENT → VALIDATE → CREATE_PR → WAIT_FOR_REVIEW
|
|
17
|
+
↑ |
|
|
18
|
+
| ← RESPOND_TO_REVIEW ←|
|
|
19
|
+
|____________↑____________/
|
|
20
|
+
(re-validates after each review response)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
| State | What happens |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `RECEIVED` | Validates that a repo URL is present |
|
|
26
|
+
| `PREPARE_ENV` | Clones the repo into `~/.devvy/workspaces/<ticket-id>/`, starts a `devvy-worker` container with the workspace bind-mounted |
|
|
27
|
+
| `PLAN` | Runs opencode in the container — explores the codebase and produces a detailed implementation plan (no code changes yet) |
|
|
28
|
+
| `IMPLEMENT` | Continues the same opencode session — implements the plan, then self-verifies by running the project's own validation scripts inside the container |
|
|
29
|
+
| `VALIDATE` | Builds the repo's Docker image and runs its validation scripts (`format.sh`, `code-checks.sh`, `run-tests.sh`). On failure, re-prompts opencode to fix the issues. Up to 3 fix attempts before the ticket is marked `FAILED`. |
|
|
30
|
+
| `CREATE_PR` | Pushes the branch to ADO and opens a pull request. If the repo has a PR template (`.azuredevops/pull_request_template.md` or `docs/pull_request_template.md`), opencode fills it in. |
|
|
31
|
+
| `WAIT_FOR_REVIEW` | Polls ADO every 30 seconds. On `completed` → `MERGED`. On new review comments → `RESPOND_TO_REVIEW`. |
|
|
32
|
+
| `RESPOND_TO_REVIEW` | Re-reads all review threads, prompts opencode to address each one (code changes or a written reply), posts replies back to ADO. If code changed, re-runs `VALIDATE` before returning to `WAIT_FOR_REVIEW`. |
|
|
33
|
+
| `MERGED` | Stops the container and deletes the workspace. Done. |
|
|
34
|
+
| `FAILED` | Stops the container and deletes the workspace. Error stored in the DB. |
|
|
35
|
+
|
|
36
|
+
### Validation in detail
|
|
37
|
+
|
|
38
|
+
devvy does not have a fixed linter/test runner. Instead it looks for three shell scripts **in the repo being worked on**:
|
|
39
|
+
|
|
40
|
+
| Script | Fatal on failure? |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `src/scripts/format.sh` | No — runs first; any formatting changes land in the workspace for the next commit |
|
|
43
|
+
| `src/scripts/code-checks.sh` | Yes — linting/type-checking |
|
|
44
|
+
| `src/scripts/run-tests.sh` | Yes — test suite |
|
|
45
|
+
|
|
46
|
+
These scripts are run inside a temporary container built from the repo's own `Dockerfile` or `docker-compose.yml`, so the validation environment exactly mirrors production. The container and its image are removed immediately after validation to avoid filling disk.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Requirements
|
|
51
|
+
|
|
52
|
+
- Python 3.11+
|
|
53
|
+
- Docker
|
|
54
|
+
- [opencode](https://opencode.ai) — installed and authenticated with an AI provider
|
|
55
|
+
- An Azure DevOps repository
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install devvy
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Or with [uv](https://docs.astral.sh/uv/):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
uv tool install devvy
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Setup
|
|
74
|
+
|
|
75
|
+
### 1. Install and authenticate opencode
|
|
76
|
+
|
|
77
|
+
Follow the [opencode getting started guide](https://opencode.ai/docs) to install opencode and sign in to your AI provider. devvy mounts your opencode credentials (`~/.local/share/opencode/auth.json`) into the worker container automatically.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
opencode auth login
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 2. Build the worker image
|
|
84
|
+
|
|
85
|
+
The `devvy-worker` Docker image contains git, Node.js 22, and opencode. devvy builds it automatically the first time you run `devvy run` if it isn't already present.
|
|
86
|
+
|
|
87
|
+
To build it manually in advance (optional):
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
docker build -f worker.dockerfile -t devvy-worker:latest .
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
> The `worker.dockerfile` is included in this repository. If you installed devvy via pip, clone the repo first:
|
|
94
|
+
> ```bash
|
|
95
|
+
> git clone https://github.com/anomalyco/devvy && cd devvy
|
|
96
|
+
> docker build -f worker.dockerfile -t devvy-worker:latest .
|
|
97
|
+
> ```
|
|
98
|
+
|
|
99
|
+
### 3. Configure devvy
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
devvy init
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
You will be prompted for:
|
|
106
|
+
|
|
107
|
+
| Prompt | Description |
|
|
108
|
+
|---|---|
|
|
109
|
+
| Model | Arrow-key picker of 16 GitHub Copilot models (or type any `provider/model` string) |
|
|
110
|
+
| Azure DevOps org URL | e.g. `https://dev.azure.com/myorg` |
|
|
111
|
+
| Azure DevOps project name | e.g. `MyProject` |
|
|
112
|
+
| Azure DevOps personal access token | Needs Code (Read & Write) and Pull Requests (Read & Write) scopes |
|
|
113
|
+
| Repository URL | e.g. `https://dev.azure.com/myorg/myproject/_git/myrepo` — used as the default for `devvy run` |
|
|
114
|
+
| Path to `.env` file | Optional — copied into each workspace so the validation environment can reach databases, APIs, etc. |
|
|
115
|
+
|
|
116
|
+
Config is written to `~/.coding-agent.toml` (mode `600`).
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Usage
|
|
121
|
+
|
|
122
|
+
### Run a task (foreground)
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
devvy run --title "Fix login bug" --description "Users cannot log in with SSO after the OAuth refactor"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Both flags are optional — omit either to be prompted interactively:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
devvy run
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
devvy runs in the foreground, printing each state transition as it progresses. On success it exits 0; on failure it exits 1.
|
|
135
|
+
|
|
136
|
+
### Run a task in the background
|
|
137
|
+
|
|
138
|
+
Add `--background` (or `-d`) to detach immediately. The command returns as soon as the ticket is queued:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
devvy run -d --title "Fix login bug" --description "Users can't log in with SSO"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Multiple tickets can run in parallel — each gets its own Docker worker container and workspace:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
devvy run -d --title "Add dark mode" --description "..."
|
|
148
|
+
devvy run -d --title "Fix payment bug" --description "..."
|
|
149
|
+
devvy run -d --title "Update README" --description "..."
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### List active tickets
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
devvy ps
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Shows all non-terminal tickets with their current state and whether the background process is still running:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
ID TITLE STATE PROCESS BRANCH
|
|
162
|
+
a1b2c3 Fix login bug ● VALIDATE Running (pid 48291) agent/a1b2c3
|
|
163
|
+
d4e5f6 Add dark mode ● IMPLEMENT Running (pid 48355) agent/d4e5f6
|
|
164
|
+
7g8h9i Update README ● CREATE_PR Idle / resumable agent/7g8h9i
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
If a ticket shows **Idle / resumable**, use `devvy resume <id>` to continue from where it left off.
|
|
168
|
+
|
|
169
|
+
### Resume an interrupted task
|
|
170
|
+
|
|
171
|
+
If devvy is killed mid-run (Ctrl-C, system restart, etc.) the ticket state is preserved in the local database. Resume from where it left off:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
devvy resume <ticket-id>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
devvy re-attaches to the running container if it is still alive, or spawns a fresh container over the existing workspace directory if not. The cloned repo and any code changes are preserved.
|
|
178
|
+
|
|
179
|
+
### Check task status
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
devvy status <ticket-id>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Shows the current FSM state, branch name, PR number, retry count, timestamps, and any error message.
|
|
186
|
+
|
|
187
|
+
### View task logs
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
devvy logs <ticket-id>
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Renders the full timestamped log for a ticket, grouped by phase.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Storage
|
|
198
|
+
|
|
199
|
+
All state is stored locally:
|
|
200
|
+
|
|
201
|
+
| Path | Contents |
|
|
202
|
+
|---|---|
|
|
203
|
+
| `~/.devvy/devvy.db` | SQLite database — tickets, FSM state, opencode session IDs, PR numbers, logs |
|
|
204
|
+
| `~/.devvy/workspaces/<ticket-id>/` | Cloned repo for each active ticket — deleted on `MERGED` or `FAILED` |
|
|
205
|
+
| `~/.coding-agent.toml` | devvy config (mode 600) |
|
|
206
|
+
|
|
207
|
+
### Supported models
|
|
208
|
+
|
|
209
|
+
Any model that opencode supports can be used. The `devvy init` picker lists 16 GitHub Copilot models. Models from other providers can be typed in manually. The format is `provider/model`, e.g.:
|
|
210
|
+
|
|
211
|
+
- `github-copilot/claude-sonnet-4.6` (default)
|
|
212
|
+
- `github-copilot/gpt-4.1`
|
|
213
|
+
- `github-copilot/gemini-2.5-pro`
|
|
214
|
+
- `anthropic/claude-opus-4-5`
|
|
215
|
+
- `openai/gpt-4o`
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'devvy')
|
|
2
|
+
BEGIN
|
|
3
|
+
CREATE DATABASE [devvy]
|
|
4
|
+
ON PRIMARY
|
|
5
|
+
(
|
|
6
|
+
NAME = N'devvy_data',
|
|
7
|
+
FILENAME = N'/var/opt/mssql/data/devvy_data.mdf',
|
|
8
|
+
SIZE = 8192KB,
|
|
9
|
+
MAXSIZE = UNLIMITED,
|
|
10
|
+
FILEGROWTH = 65536KB
|
|
11
|
+
)
|
|
12
|
+
LOG ON
|
|
13
|
+
(
|
|
14
|
+
NAME = N'devvy_log',
|
|
15
|
+
FILENAME = N'/var/opt/mssql/data/devvy_log.ldf',
|
|
16
|
+
SIZE = 10240KB,
|
|
17
|
+
MAXSIZE = 524288KB,
|
|
18
|
+
FILEGROWTH = 5120KB
|
|
19
|
+
);
|
|
20
|
+
END
|
|
21
|
+
GO
|
|
22
|
+
|
|
23
|
+
IF EXISTS (SELECT * FROM sys.databases WHERE name = 'devvy')
|
|
24
|
+
BEGIN
|
|
25
|
+
ALTER DATABASE [devvy] SET COMPATIBILITY_LEVEL = 150;
|
|
26
|
+
ALTER DATABASE [devvy] SET ANSI_NULL_DEFAULT OFF;
|
|
27
|
+
ALTER DATABASE [devvy] SET ANSI_NULLS OFF;
|
|
28
|
+
ALTER DATABASE [devvy] SET ANSI_PADDING OFF;
|
|
29
|
+
ALTER DATABASE [devvy] SET ANSI_WARNINGS OFF;
|
|
30
|
+
ALTER DATABASE [devvy] SET ARITHABORT OFF;
|
|
31
|
+
ALTER DATABASE [devvy] SET AUTO_CLOSE OFF;
|
|
32
|
+
ALTER DATABASE [devvy] SET AUTO_SHRINK OFF;
|
|
33
|
+
ALTER DATABASE [devvy] SET AUTO_UPDATE_STATISTICS ON;
|
|
34
|
+
ALTER DATABASE [devvy] SET CURSOR_CLOSE_ON_COMMIT OFF;
|
|
35
|
+
ALTER DATABASE [devvy] SET CURSOR_DEFAULT GLOBAL;
|
|
36
|
+
ALTER DATABASE [devvy] SET CONCAT_NULL_YIELDS_NULL OFF;
|
|
37
|
+
ALTER DATABASE [devvy] SET NUMERIC_ROUNDABORT OFF;
|
|
38
|
+
ALTER DATABASE [devvy] SET QUOTED_IDENTIFIER OFF;
|
|
39
|
+
ALTER DATABASE [devvy] SET RECURSIVE_TRIGGERS OFF;
|
|
40
|
+
ALTER DATABASE [devvy] SET DISABLE_BROKER;
|
|
41
|
+
ALTER DATABASE [devvy] SET AUTO_UPDATE_STATISTICS_ASYNC OFF;
|
|
42
|
+
ALTER DATABASE [devvy] SET DATE_CORRELATION_OPTIMIZATION OFF;
|
|
43
|
+
ALTER DATABASE [devvy] SET TRUSTWORTHY OFF;
|
|
44
|
+
ALTER DATABASE [devvy] SET ALLOW_SNAPSHOT_ISOLATION OFF;
|
|
45
|
+
ALTER DATABASE [devvy] SET PARAMETERIZATION SIMPLE;
|
|
46
|
+
ALTER DATABASE [devvy] SET READ_COMMITTED_SNAPSHOT OFF;
|
|
47
|
+
ALTER DATABASE [devvy] SET HONOR_BROKER_PRIORITY OFF;
|
|
48
|
+
ALTER DATABASE [devvy] SET RECOVERY FULL;
|
|
49
|
+
ALTER DATABASE [devvy] SET MULTI_USER;
|
|
50
|
+
ALTER DATABASE [devvy] SET PAGE_VERIFY CHECKSUM;
|
|
51
|
+
ALTER DATABASE [devvy] SET DB_CHAINING OFF;
|
|
52
|
+
ALTER DATABASE [devvy] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF );
|
|
53
|
+
ALTER DATABASE [devvy] SET TARGET_RECOVERY_TIME = 60 SECONDS;
|
|
54
|
+
ALTER DATABASE [devvy] SET DELAYED_DURABILITY = DISABLED;
|
|
55
|
+
ALTER DATABASE [devvy] SET QUERY_STORE = OFF;
|
|
56
|
+
END
|
|
57
|
+
GO
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function run_sql(){
|
|
2
|
+
FILENAME=$1
|
|
3
|
+
echo "Running $FILENAME"
|
|
4
|
+
sleep 2
|
|
5
|
+
for i in {1..50}; do
|
|
6
|
+
/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P $SA_PASSWORD -d master -i $FILENAME
|
|
7
|
+
if [ $? -eq 0 ]
|
|
8
|
+
then
|
|
9
|
+
echo "$FILENAME executed successfully"
|
|
10
|
+
break
|
|
11
|
+
else
|
|
12
|
+
echo "Failed to execute $FILENAME. Retrying in 5 seconds..."
|
|
13
|
+
sleep 5
|
|
14
|
+
fi
|
|
15
|
+
done
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
run_sql "db_create.sql"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
services:
|
|
2
|
+
# Worker image — built here but never started automatically.
|
|
3
|
+
# The orchestrator starts ephemeral instances of this image per task.
|
|
4
|
+
worker:
|
|
5
|
+
build:
|
|
6
|
+
context: .
|
|
7
|
+
dockerfile: worker.dockerfile
|
|
8
|
+
image: devvy-worker:latest
|
|
9
|
+
profiles:
|
|
10
|
+
- build-only # prevents `docker compose up` from starting this service
|
|
11
|
+
|
|
12
|
+
volumes:
|
|
13
|
+
workspaces:
|