/collect-knowledge
Orchestrator for knowledge collection from source code.
Progress Checklist
- [ ] Step 1: Get source files
- [ ] Step 2: Analyze source code
- [ ] Step 3: Load categories
- [ ] Step 4: Generate knowledge entries
- [ ] Step 5: Confirm bulk creation
- [ ] Step 6: Create files
- [ ] Step 7: Rebuild index
- [ ] Step 8: Report
Steps
Get source files:
- AskUserQuestion: "Source file path or glob pattern?"
- Resolve globs → SOURCE_FILES
- Validate files exist
Analyze source code:
- For each source file: read and extract documentation-worthy concepts
- Build CONCEPTS list with category, id, tags, content
Load categories:
- Invoke knowledge-reader:
OPERATION=list - Parse CATEGORY_LIST
- Invoke knowledge-reader:
Generate knowledge entries:
- For each concept:
- Determine category (from existing or propose new)
- Generate id, tags, related
- Structure content
- For each concept:
Confirm bulk creation:
- AskUserQuestion: Show all entries for confirmation
- Options: [Create all] [Modify] [Cancel]
- If Cancel → END
Create files:
- Get current commit:
git rev-parse HEAD - For each confirmed entry:
- Invoke knowledge-writer:
OPERATION=create CATEGORY=$CATEGORY ID=$ID TAGS=$TAGS RELATED=$RELATED CONTENT=$CONTENT SOURCE_REFS=$SOURCE_REFS COMMIT_HASH=$COMMIT_HASH
- Invoke knowledge-writer:
- Get current commit:
Rebuild index:
- Invoke knowledge-writer:
OPERATION=rebuild-index
- Invoke knowledge-writer:
Report:
- Display summary: categories used, files created, sources analyzed
- END
Converted and distributed by TomeVault — claim your Tome and manage your conversions.