Commit graph

99 commits

Author SHA1 Message Date
Gros Frumos
c67fa379b3 kin: KIN-080 Разобраться с KIN-FIX-003 и KIN-FIX-004, одна из задач уже выполнена, вторая берется в работу (руками завершаю) но в задаче не меняется текущий статус 2026-03-16 17:30:31 +02:00
Gros Frumos
bfc8f1c0bb kin: KIN-083 Healthcheck claude CLI auth: перед запуском pipeline проверять что claude залогинен (быстрый claude -p 'ok' --output-format json, проверить is_error и 'Not logged in'). Если не залогинен — не запускать pipeline, а показать ошибку 'Claude CLI requires login' в GUI с инструкцией. 2026-03-16 15:48:09 +02:00
Gros Frumos
cb099030ce kin: KIN-074 Попытка переключить review на auto приводит к 400 ошибке 2026-03-16 10:11:01 +02:00
Gros Frumos
e4566d51a6 kin: KIN-ARCH-007 Дочистить оставшиеся workaround path='' после KIN-ARCH-003 2026-03-16 10:08:50 +02:00
Gros Frumos
a28790d194 kin: KIN-073 Добавить поле acceptance_criteria в таблицу tasks. При создании задачи — отдельное поле описывающее что должно быть на выходе. PM получает acceptance_criteria и использует для проверки завершённости, не путает с текущим состоянием. GUI: textarea 'Критерии приёмки' в форме создания задачи. Tester и reviewer тоже получают acceptance_criteria для проверки. 2026-03-16 10:06:01 +02:00
Gros Frumos
ff69d24acc kin: KIN-UI-002 Исправить падающие тесты миграции (регрессия KIN-ARCH-003) в core/db.py 2026-03-16 10:04:01 +02:00
Gros Frumos
7630736860 kin: KIN-ARCH-006 Добавить autocommit_enabled и obsidian_vault_path в базовый SCHEMA 2026-03-16 09:57:14 +02:00
Gros Frumos
295a95bc7f kin: KIN-ARCH-003 Сделать path nullable для operations-проектов 2026-03-16 09:52:44 +02:00
Gros Frumos
39acc9cc4b kin: KIN-BIZ-002 Исправить консистентность: approve через /tasks/{id}/approve не продвигает phase state machine 2026-03-16 09:47:56 +02:00
Gros Frumos
044bd15b2e kin: KIN-BIZ-003 Обновить prompts/architect.md для режима 'last research phase' 2026-03-16 09:44:53 +02:00
Gros Frumos
ba04e7ad84 kin: KIN-ARCH-001 Добавить серверную валидацию ssh_host для operations-проектов 2026-03-16 09:44:31 +02:00
Gros Frumos
4188384f1b kin: KIN-059 Workflow new_project с выбором команды. При создании нового проекта через GUI или CLI директор описывает проект свободным текстом и выбирает галочками какие этапы research нужны: ☐ Business analyst (бизнес-модель, аудитория, монетизация) ☐ Market researcher (конкуренты, ниша, отзывы, сильные/слабые стороны) ☐ Legal researcher (юрисдикция, лицензии, KYC/AML, GDPR) ☐ Tech researcher (API, ограничения, стоимость, альтернативы) ☐ UX designer (анализ UX конкурентов, user journey, wireframes) ☐ Marketer (стратегия продвижения, SEO, conversion-паттерны) ☐ Architect (blueprint на основе одобренных research'ей) — всегда последний Architect включается автоматически если выбран хотя бы один researcher. Каждый выбранный этап — отдельная задача на review. Директор одобряет, отклоняет, или просит доисследовать (Revise). Следующий этап только после approve предыдущего. GUI: форма 'New Project' с описанием + чекбоксы ролей + кнопка 'Start Research'. CLI: kin new-project 'описание' --roles 'business,market,tech,architect' 2026-03-16 09:30:00 +02:00
Gros Frumos
75fee86110 kin: KIN-071 Добавить тип проекта: development / operations / research. Для operations: вместо path к локальной папке — ssh-доступ (host, user, key, proxy or jump). При создании operations-проекта запускается sysadmin-агент который подключается по SSH, обходит сервер, составляет карту: какие сервисы запущены (docker ps, systemctl), какие конфиги где лежат, какие порты открыты, какие версии. Результат сохраняется в decisions и modules как база знаний по серверу. Код не хранится локально — агенты работают через SSH. PM для operations вызывает sysadmin/debugger, не architect/frontend_dev. 2026-03-16 09:17:42 +02:00
Gros Frumos
d9172fc17c kin: KIN-016 Агенты должны уметь говорить 'не могу'. Если агент не может выполнить задачу (нет доступа, не понимает, выходит за компетенцию) — он должен вернуть status: blocked с причиной, а не пытаться угадывать. PM при получении blocked от агента — эскалирует к человеку через GUI (уведомление) и Telegram (когда будет). 2026-03-16 09:13:34 +02:00
Gros Frumos
a605e9d110 kin: KIN-070 При попытке запустить синк с обсидианом: Exported: 0 decisions Updated: 0 tasks Vault path does not exist or is not a directory: '/Users/grosfrumos/Library/Mobile Documents/iCloud~md~obsidian/Documents/myvault/kin'. Проверить задачу и добиться синхронизации. 2026-03-16 08:53:30 +02:00
Gros Frumos
71c697bf68 kin: KIN-070 Исправить sync с Obsidian: auto-create vault dir + корректный vault_path
- obsidian_sync.py: заменить проверку is_dir() на mkdir(parents=True, exist_ok=True)
  вместо ошибки при отсутствующей директории — автоматически создаём её
- test_obsidian_sync.py: обновить тест #9 под новое поведение (директория создаётся)
- БД fix: исправлен obsidian_vault_path (убраны лишние кавычки и /kin суффикс),
  теперь путь указывает на vault root, а не на подпапку проекта

Результат: Exported: 79 decisions, errors: []

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 08:50:52 +02:00
Gros Frumos
8007960332 kin: KIN-069 Frontend: цветные бейджи категорий и фильтр по категории в канбане 2026-03-16 08:41:24 +02:00
Gros Frumos
993362341b kin: KIN-067 При попытке сохранить настройки и синхронизироваться с обсидианом через настройки ошибка 'Sync error: Error: 400 Bad Request'. Разобраться с проблемой. Синхронизация работает в обе стороны. 2026-03-16 08:38:49 +02:00
Gros Frumos
81f974e6d3 kin: KIN-OBS-009 Task ID по категориям: PROJ-CAT-NUM (VDOL-SEC-001, VDOL-UI-003, VDOL-API-002, VDOL-INFRA-001, VDOL-BIZ-001). PM назначает категорию при создании задачи. 2026-03-16 08:34:30 +02:00
Gros Frumos
d50bd703ae kin: KIN-049 Кнопка Deploy на странице задачи после approve. Для каждого проекта настраивается deploy-команда (git push, scp, ssh restart). В Settings проекта. 2026-03-16 08:21:13 +02:00
Gros Frumos
01c39cc45c kin: KIN-045 добавить в GUI третью кнопку Revise (🔄) рядом с Approve/Reject. Revise = вернуть задачу агенту с комментарием человека. Модалка с textarea 'что доисследовать/доработать'. Задача возвращается в in_progress, агент получает свой предыдущий output + комментарий директора и дорабатывает 2026-03-16 07:21:36 +02:00
Gros Frumos
4fd825dc58 kin: KIN-013 Настройки в GUI: страница Settings с конфигурацией проектов. Путь к Obsidian vault для синхронизации decisions/tasks/kanban. Двусторонний sync: decisions → Obsidian .md, Obsidian чекбоксы → tasks. 2026-03-16 07:19:59 +02:00
Gros Frumos
6b328d7f2d kin: KIN-013 Obsidian sync + Revise UI (fixes и тесты)
- obsidian_sync.py: расширен regex для task ID с цифробуквенными префиксами ([A-Z][A-Z0-9]*-\d+)
- test_obsidian_sync.py: тест test_sync_updates_task_status обновлён под uppercase PROJ1-001
- TaskDetail.vue: добавлены revise() функция и Revise modal (отправить задачу на доработку)
- test_api.py: добавлены test_revise_task и test_revise_not_found

473/473 тестов проходят.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 07:17:54 +02:00
Gros Frumos
a48892d456 kin: KIN-008 Добавить возможность смены приоритетности и типа задачи руками из тасков 2026-03-16 07:15:04 +02:00
Gros Frumos
a0b0976d8d kin: KIN-021 Аудит-лог для --dangerously-skip-permissions в auto mode 2026-03-16 07:13:32 +02:00
Gros Frumos
756f9e65ab kin: KIN-054 Исправить race condition в loadMode() при инициализации ProjectView 2026-03-16 07:06:34 +02:00
Gros Frumos
ae21e48b65 kin: KIN-048 Post-pipeline hook: автокоммит после успешного завершения задачи. git add -A && git commit -m 'kin: TASK_ID TITLE'. Срабатывает автоматически как rebuild-frontend. 2026-03-16 06:59:46 +02:00
Gros Frumos
8a6f280cbd day 1: Kin from zero to production - agents, GUI, autopilot, 352 tests 2026-03-15 23:22:49 +02:00
Gros Frumos
4a27bf0693 feat(KIN-012): UI auto/review mode toggle, autopilot indicator, persist project mode in DB
- TaskDetail: hide Approve/Reject buttons in auto mode, show "Автопилот активен" badge
- TaskDetail: execution_mode persisted per-task via PATCH /api/tasks/{id}
- TaskDetail: loadMode reads DB value, falls back to localStorage per project
- TaskDetail: back navigation preserves status filter via ?back_status query param
- ProjectView: toggleMode now persists to DB via PATCH /api/projects/{id}
- ProjectView: loadMode reads project.execution_mode from DB first
- ProjectView: task list shows 🔓 badge for auto-mode tasks
- ProjectView: status filter synced to URL query param ?status=
- api.ts: add patchProject(), execution_mode field on Project interface
- core/db.py, core/models.py: execution_mode columns + migration for projects & tasks
- web/api.py: PATCH /api/projects/{id} and PATCH /api/tasks/{id} support execution_mode
- tests: 256 tests pass, new test_auto_mode.py with 60+ auto mode tests
- frontend: vitest config added for component tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 20:02:01 +02:00
Gros Frumos
3cb516193b feat(KIN-012): auto followup generation and pending_actions auto-resolution
Auto mode now calls generate_followups() after task_auto_approved hook.
Permission-blocked followup items are auto-resolved: rerun first, fallback
to manual_task on failure. Recursion guard skips followup-sourced tasks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 19:49:34 +02:00
Gros Frumos
01b269e2b8 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>
2026-03-15 19:17:42 +02:00
Gros Frumos
6705b302f7 test(KIN-005): parameterize task status update test for all valid statuses
Expand test_task_update_status to test all 7 valid statuses including
'cancelled' via CLI. Each status now has its own test case through
pytest parametrization.

Test suite now: 208 → 214 tests (all passing ✓)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-15 18:48:16 +02:00
Gros Frumos
8e517d5888 fix(tests): update test expectations to match KIN_NONINTERACTIVE env behavior
test_interactive_uses_600s_timeout: 600 → 300
test_interactive_no_stdin_override: None → subprocess.DEVNULL

When KIN_NONINTERACTIVE=1 is set in environment, runner always uses
300s timeout and DEVNULL stdin regardless of noninteractive parameter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 18:34:47 +02:00
Gros Frumos
d311c2fb66 feat: add post-pipeline hooks (KIN-003)
- core/hooks.py: HookRunner с CRUD, run_hooks(), _execute_hook(), логированием
- core/db.py: новые таблицы hooks и hook_logs в схеме
- agents/runner.py: вызов run_hooks() после завершения pipeline
- tests/test_hooks.py: 23 теста (CRUD, fnmatch-матчинг, выполнение, таймаут)

Хуки запускаются синхронно после update_task(status="review").
Ошибка хука логируется, не блокирует пайплайн.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 18:31:00 +02:00
Gros Frumos
bf38532f59 Add cancelled status for tasks
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 18:22:17 +02:00
Gros Frumos
6e872121eb feat: status dropdown on task detail page 2026-03-15 18:17:57 +02:00
Gros Frumos
9cbb3cec37 Fix audit hanging: add auto_apply param + allow_write for tool access
Root cause: claude agent without --dangerously-skip-permissions
hangs on tool permission prompts when stdin=DEVNULL.

Fixes:
- run_audit() now passes allow_write=True so agent can use
  Read/Bash tools without interactive permission prompts
- Added auto_apply param: False for API (result only),
  CLI confirms with user then applies manually
- API explicitly passes auto_apply=False
- Tests for auto_apply=True/False behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 18:00:39 +02:00
Gros Frumos
96509dcafc Add backlog audit and task update command
- agents/prompts/backlog_audit.md: QA analyst prompt for checking
  which pending tasks are already implemented in the codebase
- agents/runner.py: run_audit() — project-level agent that reads
  all pending tasks, inspects code, returns classification
- cli/main.py: kin audit <project_id> — runs audit, offers to mark
  done tasks; kin task update <id> --status --priority
- web/api.py: POST /api/projects/{id}/audit (runs audit inline),
  POST /api/projects/{id}/audit/apply (batch mark as done)
- Frontend: "Audit backlog" button on ProjectView with results
  modal showing already_done/still_pending/unclear categories

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 17:44:16 +02:00
Gros Frumos
e755a19633 Add Auto/Review mode toggle and non-interactive runner
- GUI: Auto/Review toggle on TaskDetail and ProjectView
  persisted per-project in localStorage
- Runner: noninteractive param (stdin=DEVNULL, 300s timeout)
  activated by KIN_NONINTERACTIVE=1 env or param
- CLI: --allow-write flag for kin run command
- API: POST /run accepts {allow_write: bool}, sets
  KIN_NONINTERACTIVE=1 and stdin=DEVNULL for subprocess
- Fixes pipeline hanging on interactive claude input (VDOL-002)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 17:35:08 +02:00
johnfrum1234
db1729730f Full pipeline flow through web interface with live updates
API:
  POST /api/tasks/{id}/run — sets task to in_progress immediately,
    launches subprocess with error handling and logging.
  GET /api/tasks/{id}/running — checks pipelines table for active run.
  Fixed --db flag position in subprocess command.

TaskDetail (live pipeline):
  - Run button starts pipeline, auto-starts 3s polling
  - Pipeline cards update in real-time as agent_logs appear
  - Pulsing blue dot on header while in_progress
  - Spinner on run button during execution
  - Auto-stops polling when status changes from in_progress
  - Cleanup on component unmount (no leaked timers)

ProjectView (run from list):
  - [>] button on each pending task row
  - Confirm dialog before starting
  - Pulsing blue dot for in_progress tasks
  - Click task row → /task/:id with live view

Dashboard (live statuses):
  - Pulsing blue dot next to active task count
  - Auto-poll every 5s when any project has active tasks
  - Stops polling when no active tasks

5 new API tests (running endpoint, run sets status, not found).
141 tests total, all passing. Frontend builds clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 15:29:05 +02:00
johnfrum1234
ab693d3c4d Add permission-aware follow-up flow with interactive resolution
When follow-up agent detects permission-blocked items ("ручное
применение", "permission denied", etc.), they become pending_actions
instead of auto-created tasks. User chooses per item:
  1. Rerun with --dangerously-skip-permissions
  2. Create manual task
  3. Skip

core/followup.py:
  _is_permission_blocked() — regex detection of 9 permission patterns
  generate_followups() returns {created, pending_actions}
  resolve_pending_action() — handles rerun/manual_task/skip

agents/runner.py:
  _run_claude(allow_write=True) adds --dangerously-skip-permissions
  run_agent/run_pipeline pass allow_write through

CLI: kin approve --followup — interactive 1/2/3 prompt per blocked item
API: POST /approve returns {needs_decision, pending_actions}
     POST /resolve resolves individual actions
Frontend: pending actions shown as cards with 3 buttons in approve modal

136 tests, all passing. Frontend builds clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 15:16:48 +02:00
johnfrum1234
9264415776 Add follow-up task generation on approve
When approving a task, PM agent analyzes pipeline output and creates
follow-up tasks automatically (e.g. security audit → 8 fix tasks).

core/followup.py:
  generate_followups() — collects pipeline output, runs followup agent,
  parses JSON task list, creates tasks with parent_task_id linkage.
  Handles: bare arrays, {tasks:[...]} wrappers, invalid JSON, empty.

agents/prompts/followup.md — PM prompt for analyzing results and
  creating actionable follow-up tasks with priority from severity.

CLI: kin approve <task_id> [--followup] [--decision "text"]
API: POST /api/tasks/{id}/approve {create_followups: true}
  Returns {status, decision, followup_tasks: [...]}

Frontend (TaskDetail approve modal):
  - Checkbox "Create follow-up tasks" (default ON)
  - Loading state during generation
  - Results view: list of created tasks with links to /task/:id

ProjectView: tasks show "from VDOL-001" for follow-ups.

13 new tests (followup), 125 total, all passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 15:02:58 +02:00
johnfrum1234
c129cf9d95 Fix output truncation bug, add language support for agent responses
Bug 1 — Output truncation:
  _run_claude() was replacing raw stdout with parsed sub-field which
  could be a dict (not string). run_agent() then saved dict.__repr__
  to DB instead of full JSON. Fixed: _run_claude() always returns
  string output; run_agent() ensures string before DB write.
  Added tests: full_output_saved_to_db, dict_output_saved_as_json_string.

Bug 2 — Language support:
  Added projects.language column (TEXT DEFAULT 'ru').
  Auto-migration for existing DBs (ALTER TABLE ADD COLUMN).
  context_builder passes language in project context.
  format_prompt() appends "## Language\nALWAYS respond in {language}"
  at the end of every prompt.
  CLI: kin project add --language ru (default: ru).
  Tests: language in prompt for ru/en, project creation, context.

112 tests, all passing. ~/.kin/kin.db migrated (vdol: language=ru).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 14:39:33 +02:00
johnfrum1234
38c252fc1b Add task detail view, pipeline visualization, approve/reject workflow
API (web/api.py) — 5 new endpoints:
  GET  /api/tasks/{id}/pipeline — agent_logs as pipeline steps
  GET  /api/tasks/{id}/full — task + steps + related decisions
  POST /api/tasks/{id}/approve — mark done, optionally add decision
  POST /api/tasks/{id}/reject — return to pending with reason
  POST /api/tasks/{id}/run — launch pipeline in background (202)

Frontend:
  TaskDetail (/task/:id) — full task page with:
    - Pipeline graph: role cards with icons, arrows, status colors
    - Click step → expand output (pre-formatted, JSON detected)
    - Action bar: Approve (with optional decision), Reject, Run Pipeline
    - Polling for live pipeline updates
  Dashboard: review_tasks badge ("awaiting review" in yellow)
  ProjectView: task rows are now clickable links to /task/:id

Runner: output_summary no longer truncated (full output for GUI).
Models: get_project_summary includes review_tasks count.

13 new API tests, 105 total, all passing. Frontend builds clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 14:32:29 +02:00
johnfrum1234
fabae74c19 Add context builder, agent runner, and pipeline executor
core/context_builder.py:
  build_context() — assembles role-specific context from DB.
  PM gets everything; debugger gets gotchas/workarounds; reviewer
  gets conventions only; tester gets minimal context; security
  gets security-category decisions.
  format_prompt() — injects context into role templates.

agents/runner.py:
  run_agent() — launches claude CLI as subprocess with role prompt.
  run_pipeline() — executes multi-step pipelines sequentially,
  chains output between steps, logs to agent_logs, creates/updates
  pipeline records, handles failures gracefully.

agents/specialists.yaml — 8 roles with tools, permissions, context rules.
agents/prompts/pm.md — PM prompt for task decomposition.
agents/prompts/security.md — security audit prompt (OWASP, auth, secrets).

CLI: kin run <task_id> [--dry-run]
  PM decomposes → shows pipeline → executes with confirmation.

31 new tests (15 context_builder, 11 runner, 5 JSON parsing).
92 total, all passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 14:03:32 +02:00
johnfrum1234
e5444114bd Fix bootstrap: deep scan, CLAUDE.md fallback, noise filtering
1. Tech stack: recursive file search (depth 3) + CLAUDE.md text fallback
   when config files are on remote server (detects nodejs, postgresql, etc.)
2. Modules: scan */src/ patterns in top-level dirs (frontend/src/, backend-pg/src/)
3. Decisions: filter out unrelated sections (Jitsi, Nextcloud, Prosody, GOIP),
   filter noise (commit hashes, shell commands, external service paths).
   Noise filtering also applied to Obsidian decisions.

Tested on vdolipoperek: 4 tech, 5 modules, 9 clean decisions, 24 Obsidian tasks.
61 tests, all passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:37:42 +02:00
johnfrum1234
da4a8aae72 Add bootstrap command — auto-detect project stack, modules, decisions
kin bootstrap <path> --id <id> --name <name> [--vault <path>]

Detects: package.json, requirements.txt, go.mod, config files → tech_stack.
Scans src/app/lib/frontend/backend dirs → modules with type detection.
Parses CLAUDE.md for GOTCHA/WORKAROUND/FIXME/ВАЖНО → decisions.
Scans Obsidian vault for kanban tasks, checkboxes, and decisions.
Preview before save, -y to skip confirmation.
18 bootstrap tests, 57 total passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:29:01 +02:00
johnfrum1234
432cfd55d4 Add CLI (cli/main.py) — click-based interface for all core operations
Commands: project (add/list/show), task (add/list/show),
decision (add/list), module (add/list), status, cost.
Auto-generated task IDs (PROJ-001). DB at ~/.kin/kin.db or $KIN_DB.
pyproject.toml with `kin` entry point. 18 CLI tests, 39 total passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:20:57 +02:00
johnfrum1234
3db73332ad Add core/models.py — data access functions for all 9 tables
20 functions covering: projects, tasks, decisions, modules,
agent_logs, pipelines, support tickets, and dashboard stats.
Parameterized queries, JSON encode/decode, no ORM.
21 tests, all passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 13:16:12 +02:00