Why Does This Exist
Why Does This Exist helps reviewers understand code context by showing the last commit that
changed a line, along with optional Jira ticket enrichment when a ticket id is present.
Features
- Hover over a line to see the last commit that touched it
- View author, date, and commit message context
- Optionally enrich ticket ids with Jira metadata
- Works entirely from the local git history and VS Code
Installation
Install from the VS Code Marketplace or build a local package with:
npm install
npm run compile
npx @vscode/vsce package
Development
See CONTRIBUTING.md for local development and pull request guidance.
Parts
src/blame.ts — pure porcelain-parsing/formatting functions (no vscode dependency),
unit-tested without a repo or a VS Code host: npm run compile && npm test.
src/jira.ts — optional Jira enrichment (fail-soft: any failure falls back to a plain
ticket link).
src/extension.ts — the hover provider, blame caching, and the Jira-token commands.
Requires Node.js + npm to build (npm install && npm run compile).
Installing the .vsix manually (sharing with your team)
why-does-this-exist-hover-0.1.0.vsix is a single file — copy it anywhere (network share,
Slack/Teams, email) and any teammate can install it without needing Node.js or building
anything themselves. There is no companion tool to bundle; the only requirement on the
receiving machine is git on PATH.
Option A — VS Code UI:
- Open the Extensions view (
Ctrl+Shift+X).
- Click the
... (More Actions) menu at the top of the panel.
- Choose Install from VSIX...
- Browse to the
.vsix file and select it.
- Reload VS Code if prompted.
Option B — command line:
code --install-extension why-does-this-exist-hover-0.1.0.vsix
To update to a newer version later, just repeat either step with the new .vsix.
To remove it: Extensions view ... menu, or
code --uninstall-extension local.why-does-this-exist-hover.
How it triggers
Automatic — hover any line in a file that's tracked by git and inside a workspace folder.
No command needed for the git-only hover. A file not under git, or a line with no committed
blame (new/unsaved), simply shows no hover. If the document has unsaved edits, the hover adds
a note that blame may not match the current line (blame is always computed against the file
on disk).
Jira enrichment is off until you turn it on:
- Set
whyHover.jiraBaseUrl to your instance (e.g. https://yourteam.atlassian.net).
- Run "Why Hover: Set Jira Token..." — prompts for an email + API token (Jira Cloud,
the default
basic auth scheme) or just a token (whyHover.jiraAuthScheme: "bearer" for
Jira Server/Data Center's Personal Access Tokens). Stored only in VS Code's
SecretStorage — never in settings, never logged.
- Hover a line whose commit message contains a ticket id (default pattern matches
PROJ-123-style ids) — the hover now shows the issue's summary and status alongside the
link.
Any Jira failure (no token, wrong scheme, network error, wrong ticket) silently falls back
to a plain link to the ticket — never an error, never a blocked hover, bounded by
whyHover.jiraTimeoutMs (default 3000ms). Run "Why Hover: Clear Jira Token" to remove
stored credentials.
Settings
whyHover.ticketPattern (default [A-Z][A-Z0-9]+-\d+)
whyHover.jiraBaseUrl (default empty — enrichment off)
whyHover.jiraAuthScheme ("basic" | "bearer", default "basic")
whyHover.jiraTimeoutMs (default 3000)
Security
Commit messages and Jira issue text are rendered as Markdown with isTrusted = false and
manually escaped — a crafted commit message or issue title cannot inject a clickable
command: link into the hover.
Status
Unit tests for the porcelain blame parser, commit-message splitting, and ticket extraction
(including an all-zero/uncommitted hash and an invalid user-supplied regex pattern) all
pass with no repo or network required. Extension built, packaged, and installed into VS
Code. The working directory this was built in is not a git repository, so the live
hover-in-a-real-repo path and the Jira enrichment path (which needs a reachable Atlassian
instance and a valid token) have not been manually exercised — both need to be verified by
hand in an actual git repository.