bmad初始化

This commit is contained in:
2025-11-01 19:22:39 +08:00
parent 5b21dc0bd5
commit 426ae41f54
447 changed files with 80633 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
# Document Project Workflow Templates
This directory contains template files for the `document-project` workflow.
## Template Files
- **index-template.md** - Master index template (adapts for single/multi-part projects)
- **project-overview-template.md** - Executive summary and high-level overview
- **source-tree-template.md** - Annotated directory structure
## Template Usage
The workflow dynamically selects and populates templates based on:
1. **Project structure** (single part vs multi-part)
2. **Project type** (web, backend, mobile, etc.)
3. **Documentation requirements** (from documentation-requirements.csv)
## Variable Naming Convention
Templates use Handlebars-style variables:
- `{{variable_name}}` - Simple substitution
- `{{#if condition}}...{{/if}}` - Conditional blocks
- `{{#each collection}}...{{/each}}` - Iteration
## Additional Templates
Architecture-specific templates are dynamically loaded from:
`/bmad/bmm/workflows/3-solutioning/templates/`
Based on the matched architecture type from the registry.
## Notes
- Templates support both simple and complex project structures
- Multi-part projects get part-specific file naming (e.g., `architecture-{part_id}.md`)
- Single-part projects use simplified naming (e.g., `architecture.md`)

View File

