-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.mise.toml
More file actions
390 lines (310 loc) · 13 KB
/
.mise.toml
File metadata and controls
390 lines (310 loc) · 13 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
389
390
# Mise Task Runner Configuration for Babylon
# https://mise.jdx.dev/
[tools]
python = "3.12"
[env]
PYTHONPATH = "src"
BABYLON_ENV = "development"
# Soundfont for MIDI conversion
SOUNDFONT = "/usr/share/sounds/sf2/FluidR3_GM.sf2"
MUSIC_DIR = "assets/music"
AUDIO_OUTPUT_DIR = "assets/audio"
# =============================================================================
# INSTALLATION
# =============================================================================
[tasks.install]
description = "Install all dependencies"
run = "poetry install --with dev"
# =============================================================================
# CODE QUALITY
# =============================================================================
[tasks.lint]
description = "Run ruff linter with auto-fix"
run = "poetry run ruff check src tests --fix"
[tasks.format]
description = "Run ruff formatter"
run = "poetry run ruff format src tests"
[tasks.typecheck]
description = "Run mypy type checker"
run = "poetry run mypy src"
[tasks.lint-yaml]
description = "Lint YAML files"
run = "poetry run yamllint -c .yamllint.yaml ."
[tasks.lint-md]
description = "Lint Markdown files"
run = "npx markdownlint --config .markdownlint.yaml '**/*.md' --ignore 'CHANGELOG.md' --ignore 'brainstorm/**' --ignore '.venv/**'"
[tasks.complexity]
description = "Show code complexity report (radon)"
run = "poetry run radon cc src/ -a -s --show-complexity"
[tasks.complexity-check]
description = "Run complexity gate (xenon) - fails if CC > 15"
run = "poetry run xenon --max-absolute C src/"
[tasks.complexity-grade]
description = "Show complexity grades summary"
run = "poetry run radon cc src/ -a -s"
[tasks.check]
description = "Run all quality checks (lint, format, typecheck, test-fast)"
depends = ["lint", "format", "typecheck", "test-fast"]
# =============================================================================
# TESTING
# =============================================================================
[tasks.test]
description = "Run all non-AI tests"
run = "poetry run pytest -m 'not ai' --tb=short"
[tasks.test-fast]
description = "Run fast math/engine tests only"
run = "poetry run pytest tests/unit/formulas tests/unit/engine -v"
[tasks.test-cov]
description = "Run tests with coverage report"
run = "poetry run pytest -m 'not ai' --cov=src/babylon --cov-report=term-missing"
[tasks.test-all]
description = "Run all tests including AI evals"
run = "poetry run pytest --tb=short"
[tasks.doctest]
description = "Run doctest examples in formulas module"
run = "poetry run pytest --doctest-modules src/babylon/systems/formulas.py -v"
# =============================================================================
# DOCUMENTATION
# =============================================================================
[tasks.docs]
description = "Build Sphinx documentation"
run = "cd docs && poetry run sphinx-build -b html . _build/html"
[tasks.docs-strict]
description = "Build docs with warnings as errors (CI mode)"
run = "cd docs && poetry run sphinx-build -W -b html . _build/html"
[tasks.docs-live]
description = "Live-reload documentation server"
run = "cd docs && poetry run sphinx-autobuild . _build/html --open-browser"
[tasks.docs-clean]
description = "Clean documentation build artifacts"
run = "rm -rf docs/_build docs/api/_autosummary"
[tasks.docs-build]
description = "Clean and build Sphinx documentation"
depends = ["docs-clean", "docs"]
[tasks.docs-pdf]
description = "Build PDF documentation (babylon-docs.pdf + babylon-commentary.pdf)"
run = """
cd docs && \
poetry run sphinx-build -b latex . _build/latex && \
cd _build/latex && \
make all-pdf
"""
[tasks.docs-pdf-single]
description = "Build a single PDF book (usage: mise run docs-pdf-single babylon-docs)"
run = """
cd docs && \
poetry run sphinx-build -b latex . _build/latex && \
cd _build/latex && \
latexmk -pdf -interaction=nonstopmode ${1:-babylon-docs}.tex
"""
# =============================================================================
# SECURITY & COVERAGE
# =============================================================================
[tasks.security]
description = "Run security audit on dependencies"
run = "poetry run pip-audit"
[tasks.coverage]
description = "Run tests with coverage report"
run = "poetry run pytest -m 'not ai' --cov=src/babylon --cov-report=term-missing"
# =============================================================================
# MUTATION TESTING (Test Quality Verification)
# =============================================================================
[tasks.mutation]
description = "Run mutation testing on simulation-critical code (~15-30 min)"
run = """
echo "🧬 Running mutation testing on critical simulation code..."
echo " Target: src/babylon/engine/systems/ and src/babylon/systems/"
echo ""
poetry run mutmut run \
--paths-to-mutate=src/babylon/engine/systems/economic.py,src/babylon/engine/systems/survival.py,src/babylon/systems/formulas.py \
--runner="poetry run pytest tests/unit/engine tests/unit/formulas -x -q --tb=no"
echo ""
echo "📊 Results:"
poetry run mutmut results
"""
[tasks.mutation-fast]
description = "Run mutation testing on formulas only (~5-10 min)"
run = """
echo "🧬 Running mutation testing on formulas..."
poetry run mutmut run \
--paths-to-mutate=src/babylon/systems/formulas.py \
--runner="poetry run pytest tests/unit/formulas -x -q --tb=no"
poetry run mutmut results
"""
[tasks.mutation-file]
description = "Run mutation testing on a specific file (usage: mise run mutation-file src/babylon/foo.py)"
run = """
if [ -z "$1" ]; then
echo "Usage: mise run mutation-file <path/to/file.py>"
exit 1
fi
echo "🧬 Running mutation testing on $1..."
poetry run mutmut run --paths-to-mutate="$1"
poetry run mutmut results
"""
[tasks.mutate]
description = "Run full mutation testing (entire src/babylon/, overnight run)"
run = "poetry run python tools/run_mutmut.py"
[tasks.mutate-critical]
description = "Run mutation testing on critical formulas only (faster, ~30 min)"
run = "poetry run python tools/run_mutmut.py --critical"
[tasks.mutate-results]
description = "Show mutation testing results summary"
run = "poetry run mutmut results"
[tasks.mutate-show]
description = "Show specific mutant details (usage: mise run mutate-show 42)"
run = "poetry run mutmut show ${1:-1}"
[tasks.mutate-html]
description = "Generate HTML report of mutation testing results"
run = "poetry run mutmut html && echo 'Report: html/index.html'"
# =============================================================================
# DATA / RAG
# =============================================================================
[tasks.ingest-corpus]
description = "Ingest Marxist corpus into ChromaDB"
run = "poetry run python tools/ingest_corpus.py"
[tasks.ingest-corpus-reset]
description = "Reset and re-ingest corpus"
run = "poetry run python tools/ingest_corpus.py --reset"
[tasks.validate-schemas]
description = "Validate JSON schemas against data files"
run = "poetry run python tools/validate_schemas.py"
[tasks.db-init]
description = "Initialize SQLite database"
run = "poetry run python tools/init_db.py"
# =============================================================================
# INTEGRATION / VERIFICATION
# =============================================================================
[tasks.vertical-slice]
description = "Run vertical slice integration test"
run = "poetry run python tools/vertical_slice.py"
[tasks.interview-persona]
description = "Test Persephone's narrative voice with Hard Case scenarios"
run = "poetry run python tools/interview_persona.py"
[tasks.verify-formulas]
description = "Verify math formula divergence"
run = "poetry run python tools/verify_math_divergence.py"
[tasks.analyze-trace]
description = "Run simulation trace with CSV + JSON output"
usage = 'arg "[ticks]" help="Number of ticks to simulate" default="200"'
run = """
mkdir -p results
poetry run python tools/parameter_analysis.py trace \
--csv results/trace.csv \
--json results/trace.json \
--ticks ${usage_ticks}
"""
[tasks.analyze-trace-csv]
description = "Run simulation trace with CSV only"
usage = 'arg "[ticks]" help="Number of ticks to simulate" default="200"'
run = """
mkdir -p results
poetry run python tools/parameter_analysis.py trace \
--csv results/trace.csv \
--ticks ${usage_ticks}
"""
[tasks.analyze-trace-json]
description = "Run simulation trace with JSON metadata only"
usage = 'arg "[ticks]" help="Number of ticks to simulate" default="200"'
run = """
mkdir -p results
poetry run python tools/parameter_analysis.py trace \
--csv /dev/null \
--json results/trace.json \
--ticks ${usage_ticks}
"""
[tasks.analyze-sweep]
description = "Run parameter sweep with rich summary metrics"
run = """
poetry run python tools/parameter_analysis.py sweep \
--param economy.extraction_efficiency \
--start 0.05 --end 0.50 --step 0.05 \
--csv results/sweep.csv
"""
[tasks.tune-params]
description = "Run parameter sensitivity analysis (sweep extraction_efficiency)"
run = "poetry run python tools/tune_parameters.py"
[tasks.tune-params-custom]
description = "Run parameter sweep with custom range (usage: mise run tune-params-custom 0.1 0.5 0.05)"
run = "poetry run python tools/tune_parameters.py --start ${1:-0.05} --end ${2:-0.50} --step ${3:-0.05}"
[tasks.narrative-sweep]
description = "Run 5-point Dialectical U-Curve analysis"
run = "poetry run python tools/narrative_sweep.py"
[tasks.narrative-sweep-mock]
description = "Run U-Curve analysis with MockLLM (no API key needed)"
run = "poetry run python tools/narrative_sweep.py --mock"
# =============================================================================
# VERSIONING
# =============================================================================
[tasks.bump]
description = "Bump version with commitizen"
run = "poetry run cz bump --changelog"
[tasks.bump-dry]
description = "Preview version bump without changes"
run = "poetry run cz bump --dry-run"
# =============================================================================
# CI / HOOKS
# =============================================================================
[tasks.ci]
description = "Quick CI check (lint, typecheck, fast tests)"
depends = ["lint", "format", "typecheck", "test-fast"]
[tasks.hooks]
description = "Install pre-commit hooks"
run = "poetry run pre-commit install --hook-type commit-msg --hook-type pre-commit"
[tasks.hooks-run]
description = "Run all pre-commit hooks on all files"
run = "poetry run pre-commit run --all-files"
# =============================================================================
# UTILITIES
# =============================================================================
[tasks.clean]
description = "Clean build artifacts and caches"
run = """
rm -rf .pytest_cache .mypy_cache .ruff_cache
rm -rf dist build *.egg-info
rm -rf .coverage htmlcov
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
echo "Cleaned!"
"""
# =============================================================================
# MUSIC GENERATION & CONVERSION
# =============================================================================
[tasks.midi-to-wav]
description = "Convert a MIDI file to WAV using FluidSynth"
run = "tools/scripts/midi-to-wav.sh"
[tasks.midi-to-mp3]
description = "Convert a MIDI file to MP3 (requires ffmpeg)"
run = "tools/scripts/midi-to-mp3.sh"
[tasks.midi-to-ogg]
description = "Convert a MIDI file to OGG Vorbis (good for games)"
run = "tools/scripts/midi-to-ogg.sh"
[tasks.midi-convert-all]
description = "Convert all MIDI files to specified format (wav|mp3|ogg)"
run = "tools/scripts/midi-convert-all.sh"
[tasks.midi-play]
description = "Play a MIDI file through speakers using FluidSynth"
run = "tools/scripts/midi-play.sh"
[tasks.midi-list]
description = "List all MIDI files in the music directory"
run = "find $MUSIC_DIR -name '*.mid' -printf ' %P\\n' | sort && echo '' && echo \"Total: $(find $MUSIC_DIR -name '*.mid' | wc -l) files\""
[tasks.midi-generate-fascist]
description = "Generate all fascist faction MIDI tracks"
run = "cd tools/fascist_soundtrack && for f in generate_*.py; do echo \"Generating: $f\"; poetry run python \"$f\"; done"
# =============================================================================
# SOUNDFONT
# =============================================================================
[tasks.soundfont-list]
description = "List available soundfonts on the system"
run = "find /usr/share/sounds -name '*.sf2' -o -name '*.sf3' 2>/dev/null"
[tasks.soundfont-info]
description = "Show info about the current soundfont"
run = "echo \"Current: $SOUNDFONT\" && ls -lh \"$SOUNDFONT\""
# =============================================================================
# UI / DASHBOARD
# =============================================================================
[tasks.ui]
description = "Launch the Synopticon debug dashboard (NiceGUI)"
run = "poetry run python src/babylon/ui/main.py"
[tasks.ui-dev]
description = "Launch dashboard with auto-reload for development"
run = "poetry run python -c \"from nicegui import ui; from babylon.ui.main import main_page, init_simulation; init_simulation(); ui.run(main_page, title='Babylon v0.3', dark=True, reload=True, port=6969)\""