Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
388 lines (343 loc) · 12.2 KB
/
Copy pathTaskfile.yml
File metadata and controls
388 lines (343 loc) · 12.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
version: '3'
set: ['pipefail']
vars:
PYTEST_TMPDIR: '{{if eq OS "linux"}}/dev/shm/pytest-tmp-{{else}}/tmp/pytest-tmp-{{end}}{{ substr 0 8 (sha256sum .ROOT_DIR) }}'
PYTEST_CACHEDIR: '{{if eq OS "linux"}}/dev/shm/pytest-cache-{{else}}/tmp/pytest-cache-{{end}}{{ substr 0 8 (sha256sum .ROOT_DIR) }}'
tasks:
_tmpdir-setup:
internal: true
desc: Wipe and recreate pytest tmpdir so each run starts clean (platform-aware)
cmds:
- rm -rf {{.PYTEST_TMPDIR}}
- mkdir -p {{.PYTEST_TMPDIR}} {{.PYTEST_CACHEDIR}}
test-all:
desc: Run all tests with parallel workers
deps: [install-worktree, _tmpdir-setup]
env:
PYTHONDONTWRITEBYTECODE: "1"
OMP_NUM_THREADS: "1"
TMPDIR: "{{.PYTEST_TMPDIR}}"
cmds:
- |
mkdir -p temp
TEST_OUTPUT="temp/test-$(date +%Y-%m-%d_%H%M%S).txt"
echo "Running all tests with -n 4"
echo "Output: $TEST_OUTPUT"
if [[ -d ".venv" ]]; then
.venv/bin/lint-imports
PYTEST_CMD=".venv/bin/python -m pytest"
else
lint-imports
PYTEST_CMD="pytest"
fi
set -o pipefail
set +e
$PYTEST_CMD tests/ -q --tb=short -n 4 -m "not smoke and not canary" --disable-warnings -o "addopts=" --basetemp={{.PYTEST_TMPDIR}} -o "cache_dir={{.PYTEST_CACHEDIR}}" 2>&1 | tee "$TEST_OUTPUT"
PYTEST_EXIT=$?
set +o pipefail
set -e
echo ""
echo "Test output saved to: $TEST_OUTPUT"
exit $PYTEST_EXIT
test-check:
desc: Run all tests and return unambiguous PASS/FAIL (for automation)
deps: [install-worktree, _tmpdir-setup]
env:
PYTHONDONTWRITEBYTECODE: "1"
OMP_NUM_THREADS: "1"
TMPDIR: "{{.PYTEST_TMPDIR}}"
cmds:
- |
mkdir -p temp
TEST_OUTPUT="temp/test-$(date +%Y-%m-%d_%H%M%S).txt"
if [[ -d ".venv" ]]; then
PYTEST_CMD=".venv/bin/python -m pytest"
else
PYTEST_CMD="pytest"
fi
set -o pipefail
set +e
$PYTEST_CMD tests/ -q --tb=short -n 4 -m "not smoke and not canary" --disable-warnings -o "addopts=" --basetemp={{.PYTEST_TMPDIR}} -o "cache_dir={{.PYTEST_CACHEDIR}}" 2>&1 | tee "$TEST_OUTPUT"
PYTEST_EXIT=$?
set +o pipefail
set -e
echo ""
echo "Test output saved to: $TEST_OUTPUT"
if [ "$PYTEST_EXIT" -ne 0 ]; then
echo ""
echo "TEST_RESULT=FAIL"
echo "PYTEST_EXIT_CODE=$PYTEST_EXIT"
exit 1
else
echo ""
echo "TEST_RESULT=PASS"
exit 0
fi
test-filtered:
desc: Run path-filtered tests (delegates to test-check with filter env passthrough)
cmds:
- |
export AUTOSKILLIT_TEST_FILTER="${AUTOSKILLIT_TEST_FILTER:-conservative}"
task test-check
coverage-audit:
desc: "Run pytest with coverage collection and compare against AST-derived function map"
deps: [install-worktree, _tmpdir-setup]
env:
PYTHONDONTWRITEBYTECODE: "1"
OMP_NUM_THREADS: "1"
TMPDIR: "{{.PYTEST_TMPDIR}}"
cmds:
- |
mkdir -p temp
if [[ -d ".venv" ]]; then
PYTEST_CMD=".venv/bin/python -m pytest"
PYTHON=".venv/bin/python"
else
PYTEST_CMD="pytest"
PYTHON="python"
fi
set +e
$PYTEST_CMD tests/ -q --tb=short \
-n 4 \
-m "not smoke and not canary" \
--disable-warnings \
-o "addopts=" \
--basetemp="{{.PYTEST_TMPDIR}}" \
-o "cache_dir={{.PYTEST_CACHEDIR}}" \
--cov=src/autoskillit \
--cov-context=test \
--cov-branch \
--cov-report=term-missing:skip-covered \
--cov-report=
set -e
echo ""
echo "--- Coverage AST Comparison ---"
$PYTHON scripts/compare-coverage-ast.py \
--coverage-db .coverage \
--output "temp/coverage-audit-$(date +%Y%m%d-%H%M%S).json"
echo ""
echo "--- Building test-source map ---"
$PYTHON scripts/compare-coverage-ast.py \
--mode build-test-source-map \
--coverage-db .coverage \
--output ".autoskillit/test-source-map.json"
test-smoke:
desc: Run smoke tests (requires ANTHROPIC_API_KEY)
deps: [_tmpdir-setup]
env:
PYTHONDONTWRITEBYTECODE: "1"
OMP_NUM_THREADS: "1"
SMOKE_TEST: "1"
TMPDIR: "{{.PYTEST_TMPDIR}}"
cmds:
- |
mkdir -p temp
TEST_OUTPUT="temp/smoke-$(date +%Y-%m-%d_%H%M%S).txt"
echo "Running smoke tests"
echo "Output: $TEST_OUTPUT"
if [[ -d ".venv" ]]; then
PYTEST_CMD=".venv/bin/python -m pytest"
else
PYTEST_CMD="pytest"
fi
set -o pipefail
set +e
$PYTEST_CMD tests/server/test_smoke_pipeline.py -m smoke -v --tb=short -o "addopts=" --basetemp={{.PYTEST_TMPDIR}} -o "cache_dir={{.PYTEST_CACHEDIR}}" 2>&1 | tee "$TEST_OUTPUT"
PYTEST_EXIT=$?
set +o pipefail
set -e
echo ""
echo "Smoke test output saved to: $TEST_OUTPUT"
exit $PYTEST_EXIT
test-smoke-research:
desc: Run research recipe smoke tests (requires ANTHROPIC_API_KEY)
deps: [_tmpdir-setup]
env:
PYTHONDONTWRITEBYTECODE: "1"
OMP_NUM_THREADS: "1"
RESEARCH_SMOKE_TEST: "1"
TMPDIR: "{{.PYTEST_TMPDIR}}"
preconditions:
- sh: test -n "$ANTHROPIC_API_KEY"
msg: "ANTHROPIC_API_KEY must be set"
cmds:
- |
mkdir -p temp
TEST_OUTPUT="temp/smoke-research-$(date +%Y-%m-%d_%H%M%S).txt"
echo "Running research smoke tests"
echo "Output: $TEST_OUTPUT"
if [[ -d ".venv" ]]; then
PYTEST_CMD=".venv/bin/python -m pytest"
else
PYTEST_CMD="pytest"
fi
set -o pipefail
set +e
$PYTEST_CMD tests/server/test_research_smoke_pipeline.py -m smoke -v --tb=short -o "addopts=" --basetemp={{.PYTEST_TMPDIR}} -o "cache_dir={{.PYTEST_CACHEDIR}}" 2>&1 | tee "$TEST_OUTPUT"
PYTEST_EXIT=$?
set +o pipefail
set -e
echo ""
echo "Research smoke test output saved to: $TEST_OUTPUT"
exit $PYTEST_EXIT
test-smoke-record:
desc: Record smoke test scenario by running autoskillit order with recording enabled
env:
RECORD_SCENARIO: "1"
RECORD_SCENARIO_DIR: '{{.RECORD_SCENARIO_DIR | default "tests/fixtures/scenarios/smoke-happy"}}'
RECORD_SCENARIO_RECIPE: "smoke-test"
cmds:
- |
mkdir -p "$RECORD_SCENARIO_DIR"
echo "Recording smoke-test scenario"
echo " RECORD_SCENARIO_DIR=$RECORD_SCENARIO_DIR"
echo ""
autoskillit order smoke-test
check-docs:
desc: Verify documentation counts match source code
cmds:
- python scripts/check_doc_counts.py
sync-versions:
desc: Sync all version-bearing files from pyproject.toml
cmds:
- python scripts/sync_versions.py
sync-hooks-hash:
desc: "Regenerate src/autoskillit/hooks/registry.sha256 from the live HOOK_REGISTRY"
cmds:
- uv run python -c "from autoskillit.hook_registry import HOOK_REGISTRY_HASH, HOOKS_DIR; (HOOKS_DIR / 'registry.sha256').write_text(HOOK_REGISTRY_HASH + '\n')"
compile-recipes:
desc: Pre-compile bundled recipe YAML files to JSON
cmds:
- uv run python scripts/compile_recipes.py
install-worktree:
desc: Set up development environment (isolated venv in worktrees, direct install in main)
deps: [compile-recipes]
status:
- test -x .venv/bin/python
- uv sync --check --all-extras 2>/dev/null
cmds:
- |
# Detect if we're in a git worktree (worktrees have .git as a file, not a directory)
if [[ -f ".git" ]]; then
echo "Worktree detected — creating isolated venv"
uv venv --clear .venv
uv pip install -e '.[dev]' --python .venv/bin/python
elif [[ -d ".venv" ]]; then
echo "Main directory — installing into existing venv"
uv pip install -e '.[dev]' --python .venv/bin/python
else
echo "Main directory — creating venv and installing"
uv venv --clear .venv
uv pip install -e '.[dev]' --python .venv/bin/python
fi
echo "Done: $(.venv/bin/python --version)"
install-dev:
desc: Install dev version of autoskillit from the develop branch
cmds:
- uv tool install --force "autoskillit[dev] @ git+https://github.com/TalonT-Org/AutoSkillit.git@develop"
- "$(uv tool dir)/autoskillit/bin/autoskillit install"
vendor-mermaid:
desc: Download latest mermaid v11 UMD bundle to src/autoskillit/assets/mermaid/
cmds:
- mkdir -p src/autoskillit/assets/mermaid
- |
VERSION=$(curl -sfL https://unpkg.com/mermaid@11/package.json \
| python3 -c "import sys, json; print(json.load(sys.stdin)['version'])")
echo "Fetching mermaid ${VERSION}..."
curl -sfL "https://unpkg.com/mermaid@${VERSION}/dist/mermaid.min.js" \
-o src/autoskillit/assets/mermaid/mermaid.min.js
echo "${VERSION}" > src/autoskillit/assets/mermaid/VERSION
echo "Vendored mermaid ${VERSION} ($(wc -c < src/autoskillit/assets/mermaid/mermaid.min.js) bytes)"
testmon-build:
desc: Build .testmondata DB by running full suite with testmon (serial, no xdist)
deps: [install-worktree, _tmpdir-setup]
env:
PYTHONDONTWRITEBYTECODE: "1"
OMP_NUM_THREADS: "1"
TMPDIR: "{{.PYTEST_TMPDIR}}"
AUTOSKILLIT_TEST_FILTER: "none"
cmds:
- |
mkdir -p temp
echo "Building .testmondata (serial run — this will take a while)"
if [[ -d ".venv" ]]; then
PYTEST_CMD=".venv/bin/python -m pytest"
else
PYTEST_CMD="pytest"
fi
set -o pipefail
set +e
$PYTEST_CMD tests/ -q --tb=short --testmon \
-m "not smoke and not canary" \
--disable-warnings -o "addopts=" \
--basetemp={{.PYTEST_TMPDIR}} \
-o "cache_dir={{.PYTEST_CACHEDIR}}" \
2>&1 | tee "temp/testmon-build-$(date +%Y-%m-%d_%H%M%S).txt"
PYTEST_EXIT=$?
set +o pipefail
set -e
if [ -f ".testmondata" ]; then
SIZE=$(du -h .testmondata | cut -f1)
echo ""
echo ".testmondata built successfully: $SIZE"
else
echo ""
echo "WARNING: .testmondata was not created"
fi
exit $PYTEST_EXIT
testmon-run:
desc: Run tests incrementally with testmon selection (requires prior testmon-build)
deps: [install-worktree, _tmpdir-setup]
env:
PYTHONDONTWRITEBYTECODE: "1"
OMP_NUM_THREADS: "1"
TMPDIR: "{{.PYTEST_TMPDIR}}"
AUTOSKILLIT_TEST_FILTER: "none"
cmds:
- |
mkdir -p temp
if [ ! -f ".testmondata" ]; then
echo "ERROR: .testmondata not found. Run 'task testmon-build' first."
exit 1
fi
if [[ -d ".venv" ]]; then
PYTEST_CMD=".venv/bin/python -m pytest"
else
PYTEST_CMD="pytest"
fi
XDIST_FLAGS=""
if [ "${TESTMON_XDIST:-0}" = "1" ]; then
XDIST_FLAGS="-n 4"
echo "Running testmon with xdist (-n 4)"
else
echo "Running testmon serial (set TESTMON_XDIST=1 for parallel)"
fi
set -o pipefail
set +e
$PYTEST_CMD tests/ -q --tb=short --testmon $XDIST_FLAGS \
-m "not smoke and not canary" \
--disable-warnings -o "addopts=" \
--basetemp={{.PYTEST_TMPDIR}} \
-o "cache_dir={{.PYTEST_CACHEDIR}}" \
2>&1 | tee "temp/testmon-run-$(date +%Y-%m-%d_%H%M%S).txt"
PYTEST_EXIT=$?
set +o pipefail
set -e
exit $PYTEST_EXIT
testmon-benchmark:
desc: Compare testmon selection vs cascade selection for changed files
deps: [install-worktree]
cmds:
- |
if [ ! -f ".testmondata" ]; then
echo "ERROR: .testmondata not found. Run 'task testmon-build' first."
exit 1
fi
if [[ -d ".venv" ]]; then
PYTHON=".venv/bin/python"
else
PYTHON="python"
fi
$PYTHON scripts/benchmark-testmon.py \
--mode="${TESTMON_BENCH_MODE:-compare}" \
${TESTMON_CHANGED_FILES:+--changed-files="$TESTMON_CHANGED_FILES"}