feat: Implement DeepWiki documentation generation tools

- Added `__init__.py` in `codexlens/tools` for documentation generation.
- Created `deepwiki_generator.py` to handle symbol extraction and markdown generation.
- Introduced `MockMarkdownGenerator` for testing purposes.
- Implemented `DeepWikiGenerator` class for managing documentation generation and file processing.
- Added unit tests for `DeepWikiStore` to ensure proper functionality and error handling.
- Created tests for DeepWiki TypeScript types matching.
This commit is contained in:
catlog22
2026-03-05 18:30:56 +08:00
parent 0bfae3fd1a
commit fb4f6e718e
62 changed files with 7500 additions and 68 deletions

View File

@@ -22,6 +22,13 @@ Design feedback mechanisms (loading/error/success states) and state management p
| React | useState, useRef | onClick, onChange |
| Vue | ref, reactive | @click, @change |
### Wisdom Input
1. Read `<session>/wisdom/patterns/ui-feedback.md` for established feedback design patterns
2. Read `<session>/wisdom/patterns/state-management.md` for state handling patterns
3. Read `<session>/wisdom/principles/general-ux.md` for UX design principles
4. Apply patterns when designing solutions for identified issues
### Complex Design (use CLI)
For complex multi-component solutions:
@@ -166,6 +173,13 @@ const handleUpload = async (event: React.FormEvent) => {
```
2. Write guide to `<session>/artifacts/design-guide.md`
### Wisdom Contribution
If novel design patterns created:
1. Write new patterns to `<session>/wisdom/contributions/designer-pattern-<timestamp>.md`
2. Format: Problem context, solution design, implementation hints, trade-offs
3. Share state via team_msg:
```
team_msg(operation="log", session_id=<session-id>, from="designer",

View File

@@ -14,6 +14,13 @@ Diagnose root causes of UI issues: state management problems, event binding fail
1. Load scan report from `<session>/artifacts/scan-report.md`
2. Load scanner state via `team_msg(operation="get_state", session_id=<session-id>, role="scanner")`
### Wisdom Input
1. Read `<session>/wisdom/patterns/ui-feedback.md` and `<session>/wisdom/patterns/state-management.md` if available
2. Use patterns to identify root causes of UI interaction issues
3. Reference `<session>/wisdom/anti-patterns/common-ux-pitfalls.md` for common causes
3. Assess issue complexity:
| Complexity | Criteria | Strategy |
@@ -82,6 +89,13 @@ For each issue from scan report:
```
2. Write report to `<session>/artifacts/diagnosis.md`
### Wisdom Contribution
If new root cause patterns discovered:
1. Write diagnosis patterns to `<session>/wisdom/contributions/diagnoser-patterns-<timestamp>.md`
2. Format: Symptom, root cause, detection method, fix approach
3. Share state via team_msg:
```
team_msg(operation="log", session_id=<session-id>, from="diagnoser",

View File

@@ -15,6 +15,12 @@ Explore codebase for UI component patterns, state management conventions, and fr
1. Parse exploration request from task description
2. Determine file patterns based on framework:
### Wisdom Input
1. Read `<session>/wisdom/patterns/ui-feedback.md` and `<session>/wisdom/patterns/state-management.md` if available
2. Use known patterns as reference when exploring codebase for component structures
3. Check `<session>/wisdom/anti-patterns/common-ux-pitfalls.md` to identify problematic patterns during exploration
| Framework | Patterns |
|-----------|----------|
| React | `**/*.tsx`, `**/*.jsx`, `**/use*.ts`, `**/store*.ts` |
@@ -80,6 +86,18 @@ For each dimension, collect:
2. Cache results to `<session>/explorations/cache-index.json`
3. Write summary to `<session>/explorations/exploration-summary.md`
### Wisdom Contribution
If new component patterns or framework conventions discovered:
1. Write pattern summaries to `<session>/wisdom/contributions/explorer-patterns-<timestamp>.md`
2. Format:
- Pattern Name: Descriptive name
- Framework: React/Vue/etc.
- Use Case: When to apply this pattern
- Code Example: Representative snippet
- Adoption: How widely used in codebase
4. Share state via team_msg:
```
team_msg(operation="log", session_id=<session-id>, from="explorer",

View File

@@ -15,7 +15,12 @@ Generate executable fix code with proper state management, event handling, and U
1. Extract session path from task description
2. Read design guide: `<session>/artifacts/design-guide.md`
3. Extract implementation tasks from design guide
4. Load framework conventions from wisdom files (if available)
4. **Wisdom Input**:
- Read `<session>/wisdom/patterns/state-management.md` for state handling patterns
- Read `<session>/wisdom/patterns/ui-feedback.md` for UI feedback implementation patterns
- Read `<session>/wisdom/principles/general-ux.md` for implementation principles
- Load framework-specific conventions if available
- Apply these patterns and principles when generating code to ensure consistency and quality
5. **For inner loop**: Load context_accumulator from prior IMPL tasks
### Context Accumulator (Inner Loop)
@@ -123,3 +128,37 @@ team_msg(operation="log", session_id=<session-id>, from="implementer",
validation_passed: true
})
```
### Wisdom Contribution
If reusable code patterns or snippets created:
1. Write code snippets to `<session>/wisdom/contributions/implementer-snippets-<timestamp>.md`
2. Format: Use case, code snippet with comments, framework compatibility notes
Example contribution format:
```markdown
# Implementer Snippets - <timestamp>
## Loading State Pattern (React)
### Use Case
Async operations requiring loading indicator
### Code Snippet
```tsx
const [isLoading, setIsLoading] = useState(false);
const handleAsyncAction = async () => {
setIsLoading(true);
try {
await performAction();
} finally {
setIsLoading(false);
}
};
```
### Framework Compatibility
- React 16.8+ (hooks)
- Next.js compatible
```

View File

@@ -32,6 +32,12 @@ Scan UI components to identify interaction issues: unresponsive buttons, missing
- React: `**/*.tsx`, `**/*.jsx`, `**/use*.ts`
- Vue: `**/*.vue`, `**/composables/*.ts`
### Wisdom Input
1. Read `<session>/wisdom/anti-patterns/common-ux-pitfalls.md` if available
2. Use anti-patterns to identify known UX issues during scanning
3. Check `<session>/wisdom/patterns/ui-feedback.md` for expected feedback patterns
### Complex Analysis (use CLI)
For large projects with many components:
@@ -103,3 +109,9 @@ For each component file:
scanned_files: <count>
})
```
### Wisdom Contribution
If novel UX issues discovered that aren't in anti-patterns:
1. Write findings to `<session>/wisdom/contributions/scanner-issues-<timestamp>.md`
2. Format: Issue description, detection criteria, affected components

View File

@@ -29,6 +29,12 @@ Generate and run tests to verify fixes (loading states, error handling, state up
3. Load test strategy from design guide
### Wisdom Input
1. Read `<session>/wisdom/anti-patterns/common-ux-pitfalls.md` for common issues to test
2. Read `<session>/wisdom/patterns/ui-feedback.md` for expected feedback behaviors to verify
3. Use wisdom to design comprehensive test cases covering known edge cases
## Phase 3: Test Generation & Execution
### Test Generation
@@ -96,6 +102,12 @@ Iterative test-fix cycle (max 5 iterations):
## Phase 4: Test Report
### Wisdom Contribution
If new edge cases or test patterns discovered:
1. Write test findings to `<session>/wisdom/contributions/tester-edge-cases-<timestamp>.md`
2. Format: Edge case description, test scenario, expected behavior, actual behavior
Generate test report:
```markdown