Kanban Workflow (core)
Goal
Provide a reusable core for a project-management “co-worker” that:
- - Uses the existing
stage:* lifecycle as the canonical state machine. - Integrates with PM platforms via CLI-managed auth only (no direct HTTP auth handling).
- Centralizes workflow/rules/runbooks so GitHub/Planka/Plane/Linear implementations share logic.
Canonical stage model
Treat these labels/states as canonical (and the only stages the agent should consider):
- - INLINECODE1
- INLINECODE2
- INLINECODE3
- INLINECODE4
Notes:
- - Done/closed is platform-specific and intentionally not part of the canonical stage set.
Adapters map platform concepts (labels, lists, statuses, custom fields) into this canonical set.
Architecture (ports & adapters)
Core (platform-agnostic)
- - Canonical entities:
WorkItem, Project, Comment, Stage. - Canonical events:
WorkItemCreated, WorkItemUpdated, StageChanged, CommentAdded, etc. - Workflow engine: stage-based worker loop + clarification/comment templates.
- State: cursors + dedupe + snapshots for diffing.
Adapters (platform-specific)
Adapters are “smart wrappers” that:
- - Call existing CLIs (e.g.
gh, planka-cli, plane-cli, linear-cli), relying on their auth/session. - Compose multiple CLI calls to implement higher-level operations.
- Synthesize events by polling + snapshot diffing when webhooks or event types are missing.
Canonical adapter entrypoints live in src/adapters/:
- -
github.ts (gh CLI) - INLINECODE19 (planka-cli)
- INLINECODE20 (plane-cli; Api2Cli workspace)
- INLINECODE21 (linear-cli; Api2Cli workspace)
See also: src/adapters/README.md for CLI links and assumptions.
Entry points
Library entry points:
- -
tick() (poll → normalize → diff → events) - verb-level workflow helpers:
show, next, start, update, ask, complete, INLINECODE30 - automations: INLINECODE31
CLI entry point:
- -
src/cli.ts (provides kanban-workflow <verb>; see README for setup flags)
CLI ergonomics: "What next" tips
All kanban-workflow <verb> commands print a What next: tip after execution to guide the canonical flow:
INLINECODE36 → next → start → (ask | update) → complete → INLINECODE42
After start, the tip additionally reminds you to run the actual execution/implementation work in a subagent, then report back via ask/update.
If config/kanban-workflow.json is missing or invalid, all commands error and instruct you to complete setup.
Setup (flags-only)
Setup writes config/kanban-workflow.json and validates that the selected platform CLI is installed + authenticated.
Required:
- - INLINECODE48
- stage mapping flags:
--map-backlog, --map-blocked, --map-in-progress, INLINECODE52
Adapter flags (summary):
- - GitHub:
--github-repo <owner/repo>, optional INLINECODE54 - Plane:
--plane-workspace-slug <slug>, --plane-project-id <uuid>, optional INLINECODE57 - Linear:
--linear-team-id <id> or --linear-project-id <id>, optional INLINECODE60 - Planka:
--planka-board-id <id>, INLINECODE62
Continuous status updates
While a task is in stage:in-progress, Kanban Workflow can post an automatic progress update comment every 5 minutes.
Use runProgressAutoUpdates() and persist its state in your agent/runtime.
Recommended repo layout
- -
scripts/: deterministic helper scripts used by adapters or the core. - INLINECODE67 : schemas and adapter notes (loaded on demand).
- INLINECODE68 : runbooks/SOP templates.
Repo status
- - The current core implementation is in TypeScript under
src/.
Next implementation steps
1) Extend the adapter port to include idempotent write operations (comment/transition/label) in addition to fetchSnapshot().
2) Finish and validate the Plane + Linear adapters (consume plane-cli / linear-cli output schemas).
3) Decide on the authoritative mapping rule for stage → platform state (names vs explicit mapping table) and codify it.
4) Add a small CLI surface for Kanban Workflow itself (e.g. kanban-workflow tick --adapter plane --workspace ... --project ...).
技能名称: kanban-workflow
详细描述:
看板工作流(核心)
目标
提供一个可复用的核心模块,用于构建项目管理“协作者”,其具备以下特性:
- - 使用现有的 stage:* 生命周期作为规范状态机。
- 仅通过 CLI 管理的认证 与项目管理平台集成(不直接处理 HTTP 认证)。
- 集中管理工作流/规则/操作手册,使 GitHub/Planka/Plane/Linear 的实现共享逻辑。
规范阶段模型
将以下标签/状态视为规范阶段(且是代理应唯一考虑的阶段):
- - stage:backlog
- stage:blocked
- stage:in-progress
- stage:in-review
注意:
- - 已完成/已关闭状态是平台特定的,有意不包含在规范阶段集合中。
适配器将平台概念(标签、列表、状态、自定义字段)映射到该规范集合。
架构(端口与适配器)
核心(平台无关)
- - 规范实体:WorkItem、Project、Comment、Stage。
- 规范事件:WorkItemCreated、WorkItemUpdated、StageChanged、CommentAdded 等。
- 工作流引擎:基于阶段的工作循环 + 澄清/评论模板。
- 状态:游标 + 去重 + 用于差异比较的快照。
适配器(平台特定)
适配器是“智能封装器”,其功能包括:
- - 调用现有 CLI(例如 gh、planka-cli、plane-cli、linear-cli),依赖其认证/会话。
- 组合多个 CLI 调用来实现更高级的操作。
- 在缺少 Webhook 或事件类型时,通过轮询 + 快照差异比较来合成事件。
规范适配器入口点位于 src/adapters/:
- - github.ts(gh CLI)
- planka.ts(planka-cli)
- plane.ts(plane-cli;Api2Cli 工作区)
- linear.ts(linear-cli;Api2Cli 工作区)
另请参阅:src/adapters/README.md 获取 CLI 链接和假设。
入口点
库入口点:
- - tick()(轮询 → 规范化 → 差异比较 → 事件)
- 动词级别的工作流辅助函数:show、next、start、update、ask、complete、create
- 自动化:runProgressAutoUpdates()
CLI 入口点:
- - src/cli.ts(提供 kanban-workflow ;参见 README 获取设置标志)
CLI 人机工程学:“下一步”提示
所有 kanban-workflow 命令在执行后都会打印一条 What next: 提示,以引导规范流程:
setup → next → start → (ask | update) → complete → next
在 start 之后,提示还会额外提醒您在 子代理 中执行实际执行/实现工作,然后通过 ask/update 报告结果。
如果 config/kanban-workflow.json 缺失或无效,所有命令 都会报错并指示您完成设置。
设置(仅标志)
设置会写入 config/kanban-workflow.json,并验证所选平台 CLI 已安装且通过认证。
必需:
- - kanban-workflow setup --adapter ...
- 阶段映射标志:--map-backlog、--map-blocked、--map-in-progress、--map-in-review
适配器标志(摘要):
- - GitHub:--github-repo ,可选 --github-project-number
- Plane:--plane-workspace-slug 、--plane-project-id ,可选 --plane-order-field
- Linear:--linear-team-id 或 --linear-project-id ,可选 --linear-view-id
- Planka:--planka-board-id 、--planka-backlog-list-id
持续状态更新
当任务处于 stage:in-progress 阶段时,看板工作流可以每 5 分钟自动发布一条进度更新评论。
使用 runProgressAutoUpdates() 并在您的代理/运行时中持久化其 state。
推荐仓库布局
- - scripts/:适配器或核心使用的确定性辅助脚本。
- references/:模式和适配器说明(按需加载)。
- assets/:操作手册/SOP 模板。
仓库状态
- - 当前核心实现位于 src/ 下的 TypeScript 中。
下一步实施步骤
1) 扩展适配器端口,使其除了 fetchSnapshot() 之外,还包括幂等写入操作(评论/状态转换/标签)。
2) 完成并验证 Plane + Linear 适配器(消费 plane-cli / linear-cli 输出模式)。
3) 确定阶段到平台状态的权威映射规则(名称与显式映射表),并将其规范化。
4) 为看板工作流本身添加一个小型 CLI 界面(例如 kanban-workflow tick --adapter plane --workspace ... --project ...)。