Skip to content

Commit 7299634

Browse files
committed
feat: /docs:flow auto-runs discover and explore if needed
1 parent 2546650 commit 7299634

2 files changed

Lines changed: 84 additions & 16 deletions

File tree

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,11 @@ aidocs init .
6969
│ DOCUMENT A MODULE │
7070
├──────────────────────────────────────────────────────────────────────────────┤
7171
│ │
72-
│ /docs:discover campaigns Analyze code: models, routes, validation
72+
│ /docs:flow campaign --lifecycle ← Just run this one command!
7373
│ │ │
74-
│ ▼ │
75-
│ /docs:explore campaigns Test UI: click buttons, fill forms │
76-
│ │ │
77-
│ ▼ │
78-
│ /docs:flow campaign --lifecycle Generate: create → view → edit → delete │
74+
│ ├──→ Auto-runs /docs:discover campaign (analyzes code) │
75+
│ ├──→ Auto-runs /docs:explore campaign (tests UI) │
76+
│ └──→ Generates full lifecycle docs with screenshots │
7977
│ │
8078
└──────────────────────────────────────────────────────────────────────────────┘
8179
@@ -96,8 +94,8 @@ aidocs init .
9694
# Simple: Generate docs for one page
9795
/docs:generate https://myapp.com/dashboard
9896

99-
# Smart: Full module documentation
100-
/docs:discover campaigns && /docs:explore campaigns && /docs:flow campaign
97+
# Smart: Full module documentation (auto-discovers and explores)
98+
/docs:flow campaign --lifecycle
10199

102100
# Maintain: Update after code changes
103101
/docs:update --base main
@@ -251,15 +249,21 @@ Interactively explore a module's UI with Playwright:
251249

252250
### `/docs:flow <entity>`
253251

254-
Document a complete entity lifecycle:
252+
Document a complete entity lifecycle. **Auto-runs discover and explore if needed.**
255253

256254
```bash
257255
/docs:flow campaign # Smart flow detection
258256
/docs:flow campaign --lifecycle # Full CRUD documentation
259257
/docs:flow "user registration" # Custom flow description
260258
/docs:flow order --include-errors # Include error states
259+
/docs:flow campaign --skip-explore # Skip UI exploration (faster)
261260
```
262261

262+
**What happens:**
263+
1. Auto-runs `/docs:discover` if module not analyzed yet
264+
2. Auto-runs `/docs:explore` if UI not explored yet
265+
3. Documents the complete flow with screenshots
266+
263267
**Produces step-by-step guides with:**
264268
- Screenshots at each step
265269
- Data flow tracking

src/aidocs_cli/templates/workflows/flow/workflow.md

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ description: Document a complete entity lifecycle or custom user flow with cross
99

1010
**Your Role:** You are a flow documentarian. You will execute a complete user journey, capture each step, document what happens, and produce a detailed guide.
1111

12-
**Requires:** Playwright MCP, Knowledge base (run /docs:discover first)
12+
**Requires:** Playwright MCP
1313

1414
---
1515

1616
## ARGUMENTS PARSING
1717

1818
Parse the arguments:
1919
```
20-
/docs:flow <entity|"custom description"> [--lifecycle] [--include-errors] [--output]
20+
/docs:flow <entity|"custom description"> [--lifecycle] [--include-errors] [--skip-explore] [--output]
2121
```
2222

2323
Examples:
@@ -26,18 +26,82 @@ Examples:
2626
/docs:flow campaign --lifecycle # Full CRUD: create, view, edit, delete
2727
/docs:flow "user registration" # Custom flow by description
2828
/docs:flow order --include-errors # Include error states
29-
/docs:flow payment --output ./guides # Custom output location
29+
/docs:flow campaign --skip-explore # Skip UI exploration (use existing knowledge)
3030
```
3131

3232
---
3333

34-
## STEP 1: DETERMINE FLOW TYPE
34+
## STEP 1: AUTO-RUN PREREQUISITES
35+
36+
**This command automatically runs discover and explore if needed.**
37+
38+
### 1.1 Check Knowledge Base
39+
40+
Check if `.docs-knowledge/modules/{entity}/` exists:
41+
42+
```
43+
🔍 Checking knowledge base for: campaign
44+
45+
□ Module discovery → Not found
46+
□ UI exploration → Not found
47+
□ Flow documentation → Starting...
48+
```
49+
50+
### 1.2 Auto-Run Discover (if missing)
51+
52+
If knowledge base doesn't exist for this module:
53+
54+
```
55+
📊 Step 1/3: Discovering module structure...
56+
57+
Running: /docs:discover campaign --deep
58+
59+
✓ Entity analyzed: Campaign (12 fields, 3 relationships)
60+
✓ Routes found: 5 endpoints
61+
✓ Validation rules: 8 rules extracted
62+
✓ Components: CampaignForm, CampaignList, CampaignDetail
63+
64+
Knowledge saved to: .docs-knowledge/modules/campaigns/
65+
```
66+
67+
### 1.3 Auto-Run Explore (if missing or outdated)
68+
69+
If UI exploration hasn't been done (unless --skip-explore):
70+
71+
```
72+
🖱️ Step 2/3: Exploring UI behaviors...
73+
74+
Running: /docs:explore campaign
75+
76+
✓ Pages explored: 4
77+
✓ Conditional UI discovered: 3 triggers
78+
✓ Validation messages captured: 8
79+
✓ Cross-page effects mapped: 5
80+
81+
Exploration saved to: .docs-knowledge/modules/campaigns/ui-states/
82+
```
83+
84+
### 1.4 Proceed to Flow Documentation
85+
86+
```
87+
📚 Step 3/3: Documenting flow...
88+
89+
Knowledge loaded:
90+
✓ Entity: Campaign
91+
✓ Routes: 5 endpoints
92+
✓ UI States: 4 pages mapped
93+
✓ Validation: 8 rules + messages
94+
95+
Ready to document flow.
96+
```
97+
98+
---
99+
100+
## STEP 2: DETERMINE FLOW TYPE
35101

36102
### If entity name provided:
37103

38-
Check `.docs-knowledge/modules/{entity}/`:
39-
- If exists: Load entity knowledge
40-
- If not: Run quick discovery or ask to run `/docs:discover {entity}` first
104+
Load knowledge from `.docs-knowledge/modules/{entity}/`
41105

42106
**Detect available flows:**
43107
```

0 commit comments

Comments
 (0)