MCPcopy
hub / github.com/cft0808/edict / cmd_flow

Function cmd_flow

scripts/kanban_update.py:416–437  ·  view source on GitHub ↗

添加流转记录(原子操作)

(task_id, from_dept, to_dept, remark)

Source from the content-addressed store, hash-verified

414
415
416def cmd_flow(task_id, from_dept, to_dept, remark):
417 """添加流转记录(原子操作)"""
418 clean_remark = _sanitize_remark(remark)
419 agent_id = _infer_agent_id_from_runtime()
420 agent_label = _AGENT_LABELS.get(agent_id, agent_id)
421 def modifier(tasks):
422 t = find_task(tasks, task_id)
423 if not t:
424 log.error(f'任务 {task_id} 不存在')
425 return tasks
426 t.setdefault('flow_log', []).append({
427 "at": now_iso(), "from": from_dept, "to": to_dept, "remark": clean_remark,
428 "agent": agent_id, "agentLabel": agent_label,
429 })
430 # 同步更新 org,使看板能正确显示当前所属部门
431 t['org'] = to_dept
432 t['updatedAt'] = now_iso()
433 return tasks
434 atomic_json_update(TASKS_FILE, modifier, [])
435 _trigger_refresh()
436 log.info(f'✅ {task_id} 流转记录: {from_dept} → {to_dept}')
437 _append_audit(task_id, _infer_agent_id_from_runtime(), 'flow', from_dept, to_dept, clean_remark)
438
439
440def cmd_done(task_id, output_path='', summary=''):

Callers 2

test_flow_remark_cleanedFunction · 0.90
kanban_update.pyFile · 0.70

Calls 5

atomic_json_updateFunction · 0.90
_append_auditFunction · 0.85
_sanitize_remarkFunction · 0.70
_trigger_refreshFunction · 0.70

Tested by 1

test_flow_remark_cleanedFunction · 0.72