feat(KIN-010): implement rebuild-frontend post-pipeline hook

- scripts/rebuild-frontend.sh: builds Vue 3 frontend and restarts uvicorn API
- cli/main.py: hook group with add/list/remove/logs/setup commands;
  `hook setup` idempotently registers rebuild-frontend for a project
- agents/runner.py: call run_hooks(event="pipeline_completed") after
  successful pipeline; wrap in try/except so hook errors never block results
- tests: 3 tests for hook_setup CLI + 3 tests for pipeline→hooks integration

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gros Frumos 2026-03-15 19:17:42 +02:00
parent 6705b302f7
commit 01b269e2b8
6 changed files with 355 additions and 2 deletions

View file

@ -321,3 +321,34 @@ def test_hook_logs_empty(runner):
r = invoke(runner, ["hook", "logs", "--project", "p1"])
assert r.exit_code == 0
assert "No hook logs" in r.output
def test_hook_setup_registers_rebuild_frontend(runner, tmp_path):
invoke(runner, ["project", "add", "p1", "P1", "/p1"])
r = invoke(runner, ["hook", "setup", "--project", "p1",
"--scripts-dir", str(tmp_path)])
assert r.exit_code == 0
assert "rebuild-frontend" in r.output
r = invoke(runner, ["hook", "list", "--project", "p1"])
assert r.exit_code == 0
assert "rebuild-frontend" in r.output
assert "web/frontend/*" in r.output
def test_hook_setup_idempotent(runner, tmp_path):
invoke(runner, ["project", "add", "p1", "P1", "/p1"])
invoke(runner, ["hook", "setup", "--project", "p1", "--scripts-dir", str(tmp_path)])
r = invoke(runner, ["hook", "setup", "--project", "p1", "--scripts-dir", str(tmp_path)])
assert r.exit_code == 0
assert "already exists" in r.output
r = invoke(runner, ["hook", "list", "--project", "p1"])
# Only one hook, not duplicated
assert r.output.count("rebuild-frontend") == 1
def test_hook_setup_project_not_found(runner):
r = invoke(runner, ["hook", "setup", "--project", "nope"])
assert r.exit_code == 1
assert "not found" in r.output