-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
807 lines (712 loc) · 30.8 KB
/
Taskfile.yml
File metadata and controls
807 lines (712 loc) · 30.8 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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
version: '3'
# Taskfile for koru — closed-loop refactor automation.
#
# Usage:
# task # show all tasks
# task install # install koru in editable mode
# task loop -- WORKSPACE=/repos COMMAND='pytest -q'
# task tickets:next
# task quality:regix
# task template:install # copy all template configs to current dir
#
# See docs/cli-examples.md for full examples.
vars:
KORU_VERSION:
sh: cat VERSION 2>/dev/null || echo "0.1.1"
PYTHON: python3
tasks:
default:
desc: Show all available tasks
cmds:
- task --list-all
silent: true
version:
desc: Show koru version
cmds:
- 'echo "koru v{{.KORU_VERSION}}"'
silent: true
# =====================================================================
# Install / setup
# =====================================================================
install:
desc: Install koru in editable mode
cmds:
- pip install -e .
sources:
- pyproject.toml
- src/**/*.py
install:dev:
desc: Install koru with dev dependencies (pytest etc.)
cmds:
- pip install -e ".[dev]" || pip install -e .
install:tools:
desc: Install semcod toolchain used by koru (planfile, wup, testql, regix, redup, sumr/sumd, doql, redeploy, ...)
cmds:
- pip install planfile wup testql regix redup vallm prefact pfix sumd sumr code2llm redsl llx doql redeploy goal costs op3 toonic protogate rebuild mdflow metrun
- 'echo "✓ semcod toolchain installed. Optional interactive agent: pip install aider-chat"'
# =====================================================================
# Tests
# =====================================================================
test:
desc: Run default koru tests (slow Docker/integration tests are deselected by pytest addopts)
cmds:
- python3 -m pytest tests/ -v {{.CLI_ARGS}}
test:all:
desc: Run every koru test, including slow Docker/integration tests
cmds:
- python3 -m pytest tests/ -v -m "" {{.CLI_ARGS}}
test:fast:
desc: Run tests without verbose output
cmds:
- python3 -m pytest tests/ -q
test:quick:
desc: Fastest possible test run (fail fast, no header)
cmds:
- python3 -m pytest tests/ -q --maxfail=1 --no-header
test:parallel:
desc: Run tests in parallel (safe only for isolated subsets)
cmds:
- python3 -m pytest tests/ -q -n auto --maxfail=1
lint:
desc: Run ruff on koru sources and tests
cmds:
- python3 -m ruff check src tests
lint:fix:
desc: Run ruff with autofix
cmds:
- python3 -m ruff check src tests --fix
ci:
desc: Local CI equivalent (lint + tests)
cmds:
- task: lint
- task: test:fast
# =====================================================================
# Closed-loop automation (the core koru CLI)
# =====================================================================
loop:
desc: 'Run closed-loop across workspace. Vars: WORKSPACE, INCLUDE, COMMAND'
cmds:
- koru --workspace "{{.WORKSPACE}}" --include "{{.INCLUDE}}" --command "{{.COMMAND}}"
vars:
WORKSPACE: '{{.WORKSPACE | default "."}}'
INCLUDE: '{{.INCLUDE | default "**"}}'
COMMAND: '{{.COMMAND | default "pytest -q"}}'
interactive: true
loop:test:
desc: Run pytest in closed-loop mode
cmds:
- task: loop
vars: {COMMAND: 'pytest -q'}
loop:lint:
desc: Run ruff in closed-loop mode
cmds:
- task: loop
vars: {COMMAND: 'ruff check .'}
queue:run:
desc: 'Run one task from planfile queue. Vars: PROJECT, ACTOR, DRY_RUN'
cmds:
- koru --queue --project "{{.PROJECT}}" --actor "{{.ACTOR}}" {{if eq .DRY_RUN "true"}}--dry-run{{end}}
vars:
PROJECT: '{{.PROJECT | default "."}}'
ACTOR: '{{.ACTOR | default "koru-shell"}}'
DRY_RUN: '{{.DRY_RUN | default "false"}}'
interactive: true
queue:dry-run:
desc: Preview one runnable planfile queue task without executing it
cmds:
- task: queue:run
vars: {DRY_RUN: "true"}
queue:watch:
desc: 'Watch planfile WebSocket events. Vars: WS_URL, MAX_EVENTS'
cmds:
- koru --watch --ws-url "{{.WS_URL}}" {{if .MAX_EVENTS}}--max-events "{{.MAX_EVENTS}}"{{end}}
vars:
WS_URL: '{{.WS_URL | default "ws://localhost:8000/ws"}}'
MAX_EVENTS: '{{.MAX_EVENTS | default ""}}'
interactive: true
queue:autoloop:
desc: 'Continuous intake+execution loop (scan + queue --loop + idle diagnostics + autopilot drive). See scripts/koru-autoloop.sh header for all env vars.'
cmds:
- |
PROJECT="{{.PROJECT}}" \
ACTOR="{{.ACTOR}}" \
QUEUE_NAME="{{.QUEUE_NAME}}" \
USE_ALL_QUEUES="{{.USE_ALL_QUEUES}}" \
MAX_ITERATIONS="{{.MAX_ITERATIONS}}" \
MAX_CYCLES="{{.MAX_CYCLES}}" \
SLEEP_SECONDS="{{.SLEEP_SECONDS}}" \
INITIAL_DELAY_SECONDS="{{.INITIAL_DELAY_SECONDS}}" \
ENABLE_SCAN="{{.ENABLE_SCAN}}" \
TICKET_SOURCES="{{.TICKET_SOURCES}}" \
ENABLE_INTERACTIVE="{{.ENABLE_INTERACTIVE}}" \
ENABLE_AUTOPILOT_DRIVE="{{.ENABLE_AUTOPILOT_DRIVE}}" \
AUTOPILOT_ACTION="{{.AUTOPILOT_ACTION}}" \
AUTOPILOT_IDE="{{.AUTOPILOT_IDE}}" \
AUTOPILOT_SUBMIT="{{.AUTOPILOT_SUBMIT}}" \
AUTOPILOT_ON_IDLE_ONLY="{{.AUTOPILOT_ON_IDLE_ONLY}}" \
AUTOPILOT_SKIP_ON_DIAGNOSTICS_FAIL="{{.AUTOPILOT_SKIP_ON_DIAGNOSTICS_FAIL}}" \
DRIVE_PROMPT="{{.DRIVE_PROMPT}}" \
ENABLE_IDLE_DIAGNOSTICS="{{.ENABLE_IDLE_DIAGNOSTICS}}" \
IDLE_DIAGNOSTICS_PROFILE="{{.IDLE_DIAGNOSTICS_PROFILE}}" \
STRICT_DIAGNOSTICS="{{.STRICT_DIAGNOSTICS}}" \
ENABLE_DIAGNOSTIC_TICKETS="{{.ENABLE_DIAGNOSTIC_TICKETS}}" \
DIAGNOSTIC_TICKET_QUEUE="{{.DIAGNOSTIC_TICKET_QUEUE}}" \
DIAGNOSTIC_TICKET_PRIORITY="{{.DIAGNOSTIC_TICKET_PRIORITY}}" \
DIAG_STATE_DIR="{{.DIAG_STATE_DIR}}" \
AUTOPILOT_SKIP_STATUSES="{{.AUTOPILOT_SKIP_STATUSES}}" \
BACKOFF_ON_STAGNATION="{{.BACKOFF_ON_STAGNATION}}" \
MAX_SLEEP_SECONDS="{{.MAX_SLEEP_SECONDS}}" \
SCAN_SKIP_IF_CLEAN="{{.SCAN_SKIP_IF_CLEAN}}" \
SCAN_SKIP_AFTER="{{.SCAN_SKIP_AFTER}}" \
KORU_CMD="{{.KORU_CMD}}" \
KORU_PLANFILE_CMD="{{.KORU_PLANFILE_CMD}}" \
KORU_PYTHONPATH="{{.KORU_PYTHONPATH}}" \
bash scripts/koru-autoloop.sh
vars:
PROJECT: '{{.PROJECT | default "."}}'
ACTOR: '{{.ACTOR | default "koru-shell"}}'
QUEUE_NAME: '{{.QUEUE_NAME | default ""}}'
USE_ALL_QUEUES: '{{.USE_ALL_QUEUES | default "false"}}'
MAX_ITERATIONS: '{{.MAX_ITERATIONS | default "50"}}'
MAX_CYCLES: '{{.MAX_CYCLES | default "0"}}'
SLEEP_SECONDS: '{{.SLEEP_SECONDS | default "120"}}'
INITIAL_DELAY_SECONDS: '{{.INITIAL_DELAY_SECONDS | default "0"}}'
ENABLE_SCAN: '{{.ENABLE_SCAN | default "true"}}'
TICKET_SOURCES: '{{.TICKET_SOURCES | default "queue"}}'
ENABLE_INTERACTIVE: '{{.ENABLE_INTERACTIVE | default "false"}}'
ENABLE_AUTOPILOT_DRIVE: '{{.ENABLE_AUTOPILOT_DRIVE | default "true"}}'
AUTOPILOT_ACTION: '{{.AUTOPILOT_ACTION | default "drive"}}'
AUTOPILOT_IDE: '{{.AUTOPILOT_IDE | default "auto"}}'
AUTOPILOT_SUBMIT: '{{.AUTOPILOT_SUBMIT | default "true"}}'
AUTOPILOT_ON_IDLE_ONLY: '{{.AUTOPILOT_ON_IDLE_ONLY | default "false"}}'
AUTOPILOT_SKIP_ON_DIAGNOSTICS_FAIL: '{{.AUTOPILOT_SKIP_ON_DIAGNOSTICS_FAIL | default "true"}}'
DRIVE_PROMPT: '{{.DRIVE_PROMPT | default "continue with the next ticket"}}'
ENABLE_IDLE_DIAGNOSTICS: '{{.ENABLE_IDLE_DIAGNOSTICS | default "false"}}'
IDLE_DIAGNOSTICS_PROFILE: '{{.IDLE_DIAGNOSTICS_PROFILE | default "quick"}}'
STRICT_DIAGNOSTICS: '{{.STRICT_DIAGNOSTICS | default "false"}}'
ENABLE_DIAGNOSTIC_TICKETS: '{{.ENABLE_DIAGNOSTIC_TICKETS | default "false"}}'
DIAGNOSTIC_TICKET_QUEUE: '{{.DIAGNOSTIC_TICKET_QUEUE | default "default"}}'
DIAGNOSTIC_TICKET_PRIORITY: '{{.DIAGNOSTIC_TICKET_PRIORITY | default "high"}}'
DIAG_STATE_DIR: '{{.DIAG_STATE_DIR | default ".planfile/.koru/autoloop-diag"}}'
AUTOPILOT_SKIP_STATUSES: '{{.AUTOPILOT_SKIP_STATUSES | default "waiting_input"}}'
BACKOFF_ON_STAGNATION: '{{.BACKOFF_ON_STAGNATION | default "true"}}'
MAX_SLEEP_SECONDS: '{{.MAX_SLEEP_SECONDS | default "900"}}'
SCAN_SKIP_IF_CLEAN: '{{.SCAN_SKIP_IF_CLEAN | default "false"}}'
SCAN_SKIP_AFTER: '{{.SCAN_SKIP_AFTER | default "1"}}'
KORU_CMD: '{{.KORU_CMD | default "koru"}}'
KORU_PLANFILE_CMD: '{{.KORU_PLANFILE_CMD | default "planfile"}}'
KORU_PYTHONPATH: '{{.KORU_PYTHONPATH | default ""}}'
interactive: true
queue:autoloop:reset-diag-markers:
desc: 'Clear autoloop diagnostic dedup markers; optionally close [AUTO-DIAG] tickets. Usage: task queue:autoloop:reset-diag-markers CLOSE_TICKETS=true CHECK=regix'
cmds:
- |
MARKER_DIR="{{.MARKER_DIR}}" \
CHECK="{{.CHECK}}" \
CLOSE_TICKETS="{{.CLOSE_TICKETS}}" \
CLOSE_STATUS="{{.CLOSE_STATUS}}" \
KORU_PLANFILE_CMD="{{.KORU_PLANFILE_CMD}}" \
KORU_PYTHONPATH="{{.KORU_PYTHONPATH}}" \
bash scripts/koru-autoloop-reset-diag-markers.sh
vars:
MARKER_DIR: '{{.MARKER_DIR | default ".planfile/.koru/autoloop-diag"}}'
CHECK: '{{.CHECK | default "all"}}'
CLOSE_TICKETS: '{{.CLOSE_TICKETS | default "false"}}'
CLOSE_STATUS: '{{.CLOSE_STATUS | default "done"}}'
KORU_PLANFILE_CMD: '{{.KORU_PLANFILE_CMD | default "planfile"}}'
KORU_PYTHONPATH: '{{.KORU_PYTHONPATH | default ""}}'
# =====================================================================
# Quality gates (LLM-free, proxies to underlying tools)
# =====================================================================
quality:regix:
desc: Run regix gates locally (LLM-free regression metrics)
cmds:
- |
set -euo pipefail
if python3 -m koru.cli topology --project . --is-enabled gate:regix >/dev/null 2>&1; then
regix gates
else
rc=$?
if [ "$rc" -eq 1 ]; then
echo "quality:regix skipped (gate:regix disabled in topology)"
exit 0
fi
regix gates
fi
preconditions:
- sh: which regix
msg: "regix not installed. Run: task install:tools"
quality:regix:local:
desc: Compare working tree against HEAD with regix
cmds:
- regix compare HEAD --local
preconditions:
- sh: which regix
msg: "regix not installed. Run: task install:tools"
quality:wup:
desc: Check WUP on-change watcher configuration
cmds:
- |
set -euo pipefail
if python3 -m koru.cli topology --project . --is-enabled gate:wup >/dev/null 2>&1; then
wup status
else
rc=$?
if [ "$rc" -eq 1 ]; then
echo "quality:wup skipped (gate:wup disabled in topology)"
exit 0
fi
wup status
fi
preconditions:
- sh: which wup
msg: "wup not installed. Run: task install:tools"
- sh: test -f wup.yaml
msg: "wup.yaml missing. Run: task template:install:wup"
quality:redup:
desc: 'Run redup duplicate detection (default: current dir)'
cmds:
- |
set -euo pipefail
if python3 -m koru.cli topology --project . --is-enabled gate:redup >/dev/null 2>&1; then
redup scan . --min-lines 10
else
rc=$?
if [ "$rc" -eq 1 ]; then
echo "quality:redup skipped (gate:redup disabled in topology)"
exit 0
fi
redup scan . --min-lines 10
fi
preconditions:
- sh: which redup
msg: "redup not installed. Run: task install:tools"
quality:redup:check:
desc: Run redup with budget check (uses scripts/redup-check.sh)
cmds:
- |
set -euo pipefail
if python3 -m koru.cli topology --project . --is-enabled gate:redup >/dev/null 2>&1; then
bash scripts/redup-check.sh "{{.PATH | default "."}}"
else
rc=$?
if [ "$rc" -eq 1 ]; then
echo "quality:redup:check skipped (gate:redup disabled in topology)"
exit 0
fi
bash scripts/redup-check.sh "{{.PATH | default "."}}"
fi
quality:vallm:
desc: 'Validate file with vallm (FILE=path/to/file.py)'
cmds:
- vallm validate -f "{{.FILE}}"
requires:
vars: [FILE]
quality:vallm:semantic:
desc: 'Validate with LLM-as-judge (requires OPENROUTER_API_KEY, FILE=...)'
cmds:
- vallm validate -f "{{.FILE}}" --semantic -v
requires:
vars: [FILE]
preconditions:
- sh: '[ -n "$OPENROUTER_API_KEY" ]'
msg: "OPENROUTER_API_KEY not set"
# ── SUMR — debounced refactor snapshot (requires `task template:install:sumr`) ─
quality:sumr:status:
desc: Show SUMR.md staleness vs HEAD (LLM-free; exit 1 if stale)
cmds:
- |
set -euo pipefail
if python3 -m koru.cli topology --project . --is-enabled gate:sumr >/dev/null 2>&1; then
scripts/sumr-refresh.sh --status
else
rc=$?
if [ "$rc" -eq 1 ]; then
echo "quality:sumr:status skipped (gate:sumr disabled in topology)"
exit 0
fi
scripts/sumr-refresh.sh --status
fi
preconditions:
- sh: test -x scripts/sumr-refresh.sh
msg: "scripts/sumr-refresh.sh missing. Run: task template:install:sumr"
quality:sumr:auto:
desc: Refresh SUMR.md only if stale (debounced; safe for hooks/cron)
cmds:
- |
set -euo pipefail
if python3 -m koru.cli topology --project . --is-enabled gate:sumr >/dev/null 2>&1; then
scripts/sumr-refresh.sh
else
rc=$?
if [ "$rc" -eq 1 ]; then
echo "quality:sumr:auto skipped (gate:sumr disabled in topology)"
exit 0
fi
scripts/sumr-refresh.sh
fi
quality:sumr:refresh:
desc: Force-refresh SUMR.md (bumps sumd/code2llm/redup/doql + regenerates)
cmds:
- |
set -euo pipefail
if python3 -m koru.cli topology --project . --is-enabled gate:sumr >/dev/null 2>&1; then
scripts/sumr-refresh.sh --force
else
rc=$?
if [ "$rc" -eq 1 ]; then
echo "quality:sumr:refresh skipped (gate:sumr disabled in topology)"
exit 0
fi
scripts/sumr-refresh.sh --force
fi
quality:sumr:install-hook:
desc: 'Install git post-merge hook (HOOK=post-commit|both for alt)'
cmds:
- bash scripts/git-hooks/install.sh {{.HOOK | default "post-merge"}}
quality:sumr:uninstall-hook:
desc: Remove sumr-refresh git hooks (leaves foreign hooks intact)
cmds:
- bash scripts/git-hooks/install.sh --uninstall
quality:semcod:planfile:
desc: Run configured semcod/* gates and create/update deduplicated planfile tickets on failures
cmds:
- bash scripts/koru-semcod-gates.sh
# =====================================================================
# Tickets (planfile)
# =====================================================================
tickets:next:
desc: Show highest-priority open ticket
cmds:
- planfile ticket next
preconditions:
- sh: which planfile
msg: "planfile not installed. Run: pip install planfile"
tickets:list:
desc: List open tickets
cmds:
- planfile ticket list --status open --format yaml
tickets:show:
desc: 'Show ticket details (TID=PLF-XXX)'
cmds:
- planfile ticket show "{{.TID}}"
requires:
vars: [TID]
tickets:done:
desc: 'Mark ticket as done (TID=PLF-XXX)'
cmds:
- planfile ticket update "{{.TID}}" --status done
requires:
vars: [TID]
tickets:export:
desc: 'Export ticket as LLM-ready prompt (TID=PLF-XXX)'
cmds:
- bash scripts/planfile-export-prompt.sh "{{.TID}}"
requires:
vars: [TID]
# =====================================================================
# Templates (copy reference configs to current directory)
# =====================================================================
template:list:
desc: List available templates
cmds:
- ls templates/
template:install:
desc: Copy all template configs to current directory
cmds:
- cp templates/pyqual.yaml.template ./pyqual.yaml
- cp templates/redup.toml.template ./redup.toml
- cp templates/redsl.yaml.template ./redsl.yaml
- cp templates/regix.yaml.template ./regix.yaml
- cp templates/llx.toml.template ./llx.toml
- cp templates/llx.yaml.template ./llx.yaml
- cp templates/prefact.yaml.template ./prefact.yaml
- 'echo "✓ All templates copied. Review and edit before committing."'
template:install:single:
desc: 'Copy single template (TPL=pyqual.yaml|redup.toml|redsl.yaml|...)'
cmds:
- 'cp templates/{{.TPL}}.template ./{{.TPL}} && echo "✓ {{.TPL}} copied"'
requires:
vars: [TPL]
template:install:compose:
desc: Copy docker-compose.quality.yml template
cmds:
- cp templates/docker-compose.quality.yml.template ./docker-compose.quality.yml
- 'echo "✓ docker-compose.quality.yml copied. Review service definitions."'
template:install:sumr:
desc: 'Copy SUMR-refresh stack (script + git hooks + weekly workflow)'
cmds:
- mkdir -p scripts scripts/git-hooks .github/workflows
- cp templates/sumr-refresh.sh.template scripts/sumr-refresh.sh
- cp templates/git-hooks/post-merge.template scripts/git-hooks/post-merge
- cp templates/git-hooks/post-commit.template scripts/git-hooks/post-commit
- cp templates/git-hooks/install.sh.template scripts/git-hooks/install.sh
- cp templates/sumr-weekly.yml.template .github/workflows/sumr-weekly.yml
- chmod +x scripts/sumr-refresh.sh scripts/git-hooks/post-merge scripts/git-hooks/post-commit scripts/git-hooks/install.sh
- |
grep -q '^\.sumr/$' .gitignore 2>/dev/null || echo '.sumr/' >> .gitignore
- 'echo "✓ SUMR stack installed. Next: task quality:sumr:install-hook (see workflows/sumr-refresh-loop.md)"'
template:install:redeploy:
desc: 'Copy redeploy templates (local + device baseline) to redeploy/'
cmds:
- mkdir -p redeploy/local redeploy/device
- cp templates/redeploy/local/deployment.md.template redeploy/local/deployment.md
- cp templates/redeploy/device/manifest.yaml.template redeploy/device/manifest.yaml
- cp templates/redeploy/device/migration.md.template redeploy/device/migration.md
- cp templates/redeploy/device/diagnose.md.template redeploy/device/diagnose.md
- 'echo "✓ redeploy templates installed at redeploy/"'
- 'echo " Next: substitute placeholders (see workflows/redeploy-multi-device.md Krok 3)"'
- 'echo " rename redeploy/device/ → redeploy/<your-device>/"'
- 'echo " sed -i ''s/<APP_NAME>/myapp/g'' redeploy/local/*.md redeploy/device/*"'
template:install:observability:
desc: 'Copy observability stack (Prometheus + Grafana + Loki + Alertmanager + healing-webhook)'
cmds:
- mkdir -p monitoring/prometheus/rules monitoring/alertmanager monitoring/grafana/provisioning
- cp templates/observability/docker-compose.observability.yml.template docker-compose.observability.yml
- cp templates/observability/prometheus/prometheus.yml.template monitoring/prometheus/prometheus.yml
- cp templates/observability/prometheus/rules/app-alerts.yml.template monitoring/prometheus/rules/app-alerts.yml
- cp templates/observability/alertmanager/alertmanager.yml.template monitoring/alertmanager/alertmanager.yml
- 'echo "✓ Observability stack installed."'
- 'echo " Next: substitute <APP_NAME>/<APP_PORT> placeholders, then task monitor:up"'
- 'echo " See: workflows/observability-bootstrap.md"'
template:install:windsurf:
desc: 'Copy .windsurf/ bootstrap (rules.md + mcp_config.example.json)'
cmds:
- mkdir -p .windsurf
- cp templates/.windsurf/rules.md.template .windsurf/rules.md
- cp templates/.windsurf/mcp_config.example.json.template .windsurf/mcp_config.example.json
- 'echo "✓ .windsurf/ installed."'
- 'echo " Next: substitute <APP_NAME>/<REPO_PATH>, then merge mcp_config into ~/.codeium/windsurf/mcp_config.json"'
template:install:ci:
desc: 'Copy GH Actions templates (version-drift + code-quality) to .github/workflows/'
cmds:
- mkdir -p .github/workflows
- cp templates/github-workflows/version-drift.yml.template .github/workflows/version-drift.yml
- cp templates/github-workflows/code-quality.yml.template .github/workflows/code-quality.yml
- mkdir -p scripts
- cp templates/scripts/check-version-drift.sh.template scripts/check-version-drift.sh
- chmod +x scripts/check-version-drift.sh
- 'echo "✓ CI templates installed."'
- 'echo " Next: ensure VERSION file at repo root + commit + push"'
template:install:precommit:
desc: 'Copy .pre-commit-config.yaml template'
cmds:
- cp templates/.pre-commit-config.yaml.template .pre-commit-config.yaml
- 'echo "✓ .pre-commit-config.yaml installed."'
- 'echo " Next: substitute <APP_NAME>, then: pip install pre-commit && pre-commit install"'
template:install:wup:
desc: 'Copy wup.yaml template (on-change file watcher feeding testql gates)'
cmds:
- cp templates/wup.yaml.template ./wup.yaml
- |
if [ -n "${PROJECT:-}" ]; then
sed -i "s/__PROJECT__/${PROJECT}/g" ./wup.yaml
echo "✓ wup.yaml installed (project=${PROJECT})"
else
echo "✓ wup.yaml installed (no PROJECT set; placeholder __PROJECT__ left in file)"
fi
- 'echo " Next: 1) review wup.yaml services/paths"'
- 'echo " 2) wup map-deps (build dependency map)"'
- 'echo " 3) wup testql-endpoints (verify scenarios reachable)"'
- 'echo " 4) wup watch (start daemon, foreground)"'
- 'echo " See: workflows/on-change-gates.md for the full triad cycle"'
template:install:on-change-gates:
desc: 'Bootstrap on-change gate triad configs (wup.yaml + regix.yaml)'
cmds:
- task: template:install:wup
vars: {PROJECT: '{{.PROJECT}}'}
- test -f regix.yaml || cp templates/regix.yaml.template ./regix.yaml
- 'echo "✓ on-change gate triad installed (wup.yaml + regix.yaml)"'
- 'echo " testql scenarios are project-specific — re-use existing testql-testing/scenarios/ or write new TOON YAML by hand"'
- 'echo " Workflow guide: see koru workflows/on-change-gates.md"'
- 'echo " Slash command: /koru-gate (invokes all three on demand)"'
# =====================================================================
# Scripts wrappers
# =====================================================================
scripts:list:
desc: List available scripts
cmds:
- ls scripts/
scripts:redup:check:
desc: 'Run redup-check.sh (PATH=. by default)'
cmds:
- bash scripts/redup-check.sh "{{.PATH | default \".\"}}"
scripts:redup:precommit:
desc: Run redup precommit hook
cmds:
- bash scripts/redup-precommit.sh
scripts:regix:precommit:
desc: Run regix precommit hook
cmds:
- bash scripts/regix-precommit.sh
scripts:redsl:precommit:
desc: Run redsl gate precommit hook
cmds:
- bash scripts/redsl-gate-precommit.sh
scripts:planfile:sync-todo:
desc: Sync planfile tickets with TODO.md
cmds:
- python3 scripts/planfile-sync-todo.py
# =====================================================================
# Deploy (redeploy + markpact specs — local + multi-device)
# =====================================================================
# Templates: templates/redeploy/ | Workflow: workflows/redeploy-multi-device.md
# Bootstrap: task template:install:redeploy
deploy:plan:
desc: 'Plan deploy without changes — DEVICE=<name> SPEC=<file> (defaults: local + deployment.md)'
cmds:
- redeploy run "redeploy/{{.DEVICE | default \"local\"}}/{{.SPEC | default \"deployment.md\"}}" --plan-only
preconditions:
- sh: which redeploy
msg: "redeploy not installed. Run: task install:tools (or pip install --user redeploy)"
deploy:dry:
desc: 'Dry run deploy (preview commands) — DEVICE=<name>'
cmds:
- redeploy run "redeploy/{{.DEVICE | default \"local\"}}/{{.SPEC | default \"deployment.md\"}}" --dry-run
deploy:local:
desc: Deploy locally via Docker Compose
cmds:
- redeploy run redeploy/local/deployment.md
preconditions:
- sh: test -f redeploy/local/deployment.md
msg: "redeploy/local/deployment.md missing. Run: task template:install:redeploy"
deploy:device:
desc: 'Deploy to remote device — DEVICE=<name> (e.g. pi109, edge01)'
cmds:
- redeploy run "redeploy/{{.DEVICE}}/migration.md"
requires:
vars: [DEVICE]
preconditions:
- sh: test -f "redeploy/{{.DEVICE}}/migration.md"
msg: "redeploy/{{.DEVICE}}/migration.md missing. Copy from templates/redeploy/device/ and customize."
deploy:diagnose:
desc: 'Read-only diagnose — DEVICE=<name> (default: local)'
cmds:
- redeploy run "redeploy/{{.DEVICE | default \"local\"}}/diagnose.md"
deploy:resume:
desc: 'Resume failed deploy — DEVICE=<name> STEP=<step_id>'
cmds:
- redeploy run "redeploy/{{.DEVICE}}/migration.md" --from-step {{.STEP}}
requires:
vars: [DEVICE, STEP]
deploy:drift:
desc: 'Snapshot device state into app.doql.less (drift baseline) — DEVICE_HOST=<user@host>'
cmds:
- doql adopt --from-device "{{.DEVICE_HOST}}" -o app.doql.less
- 'echo "✓ Intended state captured. Commit app.doql.less to lock baseline."'
requires:
vars: [DEVICE_HOST]
preconditions:
- sh: which doql
msg: "doql not installed. Run: pip install --user doql"
# =====================================================================
# Observability stack (Prometheus + Grafana + Loki + Alertmanager + healing-webhook)
# =====================================================================
# Templates: templates/observability/ | Workflow: workflows/observability-bootstrap.md
# Bootstrap: task template:install:observability
monitor:net:
desc: Ensure the shared quality-net docker network exists
cmds:
- |
NET="${MONITOR_NET:-koru-quality-net}"
docker network inspect "$NET" >/dev/null 2>&1 || docker network create "$NET"
echo "✓ network $NET ready"
monitor:up:
desc: Bring up the full observability + self-healing stack (10 services)
deps: [monitor:net]
cmds:
- docker compose -f docker-compose.observability.yml up -d --build
- echo ""
- 'echo "Grafana → http://localhost:$${GRAFANA_PORT:-3000} (anonymous viewer)"'
- 'echo "Prometheus → http://localhost:$${PROMETHEUS_PORT:-9090}"'
- 'echo "Alertmanager → http://localhost:$${ALERTMANAGER_PORT:-9093}"'
- 'echo "Loki → http://localhost:$${LOKI_PORT:-3100}"'
- 'echo "Uptime Kuma → http://localhost:$${UPTIME_KUMA_PORT:-3001}"'
- 'echo "Healing hook → http://localhost:$${HEALING_WEBHOOK_PORT:-8810}/health"'
preconditions:
- sh: test -f docker-compose.observability.yml
msg: "docker-compose.observability.yml missing. Run: task template:install:observability"
monitor:up:lite:
desc: Bring up observability without Loki/Promtail (skip if disk is tight)
deps: [monitor:net]
cmds:
- docker compose -f docker-compose.observability.yml up -d --build
prometheus alertmanager grafana blackbox-exporter
node-exporter cadvisor uptime-kuma healing-webhook
monitor:down:
desc: Stop the observability stack
cmds:
- docker compose -f docker-compose.observability.yml down
monitor:status:
desc: Show status of observability containers
cmds:
- docker compose -f docker-compose.observability.yml ps
monitor:logs:
desc: 'Tail logs of one observability service — SVC=<name> (default: healing-webhook)'
cmds:
- docker compose -f docker-compose.observability.yml logs -f --tail=50 {{.SVC | default "healing-webhook"}}
monitor:probe:
desc: 'Sanity check — curl health endpoints of all observability services'
cmds:
- |
for url in \
"http://localhost:$${PROMETHEUS_PORT:-9090}/-/healthy" \
"http://localhost:$${ALERTMANAGER_PORT:-9093}/-/healthy" \
"http://localhost:$${GRAFANA_PORT:-3000}/api/health" \
"http://localhost:$${LOKI_PORT:-3100}/ready" \
"http://localhost:$${HEALING_WEBHOOK_PORT:-8810}/health"; do
CODE=$(curl -s -o /dev/null -w '%{http_code}' --max-time 3 "$url" || echo 000)
printf ' %-3s %s\n' "$CODE" "$url"
done
monitor:reload-prometheus:
desc: Hot-reload Prometheus rules (no restart)
cmds:
- 'curl -X POST http://localhost:$${PROMETHEUS_PORT:-9090}/-/reload && echo "✓ reloaded"'
# =====================================================================
# Healing-webhook (generic alert → ticket service)
# =====================================================================
webhook:run:
desc: 'Run healing-webhook locally on port 8810'
cmds:
- cd services/healing-webhook && python3 app.py
interactive: true
webhook:docker:build:
desc: Build healing-webhook Docker image
cmds:
- docker build -t koru-healing-webhook:latest services/healing-webhook/
webhook:docker:run:
desc: Run healing-webhook in Docker (port 8810)
cmds:
- docker run --rm -p 8810:8810 koru-healing-webhook:latest
webhook:test:
desc: Send test alertmanager payload to local webhook
cmds:
- 'curl -X POST http://localhost:8810/alert -H "Content-Type: application/json" -d ''{"alerts":[{"status":"firing","labels":{"alertname":"TestAlert","severity":"warning"},"annotations":{"summary":"Smoke test"}}]}'''
# =====================================================================
# Documentation
# =====================================================================
docs:
desc: Open documentation index
cmds:
- 'echo "Documentation: docs/README.md"'
- 'echo "Agent guide: docs/agent-guide.md"'
- 'echo "Tool catalog: docs/llm-tools/README.md"'
- 'echo "CLI examples: docs/cli-examples.md"'
silent: true
docs:serve:
desc: 'Serve docs over HTTP (port 8000)'
cmds:
- cd docs && python3 -m http.server 8000
# =====================================================================
# Workflows (slash-commands ported from .windsurf/workflows/)
# =====================================================================
workflow:list:
desc: List available workflows (markdown instructions for agents)
cmds:
- ls workflows/
workflow:show:
desc: 'Show workflow content (NAME=testql-autoloop|aider-docker-autoloop|...)'
cmds:
- 'cat workflows/{{.NAME}}.md'
requires:
vars: [NAME]