Skip to content

Commit 88dd14d

Browse files
binarykclaude
andcommitted
fix: output /docs:generate to docs/{module}/ folder
- /docs:generate projects → docs/projects/index.md - /docs:generate /users/settings → docs/users-settings/index.md - Images saved to docs/{module}/images/ - Consistent with /docs:flow output structure 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f6d0b06 commit 88dd14d

1 file changed

Lines changed: 69 additions & 25 deletions

File tree

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

Lines changed: 69 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,58 @@ Check `auth.method` in config:
6363

6464
Parse the arguments passed to this workflow. Expected format:
6565
```
66-
/docs:generate <url> [--auth user:pass] [--output ./docs] [--codebase ./src] [--skip-flows] [--flow "flow name"]
66+
/docs:generate <url-or-module> [--auth user:pass] [--output ./docs] [--codebase ./src] [--skip-flows] [--flow "flow name"]
6767
```
6868

6969
Extract:
70-
- `url` (required) - The URL to document (can be full URL or path if base URL in config)
70+
- `url` (required) - The URL or module name to document (can be full URL, path, or module name)
7171
- `auth` (optional) - Credentials in user:pass format for authenticated pages
72-
- `output` (optional) - Output directory (default from config or ./docs)
72+
- `output` (optional) - Base output directory (default from config or ./docs)
7373
- `codebase` (optional) - Path to codebase (default from config or .)
7474
- `skip-flows` (optional) - Skip interactive flow detection, just capture page
7575
- `flow` (optional) - Automatically document a specific flow (e.g., --flow "create campaign")
7676

77-
If URL is missing, ask the user: "Please provide the URL to document."
77+
If URL is missing, ask the user: "Please provide the URL or module name to document."
7878

79-
**URL Resolution:**
80-
- If full URL provided: use as-is
79+
**URL/Module Resolution:**
80+
- If full URL provided: use as-is, extract module from path
8181
- If path provided (e.g., `/campaigns`): combine with `urls.base` from config
82+
- If module name provided (e.g., `projects`): search routes for matching URL
8283
- If no base URL in config and path provided: ask for full URL
8384

85+
**Module Name Detection:**
86+
If input looks like a module name (no `/` prefix, no `http`):
87+
1. Search `routes/web.php` or `routes/api.php` for matching route
88+
2. Search for controller with matching name (e.g., `ProjectsController`)
89+
3. If found, construct URL from base URL + route path
90+
4. If not found, ask user for the full URL
91+
92+
---
93+
94+
## OUTPUT STRUCTURE
95+
96+
**Output is organized by module name:**
97+
98+
```
99+
docs/
100+
├── {module}/
101+
│ ├── index.md # Main page documentation
102+
│ └── images/
103+
│ ├── {module}.png # Main screenshot
104+
│ └── {module}-flow-step-1.png # Flow screenshots
105+
```
106+
107+
**Examples:**
108+
- `/docs:generate /projects` → `docs/projects/index.md`
109+
- `/docs:generate /users/settings` → `docs/users-settings/index.md`
110+
- `/docs:generate campaigns` → `docs/campaigns/index.md`
111+
112+
**Module name extraction:**
113+
- From URL path: `/projects` → `projects`
114+
- From URL path: `/users/settings` → `users-settings`
115+
- From full URL: `https://app.com/campaigns` → `campaigns`
116+
- From module name: `projects` → `projects`
117+
84118
---
85119
86120
## STEP 1: MCP PREREQUISITE CHECK
@@ -145,13 +179,14 @@ Use Playwright MCP to:
145179
146180
## STEP 3: CAPTURE AND ANALYZE PAGE
147181
148-
1. **Capture full-page screenshot** using Playwright MCP
149-
2. **Save screenshot to file:**
150-
- Create `{output}/images/` directory if it doesn't exist
151-
- Save as `{output}/images/{kebab-case-title}.png`
152-
- Store the relative path for markdown: `./images/{kebab-case-title}.png`
153-
3. **Extract page title** from the browser
154-
4. **Analyze the screenshot visually** - identify:
182+
1. **Extract module name** from URL (e.g., `/projects` → `projects`)
183+
2. **Capture full-page screenshot** using Playwright MCP
184+
3. **Save screenshot to file:**
185+
- Create `docs/{module}/images/` directory if it doesn't exist
186+
- Save as `docs/{module}/images/{module}.png`
187+
- Store the relative path for markdown: `./images/{module}.png`
188+
4. **Extract page title** from the browser
189+
5. **Analyze the screenshot visually** - identify:
155190
- Page purpose and layout
156191
- Main sections (header, sidebar, main content, footer)
157192
- Interactive elements (buttons, forms, links, tables)
@@ -250,7 +285,7 @@ Create a markdown file with the following structure:
250285
- Remove runtime data (counts, specific IDs, timestamps)
251286
- Describe WHAT users can do, not HOW it's implemented
252287
- Keep it concise and scannable
253-
- Use the page title for filename (kebab-case): `campaigns.md`, `user-settings.md`
288+
- Save as `docs/{module}/index.md` (e.g., `docs/projects/index.md`)
254289
- Include project name from config in header if available
255290

256291
---
@@ -450,26 +485,35 @@ If user requests a complete flow (e.g., "Create a new campaign"):
450485

451486
## STEP 8: SAVE AND REPORT
452487

453-
1. **Create output directory** if it doesn't exist
454-
2. **Create images subdirectory** `{output}/images/` if it doesn't exist
455-
3. **Save all screenshots**:
456-
- Main page: `{output}/images/{kebab-case-title}.png`
457-
- Flow steps: `{output}/images/{kebab-case-title}-flow-step-{n}.png`
458-
- Form states: `{output}/images/{kebab-case-title}-form-{state}.png`
459-
4. **Write markdown file** to `{output}/{kebab-case-title}.md`
460-
5. **Report completion:**
488+
1. **Extract module name** from URL:
489+
- `/projects``projects`
490+
- `/users/settings``users-settings`
491+
- `https://app.com/campaigns``campaigns`
492+
493+
2. **Create module directory** `docs/{module}/` if it doesn't exist
494+
495+
3. **Create images subdirectory** `docs/{module}/images/` if it doesn't exist
496+
497+
4. **Save all screenshots**:
498+
- Main page: `docs/{module}/images/{module}.png`
499+
- Flow steps: `docs/{module}/images/{module}-flow-step-{n}.png`
500+
- Form states: `docs/{module}/images/{module}-form-{state}.png`
501+
502+
5. **Write markdown file** to `docs/{module}/index.md`
503+
504+
6. **Report completion:**
461505

462506
```
463507
✅ Documentation generated successfully!
464508
465-
📄 File: {output path}
509+
📄 File: docs/{module}/index.md
510+
📁 Folder: docs/{module}/
466511
🖼️ Screenshots: {count} images saved
467-
- Main page screenshot
512+
- docs/{module}/images/{module}.png
468513
{if flow documented}
469514
- {flow_name} flow ({step_count} steps)
470515
{/if}
471516
📊 Sections: Overview, Features, Key Actions, [How to: ...], [Data Display], [Related Pages]
472-
⏱️ Time: {elapsed time}
473517
474518
Review the generated documentation and edit as needed.
475519
```

0 commit comments

Comments
 (0)