Add `lore who` command with 5 query modes answering collaboration questions using existing DB data (280K notes, 210K discussions, 33K DiffNotes): - Expert: who knows about a file/directory (DiffNote path analysis + MR breadth scoring) - Workload: what is a person working on (assigned issues, authored/reviewing MRs, discussions) - Active: what discussions need attention (unresolved resolvable, global/project-scoped) - Overlap: who else is touching these files (dual author+reviewer role tracking) - Reviews: what review patterns does a person have (prefix-based category extraction) Includes migration 017 (5 composite indexes), CLI skeleton with clap conflicts_with validation, robot JSON output with input+resolved_input reproducibility, human terminal output, and 20 unit tests. All quality gates pass. Closes: bd-1q8z, bd-34rr, bd-2rk9, bd-2ldg, bd-zqpf, bd-s3rc, bd-m7k1, bd-b51e, bd-2711, bd-1rdi, bd-3mj2, bd-tfh3, bd-zibc, bd-g0d5 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
1.2 KiB
SQL
29 lines
1.2 KiB
SQL
-- Migration 017: Composite indexes for `who` query paths
|
|
|
|
-- Expert/Overlap: DiffNote path prefix + timestamp filter.
|
|
CREATE INDEX IF NOT EXISTS idx_notes_diffnote_path_created
|
|
ON notes(position_new_path, created_at, project_id)
|
|
WHERE note_type = 'DiffNote' AND is_system = 0;
|
|
|
|
-- Active/Workload: discussion participation lookups.
|
|
CREATE INDEX IF NOT EXISTS idx_notes_discussion_author
|
|
ON notes(discussion_id, author_username)
|
|
WHERE is_system = 0;
|
|
|
|
-- Active (project-scoped): unresolved discussions by recency, scoped by project.
|
|
CREATE INDEX IF NOT EXISTS idx_discussions_unresolved_recent
|
|
ON discussions(project_id, last_note_at)
|
|
WHERE resolvable = 1 AND resolved = 0;
|
|
|
|
-- Active (global): unresolved discussions by recency (no project scope).
|
|
CREATE INDEX IF NOT EXISTS idx_discussions_unresolved_recent_global
|
|
ON discussions(last_note_at)
|
|
WHERE resolvable = 1 AND resolved = 0;
|
|
|
|
-- Workload: issue assignees by username.
|
|
CREATE INDEX IF NOT EXISTS idx_issue_assignees_username
|
|
ON issue_assignees(username, issue_id);
|
|
|
|
INSERT INTO schema_version (version, applied_at, description)
|
|
VALUES (17, strftime('%s', 'now') * 1000, 'Composite indexes for who query paths');
|