diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index b1f5550..97b239b 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "taskflow", "description": "Plan-and-task workflow: scope/tasks/questions/progress scaffolding split into pull requests under a line budget, acceptance criteria agreed up front, tests red before green, one-task-per-commit cycle, questions answered at the task that needs them, red-first bug fixes, docs-and-diagram sync, standards review.", - "version": "0.8.3", + "version": "0.8.4", "types": "./types/index.d.ts", "author": { "name": "Guilherme Moraes" }, "license": "MIT" diff --git a/panel/data/board.ts b/panel/data/board.ts index 0f7ea11..15c4614 100644 --- a/panel/data/board.ts +++ b/panel/data/board.ts @@ -112,6 +112,24 @@ export async function loadBoard($: EngineInterface) { } } +// A cheap fingerprint of what the board shows: the resolved plan dir and every PROGRESS.md's mtime. +export async function boardSignature($: EngineInterface) { + const root = await repoRoot($) + const resolved = await readPlanDir($, root) + if ('error' in resolved) return `error:${resolved.error}` + if (!(await $.fs.exists(resolved.base))) return `missing:${resolved.base}` + + const stamps: string[] = [resolved.base] + for (const entry of await $.fs.list(resolved.base)) { + if (entry.kind !== 'dir') continue + const progressPath = `${resolved.base}/${entry.name}/PROGRESS.md` + if (!(await $.fs.exists(progressPath))) continue + stamps.push(`${entry.name}:${(await $.fs.stat(progressPath)).mtimeMs}`) + } + + return stamps.join('|') +} + async function realPath($: EngineInterface, path: string) { const resolved = await $.process.run(['realpath', '--', path]) diff --git a/panel/register.tsx b/panel/register.tsx index 09616e4..1e8ecc7 100644 --- a/panel/register.tsx +++ b/panel/register.tsx @@ -1,11 +1,12 @@ import { atom, update } from 'claude-code' import type { EngineInterface, Register } from 'claude-code' -import { loadBoard } from './data/board' +import { boardSignature, loadBoard } from './data/board' import { renderPane } from './ui/pane' const PANE = 'taskflow' const TITLE = 'Taskflow' +const WATCH_MS = 1000 const animationStep = atom({ plugin: 'taskflow', key: 'animationStep' } as const, 0) @@ -20,6 +21,15 @@ export const register: Register = on => { void openPane($) $.clock.every(100, () => void update($, animationStep, step => step + 1)) + // Reload whenever a PROGRESS.md changes - mid-turn, from a subagent or from Obsidian - not only at turn end. + let lastSignature = '' + $.clock.every(WATCH_MS, async () => { + const signature = await boardSignature($) + if (signature === lastSignature) return + lastSignature = signature + await loadBoard($) + }) + return next(e) })