File
Blob: .opencode/commands/find-owner.md
description: Find who owns or is most active in a file or directory subtask: true
Find code owners for: $ARGUMENTS
Steps:
Identify the current user. Load the
identify-reviewerskill and run its identity detection steps (gh auth status, git config) to determine the current user's GitHub handle, name, and email.Resolve the path. If the argument is a symbol name, find its file first. If it's a directory, analyze the directory as a whole.
Recent commit activity. Run:
git log --format='%aN <%aE>' --since='6 months ago' -- <path> | sort | uniq -c | sort -rn | head -10This shows who has been most active recently.
Blame analysis. For individual files, run:
git blame --line-porcelain <file> | grep '^author ' | sort | uniq -c | sort -rn | head -10This shows who wrote the most lines currently in the file.
Check for CODEOWNERS. Look for a
CODEOWNERSor.github/CODEOWNERSfile that may define ownership rules.Output:
- Top recent contributors (last 6 months): ranked list with commit counts
- Top authors by current lines: ranked list with line counts
- Suggested reviewers: 2-3 people who are most likely to be good reviewers, preferring people who are both recent contributors and significant authors
- If the current user appears in any of the above lists, use second person ("You" / "your") to refer to them, matching by GitHub handle, git name, or git email per the identify-reviewer matching rules
- If the results are sparse (few commits, single author), note that and suggest broadening the search to the parent directory