whitesmith 0.0.1 → 0.0.3
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.
- package/README.md +286 -88
- package/dist/auto-work.d.ts +11 -0
- package/dist/auto-work.d.ts.map +1 -0
- package/dist/auto-work.js +22 -0
- package/dist/auto-work.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +186 -0
- package/dist/cli.js.map +1 -1
- package/dist/comment.d.ts +29 -0
- package/dist/comment.d.ts.map +1 -0
- package/dist/comment.js +397 -0
- package/dist/comment.js.map +1 -0
- package/dist/git.d.ts +15 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +51 -17
- package/dist/git.js.map +1 -1
- package/dist/harnesses/pi.d.ts +2 -0
- package/dist/harnesses/pi.d.ts.map +1 -1
- package/dist/harnesses/pi.js +109 -7
- package/dist/harnesses/pi.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/install-ci.d.ts +7 -0
- package/dist/install-ci.d.ts.map +1 -0
- package/dist/install-ci.js +760 -0
- package/dist/install-ci.js.map +1 -0
- package/dist/orchestrator.d.ts +52 -4
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +463 -74
- package/dist/orchestrator.js.map +1 -1
- package/dist/prompts.d.ts +52 -0
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +198 -0
- package/dist/prompts.js.map +1 -1
- package/dist/providers/github-ci.d.ts +54 -0
- package/dist/providers/github-ci.d.ts.map +1 -0
- package/dist/providers/github-ci.js +982 -0
- package/dist/providers/github-ci.js.map +1 -0
- package/dist/providers/github.d.ts +21 -0
- package/dist/providers/github.d.ts.map +1 -1
- package/dist/providers/github.js +88 -3
- package/dist/providers/github.js.map +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/issue-provider.d.ts +26 -0
- package/dist/providers/issue-provider.d.ts.map +1 -1
- package/dist/review.d.ts +48 -0
- package/dist/review.d.ts.map +1 -0
- package/dist/review.js +221 -0
- package/dist/review.js.map +1 -0
- package/dist/task-manager.d.ts +4 -0
- package/dist/task-manager.d.ts.map +1 -1
- package/dist/task-manager.js +6 -0
- package/dist/task-manager.js.map +1 -1
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -1
- package/package.json +2 -1
- package/src/auto-work.ts +26 -0
- package/src/cli.ts +226 -0
- package/src/comment.ts +537 -0
- package/src/git.ts +55 -16
- package/src/harnesses/pi.ts +130 -7
- package/src/index.ts +9 -1
- package/src/orchestrator.ts +529 -79
- package/src/prompts.ts +240 -0
- package/src/providers/github-ci.ts +1131 -0
- package/src/providers/github.ts +118 -5
- package/src/providers/index.ts +1 -0
- package/src/providers/issue-provider.ts +25 -1
- package/src/review.ts +290 -0
- package/src/task-manager.ts +7 -0
- package/src/types.ts +11 -0
package/README.md
CHANGED
|
@@ -4,13 +4,15 @@ AI-powered issue-to-PR pipeline. Whitesmith monitors your GitHub issues, breaks
|
|
|
4
4
|
|
|
5
5
|
## How It Works
|
|
6
6
|
|
|
7
|
-
Whitesmith runs a loop with
|
|
7
|
+
Whitesmith runs a loop with four phases:
|
|
8
8
|
|
|
9
|
-
1. **Investigate** — Picks up unlabeled GitHub issues, explores the codebase, and breaks each issue into concrete implementation tasks (stored as markdown files in `tasks/<issue>/`). Opens a PR for human review.
|
|
9
|
+
1. **Investigate** — Picks up unlabeled GitHub issues, explores the codebase, and breaks each issue into concrete implementation tasks (stored as markdown files in `tasks/<issue>/`). Opens a PR on `investigate/<issue-number>` for human review.
|
|
10
10
|
|
|
11
|
-
2. **
|
|
11
|
+
2. **Auto-approve** *(optional)* — If [auto-work mode](#auto-work-mode) is enabled for an issue, the task-proposal PR is automatically merged (with an optional AI review first).
|
|
12
12
|
|
|
13
|
-
3. **
|
|
13
|
+
3. **Implement** — Once a task PR is merged (tasks accepted), picks up available tasks respecting dependency order, implements the changes on the `issue/<issue-number>` branch, deletes the task file, and opens a PR when all tasks are complete.
|
|
14
|
+
|
|
15
|
+
4. **Reconcile** — When all tasks for an issue are completed and merged, closes the original issue.
|
|
14
16
|
|
|
15
17
|
### Issue Lifecycle
|
|
16
18
|
|
|
@@ -20,10 +22,50 @@ Issues move through labels automatically:
|
|
|
20
22
|
(new issue, no labels)
|
|
21
23
|
→ whitesmith:investigating — agent is generating tasks
|
|
22
24
|
→ whitesmith:tasks-proposed — task PR opened for review
|
|
23
|
-
→ whitesmith:tasks-accepted — task PR merged, implementation begins
|
|
25
|
+
→ whitesmith:tasks-accepted — task PR merged (or auto-approved), implementation begins
|
|
24
26
|
→ whitesmith:completed — all tasks done, issue closed
|
|
25
27
|
```
|
|
26
28
|
|
|
29
|
+
### Labels
|
|
30
|
+
|
|
31
|
+
| Label | Description |
|
|
32
|
+
|---|---|
|
|
33
|
+
| `whitesmith:investigating` | Agent is generating tasks for this issue |
|
|
34
|
+
| `whitesmith:tasks-proposed` | A PR with generated tasks has been opened for review |
|
|
35
|
+
| `whitesmith:tasks-accepted` | Task PR has been merged — implementation in progress |
|
|
36
|
+
| `whitesmith:completed` | All tasks have been implemented and merged |
|
|
37
|
+
| `whitesmith:auto-work` | Enables [auto-work mode](#auto-work-mode) for this issue |
|
|
38
|
+
|
|
39
|
+
### Branch Naming Convention
|
|
40
|
+
|
|
41
|
+
Whitesmith uses specific branch naming conventions:
|
|
42
|
+
|
|
43
|
+
| Branch | Purpose |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `investigate/<issue-number>` | Task proposal PRs — contains generated task files |
|
|
46
|
+
| `issue/<issue-number>` | Implementation PRs — contains the actual code changes |
|
|
47
|
+
|
|
48
|
+
### Review System
|
|
49
|
+
|
|
50
|
+
After creating task-proposal PRs or implementation PRs, whitesmith automatically runs an AI review. Reviews produce a verdict:
|
|
51
|
+
|
|
52
|
+
- **APPROVE** — The PR looks good
|
|
53
|
+
- **REQUEST_CHANGES** — The review found issues that need attention
|
|
54
|
+
|
|
55
|
+
The review is posted as a comment on the PR. Disable automatic reviews with the `--no-review` flag on the `run` command.
|
|
56
|
+
|
|
57
|
+
### Auto-Work Mode
|
|
58
|
+
|
|
59
|
+
Auto-work mode enables fully autonomous operation — task-proposal PRs are automatically merged without waiting for human review.
|
|
60
|
+
|
|
61
|
+
Auto-work is enabled for an issue when **any** of these conditions are met:
|
|
62
|
+
|
|
63
|
+
1. The `--auto-work` CLI flag is passed to `whitesmith run`
|
|
64
|
+
2. The issue has the `whitesmith:auto-work` label
|
|
65
|
+
3. The issue body contains the string `whitesmith:auto-work`
|
|
66
|
+
|
|
67
|
+
When auto-work is enabled and the review system is active, whitesmith runs an AI review before merging. If the review returns REQUEST_CHANGES, the auto-merge is skipped and a comment is posted asking for manual review.
|
|
68
|
+
|
|
27
69
|
## Installation
|
|
28
70
|
|
|
29
71
|
```bash
|
|
@@ -40,7 +82,11 @@ npm install -g @mariozechner/pi-coding-agent
|
|
|
40
82
|
|
|
41
83
|
### 1. Configure AI Provider
|
|
42
84
|
|
|
43
|
-
Whitesmith uses `pi` as its agent harness.
|
|
85
|
+
Whitesmith uses `pi` as its agent harness. You can configure authentication in two ways:
|
|
86
|
+
|
|
87
|
+
#### Option A: `auth.json` (OAuth / API key)
|
|
88
|
+
|
|
89
|
+
Create `~/.pi/agent/auth.json`:
|
|
44
90
|
|
|
45
91
|
```json
|
|
46
92
|
{
|
|
@@ -51,6 +97,30 @@ Whitesmith uses `pi` as its agent harness. Configure authentication by creating
|
|
|
51
97
|
}
|
|
52
98
|
```
|
|
53
99
|
|
|
100
|
+
#### Option B: `models.json` (provider configuration)
|
|
101
|
+
|
|
102
|
+
Create `~/.pi/agent/models.json` to configure providers with custom base URLs, API types, and models:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"providers": {
|
|
107
|
+
"anthropic": {
|
|
108
|
+
"apiKey": "ANTHROPIC_API_KEY"
|
|
109
|
+
},
|
|
110
|
+
"my-custom-provider": {
|
|
111
|
+
"baseUrl": "https://api.example.com/v1",
|
|
112
|
+
"api": "openai-completions",
|
|
113
|
+
"apiKey": "MY_API_KEY",
|
|
114
|
+
"models": [{ "id": "my-model" }]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
For built-in providers (`anthropic`, `openai`), the `apiKey` field references an environment variable name that contains the actual key. For custom providers, you also specify `baseUrl`, `api` type (`anthropic-messages` or `openai-completions`), and available `models`.
|
|
121
|
+
|
|
122
|
+
This is the default auth mode used by `install-ci` for CI/CD setups.
|
|
123
|
+
|
|
54
124
|
### 2. GitHub Authentication
|
|
55
125
|
|
|
56
126
|
Whitesmith uses the `gh` CLI. Make sure you're authenticated:
|
|
@@ -61,12 +131,14 @@ gh auth login
|
|
|
61
131
|
|
|
62
132
|
## Usage
|
|
63
133
|
|
|
64
|
-
### Run the Loop
|
|
134
|
+
### `whitesmith run` — Run the Main Loop
|
|
65
135
|
|
|
66
136
|
```bash
|
|
67
137
|
whitesmith run . --provider anthropic --model claude-opus-4-6
|
|
68
138
|
```
|
|
69
139
|
|
|
140
|
+
Runs the full investigate → auto-approve → implement → reconcile loop.
|
|
141
|
+
|
|
70
142
|
#### Options
|
|
71
143
|
|
|
72
144
|
| Option | Description | Default |
|
|
@@ -79,8 +151,11 @@ whitesmith run . --provider anthropic --model claude-opus-4-6
|
|
|
79
151
|
| `--log-file <path>` | Log agent output to file | — |
|
|
80
152
|
| `--no-push` | Skip pushing branches and PR creation | `false` |
|
|
81
153
|
| `--no-sleep` | Skip sleep between iterations | `false` |
|
|
154
|
+
| `--dry-run` | Print what would be done without executing it | `false` |
|
|
155
|
+
| `--auto-work` | Enable [auto-work mode](#auto-work-mode) (auto-approve task PRs) | `false` |
|
|
156
|
+
| `--no-review` | Disable the automatic [review step](#review-system) after PRs are created | `false` |
|
|
82
157
|
|
|
83
|
-
### Check Status
|
|
158
|
+
### `whitesmith status` — Check Status
|
|
84
159
|
|
|
85
160
|
```bash
|
|
86
161
|
whitesmith status .
|
|
@@ -88,94 +163,217 @@ whitesmith status .
|
|
|
88
163
|
|
|
89
164
|
Shows all issues grouped by their whitesmith label and any pending tasks.
|
|
90
165
|
|
|
91
|
-
|
|
166
|
+
#### Options
|
|
167
|
+
|
|
168
|
+
| Option | Description | Default |
|
|
169
|
+
|---|---|---|
|
|
170
|
+
| `--repo <owner/repo>` | GitHub repo | auto-detected |
|
|
171
|
+
|
|
172
|
+
### `whitesmith reconcile` — Reconcile Issues
|
|
92
173
|
|
|
93
174
|
```bash
|
|
94
175
|
whitesmith reconcile .
|
|
95
176
|
```
|
|
96
177
|
|
|
97
|
-
Checks for completed issues (all tasks merged) and closes them. No AI needed.
|
|
178
|
+
Checks for completed issues (all tasks merged) and closes them. Also handles the `tasks-proposed` → `tasks-accepted` transition when a task PR has been merged. No AI needed.
|
|
98
179
|
|
|
99
|
-
|
|
180
|
+
#### Options
|
|
181
|
+
|
|
182
|
+
| Option | Description | Default |
|
|
183
|
+
|---|---|---|
|
|
184
|
+
| `--repo <owner/repo>` | GitHub repo | auto-detected |
|
|
185
|
+
|
|
186
|
+
### `whitesmith comment` — Handle Comments
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
whitesmith comment . --number 42 --body "Please add tests" --provider anthropic --model claude-opus-4-6
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Handles a comment on an issue or PR. Whitesmith auto-detects whether the target is a PR or an issue and handles each appropriately:
|
|
193
|
+
|
|
194
|
+
- **PR comments**: Checks out the PR branch, lets the agent make changes, commits and pushes any modifications, and optionally posts a response.
|
|
195
|
+
- **Issue comments**: The agent analyzes the issue and related context (task PRs, implementation PRs, pending tasks) and generates a response. If related PRs exist with open branches, the agent can check them out and make changes.
|
|
196
|
+
|
|
197
|
+
#### Options
|
|
198
|
+
|
|
199
|
+
| Option | Description | Default |
|
|
200
|
+
|---|---|---|
|
|
201
|
+
| `--number <n>` | Issue or PR number | *required* |
|
|
202
|
+
| `--body <text>` | Comment body text | — |
|
|
203
|
+
| `--body-file <path>` | Read comment body from a file (alternative to `--body`) | — |
|
|
204
|
+
| `--provider <name>` | AI provider | *required* |
|
|
205
|
+
| `--model <id>` | AI model ID | *required* |
|
|
206
|
+
| `--agent-cmd <cmd>` | Agent harness command | `pi` |
|
|
207
|
+
| `--repo <owner/repo>` | GitHub repo | auto-detected |
|
|
208
|
+
| `--log-file <path>` | Log agent output to file | — |
|
|
209
|
+
| `--post` | Post the response as a GitHub comment (otherwise prints to stdout) | `false` |
|
|
210
|
+
|
|
211
|
+
Either `--body` or `--body-file` must be provided.
|
|
212
|
+
|
|
213
|
+
### `whitesmith review` — Review PRs and Tasks
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
whitesmith review . --number 42 --provider anthropic --model claude-opus-4-6
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Reviews a PR, task proposal, or completed task implementation. Produces a verdict: **APPROVE** or **REQUEST_CHANGES**.
|
|
220
|
+
|
|
221
|
+
#### Review Types
|
|
222
|
+
|
|
223
|
+
| Type | Description |
|
|
224
|
+
|---|---|
|
|
225
|
+
| `pr` | Review a generic PR (examine the diff, check for bugs, quality) |
|
|
226
|
+
| `issue-tasks` | Review a task proposal — check that tasks are detailed and precise enough |
|
|
227
|
+
| `issue-tasks-completed` | Review completed tasks — verify implementation follows the plan, check for bugs |
|
|
228
|
+
|
|
229
|
+
If `--type` is omitted, the review type is auto-detected based on the target:
|
|
100
230
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
pull-requests: write
|
|
132
|
-
|
|
133
|
-
jobs:
|
|
134
|
-
run:
|
|
135
|
-
runs-on: ubuntu-latest
|
|
136
|
-
steps:
|
|
137
|
-
- uses: actions/checkout@v4
|
|
138
|
-
with:
|
|
139
|
-
fetch-depth: 0
|
|
140
|
-
|
|
141
|
-
- uses: actions/setup-node@v4
|
|
142
|
-
with:
|
|
143
|
-
node-version: '22'
|
|
144
|
-
|
|
145
|
-
- name: Configure git
|
|
146
|
-
run: |
|
|
147
|
-
git config user.name "whitesmith[bot]"
|
|
148
|
-
git config user.email "whitesmith[bot]@users.noreply.github.com"
|
|
149
|
-
|
|
150
|
-
- name: Install whitesmith & pi
|
|
151
|
-
run: |
|
|
152
|
-
npm install -g whitesmith
|
|
153
|
-
npm install -g @mariozechner/pi-coding-agent
|
|
154
|
-
|
|
155
|
-
- name: Configure pi auth
|
|
156
|
-
run: |
|
|
157
|
-
mkdir -p ~/.pi/agent
|
|
158
|
-
echo '${{ secrets.PI_AUTH_JSON }}' > ~/.pi/agent/auth.json
|
|
159
|
-
chmod 600 ~/.pi/agent/auth.json
|
|
160
|
-
|
|
161
|
-
- name: Run whitesmith
|
|
162
|
-
env:
|
|
163
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
164
|
-
run: |
|
|
165
|
-
whitesmith run . \
|
|
166
|
-
--agent-cmd "pi" \
|
|
167
|
-
--provider "${{ inputs.provider || vars.WHITESMITH_PROVIDER }}" \
|
|
168
|
-
--model "${{ inputs.model || vars.WHITESMITH_MODEL }}" \
|
|
169
|
-
--max-iterations ${{ inputs.max_iterations || '3' }}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Required Configuration
|
|
173
|
-
|
|
174
|
-
| Secret/Variable | Description |
|
|
231
|
+
- PR on `investigate/<N>` branch → `issue-tasks`
|
|
232
|
+
- PR on `issue/<N>` branch → `issue-tasks-completed`
|
|
233
|
+
- Other PR → `pr`
|
|
234
|
+
- Issue with `whitesmith:tasks-accepted` label → `issue-tasks-completed`
|
|
235
|
+
- Issue with `whitesmith:tasks-proposed` label → `issue-tasks`
|
|
236
|
+
|
|
237
|
+
#### Options
|
|
238
|
+
|
|
239
|
+
| Option | Description | Default |
|
|
240
|
+
|---|---|---|
|
|
241
|
+
| `--number <n>` | PR or issue number to review | *required* |
|
|
242
|
+
| `--type <type>` | Review type: `pr`, `issue-tasks`, `issue-tasks-completed` | auto-detected |
|
|
243
|
+
| `--provider <name>` | AI provider | *required* |
|
|
244
|
+
| `--model <id>` | AI model ID | *required* |
|
|
245
|
+
| `--agent-cmd <cmd>` | Agent harness command | `pi` |
|
|
246
|
+
| `--repo <owner/repo>` | GitHub repo | auto-detected |
|
|
247
|
+
| `--log-file <path>` | Log agent output to file | — |
|
|
248
|
+
| `--post` | Post the review as a GitHub comment (otherwise prints to stdout) | `false` |
|
|
249
|
+
|
|
250
|
+
### `whitesmith install-ci` — Set Up GitHub Actions
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
whitesmith install-ci .
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Interactive setup wizard that generates GitHub Actions workflows, a shared composite action, and configures GitHub secrets. This is the recommended way to set up whitesmith for CI/CD.
|
|
257
|
+
|
|
258
|
+
#### What Gets Generated
|
|
259
|
+
|
|
260
|
+
| File | Description |
|
|
175
261
|
|---|---|
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
262
|
+
| `.github/actions/setup-whitesmith/action.yml` | Composite action: Node.js setup, git config, install whitesmith + pi, configure auth |
|
|
263
|
+
| `.github/workflows/whitesmith.yml` | Main workflow — manual dispatch for catch-up or debugging (event-driven workflows handle normal operation) |
|
|
264
|
+
| `.github/workflows/whitesmith-issue.yml` | Triggered on new issues — begins investigation immediately |
|
|
265
|
+
| `.github/workflows/whitesmith-comment.yml` | Responds to issue/PR comments (triggered by `/whitesmith` or comments on managed branches) |
|
|
266
|
+
| `.github/workflows/whitesmith-reconcile.yml` | Reconciles on PR merge to `main` — triggers implementation or closes completed issues |
|
|
267
|
+
| `.github/workflows/whitesmith-review.yml` | *(optional)* Reviews PRs on open/synchronize |
|
|
268
|
+
|
|
269
|
+
#### Auth Modes
|
|
270
|
+
|
|
271
|
+
- **`models-json`** *(default)* — Each provider's API key is stored as a separate GitHub secret. The setup wizard generates a `models.json` configuration inline in the composite action.
|
|
272
|
+
- **`auth-json`** (`--auth-json` flag) — Uses a single `PI_AUTH_JSON` GitHub secret containing the full `auth.json` file. Also requires a `GH_PAT` secret for OAuth token refresh.
|
|
273
|
+
|
|
274
|
+
#### Interactive Usage
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
whitesmith install-ci .
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
The wizard prompts you to:
|
|
281
|
+
1. Add providers (Anthropic, OpenAI, or custom)
|
|
282
|
+
2. Configure models for each provider
|
|
283
|
+
3. Select default provider and model
|
|
284
|
+
4. Enter API keys (set as GitHub secrets automatically)
|
|
285
|
+
|
|
286
|
+
#### Non-Interactive Usage
|
|
287
|
+
|
|
288
|
+
Export a configuration file:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
whitesmith install-ci . --export-config config.json --include-secrets
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Re-use the configuration later:
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
whitesmith install-ci . --config config.json
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
#### Options
|
|
301
|
+
|
|
302
|
+
| Option | Description | Default |
|
|
303
|
+
|---|---|---|
|
|
304
|
+
| `--auth-json` | Use `auth.json` mode instead of `models.json` | `false` |
|
|
305
|
+
| `--repo <owner/repo>` | GitHub repo | auto-detected |
|
|
306
|
+
| `--fake` | Write workflows to `.fake/` instead of `.github/` (for testing) | `false` |
|
|
307
|
+
| `--config <path>` | Load provider config from a JSON file (skip interactive prompts) | — |
|
|
308
|
+
| `--export-config <path>` | Write the provider config as JSON to a file (instead of generating workflows) | — |
|
|
309
|
+
| `--include-secrets` | With `--export-config`, prompt for API keys and include them in the JSON output | `false` |
|
|
310
|
+
| `--no-secrets` | Skip setting GitHub secrets (useful when reconfiguring workflows only) | `false` |
|
|
311
|
+
| `--dev` | Build whitesmith from source (pnpm) instead of npm install | `false` |
|
|
312
|
+
| `--review-workflow` | Generate the optional PR review workflow | `false` |
|
|
313
|
+
| `--no-review-step` | Disable the review step in the main loop (the review workflow will cover all PRs) | `false` |
|
|
314
|
+
|
|
315
|
+
## GitHub Actions
|
|
316
|
+
|
|
317
|
+
### Quick Setup
|
|
318
|
+
|
|
319
|
+
The easiest way to set up GitHub Actions is with the `install-ci` command:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
whitesmith install-ci .
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
This generates all necessary workflows, the shared setup action, and configures your GitHub secrets interactively. See [`whitesmith install-ci`](#whitesmith-install-ci--set-up-github-actions) for details.
|
|
326
|
+
|
|
327
|
+
### Architecture
|
|
328
|
+
|
|
329
|
+
The generated CI setup uses an **event-driven architecture** — whitesmith reacts to GitHub events immediately instead of polling on a schedule:
|
|
330
|
+
|
|
331
|
+
- **Issue created** → investigate immediately
|
|
332
|
+
- **Task PR merged** → implement immediately
|
|
333
|
+
- **Implementation PR merged** → reconcile immediately
|
|
334
|
+
- **Comment on issue/PR** → respond immediately
|
|
335
|
+
- **Manual `workflow_dispatch`** → fallback for catch-up or debugging
|
|
336
|
+
|
|
337
|
+
The setup consists of:
|
|
338
|
+
|
|
339
|
+
1. **Composite action** (`.github/actions/setup-whitesmith/action.yml`) — Shared setup logic used by all workflows: installs Node.js, configures git, installs whitesmith + pi, sets up AI provider authentication. Supports npm caching for faster CI runs.
|
|
340
|
+
|
|
341
|
+
2. **Issue workflow** (`whitesmith-issue.yml`) — Triggered when a new issue is opened. Runs `whitesmith run --issue <N>` to immediately begin investigation.
|
|
342
|
+
|
|
343
|
+
3. **Main workflow** (`whitesmith.yml`) — Manual `workflow_dispatch` trigger for catch-up or debugging. Accepts an optional `issue` input to target a specific issue, or runs a global scan when omitted. Uses per-issue or global concurrency groups to prevent overlapping runs.
|
|
344
|
+
|
|
345
|
+
4. **Comment workflow** (`whitesmith-comment.yml`) — Triggered by `issue_comment` events. Runs when:
|
|
346
|
+
- The comment body contains `/whitesmith` (slash command trigger)
|
|
347
|
+
- The comment is on a PR whose branch matches `investigate/*` or `task/*` (whitesmith-managed branches)
|
|
348
|
+
|
|
349
|
+
The workflow reacts to the comment with 👀, runs the agent, then reacts with 👍 on success or 👎 on failure.
|
|
350
|
+
|
|
351
|
+
5. **Reconcile workflow** (`whitesmith-reconcile.yml`) — Triggered when a PR is merged to `main`. Handles two cases:
|
|
352
|
+
- **Task PR merged** (branch `investigate/<N>`) → runs `whitesmith run --issue <N>` to begin implementation immediately.
|
|
353
|
+
- **Implementation PR merged** (branch `issue/<N>`) or other merges → runs `whitesmith reconcile` to transition issue labels and close completed issues.
|
|
354
|
+
|
|
355
|
+
6. **Review workflow** (`whitesmith-review.yml`, optional) — Triggered on PR open/synchronize. Runs an AI review and posts the result as a comment. When the review step is enabled in the main loop, this workflow skips whitesmith-managed branches (already reviewed inline). Pass `--review-workflow` to `install-ci` to generate this workflow.
|
|
356
|
+
|
|
357
|
+
### Required Repository Settings
|
|
358
|
+
|
|
359
|
+
Enable in your repository settings:
|
|
360
|
+
|
|
361
|
+
**Settings → Actions → General → "Allow GitHub Actions to create and approve pull requests"**
|
|
362
|
+
|
|
363
|
+
### Secrets
|
|
364
|
+
|
|
365
|
+
Secrets are set automatically by `install-ci`, or can be added manually:
|
|
366
|
+
|
|
367
|
+
**models-json mode** (default):
|
|
368
|
+
- One secret per provider API key (e.g. `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`)
|
|
369
|
+
|
|
370
|
+
**auth-json mode** (`--auth-json`):
|
|
371
|
+
- `PI_AUTH_JSON` — Contents of `~/.pi/agent/auth.json`
|
|
372
|
+
- `GH_PAT` — GitHub personal access token with repo scope (for OAuth token refresh)
|
|
373
|
+
|
|
374
|
+
### `/whitesmith` Slash Command
|
|
375
|
+
|
|
376
|
+
In the comment workflow, any comment containing `/whitesmith` triggers the agent. This works on both issues and PRs. Comments on whitesmith-managed PR branches (`investigate/*` or `task/*`) also trigger automatically without needing the slash command.
|
|
179
377
|
|
|
180
378
|
## Task File Format
|
|
181
379
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DevPulseConfig, Issue } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check whether auto-work mode is enabled for a given issue.
|
|
4
|
+
*
|
|
5
|
+
* Returns true if any of these conditions are met:
|
|
6
|
+
* 1. `config.autoWork` is `true` (global config / CLI flag)
|
|
7
|
+
* 2. The issue has the `whitesmith:auto-work` label
|
|
8
|
+
* 3. The issue body contains the string `whitesmith:auto-work`
|
|
9
|
+
*/
|
|
10
|
+
export declare function isAutoWorkEnabled(config: DevPulseConfig, issue: Issue): boolean;
|
|
11
|
+
//# sourceMappingURL=auto-work.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-work.d.ts","sourceRoot":"","sources":["../src/auto-work.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAE,KAAK,EAAC,MAAM,YAAY,CAAC;AAGtD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,GAAG,OAAO,CAc/E"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LABELS } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check whether auto-work mode is enabled for a given issue.
|
|
4
|
+
*
|
|
5
|
+
* Returns true if any of these conditions are met:
|
|
6
|
+
* 1. `config.autoWork` is `true` (global config / CLI flag)
|
|
7
|
+
* 2. The issue has the `whitesmith:auto-work` label
|
|
8
|
+
* 3. The issue body contains the string `whitesmith:auto-work`
|
|
9
|
+
*/
|
|
10
|
+
export function isAutoWorkEnabled(config, issue) {
|
|
11
|
+
if (config.autoWork) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (issue.labels.includes(LABELS.AUTO_WORK)) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (issue.body.includes('whitesmith:auto-work')) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=auto-work.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-work.js","sourceRoot":"","sources":["../src/auto-work.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,YAAY,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAsB,EAAE,KAAY;IACrE,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC;QACjD,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC"}
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AA8BlC,wBAAgB,QAAQ,IAAI,OAAO,CA2WlC;AAED,wBAAsB,IAAI,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvE"}
|