Find the files that change most often in a Git repository.
hotfiles analyzes non-merge commits, follows file renames, and reports each current file together with the commits that touched it. Use it to identify refactoring candidates, unstable modules, and frequently modified areas of a codebase.
Hotfiles 1.0 is release-ready but has not yet been published to npm.
Requirements:
- Node.js 22 or newer
- Git available on
PATH - A local Git working tree
The package has no runtime npm dependencies.
Until 1.0 is published, build and install a local package from this repository:
npm ci
npm pack
npm install --global ./hotfiles-1.0.0.tgzThe package can also be installed into another local Node.js project:
npm install /path/to/hotfiles-1.0.0.tgzAnalyze an entire repository:
hotfiles --repo ./my-projectExample output:
src/parser.js => 3
a72e1bd929f0 2026-08-18T10:42:03.000Z fix parser recovery
25f845a48d30 2026-08-11T14:20:19.000Z support escaped names
b17b86336da2 2026-08-02T09:13:51.000Z add parser
Analyze the newest 100 matching commits under src:
hotfiles \
--repo ./my-project \
--path src \
--limit 100 \
--message '^fix:' \
--ext js \
--ext tsProduce machine-readable output:
hotfiles --repo ./my-project --format json
hotfiles --repo ./my-project --json hotfiles.jsonHotfiles processes commits reachable from HEAD, from newest to oldest.
- Merge commits are excluded.
- A file receives at most one touch per commit.
- Message and date filters are applied before
--limit. --sinceincludes commits at the specified instant.- Rename history is attributed to the file's current path.
- Deleted files are omitted.
- Copies have independent histories.
- Results are sorted by commit count, then by path.
- Commit details are ordered newest first.
Hotfiles measures commit frequency, not lines changed or code complexity.
| Option | Description |
|---|---|
-r, --repo <path> |
Git repository to analyze; required |
-p, --path <path> |
Restrict results to a file or directory |
-l, --limit <number> |
Analyze the newest eligible commits |
-m, --message <regex> |
Filter commit messages with a regular expression |
-e, --ext <extension> |
Include an extension; repeatable |
-i, --ignoreExt <extension> |
Exclude an extension; repeatable |
--since <date> |
Include commits on or after a date |
-t, --till <date> |
Deprecated alias for --since |
--format <text|json> |
Select text or JSON output |
-o, --output <file> |
Write output atomically to a file |
-j, --json <file> |
JSON file-output shorthand |
--force |
Replace an existing output file |
--color |
Force colors in terminal text |
--no-color |
Disable colors |
-h, --help |
Show CLI help |
-v, --version |
Show the installed version |
Extension matching is case-insensitive. Exclusions take precedence over inclusions. JSON and file output never contain ANSI color sequences.
Hotfiles is a CommonJS package:
const { analyzeRepository } = require('hotfiles');
const files = await analyzeRepository({
repo: '/path/to/repository',
path: 'src',
limit: 100,
since: '2026-01-01T00:00:00Z',
message: '^fix:',
extensions: ['js', 'ts'],
ignoreExtensions: ['map']
});Returns a promise resolving to HotFile[].
interface AnalyzeOptions {
repo: string;
path?: string;
limit?: number;
since?: string | Date;
message?: string;
extensions?: string[];
ignoreExtensions?: string[];
}
interface HotFile {
path: string;
commits: number;
details: CommitDetail[];
}
interface CommitDetail {
hash: string;
date: string;
message: string;
}Example result:
[
{
"path": "src/parser.js",
"commits": 1,
"details": [
{
"hash": "a72e1bd929f04a8ba37b62ba280d9e52f66ab821",
"date": "2026-08-18T10:42:03.000Z",
"message": "fix parser recovery"
}
]
}
]Dates are ISO 8601 UTC timestamps. Hashes are full Git commit IDs.
Library errors expose one of these stable codes:
| Code | Meaning |
|---|---|
ERR_HOTFILES_INVALID_OPTIONS |
An option is missing or invalid |
ERR_HOTFILES_GIT_NOT_FOUND |
Git is unavailable on PATH |
ERR_HOTFILES_INVALID_REPOSITORY |
The path is not a Git working tree |
ERR_HOTFILES_GIT |
A Git subprocess or response failed |
CLI errors are written to stderr and return a non-zero exit status.
Hotfiles analyzes only commits reachable from the checked-out HEAD. Unrelated local branches and remote-only branches are not included.
It does not report:
- Deleted files
- Merge commits
- Lines changed or weighted churn
- Author statistics
- Code complexity
A shallow clone produces results from the locally available history only. Full commit details make result size proportional to the number of reported file touches.
- The package now has a working root export and returns
{ path, commits, details }[], not tuple arrays. - CLI JSON is an ordered array instead of a filename-keyed object.
- Library option names are
extensions,ignoreExtensions, andsince; the CLI retains--ext,--ignoreExt, and deprecated--tillcompatibility. - The system Git executable replaces NodeGit.
npm ci
npm test
npm run lint
npm audit
npm pack --dry-runCI tests Node.js 22, 24, and 26, plus packed-package installation and real-repository analysis on Linux, macOS, and Windows.
- Report bugs through GitHub Issues.
- Report vulnerabilities according to SECURITY.md.