-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTaskfile.yml
More file actions
411 lines (407 loc) · 16.4 KB
/
Taskfile.yml
File metadata and controls
411 lines (407 loc) · 16.4 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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
version: '1'
name: code2llm
description: Minimal Taskfile
variables:
APP_NAME: code2llm
environments:
local:
container_runtime: docker
compose_command: docker compose
pipeline:
python_version: "3.12"
runner_image: ubuntu-latest
branches: [main]
cache: [~/.cache/pip]
artifacts: [dist/]
stages:
- name: lint
tasks: [lint]
- name: test
tasks: [test]
- name: build
tasks: [build]
when: "branch:main"
tasks:
install:
desc: Install Python dependencies (editable)
cmds:
- pip install -e .[dev]
test:
desc: Run pytest suite
cmds:
- pytest -q
build:
desc: Build wheel + sdist
cmds:
- python -m build
clean:
desc: Remove build artefacts
cmds:
- rm -rf build/ dist/ *.egg-info
help:
desc: '[imported from Makefile] help'
cmds:
- echo "code2llm - Python Code Flow Analysis Tool with LLM Integration and TOON
Format"
- echo ""
- "echo \"\U0001F680 Installation:\""
- echo " make install - Install package"
- echo " make dev-install - Install with development dependencies"
- echo ""
- "echo \"\U0001F9EA Testing:\""
- echo " make test - Run test suite"
- echo " make test-toon - Test TOON format only"
- echo " make validate-toon - Validate TOON format output"
- echo " make test-all-formats - Test all output formats"
- echo ""
- "echo \"\U0001F527 Code Quality:\""
- echo " make lint - Run linters (flake8, black --check)"
- echo " make format - Format code with black"
- echo " make typecheck - Run mypy type checking"
- echo " make check - Run all quality checks"
- echo ""
- "echo \"\U0001F4CA Analysis:\""
- echo " make analyze - Run analysis on current project (TOON format)"
- echo " make run - Run with example arguments"
- echo " make analyze-all - Run analysis with all formats"
- echo ""
- "echo \"\U0001F3AF TOON Format:\""
- echo " make toon-demo - Quick TOON format demo"
- echo " make toon-compare - Compare TOON vs YAML formats"
- echo " make toon-validate - Validate TOON format structure"
- echo ""
- "echo \"\U0001F4E6 Building & Release:\""
- echo " make build - Build distribution packages"
- echo " make publish - Publish to PyPI (with version bump)"
- echo " make publish-test - Publish to TestPyPI"
- echo " make bump-patch - Bump patch version"
- echo " make bump-minor - Bump minor version"
- echo " make bump-major - Bump major version"
- echo ""
- "echo \"\U0001F3A8 Visualization:\""
- echo " make mermaid-png - Generate PNG from all Mermaid files"
- echo " make install-mermaid - Install Mermaid CLI renderer"
- echo " make check-mermaid - Check available Mermaid renderers"
- echo ""
- "echo \"\U0001F9F9 Maintenance:\""
- echo " make clean - Remove build artifacts"
- echo " make clean-png - Clean PNG files"
- echo ""
dev-install:
desc: '[imported from Makefile] dev-install'
cmds:
- $(PYTHON) -m pip install -e ".[dev]"
- "echo \"\u2713 code2llm installed with dev dependencies\""
test-cov:
desc: '[imported from Makefile] test-cov'
cmds:
- $(PYTHON) -m pytest tests/ --cov=code2llm --cov-report=html --cov-report=term
2>/dev/null || echo "No tests yet"
test-toon:
desc: '[imported from Makefile] test-toon'
cmds:
- "echo \"\U0001F3AF Testing TOON format...\""
- $(PYTHON) -m code2llm ./ -v -o ./test_toon -m hybrid -f toon
- $(PYTHON) validate_toon.py test_toon/analysis.toon
- "echo \"\u2713 TOON format test complete\""
validate-toon:
desc: '[imported from Makefile] validate-toon'
deps:
- test-toon
test-all-formats:
desc: '[imported from Makefile] test-all-formats'
cmds:
- "echo \"\U0001F4CA Testing all output formats...\""
- $(PYTHON) -m code2llm ./ -v -o ./test_all -m hybrid -f all
- $(PYTHON) validate_toon.py test_all/analysis.toon
- "echo \"\u2713 All formats test complete\""
test-comprehensive:
desc: '[imported from Makefile] test-comprehensive'
cmds:
- "echo \"\U0001F680 Running comprehensive test suite...\""
- bash project.sh
- "echo \"\u2713 Comprehensive tests complete\""
lint:
desc: '[imported from Makefile] lint'
cmds:
- $(PYTHON) -m flake8 code2llm/ --max-line-length=100 --ignore=E203,W503 2>/dev/null
|| echo "flake8 not installed"
- $(PYTHON) -m black --check code2llm/ 2>/dev/null || echo "black not installed"
- "echo \"\u2713 Linting complete\""
format:
desc: '[imported from Makefile] format'
cmds:
- '$(PYTHON) -m black code2llm/ --line-length=100 2>/dev/null || echo "black not
installed, run: pip install black"'
- "echo \"\u2713 Code formatted\""
typecheck:
desc: '[imported from Makefile] typecheck'
cmds:
- $(PYTHON) -m mypy code2llm/ --ignore-missing-imports 2>/dev/null || echo "mypy
not installed"
check:
desc: '[imported from Makefile] check'
cmds:
- "echo \"\u2713 All checks passed\""
deps:
- lint
- typecheck
- test
run:
desc: '[imported from Makefile] run'
cmds:
- $(PYTHON) -m code2llm ../python/stts_core -v -o ./output
analyze:
desc: '[imported from Makefile] analyze'
cmds:
- "echo \"\U0001F3AF Running TOON format analysis on current project...\""
- $(PYTHON) -m code2llm ./ -v -o ./analysis -m hybrid -f toon
- $(PYTHON) validate_toon.py analysis/analysis.toon
- "echo \"\u2713 TOON analysis complete - check analysis/analysis.toon\""
analyze-all:
desc: '[imported from Makefile] analyze-all'
cmds:
- "echo \"\U0001F4CA Running analysis with all formats...\""
- $(PYTHON) -m code2llm ./ -v -o ./analysis_all -m hybrid -f all
- $(PYTHON) validate_toon.py analysis_all/analysis.toon
- "echo \"\u2713 All formats analysis complete - check analysis_all/\""
toon-demo:
desc: '[imported from Makefile] toon-demo'
cmds:
- "echo \"\U0001F3AF Quick TOON format demo...\""
- $(PYTHON) -m code2llm ./ -v -o ./demo -m hybrid -f toon
- "echo \"\U0001F4C1 Generated: demo/analysis.toon\""
- "echo \"\U0001F4CA Size: $$(du -h demo/analysis.toon | cut -f1)\""
- "echo \"\U0001F50D Preview:\""
- head -20 demo/analysis.toon
toon-compare:
desc: '[imported from Makefile] toon-compare'
cmds:
- "echo \"\U0001F4CA Comparing TOON vs YAML formats...\""
- $(PYTHON) -m code2llm ./ -v -o ./compare -m hybrid -f toon,yaml
- "echo \"\U0001F4C1 Files generated:\""
- 'echo " - TOON: compare/analysis.toon ($$(du -h compare/analysis.toon | cut
-f1))"'
- 'echo " - YAML: compare/analysis.yaml ($$(du -h compare/analysis.yaml | cut
-f1))"'
- 'echo " - Ratio: $$(echo "scale=1; $$(du -k compare/analysis.yaml | cut -f1)
/ $$(du -k compare/analysis.toon | cut -f1)" | bc)x smaller"'
- $(PYTHON) validate_toon.py compare/analysis.yaml compare/analysis.toon
toon-validate:
desc: '[imported from Makefile] toon-validate'
cmds:
- "echo \"\U0001F50D Validating TOON format structure...\""
- $(PYTHON) validate_toon.py analysis/analysis.toon 2>/dev/null || $(PYTHON) validate_toon.py
test_toon/analysis.toon 2>/dev/null || echo "Run 'make test-toon' first"
publish-test:
desc: '[imported from Makefile] publish-test'
cmds:
- "echo \"\U0001F680 Publishing to TestPyPI...\""
- $(PYTHON) -m venv publish-test-env
- publish-test-env/bin/pip install twine
- publish-test-env/bin/python -m twine upload --repository testpypi dist/*
- rm -rf publish-test-env
- "echo \"\u2713 Published to TestPyPI\""
deps:
- build
bump-patch:
desc: '[imported from Makefile] bump-patch'
cmds:
- "echo \"\U0001F522 Bumping patch version...\""
- $(PYTHON) scripts/bump_version.py patch 2>/dev/null || echo "Create scripts/bump_version.py
or edit pyproject.toml manually"
bump-minor:
desc: '[imported from Makefile] bump-minor'
cmds:
- "echo \"\U0001F522 Bumping minor version...\""
- $(PYTHON) scripts/bump_version.py minor 2>/dev/null || echo "Create scripts/bump_version.py
or edit pyproject.toml manually"
bump-major:
desc: '[imported from Makefile] bump-major'
cmds:
- "echo \"\U0001F522 Bumping major version...\""
- $(PYTHON) scripts/bump_version.py major 2>/dev/null || echo "Create scripts/bump_version.py
or edit pyproject.toml manually"
publish:
desc: '[imported from Makefile] publish'
cmds:
- "echo \"\U0001F680 Publishing to PyPI...\""
- "echo \"\U0001F522 Bumping patch version...\""
- $(MAKE) bump-patch
- "echo \"\U0001F528 Rebuilding package with new version...\""
- $(MAKE) build
- "echo \"\U0001F4E6 Publishing to PyPI...\""
- $(PYTHON) -m venv publish-env
- publish-env/bin/pip install twine
- publish-env/bin/python -m twine upload dist/*
- rm -rf publish-env
- "echo \"\u2713 Published to PyPI\""
deps:
- build
mermaid-png:
desc: '[imported from Makefile] mermaid-png'
cmds:
- $(PYTHON) mermaid_to_png.py --batch output output
install-mermaid:
desc: '[imported from Makefile] install-mermaid'
cmds:
- npm install -g @mermaid-js/mermaid-cli
check-mermaid:
desc: '[imported from Makefile] check-mermaid'
cmds:
- echo "Checking available Mermaid renderers..."
- "which mmdc > /dev/null && echo \"\u2713 mmdc (mermaid-cli)\" || echo \"\u2717\
\ mmdc (run: npm install -g @mermaid-js/mermaid-cli)\""
- "which npx > /dev/null && echo \"\u2713 npx (for @mermaid-js/mermaid-cli)\"\
\ || echo \"\u2717 npx (install Node.js)\""
- "which puppeteer > /dev/null && echo \"\u2713 puppeteer\" || echo \"\u2717 puppeteer\
\ (run: npm install -g puppeteer)\""
clean-png:
desc: '[imported from Makefile] clean-png'
cmds:
- rm -f output/*.png
- "echo \"\u2713 Cleaned PNG files\""
quickstart:
desc: '[imported from Makefile] quickstart'
cmds:
- "echo \"\U0001F680 Quick Start with code2llm TOON format:\""
- echo ""
- 'echo "1. Install: make install"'
- 'echo "2. Test TOON: make test-toon"'
- 'echo "3. Analyze: make analyze"'
- 'echo "4. Compare: make toon-compare"'
- 'echo "5. All formats: make test-all-formats"'
- echo ""
- "echo \"\U0001F4D6 For more: make help\""
health:
desc: '[from doql] workflow: health'
cmds:
- docker compose ps
- docker compose exec app echo "Health check passed"
import-makefile-hint:
desc: '[from doql] workflow: import-makefile-hint'
cmds:
- 'echo ''Run: taskfile import Makefile to import existing targets.'''
all:
desc: Run install, lint, test
cmds:
- taskfile run install
- taskfile run lint
- taskfile run test
fmt:
desc: Auto-format with ruff
cmds:
- ruff format .
sumd:
desc: Generate SUMD (Structured Unified Markdown Descriptor) for AI-aware project description
cmds:
- |
echo "# $(basename $(pwd))" > SUMD.md
echo "" >> SUMD.md
echo "$(python3 -c "import tomllib; f=open('pyproject.toml','rb'); d=tomllib.load(f); print(d.get('project',{}).get('description','Project description'))" 2>/dev/null || echo 'Project description')" >> SUMD.md
echo "" >> SUMD.md
echo "## Contents" >> SUMD.md
echo "" >> SUMD.md
echo "- [Metadata](#metadata)" >> SUMD.md
echo "- [Architecture](#architecture)" >> SUMD.md
echo "- [Dependencies](#dependencies)" >> SUMD.md
echo "- [Source Map](#source-map)" >> SUMD.md
echo "- [Intent](#intent)" >> SUMD.md
echo "" >> SUMD.md
echo "## Metadata" >> SUMD.md
echo "" >> SUMD.md
echo "- **name**: \`$(basename $(pwd))\`" >> SUMD.md
echo "- **version**: \`$(python3 -c "import tomllib; f=open('pyproject.toml','rb'); d=tomllib.load(f); print(d.get('project',{}).get('version','unknown'))" 2>/dev/null || echo 'unknown')\`" >> SUMD.md
echo "- **python_requires**: \`>=$(python3 --version 2>/dev/null | cut -d' ' -f2 | cut -d. -f1,2)\`" >> SUMD.md
echo "- **license**: $(python3 -c "import tomllib; f=open('pyproject.toml','rb'); d=tomllib.load(f); print(d.get('project',{}).get('license',{}).get('text','MIT'))" 2>/dev/null || echo 'MIT')" >> SUMD.md
echo "- **ecosystem**: SUMD + DOQL + testql + taskfile" >> SUMD.md
echo "- **generated_from**: pyproject.toml, Taskfile.yml, Makefile, src/" >> SUMD.md
echo "" >> SUMD.md
echo "## Architecture" >> SUMD.md
echo "" >> SUMD.md
echo '```' >> SUMD.md
echo "SUMD (description) → DOQL/source (code) → taskfile (automation) → testql (verification)" >> SUMD.md
echo '```' >> SUMD.md
echo "" >> SUMD.md
echo "## Source Map" >> SUMD.md
echo "" >> SUMD.md
find . -name '*.py' -not -path './.venv/*' -not -path './venv/*' -not -path './__pycache__/*' -not -path './.git/*' | head -50 | sed 's|^./||' | sed 's|^|- |' >> SUMD.md
echo "Generated SUMD.md"
- |
python3 -c "
import json, os, subprocess
from pathlib import Path
project_name = Path.cwd().name
py_files = list(Path('.').rglob('*.py'))
py_files = [f for f in py_files if not any(x in str(f) for x in ['.venv', 'venv', '__pycache__', '.git'])]
data = {
'project_name': project_name,
'description': 'SUMD - Structured Unified Markdown Descriptor for AI-aware project refactorization',
'files': [{'path': str(f), 'type': 'python'} for f in py_files[:100]]
}
with open('sumd.json', 'w') as f:
json.dump(data, f, indent=2)
print('Generated sumd.json')
" 2>/dev/null || echo 'Python generation failed, using fallback'
sumr:
desc: Generate SUMR (Summary Report) with project metrics and health status
cmds:
- |
echo "# $(basename $(pwd)) - Summary Report" > SUMR.md
echo "" >> SUMR.md
echo "SUMR - Summary Report for project analysis" >> SUMR.md
echo "" >> SUMR.md
echo "## Contents" >> SUMR.md
echo "" >> SUMR.md
echo "- [Metadata](#metadata)" >> SUMR.md
echo "- [Quality Status](#quality-status)" >> SUMR.md
echo "- [Metrics](#metrics)" >> SUMR.md
echo "- [Refactoring Analysis](#refactoring-analysis)" >> SUMR.md
echo "- [Intent](#intent)" >> SUMR.md
echo "" >> SUMR.md
echo "## Metadata" >> SUMR.md
echo "" >> SUMR.md
echo "- **name**: \`$(basename $(pwd))\`" >> SUMR.md
echo "- **version**: \`$(python3 -c "import tomllib; f=open('pyproject.toml','rb'); d=tomllib.load(f); print(d.get('project',{}).get('version','unknown'))" 2>/dev/null || echo 'unknown')\`" >> SUMR.md
echo "- **generated_at**: \`$(date -Iseconds)\`" >> SUMR.md
echo "" >> SUMR.md
echo "## Quality Status" >> SUMR.md
echo "" >> SUMR.md
if [ -f pyqual.yaml ]; then
echo "- **pyqual_config**: ✅ Present" >> SUMR.md
echo "- **last_run**: $(stat -c %y .pyqual/pipeline.db 2>/dev/null | cut -d' ' -f1 || echo 'N/A')" >> SUMR.md
else
echo "- **pyqual_config**: ❌ Missing" >> SUMR.md
fi
echo "" >> SUMR.md
echo "## Metrics" >> SUMR.md
echo "" >> SUMR.md
py_files=$(find . -name '*.py' -not -path './.venv/*' -not -path './venv/*' | wc -l)
echo "- **python_files**: $py_files" >> SUMR.md
lines=$(find . -name '*.py' -not -path './.venv/*' -not -path './venv/*' -exec cat {} \; 2>/dev/null | wc -l)
echo "- **total_lines**: $lines" >> SUMR.md
echo "" >> SUMR.md
echo "## Refactoring Analysis" >> SUMR.md
echo "" >> SUMR.md
echo "Run \`code2llm ./ -f evolution\` for detailed refactoring queue." >> SUMR.md
echo "Generated SUMR.md"
- |
python3 -c "
import json, os, subprocess
from pathlib import Path
from datetime import datetime
project_name = Path.cwd().name
py_files = len([f for f in Path('.').rglob('*.py') if not any(x in str(f) for x in ['.venv', 'venv', '__pycache__', '.git'])])
data = {
'project_name': project_name,
'report_type': 'SUMR',
'generated_at': datetime.now().isoformat(),
'metrics': {
'python_files': py_files,
'has_pyqual_config': Path('pyqual.yaml').exists()
}
}
with open('SUMR.json', 'w') as f:
json.dump(data, f, indent=2)
print('Generated SUMR.json')
" 2>/dev/null || echo 'Python generation failed, using fallback'