Files
BMAD-METHOD/bmad-agent/tasks/library-indexing-task.md

118 lines
3.5 KiB
Markdown

# Library Indexing Task
## Purpose
This task maintains the integrity and completeness of the `docs/index.md` file by scanning all documentation files and ensuring they are properly indexed with descriptions.
## Task Instructions
You are now operating as a Documentation Indexer. Your goal is to ensure all documentation files are properly cataloged in the central index.
### Required Steps
1. First, locate and scan:
- The `docs/` directory and all subdirectories
- The existing `docs/index.md` file (create if absent)
- All markdown (`.md`) and text (`.txt`) files in the documentation structure
2. For the existing `docs/index.md`:
- Parse current entries
- Note existing file references and descriptions
- Identify any broken links or missing files
- Keep track of already-indexed content
3. For each documentation file found:
- Extract the title (from first heading or filename)
- Generate a brief description by analyzing the content
- Create a relative markdown link to the file
- Check if it's already in the index
- If missing or outdated, prepare an update
4. For any missing or non-existent files found in index:
- Present a list of all entries that reference non-existent files
- For each entry:
- Show the full entry details (title, path, description)
- Ask for explicit confirmation before removal
- Provide option to update the path if file was moved
- Log the decision (remove/update/keep) for final report
5. Update `docs/index.md`:
- Maintain existing structure and organization
- Add missing entries with descriptions
- Update outdated entries
- Remove only entries that were confirmed for removal
- Ensure consistent formatting throughout
### Index Entry Format
Each entry in `docs/index.md` should follow this format:
```markdown
### [Document Title](relative/path/to/file.md)
Brief description of the document's purpose and contents.
```
### Rules of Operation
1. NEVER modify the content of indexed files
2. Preserve existing descriptions in index.md when they are adequate
3. Maintain any existing categorization or grouping in the index
4. Use relative paths for all links
5. Ensure descriptions are concise but informative
6. NEVER remove entries without explicit confirmation
7. Report any broken links or inconsistencies found
8. Allow path updates for moved files before considering removal
### Process Output
The task will provide:
1. A summary of changes made to index.md
2. List of newly indexed files
3. List of updated entries
4. List of entries presented for removal and their status:
- Confirmed removals
- Updated paths
- Kept despite missing file
5. Any other issues or inconsistencies found
### Handling Missing Files
For each file referenced in the index but not found in the filesystem:
1. Present the entry:
```markdown
Missing file detected:
Title: [Document Title]
Path: relative/path/to/file.md
Description: Existing description
Options:
1. Remove this entry
2. Update the file path
3. Keep entry (mark as temporarily unavailable)
Please choose an option (1/2/3):
```
2. Wait for user confirmation before taking any action
3. Log the decision for the final report
## Required Input
Please provide:
1. Location of the `docs/` directory
2. Confirmation of write access to `docs/index.md`
3. Any specific categorization preferences
4. Any files or directories to exclude from indexing
Would you like to proceed with library indexing? Please provide the required input above.