Skip to content

Commit 8c46081

Browse files
ncrmroclaude
andcommitted
feat(library): add Nix flake detection to repair workflow errata step
The errata step now detects flake.nix and offers library job setup via sparse checkout. Silent when already configured, informational when no flake is present. Adds quality criterion and bumps version to 1.5.1. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 61599ef commit 8c46081

3 files changed

Lines changed: 71 additions & 4 deletions

File tree

src/deepwork/standard_jobs/deepwork_jobs/AGENTS.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ Mitigation strategies documented in `define.md`:
6464

6565
The github_outreach `final_report` step had `analyze_repos` as a file input but was missing it from the `dependencies` list. This was caught at workflow start time but could have been caught earlier during the `implement` step. The define step's validation rules already mention this (`from_step must be in dependencies`) but it was missed during creation.
6666

67+
### Repair Workflow: Library Job Detection (v1.5.1)
68+
69+
The errata step now detects Nix flake devshells and offers to set up shared library jobs via sparse checkout. The behavior is tri-state:
70+
- **Flake with `DEEPWORK_ADDITIONAL_JOBS_FOLDERS` already set**: Silent — no output
71+
- **Flake exists but no library job config**: Offer setup with flake.nix snippet and sparse checkout commands
72+
- **No flake.nix**: Brief mention of the Nix devshell option, no detail
73+
74+
Key details:
75+
- Library jobs are cloned into `.deepwork/upstream/` via `git clone --sparse --filter=blob:none`
76+
- Users can include/exclude specific jobs via `git sparse-checkout set --cone` / `sparse-checkout add`
77+
- Full documentation lives in `library/jobs/README.md`
78+
6779
## Version Management
6880

6981
- Version is tracked in `job.yml`
@@ -72,5 +84,5 @@ The github_outreach `final_report` step had `analyze_repos` as a file input but
7284

7385
## Last Updated
7486

75-
- Date: 2026-02-06
76-
- From conversation about: Learn workflow analyzing severe quality review issues in the new_job execution
87+
- Date: 2026-03-21
88+
- From conversation about: Adding library job Nix devshell detection to the repair workflow's errata step

src/deepwork/standard_jobs/deepwork_jobs/job.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# yaml-language-server: $schema=.deepwork/schemas/job.schema.json
22
name: deepwork_jobs
3-
version: "1.5.0"
3+
version: "1.5.1"
44
summary: "Creates and manages multi-step AI workflows. Use when defining, implementing, testing, or improving DeepWork jobs."
55
common_job_info_provided_to_all_steps_at_runtime: |
66
Core commands for managing DeepWork jobs. These commands help you define new multi-step
@@ -267,3 +267,4 @@ steps:
267267
"Rules Folder Removed": "`.deepwork/rules/` folder is gone."
268268
"Rules Job Removed": "`.deepwork/jobs/deepwork_rules/` is gone."
269269
"MCP Server Entry Removed": "The `deepwork serve` entry is removed from `.mcp.json` (or the file is deleted if empty)."
270+
"Library Jobs Offered": "If a flake.nix exists without DEEPWORK_ADDITIONAL_JOBS_FOLDERS, the user was offered library job setup. If no flake.nix exists, the Nix devshell option was mentioned. If already configured, nothing was said."

src/deepwork/standard_jobs/deepwork_jobs/steps/errata.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,61 @@ Check for and remove other obsolete files:
176176
| `.claude/commands/` | Generated commands | Keep (current system) |
177177
| `.claude/settings.local.json` | Local overrides | Keep (user settings) |
178178

179-
### Step 7: Verify Git Status
179+
### Step 7: Library Job Access via Nix Dev Shell
180+
181+
Check whether the project uses a Nix flake devshell and whether shared library jobs are configured.
182+
183+
**Detection logic:**
184+
185+
1. Check if `flake.nix` exists in the repo root:
186+
```bash
187+
test -f flake.nix && echo "flake found" || echo "no flake"
188+
```
189+
190+
2. **If `flake.nix` exists**, check whether it already sets `DEEPWORK_ADDITIONAL_JOBS_FOLDERS`:
191+
```bash
192+
grep -q 'DEEPWORK_ADDITIONAL_JOBS_FOLDERS' flake.nix && echo "already configured" || echo "not configured"
193+
```
194+
195+
3. **If already configured**: Do nothing. No output about library jobs — this is silent.
196+
197+
4. **If `flake.nix` exists but library jobs are NOT configured**: Offer to set it up. Tell the user:
198+
> Your project uses a Nix flake. You can access shared DeepWork library jobs by adding a sparse checkout to your shellHook. This keeps library jobs live and up-to-date without copying them into your project.
199+
200+
Then suggest adding to their `flake.nix` shellHook:
201+
```nix
202+
shellHook = ''
203+
export REPO_ROOT=$(git rev-parse --show-toplevel)
204+
205+
# Clone DeepWork library jobs if not present
206+
if [ ! -d "$REPO_ROOT/.deepwork/upstream" ]; then
207+
git clone --sparse --filter=blob:none \
208+
https://github.com/Unsupervisedcom/deepwork.git \
209+
"$REPO_ROOT/.deepwork/upstream"
210+
git -C "$REPO_ROOT/.deepwork/upstream" sparse-checkout set --cone library/jobs/
211+
fi
212+
213+
export DEEPWORK_ADDITIONAL_JOBS_FOLDERS="$REPO_ROOT/.deepwork/upstream/library/jobs"
214+
'';
215+
```
216+
217+
And adding `.deepwork/upstream/` to `.gitignore`.
218+
219+
If the user wants only specific library jobs, they can use sparse checkout to include/exclude:
220+
```bash
221+
# Check out only specific jobs
222+
git -C .deepwork/upstream sparse-checkout set --cone library/jobs/repo/
223+
224+
# Add more later
225+
git -C .deepwork/upstream sparse-checkout add library/jobs/spec_driven_development/
226+
```
227+
228+
5. **If no `flake.nix` exists**: Mention it as an option. Tell the user:
229+
> DeepWork library jobs can be accessed via a Nix dev shell with `DEEPWORK_ADDITIONAL_JOBS_FOLDERS`. See `library/jobs/README.md` in the DeepWork repo for setup instructions.
230+
231+
Do not go into detail — just make the user aware.
232+
233+
### Step 8: Verify Git Status
180234

181235
Check that the cleanup hasn't left untracked garbage:
182236

0 commit comments

Comments
 (0)