Skip to content

Commit 19f635e

Browse files
committed
Merge branch 'main' into claude/refactor-git-operations-2WxqO
2 parents 20237ce + e30b56f commit 19f635e

143 files changed

Lines changed: 11026 additions & 1584 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
# block_bash_with_instructions.sh - Blocks specific bash commands and provides alternative instructions
3+
#
4+
# This hook intercepts Bash tool use calls and blocks commands that match
5+
# specific patterns, providing alternative instructions to the agent.
6+
#
7+
# Usage: Registered as a PreToolUse hook in .claude/settings.json
8+
#
9+
# Input (stdin): JSON from Claude Code hook system containing tool_name and tool_input
10+
# Output (stderr): Error message if blocked (Claude Code reads stderr for exit code 2)
11+
# Exit codes:
12+
# 0 - Success (allow action)
13+
# 2 - Blocking error (prevent action with message)
14+
15+
set -e
16+
17+
# =============================================================================
18+
# BLOCKED COMMANDS CONFIGURATION
19+
# =============================================================================
20+
# Format: Each entry is a regex pattern followed by a delimiter (|||) and instructions
21+
# The regex is matched against the full bash command
22+
# Add new blocked commands here:
23+
24+
BLOCKED_COMMANDS=(
25+
'^[[:space:]]*git[[:space:]]+commit|||All commits must be done via the `/commit` skill. Do not use git commit directly. Instead, run `/commit` to start the commit workflow which includes code review, testing, and linting before committing.'
26+
)
27+
28+
# =============================================================================
29+
# HOOK LOGIC - DO NOT MODIFY BELOW UNLESS NECESSARY
30+
# =============================================================================
31+
32+
# Read stdin into variable
33+
HOOK_INPUT=""
34+
if [ ! -t 0 ]; then
35+
HOOK_INPUT=$(cat)
36+
fi
37+
38+
# Exit early if no input
39+
if [ -z "${HOOK_INPUT}" ]; then
40+
exit 0
41+
fi
42+
43+
# Extract tool_name from input
44+
TOOL_NAME=$(echo "${HOOK_INPUT}" | jq -r '.tool_name // empty' 2>/dev/null)
45+
46+
# Only process Bash tool calls
47+
if [ "${TOOL_NAME}" != "Bash" ]; then
48+
exit 0
49+
fi
50+
51+
# Extract the command from tool_input
52+
COMMAND=$(echo "${HOOK_INPUT}" | jq -r '.tool_input.command // empty' 2>/dev/null)
53+
54+
# Exit if no command
55+
if [ -z "${COMMAND}" ]; then
56+
exit 0
57+
fi
58+
59+
# Check each blocked pattern
60+
for entry in "${BLOCKED_COMMANDS[@]}"; do
61+
# Split entry by delimiter
62+
pattern="${entry%%|||*}"
63+
instructions="${entry##*|||}"
64+
65+
# Check if command matches pattern (using extended regex)
66+
if echo "${COMMAND}" | grep -qE "${pattern}"; then
67+
# Output error message to stderr (Claude Code reads stderr for exit code 2)
68+
echo "${instructions}" >&2
69+
exit 2
70+
fi
71+
done
72+
73+
# Command is allowed
74+
exit 0
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
# commit_job_git_commit.sh - Wrapper for git commit invoked via the /commit skill
3+
4+
exec git commit "$@"

