# Feature Resolution

How skills determine the active feature and which repo paths to operate on.

## When to use

If the active feature is already clear from conversation context (e.g. the user just ran /start, or this session has been working on a specific branch), use that directly — no resolution needed.

Otherwise, resolve from git:

## Algorithm

1. Run `git branch --show-current` in CWD → `branch`
2. If CWD is not a git repo, iterate repos in `$LOCAL_CONFIG_FILE` and find one on a non-base branch
3. For each repo in `$LOCAL_CONFIG_FILE`:
   - Run `git worktree list --porcelain` in the main checkout path
   - If a worktree entry matches `branch` → use that worktree path as the repo's active path
   - Else if `git -C <main_path> branch --show-current` == `branch` → use main checkout path
   - Else → repo not in this feature, skip
4. Result: `{ branch, repos: { repoKey: absolutePath } }` — in memory only

If no repo is found on any non-base branch: stop and tell user to run `/start` first.

An optional branch argument (e.g. `/commit feat/SQSH-1234-foo`) overrides CWD detection.

## Ticket extraction

Extract the ticket key from the branch name if present:
- `feat/SQSH-1672-add-profile` → `SQSH-1672`
- `NO-CARD-fix-header` → no ticket
- `chore/no-ticket-update-deps` → no ticket

If ticket metadata (title, description) is needed for a PR body, fetch from Jira MCP at invocation time using the extracted key.
