workplan 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.
- workplan-0.1.0/.github/workflows/release.yaml +43 -0
- workplan-0.1.0/.github/workflows/test.yml +21 -0
- workplan-0.1.0/.gitignore +7 -0
- workplan-0.1.0/LICENSE +21 -0
- workplan-0.1.0/PKG-INFO +263 -0
- workplan-0.1.0/README.md +237 -0
- workplan-0.1.0/SPEC.md +434 -0
- workplan-0.1.0/TODO.md +33 -0
- workplan-0.1.0/pyproject.toml +45 -0
- workplan-0.1.0/setup.cfg +4 -0
- workplan-0.1.0/src/workplan/__init__.py +8 -0
- workplan-0.1.0/src/workplan/__main__.py +5 -0
- workplan-0.1.0/src/workplan/agent.py +377 -0
- workplan-0.1.0/src/workplan/cli.py +144 -0
- workplan-0.1.0/src/workplan/config.py +74 -0
- workplan-0.1.0/src/workplan/git.py +69 -0
- workplan-0.1.0/src/workplan/llm.py +37 -0
- workplan-0.1.0/src/workplan/ops.py +287 -0
- workplan-0.1.0/src/workplan/plans.py +254 -0
- workplan-0.1.0/src/workplan/route.py +111 -0
- workplan-0.1.0/src/workplan/templates/documents/BREAKDOWN.md +3 -0
- workplan-0.1.0/src/workplan/templates/documents/NOTES.md +3 -0
- workplan-0.1.0/src/workplan/templates/documents/SQUASH_COMMIT_MSG +7 -0
- workplan-0.1.0/src/workplan/templates/documents/TASK.md +9 -0
- workplan-0.1.0/src/workplan/templates/documents/WORKPLAN.md +23 -0
- workplan-0.1.0/src/workplan/templates/project/PRINCIPLES.md +10 -0
- workplan-0.1.0/src/workplan/templates/project/README.md +9 -0
- workplan-0.1.0/src/workplan/templates/project/config.toml +28 -0
- workplan-0.1.0/src/workplan/templates/prompts/define-tasks-none.md +31 -0
- workplan-0.1.0/src/workplan/templates/prompts/define-tasks.md +29 -0
- workplan-0.1.0/src/workplan/templates/prompts/produce-patch-none.md +21 -0
- workplan-0.1.0/src/workplan/templates/prompts/produce-patch.md +23 -0
- workplan-0.1.0/src/workplan/templates/prompts/route.md +21 -0
- workplan-0.1.0/src/workplan.egg-info/PKG-INFO +263 -0
- workplan-0.1.0/src/workplan.egg-info/SOURCES.txt +62 -0
- workplan-0.1.0/src/workplan.egg-info/dependency_links.txt +1 -0
- workplan-0.1.0/src/workplan.egg-info/entry_points.txt +3 -0
- workplan-0.1.0/src/workplan.egg-info/scm_file_list.json +59 -0
- workplan-0.1.0/src/workplan.egg-info/scm_version.json +8 -0
- workplan-0.1.0/src/workplan.egg-info/top_level.txt +1 -0
- workplan-0.1.0/tests/support.py +169 -0
- workplan-0.1.0/tests/test_by_hand.py +149 -0
- workplan-0.1.0/tests/test_clones.py +80 -0
- workplan-0.1.0/tests/test_cycle.py +195 -0
- workplan-0.1.0/tests/test_fixes.py +140 -0
- workplan-0.1.0/tests/test_llm.py +127 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0000/BREAKDOWN.md +4 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0000/TASK.md +12 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0001/BREAKDOWN.md +8 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0001/TASK.md +14 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0002/BREAKDOWN.md +11 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0002/TASK.md +15 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0003/BREAKDOWN.md +7 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0003/TASK.md +11 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0004/BREAKDOWN.md +8 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0004/TASK.md +13 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0005/BREAKDOWN.md +8 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0005/TASK.md +15 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0006/BREAKDOWN.md +21 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/0006/TASK.md +21 -0
- workplan-0.1.0/workplans/2026-11-23-fewer-files/WORKPLAN.md +37 -0
- workplan-0.1.0/workplans/PRINCIPLES.md +18 -0
- workplan-0.1.0/workplans/README.md +9 -0
- workplan-0.1.0/workplans/config.toml +28 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
branches: [master]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
package:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment: release
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
|
|
23
|
+
- name: Install build tools
|
|
24
|
+
run: pip install build twine
|
|
25
|
+
|
|
26
|
+
- name: Build
|
|
27
|
+
run: python -m build
|
|
28
|
+
|
|
29
|
+
- name: Check
|
|
30
|
+
run: twine check dist/*
|
|
31
|
+
|
|
32
|
+
- name: Publish
|
|
33
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
34
|
+
env:
|
|
35
|
+
TWINE_USERNAME: __token__
|
|
36
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
37
|
+
run: twine upload dist/*
|
|
38
|
+
|
|
39
|
+
- name: Create GitHub release
|
|
40
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
41
|
+
run: gh release create ${{ github.ref_name }} --generate-notes
|
|
42
|
+
env:
|
|
43
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
python: ["3.11", "3.12", "3.13"]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ matrix.python }}
|
|
21
|
+
- run: python -m unittest discover -s tests -v
|
workplan-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bay Information Systems
|
|
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.
|
workplan-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: workplan
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Plan and record development work in git, for agent-driven and AI-assisted development
|
|
5
|
+
Author: Bay Information Systems
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/bayinfosys/workplan
|
|
8
|
+
Project-URL: Repository, https://github.com/bayinfosys/workplan
|
|
9
|
+
Project-URL: Specification, https://github.com/bayinfosys/workplan/blob/master/SPEC.md
|
|
10
|
+
Project-URL: Issues, https://github.com/bayinfosys/workplan/issues
|
|
11
|
+
Project-URL: Bay Information Systems, https://www.bayis.co.uk/
|
|
12
|
+
Keywords: git,planning,agents,ai,workflow
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development
|
|
21
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# workplan
|
|
28
|
+
|
|
29
|
+
Plan and record development work in git, for agent-driven and
|
|
30
|
+
AI-assisted development.
|
|
31
|
+
|
|
32
|
+
A workplan breaks one goal into tasks. Each task is one commit; the
|
|
33
|
+
workplan reaches master as one squash commit listing every task. The
|
|
34
|
+
plans and the task definitions are Markdown files in `workplans/`, and
|
|
35
|
+
every task's state comes from git history. Any clone holds the whole
|
|
36
|
+
record, and every step can be done by hand with git and an editor:
|
|
37
|
+
[SPEC.md](SPEC.md) describes the steps.
|
|
38
|
+
|
|
39
|
+
An agent, such as Claude Code, Codex, or a model behind any
|
|
40
|
+
OpenAI-compatible endpoint, defines the tasks and produces each task's
|
|
41
|
+
patch in a separate worktree. The maintainer reads each diff and
|
|
42
|
+
accepts or rejects it.
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pipx install workplan
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Python 3.11 or later and git. No other dependencies.
|
|
51
|
+
|
|
52
|
+
`wp` is installed as a short name for `workplan`. WP-CLI, the WordPress
|
|
53
|
+
command line, also installs `wp`; where both are installed, use
|
|
54
|
+
`workplan`.
|
|
55
|
+
|
|
56
|
+
## Manual, semi-automatic, full auto
|
|
57
|
+
|
|
58
|
+
Run it on full auto for the real vibe coding experience, or manual for the good old days.
|
|
59
|
+
|
|
60
|
+
- **Manual:** git and an editor. [SPEC.md](SPEC.md) gives every step by hand; the `workplan` command is optional.
|
|
61
|
+
- **Semi-automatic:** run each command; Agents define tasks and produce patches; you read the diffs and accept or reject.
|
|
62
|
+
- **Full auto:** `workplan install` adds hooks that route each commit
|
|
63
|
+
to its next step, and `route.dispatch` runs `define-tasks` and
|
|
64
|
+
`produce-patch` as soon as they are due. Accepting each patch and
|
|
65
|
+
merging stay with you.
|
|
66
|
+
|
|
67
|
+
## A workplan from start to finish
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
workplan init # create workplans/ and commit it
|
|
71
|
+
workplan plan greeting # branch workplan/<date>-greeting/definition;
|
|
72
|
+
# the editor opens on WORKPLAN.md: goal, context, findings
|
|
73
|
+
workplan define-tasks # the agent writes the tasks; WORKPLAN.md and the
|
|
74
|
+
# tasks are committed
|
|
75
|
+
git push # share the plan
|
|
76
|
+
|
|
77
|
+
workplan produce-patch 0000 # the agent writes output.patch and COMMIT_MSG
|
|
78
|
+
workplan apply 0000 # stage it
|
|
79
|
+
workplan diff 0000 # read it, test it
|
|
80
|
+
workplan accept 0000 # commit it with the task's files; or: workplan reject 0000
|
|
81
|
+
workplan status
|
|
82
|
+
|
|
83
|
+
workplan merge # squash into master; the editor opens on the message
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The commands commit what they complete: `init`, `define-tasks`,
|
|
87
|
+
`accept` and `merge`. Pushing is the maintainer's.
|
|
88
|
+
|
|
89
|
+
`plan` opens the editor git uses for commit messages, on WORKPLAN.md
|
|
90
|
+
rendered from its template; closing it unchanged creates nothing.
|
|
91
|
+
`plan greeting -m "app.txt says goodbye"` writes the goal and skips the
|
|
92
|
+
editor.
|
|
93
|
+
|
|
94
|
+
Every command also runs as `wp`: `wp plan greeting`, `wp accept 0000`.
|
|
95
|
+
|
|
96
|
+
`examples/demo.sh` runs this cycle in a temporary repository with a
|
|
97
|
+
scripted agent.
|
|
98
|
+
|
|
99
|
+
## Commands
|
|
100
|
+
|
|
101
|
+
| Command | Does |
|
|
102
|
+
|---|---|
|
|
103
|
+
| `init` | create `workplans/` with README, PRINCIPLES.md and config.toml; add the working files to .gitignore; commit |
|
|
104
|
+
| `plan NAME [-m GOAL]` | `workplans/<date>-NAME/WORKPLAN.md` from its template, on a new branch from master |
|
|
105
|
+
| `define-tasks [ID]` | the agent writes each new task's TASK.md and BREAKDOWN.md; they are listed in WORKPLAN.md and committed with it |
|
|
106
|
+
| `produce-patch NNNN` | the agent writes output.patch and COMMIT_MSG |
|
|
107
|
+
| `apply NNNN`, `diff NNNN` | stage the patch; show it |
|
|
108
|
+
| `accept NNNN` | commit the patch with COMMIT_MSG, together with the task's directory and WORKPLAN.md |
|
|
109
|
+
| `reject NNNN` | take an applied patch back out |
|
|
110
|
+
| `merge [ID]` | squash the workplan into master, with the message from its template |
|
|
111
|
+
| `status [ID \| ID/NNNN] [--json]` | each task's state |
|
|
112
|
+
| `route [REV] [--dispatch]` | the next step after a commit |
|
|
113
|
+
| `install` | post-commit and post-merge hooks that run `route --dispatch` |
|
|
114
|
+
|
|
115
|
+
A task is `ID/NNNN`, or `NNNN` in the current branch's workplan.
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
`workplans/config.toml`; `workplan init` writes it with every key.
|
|
120
|
+
Environment variables override it, and API keys come from the
|
|
121
|
+
environment only.
|
|
122
|
+
|
|
123
|
+
| Key | Variable | Default |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| `master` | `WORKPLAN_MASTER` | `master` |
|
|
126
|
+
| `llm.api_base` | `WORKPLAN_API_BASE` | `http://localhost:8000/v1` |
|
|
127
|
+
| `llm.api_key_env` | | `WORKPLAN_API_KEY` |
|
|
128
|
+
| `llm.params` | | `{}`, added to each request body |
|
|
129
|
+
| `route.classifier` | `WORKPLAN_ROUTE_CLASSIFIER` | `rules` |
|
|
130
|
+
| `route.model` | `WORKPLAN_ROUTE_MODEL` | |
|
|
131
|
+
| `route.dispatch` | `WORKPLAN_ROUTE_DISPATCH` | |
|
|
132
|
+
| `agent.name` | `WORKPLAN_AGENT` | `none` |
|
|
133
|
+
| `agent.model` | `WORKPLAN_AGENT_MODEL` | |
|
|
134
|
+
| `agent.setup` | `WORKPLAN_AGENT_SETUP` | |
|
|
135
|
+
| `agent.command` | `WORKPLAN_AGENT_COMMAND` | `[]` |
|
|
136
|
+
| `agent.attempts`, `agent.timeout` | | `3`, `1800` |
|
|
137
|
+
|
|
138
|
+
## Agents
|
|
139
|
+
|
|
140
|
+
`define-tasks` and `produce-patch` create a worktree at the head of
|
|
141
|
+
the workplan branch, copy `workplans/` into it, run `agent.setup`, then
|
|
142
|
+
the agent. The worktree is removed afterwards; the maintainer's own
|
|
143
|
+
tree is never touched.
|
|
144
|
+
|
|
145
|
+
- `define-tasks`: the new task directories the agent wrote under
|
|
146
|
+
`workplans/<id>/` are copied back; existing tasks are left alone.
|
|
147
|
+
- `produce-patch`: the worktree's diff outside `workplans/` becomes
|
|
148
|
+
output.patch.
|
|
149
|
+
|
|
150
|
+
| `agent.name` | Runs |
|
|
151
|
+
|---|---|
|
|
152
|
+
| `none` | completions from `llm.api_base`; the plan files and the files they name go in the prompt; the reply holds the task files or a diff, retried with the error up to `agent.attempts` times |
|
|
153
|
+
| `claude-code` | `claude -p --allowedTools Read,Edit,Write,Glob,Grep,Bash`, prompt on stdin |
|
|
154
|
+
| `codex` | `codex exec --sandbox workspace-write <prompt>` |
|
|
155
|
+
| `command` | `agent.command`; a `{prompt}` argument is replaced by the prompt, else it goes on stdin |
|
|
156
|
+
|
|
157
|
+
`claude-code` and `codex` are presets of `command`; setting
|
|
158
|
+
`agent.command` replaces the preset's arguments. Agents with a shell
|
|
159
|
+
build the code and run its checks in the worktree. Containers, ports
|
|
160
|
+
and other host resources are shared with the host, so integration runs
|
|
161
|
+
stay with the maintainer.
|
|
162
|
+
|
|
163
|
+
A `command` agent receives `WORKPLAN_ACTION` (`define-tasks` or
|
|
164
|
+
`produce-patch`) and `WORKPLAN_TARGET` (the workplan or task id) in its
|
|
165
|
+
environment, and for `produce-patch`, `WORKPLAN_COMMIT_MSG`: the path
|
|
166
|
+
to write the commit message to. When it writes none, COMMIT_MSG is the
|
|
167
|
+
task id and TASK.md's title.
|
|
168
|
+
|
|
169
|
+
### Examples
|
|
170
|
+
|
|
171
|
+
Claude Code, with the project's dependencies installed first:
|
|
172
|
+
|
|
173
|
+
```toml
|
|
174
|
+
[agent]
|
|
175
|
+
name = "claude-code"
|
|
176
|
+
setup = "uv sync"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Codex:
|
|
180
|
+
|
|
181
|
+
```toml
|
|
182
|
+
[agent]
|
|
183
|
+
name = "codex"
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
A model behind an OpenAI-compatible endpoint, with no agent:
|
|
187
|
+
|
|
188
|
+
```toml
|
|
189
|
+
[llm]
|
|
190
|
+
api_base = "https://api.anthropic.com/v1" # or https://api.openai.com/v1
|
|
191
|
+
api_key_env = "ANTHROPIC_API_KEY" # or OPENAI_API_KEY
|
|
192
|
+
|
|
193
|
+
[agent]
|
|
194
|
+
name = "none"
|
|
195
|
+
model = "<model name>"
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
A local model, through [marigold](https://marigold.run) or Ollama:
|
|
199
|
+
|
|
200
|
+
```toml
|
|
201
|
+
[llm]
|
|
202
|
+
api_base = "http://localhost:8000/v1" # Ollama: http://localhost:11434/v1
|
|
203
|
+
|
|
204
|
+
[agent]
|
|
205
|
+
name = "none"
|
|
206
|
+
model = "<model name>"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Routing
|
|
210
|
+
|
|
211
|
+
`workplan route` reads a commit and prints the next step: `complete`,
|
|
212
|
+
`review`, `produce-patch`, `define-tasks` or `none`, with its targets.
|
|
213
|
+
The rules are in SPEC.md, section 10. With `route.classifier = "llm"`,
|
|
214
|
+
a model chooses the action from the prompt in
|
|
215
|
+
`templates/prompts/route.md`; the targets still come from the commit,
|
|
216
|
+
and an answer that is not an action with targets falls back to the
|
|
217
|
+
rules. stderr shows both choices:
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
$ workplan route
|
|
221
|
+
route: llm chose produce-patch; the rules chose produce-patch
|
|
222
|
+
produce-patch 2026-11-24-greeting/0000
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
`workplan install` adds hooks that run `workplan route --dispatch` in
|
|
226
|
+
the background after each commit. `--dispatch` runs `route.dispatch`
|
|
227
|
+
with the action and its targets. `define-tasks` and `produce-patch` are also command
|
|
228
|
+
names, so a dispatch script can run `workplan "$@"` for those two.
|
|
229
|
+
|
|
230
|
+
## Templates
|
|
231
|
+
|
|
232
|
+
Documents, prompts and the squash commit message are rendered from
|
|
233
|
+
templates with `string.Template`: `$name` is replaced and nothing else
|
|
234
|
+
happens. To change one, copy it from `src/workplan/templates/<kind>/`
|
|
235
|
+
into `workplans/templates/<kind>/` and edit the copy; the rest keep the
|
|
236
|
+
package's version.
|
|
237
|
+
|
|
238
|
+
## Development
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
python -m unittest discover -s tests
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
The tests build temporary repositories, compare each command with its
|
|
245
|
+
"By hand" block in SPEC.md, rehearse two clones sharing one origin, and
|
|
246
|
+
run the `none` agent and the classifier against a local fake endpoint.
|
|
247
|
+
|
|
248
|
+
The version comes from git tags through setuptools-scm. A release is a
|
|
249
|
+
`vX.Y.Z` tag on master:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
git tag v0.1.0
|
|
253
|
+
git push origin v0.1.0
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
`.github/workflows/release.yaml` builds the package on every push to
|
|
257
|
+
master; on a tag it publishes the package to PyPI and creates the
|
|
258
|
+
GitHub release. It runs in the `release` environment and needs the
|
|
259
|
+
repository secret `PYPI_API_TOKEN`.
|
|
260
|
+
|
|
261
|
+
## Licence
|
|
262
|
+
|
|
263
|
+
MIT. See [LICENSE](LICENSE).
|
workplan-0.1.0/README.md
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# workplan
|
|
2
|
+
|
|
3
|
+
Plan and record development work in git, for agent-driven and
|
|
4
|
+
AI-assisted development.
|
|
5
|
+
|
|
6
|
+
A workplan breaks one goal into tasks. Each task is one commit; the
|
|
7
|
+
workplan reaches master as one squash commit listing every task. The
|
|
8
|
+
plans and the task definitions are Markdown files in `workplans/`, and
|
|
9
|
+
every task's state comes from git history. Any clone holds the whole
|
|
10
|
+
record, and every step can be done by hand with git and an editor:
|
|
11
|
+
[SPEC.md](SPEC.md) describes the steps.
|
|
12
|
+
|
|
13
|
+
An agent, such as Claude Code, Codex, or a model behind any
|
|
14
|
+
OpenAI-compatible endpoint, defines the tasks and produces each task's
|
|
15
|
+
patch in a separate worktree. The maintainer reads each diff and
|
|
16
|
+
accepts or rejects it.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pipx install workplan
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Python 3.11 or later and git. No other dependencies.
|
|
25
|
+
|
|
26
|
+
`wp` is installed as a short name for `workplan`. WP-CLI, the WordPress
|
|
27
|
+
command line, also installs `wp`; where both are installed, use
|
|
28
|
+
`workplan`.
|
|
29
|
+
|
|
30
|
+
## Manual, semi-automatic, full auto
|
|
31
|
+
|
|
32
|
+
Run it on full auto for the real vibe coding experience, or manual for the good old days.
|
|
33
|
+
|
|
34
|
+
- **Manual:** git and an editor. [SPEC.md](SPEC.md) gives every step by hand; the `workplan` command is optional.
|
|
35
|
+
- **Semi-automatic:** run each command; Agents define tasks and produce patches; you read the diffs and accept or reject.
|
|
36
|
+
- **Full auto:** `workplan install` adds hooks that route each commit
|
|
37
|
+
to its next step, and `route.dispatch` runs `define-tasks` and
|
|
38
|
+
`produce-patch` as soon as they are due. Accepting each patch and
|
|
39
|
+
merging stay with you.
|
|
40
|
+
|
|
41
|
+
## A workplan from start to finish
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
workplan init # create workplans/ and commit it
|
|
45
|
+
workplan plan greeting # branch workplan/<date>-greeting/definition;
|
|
46
|
+
# the editor opens on WORKPLAN.md: goal, context, findings
|
|
47
|
+
workplan define-tasks # the agent writes the tasks; WORKPLAN.md and the
|
|
48
|
+
# tasks are committed
|
|
49
|
+
git push # share the plan
|
|
50
|
+
|
|
51
|
+
workplan produce-patch 0000 # the agent writes output.patch and COMMIT_MSG
|
|
52
|
+
workplan apply 0000 # stage it
|
|
53
|
+
workplan diff 0000 # read it, test it
|
|
54
|
+
workplan accept 0000 # commit it with the task's files; or: workplan reject 0000
|
|
55
|
+
workplan status
|
|
56
|
+
|
|
57
|
+
workplan merge # squash into master; the editor opens on the message
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The commands commit what they complete: `init`, `define-tasks`,
|
|
61
|
+
`accept` and `merge`. Pushing is the maintainer's.
|
|
62
|
+
|
|
63
|
+
`plan` opens the editor git uses for commit messages, on WORKPLAN.md
|
|
64
|
+
rendered from its template; closing it unchanged creates nothing.
|
|
65
|
+
`plan greeting -m "app.txt says goodbye"` writes the goal and skips the
|
|
66
|
+
editor.
|
|
67
|
+
|
|
68
|
+
Every command also runs as `wp`: `wp plan greeting`, `wp accept 0000`.
|
|
69
|
+
|
|
70
|
+
`examples/demo.sh` runs this cycle in a temporary repository with a
|
|
71
|
+
scripted agent.
|
|
72
|
+
|
|
73
|
+
## Commands
|
|
74
|
+
|
|
75
|
+
| Command | Does |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `init` | create `workplans/` with README, PRINCIPLES.md and config.toml; add the working files to .gitignore; commit |
|
|
78
|
+
| `plan NAME [-m GOAL]` | `workplans/<date>-NAME/WORKPLAN.md` from its template, on a new branch from master |
|
|
79
|
+
| `define-tasks [ID]` | the agent writes each new task's TASK.md and BREAKDOWN.md; they are listed in WORKPLAN.md and committed with it |
|
|
80
|
+
| `produce-patch NNNN` | the agent writes output.patch and COMMIT_MSG |
|
|
81
|
+
| `apply NNNN`, `diff NNNN` | stage the patch; show it |
|
|
82
|
+
| `accept NNNN` | commit the patch with COMMIT_MSG, together with the task's directory and WORKPLAN.md |
|
|
83
|
+
| `reject NNNN` | take an applied patch back out |
|
|
84
|
+
| `merge [ID]` | squash the workplan into master, with the message from its template |
|
|
85
|
+
| `status [ID \| ID/NNNN] [--json]` | each task's state |
|
|
86
|
+
| `route [REV] [--dispatch]` | the next step after a commit |
|
|
87
|
+
| `install` | post-commit and post-merge hooks that run `route --dispatch` |
|
|
88
|
+
|
|
89
|
+
A task is `ID/NNNN`, or `NNNN` in the current branch's workplan.
|
|
90
|
+
|
|
91
|
+
## Configuration
|
|
92
|
+
|
|
93
|
+
`workplans/config.toml`; `workplan init` writes it with every key.
|
|
94
|
+
Environment variables override it, and API keys come from the
|
|
95
|
+
environment only.
|
|
96
|
+
|
|
97
|
+
| Key | Variable | Default |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| `master` | `WORKPLAN_MASTER` | `master` |
|
|
100
|
+
| `llm.api_base` | `WORKPLAN_API_BASE` | `http://localhost:8000/v1` |
|
|
101
|
+
| `llm.api_key_env` | | `WORKPLAN_API_KEY` |
|
|
102
|
+
| `llm.params` | | `{}`, added to each request body |
|
|
103
|
+
| `route.classifier` | `WORKPLAN_ROUTE_CLASSIFIER` | `rules` |
|
|
104
|
+
| `route.model` | `WORKPLAN_ROUTE_MODEL` | |
|
|
105
|
+
| `route.dispatch` | `WORKPLAN_ROUTE_DISPATCH` | |
|
|
106
|
+
| `agent.name` | `WORKPLAN_AGENT` | `none` |
|
|
107
|
+
| `agent.model` | `WORKPLAN_AGENT_MODEL` | |
|
|
108
|
+
| `agent.setup` | `WORKPLAN_AGENT_SETUP` | |
|
|
109
|
+
| `agent.command` | `WORKPLAN_AGENT_COMMAND` | `[]` |
|
|
110
|
+
| `agent.attempts`, `agent.timeout` | | `3`, `1800` |
|
|
111
|
+
|
|
112
|
+
## Agents
|
|
113
|
+
|
|
114
|
+
`define-tasks` and `produce-patch` create a worktree at the head of
|
|
115
|
+
the workplan branch, copy `workplans/` into it, run `agent.setup`, then
|
|
116
|
+
the agent. The worktree is removed afterwards; the maintainer's own
|
|
117
|
+
tree is never touched.
|
|
118
|
+
|
|
119
|
+
- `define-tasks`: the new task directories the agent wrote under
|
|
120
|
+
`workplans/<id>/` are copied back; existing tasks are left alone.
|
|
121
|
+
- `produce-patch`: the worktree's diff outside `workplans/` becomes
|
|
122
|
+
output.patch.
|
|
123
|
+
|
|
124
|
+
| `agent.name` | Runs |
|
|
125
|
+
|---|---|
|
|
126
|
+
| `none` | completions from `llm.api_base`; the plan files and the files they name go in the prompt; the reply holds the task files or a diff, retried with the error up to `agent.attempts` times |
|
|
127
|
+
| `claude-code` | `claude -p --allowedTools Read,Edit,Write,Glob,Grep,Bash`, prompt on stdin |
|
|
128
|
+
| `codex` | `codex exec --sandbox workspace-write <prompt>` |
|
|
129
|
+
| `command` | `agent.command`; a `{prompt}` argument is replaced by the prompt, else it goes on stdin |
|
|
130
|
+
|
|
131
|
+
`claude-code` and `codex` are presets of `command`; setting
|
|
132
|
+
`agent.command` replaces the preset's arguments. Agents with a shell
|
|
133
|
+
build the code and run its checks in the worktree. Containers, ports
|
|
134
|
+
and other host resources are shared with the host, so integration runs
|
|
135
|
+
stay with the maintainer.
|
|
136
|
+
|
|
137
|
+
A `command` agent receives `WORKPLAN_ACTION` (`define-tasks` or
|
|
138
|
+
`produce-patch`) and `WORKPLAN_TARGET` (the workplan or task id) in its
|
|
139
|
+
environment, and for `produce-patch`, `WORKPLAN_COMMIT_MSG`: the path
|
|
140
|
+
to write the commit message to. When it writes none, COMMIT_MSG is the
|
|
141
|
+
task id and TASK.md's title.
|
|
142
|
+
|
|
143
|
+
### Examples
|
|
144
|
+
|
|
145
|
+
Claude Code, with the project's dependencies installed first:
|
|
146
|
+
|
|
147
|
+
```toml
|
|
148
|
+
[agent]
|
|
149
|
+
name = "claude-code"
|
|
150
|
+
setup = "uv sync"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Codex:
|
|
154
|
+
|
|
155
|
+
```toml
|
|
156
|
+
[agent]
|
|
157
|
+
name = "codex"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
A model behind an OpenAI-compatible endpoint, with no agent:
|
|
161
|
+
|
|
162
|
+
```toml
|
|
163
|
+
[llm]
|
|
164
|
+
api_base = "https://api.anthropic.com/v1" # or https://api.openai.com/v1
|
|
165
|
+
api_key_env = "ANTHROPIC_API_KEY" # or OPENAI_API_KEY
|
|
166
|
+
|
|
167
|
+
[agent]
|
|
168
|
+
name = "none"
|
|
169
|
+
model = "<model name>"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
A local model, through [marigold](https://marigold.run) or Ollama:
|
|
173
|
+
|
|
174
|
+
```toml
|
|
175
|
+
[llm]
|
|
176
|
+
api_base = "http://localhost:8000/v1" # Ollama: http://localhost:11434/v1
|
|
177
|
+
|
|
178
|
+
[agent]
|
|
179
|
+
name = "none"
|
|
180
|
+
model = "<model name>"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Routing
|
|
184
|
+
|
|
185
|
+
`workplan route` reads a commit and prints the next step: `complete`,
|
|
186
|
+
`review`, `produce-patch`, `define-tasks` or `none`, with its targets.
|
|
187
|
+
The rules are in SPEC.md, section 10. With `route.classifier = "llm"`,
|
|
188
|
+
a model chooses the action from the prompt in
|
|
189
|
+
`templates/prompts/route.md`; the targets still come from the commit,
|
|
190
|
+
and an answer that is not an action with targets falls back to the
|
|
191
|
+
rules. stderr shows both choices:
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
$ workplan route
|
|
195
|
+
route: llm chose produce-patch; the rules chose produce-patch
|
|
196
|
+
produce-patch 2026-11-24-greeting/0000
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
`workplan install` adds hooks that run `workplan route --dispatch` in
|
|
200
|
+
the background after each commit. `--dispatch` runs `route.dispatch`
|
|
201
|
+
with the action and its targets. `define-tasks` and `produce-patch` are also command
|
|
202
|
+
names, so a dispatch script can run `workplan "$@"` for those two.
|
|
203
|
+
|
|
204
|
+
## Templates
|
|
205
|
+
|
|
206
|
+
Documents, prompts and the squash commit message are rendered from
|
|
207
|
+
templates with `string.Template`: `$name` is replaced and nothing else
|
|
208
|
+
happens. To change one, copy it from `src/workplan/templates/<kind>/`
|
|
209
|
+
into `workplans/templates/<kind>/` and edit the copy; the rest keep the
|
|
210
|
+
package's version.
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
python -m unittest discover -s tests
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
The tests build temporary repositories, compare each command with its
|
|
219
|
+
"By hand" block in SPEC.md, rehearse two clones sharing one origin, and
|
|
220
|
+
run the `none` agent and the classifier against a local fake endpoint.
|
|
221
|
+
|
|
222
|
+
The version comes from git tags through setuptools-scm. A release is a
|
|
223
|
+
`vX.Y.Z` tag on master:
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
git tag v0.1.0
|
|
227
|
+
git push origin v0.1.0
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
`.github/workflows/release.yaml` builds the package on every push to
|
|
231
|
+
master; on a tag it publishes the package to PyPI and creates the
|
|
232
|
+
GitHub release. It runs in the `release` environment and needs the
|
|
233
|
+
repository secret `PYPI_API_TOKEN`.
|
|
234
|
+
|
|
235
|
+
## Licence
|
|
236
|
+
|
|
237
|
+
MIT. See [LICENSE](LICENSE).
|