@@ -0,0 +1,345 @@
# {{target_name}} - Deep Dive Documentation
**Generated:** {{date}}
**Scope:** {{target_path}}
**Files Analyzed:** {{file_count}}
**Lines of Code:** {{total_loc}}
**Workflow Mode:** Exhaustive Deep-Dive
## Overview
{{target_description}}
**Purpose:** {{target_purpose}}
**Key Responsibilities:** {{responsibilities}}
**Integration Points:** {{integration_summary}}
## Complete File Inventory
{{#each files_in_inventory}}
### {{file_path}}
**Purpose:** {{purpose}}
**Lines of Code:** {{loc}}
**File Type:** {{file_type}}
**What Future Contributors Must Know:** {{contributor_note}}
**Exports:**
{{#each exports}}
- `{{signature}}` - {{description}}
{{/each}}
**Dependencies:**
{{#each imports}}
- `{{import_path}}` - {{reason}}
{{/each}}
**Used By:**
{{#each dependents}}
- `{{dependent_path}}`
{{/each}}
**Key Implementation Details:**
```{{language}}
{{key_code_snippet}}
```
{{implementation_notes}}
**Patterns Used:**
{{#each patterns}}
- {{pattern_name}}: {{pattern_description}}
{{/each}}
**State Management:** {{state_approach}}
**Side Effects:**
{{#each side_effects}}
- {{effect_type}}: {{effect_description}}
{{/each}}
**Error Handling:** {{error_handling_approach}}
**Testing:**
- Test File: {{test_file_path}}
- Coverage: {{coverage_percentage}}%
- Test Approach: {{test_approach}}
**Comments/TODOs:**
{{#each todos}}
- Line {{line_number}}: {{todo_text}}
{{/each}}
---
{{/each}}
## Contributor Checklist
- **Risks & Gotchas:** {{risks_notes}}
- **Pre-change Verification Steps:** {{verification_steps}}
- **Suggested Tests Before PR:** {{suggested_tests}}
## Architecture & Design Patterns
### Code Organization
{{organization_approach}}
### Design Patterns
{{#each design_patterns}}
- **{{pattern_name}}**: {{usage_description}}
{{/each}}
### State Management Strategy
{{state_management_details}}
### Error Handling Philosophy
{{error_handling_philosophy}}
### Testing Strategy
{{testing_strategy}}
## Data Flow
{{data_flow_diagram}}
### Data Entry Points
{{#each entry_points}}
- **{{entry_name}}**: {{entry_description}}
{{/each}}
### Data Transformations
{{#each transformations}}
- **{{transformation_name}}**: {{transformation_description}}
{{/each}}
### Data Exit Points
{{#each exit_points}}
- **{{exit_name}}**: {{exit_description}}
{{/each}}
## Integration Points
### APIs Consumed
{{#each apis_consumed}}
- **{{api_endpoint}}**: {{api_description}}
- Method: {{method}}
- Authentication: {{auth_requirement}}
- Response: {{response_schema}}
{{/each}}
### APIs Exposed
{{#each apis_exposed}}
- **{{api_endpoint}}**: {{api_description}}
- Method: {{method}}
- Request: {{request_schema}}
- Response: {{response_schema}}
{{/each}}
### Shared State
{{#each shared_state}}
- **{{state_name}}**: {{state_description}}
- Type: {{state_type}}
- Accessed By: {{accessors}}
{{/each}}
### Events
{{#each events}}
- **{{event_name}}**: {{event_description}}
- Type: {{publish_or_subscribe}}
- Payload: {{payload_schema}}
{{/each}}
### Database Access
{{#each database_operations}}
- **{{table_name}}**: {{operation_type}}
- Queries: {{query_patterns}}
- Indexes Used: {{indexes}}
{{/each}}
## Dependency Graph
{{dependency_graph_visualization}}
### Entry Points (Not Imported by Others in Scope)
{{#each entry_point_files}}
- {{file_path}}
{{/each}}
### Leaf Nodes (Don't Import Others in Scope)
{{#each leaf_files}}
- {{file_path}}
{{/each}}
### Circular Dependencies
{{#if has_circular_dependencies}}
⚠️ Circular dependencies detected:
{{#each circular_deps}}
- {{cycle_description}}
{{/each}}
{{else}}
✓ No circular dependencies detected
{{/if}}
## Testing Analysis
### Test Coverage Summary
- **Statements:** {{statements_coverage}}%
- **Branches:** {{branches_coverage}}%
- **Functions:** {{functions_coverage}}%
- **Lines:** {{lines_coverage}}%
### Test Files
{{#each test_files}}
- **{{test_file_path}}**
- Tests: {{test_count}}
- Approach: {{test_approach}}
- Mocking Strategy: {{mocking_strategy}}
{{/each}}
### Test Utilities Available
{{#each test_utilities}}
- `{{utility_name}}`: {{utility_description}}
{{/each}}
### Testing Gaps
{{#each testing_gaps}}
- {{gap_description}}
{{/each}}
## Related Code & Reuse Opportunities
### Similar Features Elsewhere
{{#each similar_features}}
- **{{feature_name}}** (`{{feature_path}}`)
- Similarity: {{similarity_description}}
- Can Reference For: {{reference_use_case}}
{{/each}}
### Reusable Utilities Available
{{#each reusable_utilities}}
- **{{utility_name}}** (`{{utility_path}}`)
- Purpose: {{utility_purpose}}
- How to Use: {{usage_example}}
{{/each}}
### Patterns to Follow
{{#each patterns_to_follow}}
- **{{pattern_name}}**: Reference `{{reference_file}}` for implementation
{{/each}}
## Implementation Notes
### Code Quality Observations
{{#each quality_observations}}
- {{observation}}
{{/each}}
### TODOs and Future Work
{{#each all_todos}}
- **{{file_path}}:{{line_number}}**: {{todo_text}}
{{/each}}
### Known Issues
{{#each known_issues}}
- {{issue_description}}
{{/each}}
### Optimization Opportunities
{{#each optimizations}}
- {{optimization_suggestion}}
{{/each}}
### Technical Debt
{{#each tech_debt_items}}
- {{debt_description}}
{{/each}}
## Modification Guidance
### To Add New Functionality
{{modification_guidance_add}}
### To Modify Existing Functionality
{{modification_guidance_modify}}
### To Remove/Deprecate
{{modification_guidance_remove}}
### Testing Checklist for Changes
{{#each testing_checklist_items}}
- [ ] {{checklist_item}}
{{/each}}
---
_Generated by `document-project` workflow (deep-dive mode)_
_Base Documentation: docs/index.md_
_Scan Date: {{date}}_
_Analysis Mode: Exhaustive_

View File

@@ -0,0 +1,169 @@
# {{project_name}} Documentation Index
**Type:** {{repository_type}}{{#if is_multi_part}} with {{parts_count}} parts{{/if}}
**Primary Language:** {{primary_language}}
**Architecture:** {{architecture_type}}
**Last Updated:** {{date}}
## Project Overview
{{project_description}}
{{#if is_multi_part}}
## Project Structure
This project consists of {{parts_count}} parts:
{{#each project_parts}}
### {{part_name}} ({{part_id}})
- **Type:** {{project_type}}
- **Location:** `{{root_path}}`
- **Tech Stack:** {{tech_stack_summary}}
- **Entry Point:** {{entry_point}}
{{/each}}
## Cross-Part Integration
{{integration_summary}}
{{/if}}
## Quick Reference
{{#if is_single_part}}
- **Tech Stack:** {{tech_stack_summary}}
- **Entry Point:** {{entry_point}}
- **Architecture Pattern:** {{architecture_pattern}}
- **Database:** {{database}}
- **Deployment:** {{deployment_platform}}
{{else}}
{{#each project_parts}}
### {{part_name}} Quick Ref
- **Stack:** {{tech_stack_summary}}
- **Entry:** {{entry_point}}
- **Pattern:** {{architecture_pattern}}
{{/each}}
{{/if}}
## Generated Documentation
### Core Documentation
- [Project Overview](./project-overview.md) - Executive summary and high-level architecture
- [Source Tree Analysis](./source-tree-analysis.md) - Annotated directory structure
{{#if is_single_part}}
- [Architecture](./architecture.md) - Detailed technical architecture
- [Component Inventory](./component-inventory.md) - Catalog of major components{{#if has_ui_components}} and UI elements{{/if}}
- [Development Guide](./development-guide.md) - Local setup and development workflow
{{#if has_api_docs}}- [API Contracts](./api-contracts.md) - API endpoints and schemas{{/if}}
{{#if has_data_models}}- [Data Models](./data-models.md) - Database schema and models{{/if}}
{{else}}
### Part-Specific Documentation
{{#each project_parts}}
#### {{part_name}} ({{part_id}})
- [Architecture](./architecture-{{part_id}}.md) - Technical architecture for {{part_name}}
{{#if has_components}}- [Components](./component-inventory-{{part_id}}.md) - Component catalog{{/if}}
- [Development Guide](./development-guide-{{part_id}}.md) - Setup and dev workflow
{{#if has_api}}- [API Contracts](./api-contracts-{{part_id}}.md) - API documentation{{/if}}
{{#if has_data}}- [Data Models](./data-models-{{part_id}}.md) - Data architecture{{/if}}
{{/each}}
### Integration
- [Integration Architecture](./integration-architecture.md) - How parts communicate
- [Project Parts Metadata](./project-parts.json) - Machine-readable structure
{{/if}}
### Optional Documentation
{{#if has_deployment_guide}}- [Deployment Guide](./deployment-guide.md) - Deployment process and infrastructure{{/if}}
{{#if has_contribution_guide}}- [Contribution Guide](./contribution-guide.md) - Contributing guidelines and standards{{/if}}
## Existing Documentation
{{#if has_existing_docs}}
{{#each existing_docs}}
- [{{title}}]({{path}}) - {{description}}
{{/each}}
{{else}}
No existing documentation files were found in the project.
{{/if}}
## Getting Started
{{#if is_single_part}}
### Prerequisites
{{prerequisites}}
### Setup
```bash
{{setup_commands}}
```
### Run Locally
```bash
{{run_commands}}
```
### Run Tests
```bash
{{test_commands}}
```
{{else}}
{{#each project_parts}}
### {{part_name}} Setup
**Prerequisites:** {{prerequisites}}
**Install & Run:**
```bash
cd {{root_path}}
{{setup_command}}
{{run_command}}
```
{{/each}}
{{/if}}
## For AI-Assisted Development
This documentation was generated specifically to enable AI agents to understand and extend this codebase.
### When Planning New Features:
**UI-only features:**
{{#if is_multi_part}}→ Reference: `architecture-{{ui_part_id}}.md`, `component-inventory-{{ui_part_id}}.md`{{else}}→ Reference: `architecture.md`, `component-inventory.md`{{/if}}
**API/Backend features:**
{{#if is_multi_part}}→ Reference: `architecture-{{api_part_id}}.md`, `api-contracts-{{api_part_id}}.md`, `data-models-{{api_part_id}}.md`{{else}}→ Reference: `architecture.md`{{#if has_api_docs}}, `api-contracts.md`{{/if}}{{#if has_data_models}}, `data-models.md`{{/if}}{{/if}}
**Full-stack features:**
→ Reference: All architecture docs{{#if is_multi_part}} + `integration-architecture.md`{{/if}}
**Deployment changes:**
{{#if has_deployment_guide}}→ Reference: `deployment-guide.md`{{else}}→ Review CI/CD configs in project{{/if}}
---
_Documentation generated by BMAD Method `document-project` workflow_

View File

@@ -0,0 +1,103 @@
# {{project_name}} - Project Overview
**Date:** {{date}}
**Type:** {{project_type}}
**Architecture:** {{architecture_type}}
## Executive Summary
{{executive_summary}}
## Project Classification
- **Repository Type:** {{repository_type}}
- **Project Type(s):** {{project_types_list}}
- **Primary Language(s):** {{primary_languages}}
- **Architecture Pattern:** {{architecture_pattern}}
{{#if is_multi_part}}
## Multi-Part Structure
This project consists of {{parts_count}} distinct parts:
{{#each project_parts}}
### {{part_name}}
- **Type:** {{project_type}}
- **Location:** `{{root_path}}`
- **Purpose:** {{purpose}}
- **Tech Stack:** {{tech_stack}}
{{/each}}
### How Parts Integrate
{{integration_description}}
{{/if}}
## Technology Stack Summary
{{#if is_single_part}}
{{technology_table}}
{{else}}
{{#each project_parts}}
### {{part_name}} Stack
{{technology_table}}
{{/each}}
{{/if}}
## Key Features
{{key_features}}
## Architecture Highlights
{{architecture_highlights}}
## Development Overview
### Prerequisites
{{prerequisites}}
### Getting Started
{{getting_started_summary}}
### Key Commands
{{#if is_single_part}}
- **Install:** `{{install_command}}`
- **Dev:** `{{dev_command}}`
- **Build:** `{{build_command}}`
- **Test:** `{{test_command}}`
{{else}}
{{#each project_parts}}
#### {{part_name}}
- **Install:** `{{install_command}}`
- **Dev:** `{{dev_command}}`
{{/each}}
{{/if}}
## Repository Structure
{{repository_structure_summary}}
## Documentation Map
For detailed information, see:
- [index.md](./index.md) - Master documentation index
- [architecture.md](./architecture{{#if is_multi_part}}-{part_id}{{/if}}.md) - Detailed architecture
- [source-tree-analysis.md](./source-tree-analysis.md) - Directory structure
- [development-guide.md](./development-guide{{#if is_multi_part}}-{part_id}{{/if}}.md) - Development workflow
---
_Generated using BMAD Method `document-project` workflow_

View File

@@ -0,0 +1,160 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Project Scan Report Schema",
"description": "State tracking file for document-project workflow resumability",
"type": "object",
"required": ["workflow_version", "timestamps", "mode", "scan_level", "completed_steps", "current_step"],
"properties": {
"workflow_version": {
"type": "string",
"description": "Version of document-project workflow",
"example": "1.2.0"
},
"timestamps": {
"type": "object",
"required": ["started", "last_updated"],
"properties": {
"started": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when workflow started"
},
"last_updated": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp of last state update"
},
"completed": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when workflow completed (if finished)"
}
}
},
"mode": {
"type": "string",
"enum": ["initial_scan", "full_rescan", "deep_dive"],
"description": "Workflow execution mode"
},
"scan_level": {
"type": "string",
"enum": ["quick", "deep", "exhaustive"],
"description": "Scan depth level (deep_dive mode always uses exhaustive)"
},
"project_root": {
"type": "string",
"description": "Absolute path to project root directory"
},
"output_folder": {
"type": "string",
"description": "Absolute path to output folder"
},
"completed_steps": {
"type": "array",
"items": {
"type": "object",
"required": ["step", "status"],
"properties": {
"step": {
"type": "string",
"description": "Step identifier (e.g., 'step_1', 'step_2')"
},
"status": {
"type": "string",
"enum": ["completed", "partial", "failed"]
},
"timestamp": {
"type": "string",
"format": "date-time"
},
"outputs": {
"type": "array",
"items": { "type": "string" },
"description": "Files written during this step"
},
"summary": {
"type": "string",
"description": "1-2 sentence summary of step outcome"
}
}
}
},
"current_step": {
"type": "string",
"description": "Current step identifier for resumption"
},
"findings": {
"type": "object",
"description": "High-level summaries only (detailed findings purged after writing)",
"properties": {
"project_classification": {
"type": "object",
"properties": {
"repository_type": { "type": "string" },
"parts_count": { "type": "integer" },
"primary_language": { "type": "string" },
"architecture_type": { "type": "string" }
}
},
"technology_stack": {
"type": "array",
"items": {
"type": "object",
"properties": {
"part_id": { "type": "string" },
"tech_summary": { "type": "string" }
}
}
},
"batches_completed": {
"type": "array",
"description": "For deep/exhaustive scans: subfolders processed",
"items": {
"type": "object",
"properties": {
"path": { "type": "string" },
"files_scanned": { "type": "integer" },
"summary": { "type": "string" }
}
}
}
}
},
"outputs_generated": {
"type": "array",
"items": { "type": "string" },
"description": "List of all output files generated"
},
"resume_instructions": {
"type": "string",
"description": "Instructions for resuming from current_step"
},
"validation_status": {
"type": "object",
"properties": {
"last_validated": {
"type": "string",
"format": "date-time"
},
"validation_errors": {
"type": "array",
"items": { "type": "string" }
}
}
},
"deep_dive_targets": {
"type": "array",
"description": "Track deep-dive areas analyzed (for deep_dive mode)",
"items": {
"type": "object",
"properties": {
"target_name": { "type": "string" },
"target_path": { "type": "string" },
"files_analyzed": { "type": "integer" },
"output_file": { "type": "string" },
"timestamp": { "type": "string", "format": "date-time" }
}
}
}
}
}

View File

@@ -0,0 +1,135 @@
# {{project_name}} - Source Tree Analysis
**Date:** {{date}}
## Overview
{{source_tree_overview}}
{{#if is_multi_part}}
## Multi-Part Structure
This project is organized into {{parts_count}} distinct parts:
{{#each project_parts}}
- **{{part_name}}** (`{{root_path}}`): {{purpose}}
{{/each}}
{{/if}}
## Complete Directory Structure
```
{{complete_source_tree}}
```
## Critical Directories
{{#each critical_folders}}
### `{{folder_path}}`
{{description}}
**Purpose:** {{purpose}}
**Contains:** {{contents_summary}}
{{#if entry_points}}**Entry Points:** {{entry_points}}{{/if}}
{{#if integration_note}}**Integration:** {{integration_note}}{{/if}}
{{/each}}
{{#if is_multi_part}}
## Part-Specific Trees
{{#each project_parts}}
### {{part_name}} Structure
```
{{source_tree}}
```
**Key Directories:**
{{#each critical_directories}}
- **`{{path}}`**: {{description}}
{{/each}}
{{/each}}
## Integration Points
{{#each integration_points}}
### {{from_part}} → {{to_part}}
- **Location:** `{{integration_path}}`
- **Type:** {{integration_type}}
- **Details:** {{details}}
{{/each}}
{{/if}}
## Entry Points
{{#if is_single_part}}
- **Main Entry:** `{{main_entry_point}}`
{{#if additional_entry_points}}
- **Additional:**
{{#each additional_entry_points}}
- `{{path}}`: {{description}}
{{/each}}
{{/if}}
{{else}}
{{#each project_parts}}
### {{part_name}}
- **Entry Point:** `{{entry_point}}`
- **Bootstrap:** {{bootstrap_description}}
{{/each}}
{{/if}}
## File Organization Patterns
{{file_organization_patterns}}
## Key File Types
{{#each file_type_patterns}}
### {{file_type}}
- **Pattern:** `{{pattern}}`
- **Purpose:** {{purpose}}
- **Examples:** {{examples}}
{{/each}}
## Asset Locations
{{#if has_assets}}
{{#each asset_locations}}
- **{{asset_type}}**: `{{location}}` ({{file_count}} files, {{total_size}})
{{/each}}
{{else}}
No significant assets detected.
{{/if}}
## Configuration Files
{{#each config_files}}
- **`{{path}}`**: {{description}}
{{/each}}
## Notes for Development
{{development_notes}}
---
_Generated using BMAD Method `document-project` workflow_