PMFlow/docs/superpowers/plans/2026-04-02-feishu-web-full-...

60 lines
3.3 KiB
Markdown

# Feishu Web Full Flow Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Add a real Feishu web automation script that drives the PMFlow draft-confirmation flow end to end, and make project creation auto-assign generated tasks through the skill graph.
**Architecture:** Keep the existing `draft_pending_confirm` PMFlow flow as the orchestration backbone. The backend change assigns owners during AI Steward project creation by resolving skill tags and calling the existing personnel recommender. The browser change uses Playwright with a persistent Chrome profile to send real Feishu web messages, then verifies downstream results through the database.
**Tech Stack:** FastAPI, SQLAlchemy, React/Vite workspace tooling, Playwright, Node.js, PostgreSQL
---
### Task 1: Lock task auto-assignment with a failing backend test
**Files:**
- Modify: `backend/tests/test_ai_steward_project_from_text_contract.py`
- [ ] Add a unit test for `_normalize_project_creation_draft` that expects a generated task draft to include `assignee_id` and structured recommendation metadata when the skill recommender returns a top match.
- [ ] Run the focused pytest target and confirm it fails for the missing assignment behavior.
### Task 2: Implement skill-graph-based auto-assignment in AI Steward
**Files:**
- Modify: `backend/app/services/ai_steward_service/shared.py`
- Modify: `backend/app/services/ai_steward_service/mixin_creation_normalize_persist.py`
- [ ] Import the personnel recommender into the AI Steward service layer.
- [ ] Add a helper that requests recommendations from the skill graph and normalizes the top candidate into `assignee_id` plus `ai_recommended_assignees`.
- [ ] Thread the recommendation result into `build_task_create_draft`.
- [ ] Re-run the focused pytest target and confirm it passes.
### Task 3: Add Playwright Feishu web automation scaffolding
**Files:**
- Modify: `frontend/package.json`
- Add: `frontend/playwright.config.ts`
- Add: `frontend/e2e/feishu-project-full-flow.spec.ts`
- [ ] Add Playwright dev dependencies and test scripts.
- [ ] Add a config that supports a persistent Chrome session, local artifacts, and env-driven runtime settings.
- [ ] Write the Feishu web E2E that sends a unique project-creation message, revises the draft for 3-5 rounds with explicit `work_item` targeting, confirms the draft, and validates database side effects.
### Task 4: Update project docs
**Files:**
- Modify: `CLAUDE.md`
- [ ] Document the new `frontend/playwright.config.ts` and `frontend/e2e/` test directory in the structure sections.
- [ ] Document the AI Steward task auto-assignment behavior and the new Feishu web E2E coverage where relevant.
### Task 5: Verify and iterate until green
**Files:**
- No code changes expected, but rerun as needed
- [ ] Run focused backend pytest for the new auto-assignment behavior.
- [ ] Install frontend dependencies and Playwright.
- [ ] Run the Feishu web E2E and fix selectors, environment assumptions, or backend gaps until it passes in the current environment.
- [ ] Run `python -m py_compile` on changed backend modules and `npm run build` / `tsc --noEmit` in `frontend` if dependency/setup state permits.