.claude/settings.json

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,68 @@
9494
"Bash(node:*)",
9595
"Bash(npm:*)",
9696
"Bash(npx:*)",
97-
"Edit(./**)"
97+
"Edit(./**)",
98+
"Read(./.deepwork/tmp/**)",
99+
"Edit(./.deepwork/tmp/**)",
100+
"Write(./.deepwork/tmp/**)",
101+
"Skill(commit)",
102+
"Skill(commit.review)",
103+
"Skill(commit.test)",
104+
"Skill(commit.lint)",
105+
"Skill(commit.commit_and_push)",
106+
"Skill(deepwork_jobs)",
107+
"Skill(deepwork_jobs.define)",
108+
"Skill(deepwork_jobs.review_job_spec)",
109+
"Skill(deepwork_jobs.implement)",
110+
"Skill(deepwork_jobs.learn)",
111+
"Skill(add_platform)",
112+
"Skill(add_platform.research)",
113+
"Skill(add_platform.add_capabilities)",
114+
"Skill(add_platform.implement)",
115+
"Skill(add_platform.verify)",
116+
"Skill(update)",
117+
"Skill(update.job)",
118+
"Skill(manual_tests)",
119+
"Skill(manual_tests.run_not_fire_tests)",
120+
"Skill(manual_tests.run_fire_tests)",
121+
"Skill(deepwork_rules)",
122+
"Skill(deepwork_rules.define)",
123+
"Bash(deepwork rules clear_queue)",
124+
"Bash(rm -rf .deepwork/tmp/rules/queue/*.json)",
125+
"Skill(manual_tests.reset)",
126+
"Skill(manual_tests.infinite_block_tests)",
127+
"Read(./.deepwork/**)",
128+
"Edit(./.deepwork/**)",
129+
"Write(./.deepwork/**)",
130+
"Bash(deepwork:*)",
131+
"Bash(.claude/hooks/commit_job_git_commit.sh:*)",
132+
"Bash(./.deepwork/jobs/deepwork_jobs/make_new_job.sh:*)",
133+
"WebSearch"
98134
]
99135
},
100136
"hooks": {
137+
"PreToolUse": [
138+
{
139+
"matcher": "Bash",
140+
"hooks": [
141+
{
142+
"type": "command",
143+
"command": ".claude/hooks/block_bash_with_instructions.sh"
144+
}
145+
]
146+
}
147+
],
148+
"SessionStart": [
149+
{
150+
"matcher": "",
151+
"hooks": [
152+
{
153+
"type": "command",
154+
"command": "src/deepwork/hooks/check_version.sh"
155+
}
156+
]
157+
}
158+
],
101159
"UserPromptSubmit": [
102160
{
103161
"matcher": "",
@@ -115,7 +173,18 @@
115173
"hooks": [
116174
{
117175
"type": "command",
118-
"command": "python -m deepwork.hooks.rules_check"
176+
"command": "deepwork hook rules_check"
177+
}
178+
]
179+
}
180+
],
181+
"SubagentStop": [
182+
{
183+
"matcher": "",
184+
"hooks": [
185+
{
186+
"type": "command",
187+
"command": "deepwork hook rules_check"
119188
}
120189
]
121190
}

.claude/skills/add_platform.add_capabilities/SKILL.md

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,14 @@
22
name: add_platform.add_capabilities
33
description: "Updates job schema and adapters with any new hook events the platform supports. Use after research to extend DeepWork's hook system."
44
user-invocable: false
5-
hooks:
6-
Stop:
7-
- hooks:
8-
- type: prompt
9-
prompt: |
10-
Verify the capability additions meet ALL criteria:
11-
1. Any new hooks from the platform (for slash commands only) are added to src/deepwork/schemas/job_schema.py
12-
2. All existing adapters in src/deepwork/adapters.py are updated with the new hook fields
13-
(set to None/null if the platform doesn't support that hook)
14-
3. Only hooks available on slash command definitions are added (not general CLI hooks)
15-
4. job_schema.py remains valid Python with no syntax errors
16-
5. adapters.py remains consistent - all adapters have the same hook fields
17-
6. If no new hooks are needed, document why in a comment
18-
19-
If ALL criteria are met, include `<promise>✓ Quality Criteria Met</promise>`.
205

216
---
227

238
# add_platform.add_capabilities
249

25-
**Step 2/4** in **add_platform** workflow
10+
**Step 2/4** in **integrate** workflow
11+
12+
> Full workflow to integrate a new AI platform into DeepWork
2613
2714
> Adds a new AI platform to DeepWork with adapter, templates, and tests. Use when integrating Cursor, Windsurf, or other AI coding tools.
2815
@@ -176,7 +163,7 @@ When you find a new hook type, consider whether it maps to an existing pattern o
176163

177164
A workflow for adding support for a new AI platform (like Cursor, Windsurf, etc.) to DeepWork.
178165

179-
This job guides you through four phases:
166+
The **integrate** workflow guides you through four phases:
180167
1. **Research**: Capture the platform's CLI configuration and hooks system documentation
181168
2. **Add Capabilities**: Update the job schema and adapters with any new hook events
182169
3. **Implement**: Create the platform adapter, templates, tests (100% coverage), and README updates
@@ -218,18 +205,10 @@ Use branch format: `deepwork/add_platform-[instance]-YYYYMMDD`
218205
- Do NOT proceed without required inputs; ask the user if any are missing
219206
- Do NOT modify files outside the scope of this step's defined outputs
220207

221-
## Quality Validation
222-
223-
Stop hooks will automatically validate your work. The loop continues until all criteria pass.
224-
225-
226-
227-
**To complete**: Include `<promise>✓ Quality Criteria Met</promise>` in your final response only after verifying ALL criteria are satisfied.
228-
229208
## On Completion
230209

231210
1. Verify outputs are created
232-
2. Inform user: "Step 2/4 complete, outputs: job_schema.py, adapters.py"
211+
2. Inform user: "integrate step 2/4 complete, outputs: job_schema.py, adapters.py"
233212
3. **Continue workflow**: Use Skill tool to invoke `/add_platform.implement`
234213

235214
---

.claude/skills/add_platform.implement/SKILL.md

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,18 @@ hooks:
77
- hooks:
88
- type: command
99
command: ".deepwork/jobs/add_platform/hooks/run_tests.sh"
10-
- type: prompt
11-
prompt: |
12-
Verify the implementation meets ALL criteria:
13-
1. Platform adapter class is added to src/deepwork/adapters.py
14-
2. Templates exist in src/deepwork/templates/<platform>/ with appropriate command structure
15-
3. Tests exist for all new functionality
16-
4. Test coverage is 100% for new code (run: uv run pytest --cov)
17-
5. All tests pass
18-
6. README.md is updated with:
19-
- New platform listed in supported platforms
20-
- Installation instructions for the platform
21-
- Any platform-specific notes
22-
23-
If ALL criteria are met, include `<promise>✓ Quality Criteria Met</promise>`.
10+
SubagentStop:
11+
- hooks:
12+
- type: command
13+
command: ".deepwork/jobs/add_platform/hooks/run_tests.sh"
2414

2515
---
2616

2717
# add_platform.implement
2818

29-
**Step 3/4** in **add_platform** workflow
19+
**Step 3/4** in **integrate** workflow
20+
21+
> Full workflow to integrate a new AI platform into DeepWork
3022
3123
> Adds a new AI platform to DeepWork with adapter, templates, and tests. Use when integrating Cursor, Windsurf, or other AI coding tools.
3224
@@ -272,7 +264,7 @@ The templates use Jinja2 and should produce files that match exactly what the pl
272264
273265
A workflow for adding support for a new AI platform (like Cursor, Windsurf, etc.) to DeepWork.
274266
275-
This job guides you through four phases:
267+
The **integrate** workflow guides you through four phases:
276268
1. **Research**: Capture the platform's CLI configuration and hooks system documentation
277269
2. **Add Capabilities**: Update the job schema and adapters with any new hook events
278270
3. **Implement**: Create the platform adapter, templates, tests (100% coverage), and README updates
@@ -317,19 +309,11 @@ Use branch format: `deepwork/add_platform-[instance]-YYYYMMDD`
317309
- Do NOT proceed without required inputs; ask the user if any are missing
318310
- Do NOT modify files outside the scope of this step's defined outputs
319311
320-
## Quality Validation
321-
322-
Stop hooks will automatically validate your work. The loop continues until all criteria pass.
323-
324-
325312
**Validation script**: `.deepwork/jobs/add_platform/hooks/run_tests.sh` (runs automatically)
326-
327-
**To complete**: Include `<promise>✓ Quality Criteria Met</promise>` in your final response only after verifying ALL criteria are satisfied.
328-
329313
## On Completion
330314
331315
1. Verify outputs are created
332-
2. Inform user: "Step 3/4 complete, outputs: templates/, tests/, README.md"
316+
2. Inform user: "integrate step 3/4 complete, outputs: templates/, tests/, README.md"
333317
3. **Continue workflow**: Use Skill tool to invoke `/add_platform.verify`
334318
335319
---

.claude/skills/add_platform.research/SKILL.md

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,14 @@
22
name: add_platform.research
33
description: "Captures CLI configuration and hooks system documentation for the new platform. Use when starting platform integration."
44
user-invocable: false
5-
hooks:
6-
Stop:
7-
- hooks:
8-
- type: prompt
9-
prompt: |
10-
Verify the research output meets ALL criteria:
11-
1. Both files exist in doc/platforms/<platform>/: cli_configuration.md and hooks_system.md
12-
2. Each file has a comment at the top with:
13-
- Last updated date
14-
- Source URL where the documentation was obtained
15-
3. cli_configuration.md covers how the platform's CLI is configured
16-
4. hooks_system.md covers hooks available for slash command definitions ONLY
17-
5. No extraneous documentation (only these two specific topics)
18-
6. Documentation is comprehensive enough to implement the platform
19-
20-
If ALL criteria are met, include `<promise>✓ Quality Criteria Met</promise>`.
215

226
---
237

248
# add_platform.research
259

26-
**Step 1/4** in **add_platform** workflow
10+
**Step 1/4** in **integrate** workflow
11+
12+
> Full workflow to integrate a new AI platform into DeepWork
2713
2814
> Adds a new AI platform to DeepWork with adapter, templates, and tests. Use when integrating Cursor, Windsurf, or other AI coding tools.
2915
@@ -226,7 +212,7 @@ Take time to be thorough - incomplete documentation will slow down subsequent st
226212

227213
A workflow for adding support for a new AI platform (like Cursor, Windsurf, etc.) to DeepWork.
228214

229-
This job guides you through four phases:
215+
The **integrate** workflow guides you through four phases:
230216
1. **Research**: Capture the platform's CLI configuration and hooks system documentation
231217
2. **Add Capabilities**: Update the job schema and adapters with any new hook events
232218
3. **Implement**: Create the platform adapter, templates, tests (100% coverage), and README updates
@@ -268,18 +254,10 @@ Use branch format: `deepwork/add_platform-[instance]-YYYYMMDD`
268254
- Do NOT proceed without required inputs; ask the user if any are missing
269255
- Do NOT modify files outside the scope of this step's defined outputs
270256

271-
## Quality Validation
272-
273-
Stop hooks will automatically validate your work. The loop continues until all criteria pass.
274-
275-
276-
277-
**To complete**: Include `<promise>✓ Quality Criteria Met</promise>` in your final response only after verifying ALL criteria are satisfied.
278-
279257
## On Completion
280258

281259
1. Verify outputs are created
282-
2. Inform user: "Step 1/4 complete, outputs: cli_configuration.md, hooks_system.md"
260+
2. Inform user: "integrate step 1/4 complete, outputs: cli_configuration.md, hooks_system.md"
283261
3. **Continue workflow**: Use Skill tool to invoke `/add_platform.add_capabilities`
284262

285263
---

0 commit comments

Comments
 (0)