Skip to content

Commit bcadd14

Browse files
authored
Merge branch 'main' into deepwork/deepwork_jobs-add-platform-20260112
2 parents 2680c89 + 32b82eb commit bcadd14

6 files changed

Lines changed: 9 additions & 71 deletions

File tree

.github/workflows/validate.yml

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@ on:
44
pull_request:
55
branches: ["*"]
66

7-
permissions:
8-
contents: write
9-
107
jobs:
11-
format:
8+
tests:
129
runs-on: ubuntu-latest
1310

1411
steps:
1512
- uses: actions/checkout@v4
16-
with:
17-
ref: ${{ github.head_ref }}
18-
token: ${{ secrets.GITHUB_TOKEN }}
1913

2014
- name: Install uv
2115
uses: astral-sh/setup-uv@v4
@@ -30,56 +24,10 @@ jobs:
3024
- name: Install dependencies
3125
run: uv sync --extra dev
3226

33-
- name: Run ruff formatting
34-
run: uv run ruff format src/ tests/
35-
36-
- name: Run ruff linting with auto-fix
37-
run: uv run ruff check --fix src/ tests/
38-
39-
- name: Re-run formatting after auto-fix
40-
run: uv run ruff format src/ tests/
41-
42-
- name: Verify all issues are fixed
27+
- name: Check formatting (ruff)
4328
run: |
44-
uv run ruff check src/ tests/
4529
uv run ruff format --check src/ tests/
46-
47-
- name: Check for changes
48-
id: check_changes
49-
run: |
50-
if [[ -n "$(git status --porcelain)" ]]; then
51-
echo "has_changes=true" >> $GITHUB_OUTPUT
52-
else
53-
echo "has_changes=false" >> $GITHUB_OUTPUT
54-
fi
55-
56-
- name: Commit and push formatting changes
57-
if: steps.check_changes.outputs.has_changes == 'true'
58-
run: |
59-
git config --local user.email "github-actions[bot]@users.noreply.github.com"
60-
git config --local user.name "github-actions[bot]"
61-
git add -A
62-
git commit -m "style: auto-format code with ruff"
63-
git push
64-
65-
tests:
66-
runs-on: ubuntu-latest
67-
68-
steps:
69-
- uses: actions/checkout@v4
70-
71-
- name: Install uv
72-
uses: astral-sh/setup-uv@v4
73-
with:
74-
version: "latest"
75-
76-
- name: Set up Python
77-
uses: actions/setup-python@v5
78-
with:
79-
python-version: "3.11"
80-
81-
- name: Install dependencies
82-
run: uv sync --extra dev
30+
uv run ruff check src/ tests/
8331
8432
- name: Run tests
8533
run: uv run pytest tests/ -v

src/deepwork/core/adapters.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ def get(cls, name: str) -> type[AgentAdapter]:
103103
"""
104104
if name not in cls._registry:
105105
raise AdapterError(
106-
f"Unknown adapter '{name}'. "
107-
f"Supported adapters: {', '.join(cls._registry.keys())}"
106+
f"Unknown adapter '{name}'. Supported adapters: {', '.join(cls._registry.keys())}"
108107
)
109108
return cls._registry[name]
110109

src/deepwork/core/generator.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,7 @@ def _is_standalone_step(self, job: JobDefinition, step: Step) -> bool:
8383

8484
return True
8585

86-
def _build_hook_context(
87-
self, job: JobDefinition, hook_action: Any
88-
) -> dict[str, Any]:
86+
def _build_hook_context(self, job: JobDefinition, hook_action: Any) -> dict[str, Any]:
8987
"""
9088
Build context for a single hook action.
9189
@@ -177,8 +175,7 @@ def _build_step_context(
177175

178176
# Backward compatibility: stop_hooks is after_agent hooks
179177
stop_hooks = hooks.get(
180-
adapter.get_platform_hook_name(CommandLifecycleHook.AFTER_AGENT) or "Stop",
181-
[]
178+
adapter.get_platform_hook_name(CommandLifecycleHook.AFTER_AGENT) or "Stop", []
182179
)
183180

184181
return {

src/deepwork/core/parser.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ def from_dict(cls, data: dict[str, Any]) -> "Step":
132132
if "stop_hooks" in data and data["stop_hooks"]:
133133
# Merge with any existing after_agent hooks
134134
after_agent_hooks = hooks.get("after_agent", [])
135-
after_agent_hooks.extend(
136-
[HookAction.from_dict(h) for h in data["stop_hooks"]]
137-
)
135+
after_agent_hooks.extend([HookAction.from_dict(h) for h in data["stop_hooks"]])
138136
hooks["after_agent"] = after_agent_hooks
139137

140138
return cls(

tests/unit/test_adapters.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,7 @@ def test_sync_hooks_merges_with_existing(self, temp_dir: Path) -> None:
156156

157157
adapter = ClaudeAdapter(temp_dir)
158158
hooks = {
159-
"PreToolUse": [
160-
{"matcher": "", "hooks": [{"type": "command", "command": "test.sh"}]}
161-
]
159+
"PreToolUse": [{"matcher": "", "hooks": [{"type": "command", "command": "test.sh"}]}]
162160
}
163161

164162
adapter.sync_hooks(temp_dir, hooks)

tests/unit/test_stop_hooks.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,7 @@ def test_build_context_with_prompt_hook(
485485
) -> None:
486486
"""Test context building includes prompt stop hook."""
487487
adapter = ClaudeAdapter()
488-
context = generator._build_step_context(
489-
job_with_hooks, job_with_hooks.steps[0], 0, adapter
490-
)
488+
context = generator._build_step_context(job_with_hooks, job_with_hooks.steps[0], 0, adapter)
491489
assert "stop_hooks" in context
492490
assert len(context["stop_hooks"]) == 1
493491
assert context["stop_hooks"][0]["type"] == "prompt"

0 commit comments

Comments
 (0)