Skip to content

rogerchappel/docfresh

Repository files navigation

DocFresh

DocFresh is a local-first CLI that checks whether README and docs examples still match the repository they describe.

It scans markdown files for local links, file references, package script commands, README package metadata, and explicitly marked smoke examples. It does not call hosted services, phone home, or run arbitrary commands by default.

Install

Install the CLI from npm:

npm install -g @rogerchappel/docfresh
docfresh --help

Or run it without a global install:

npx @rogerchappel/docfresh --help

For local development:

npm install
npm run build
node dist/cli.js --help

Use

Check the current repository:

docfresh check

Check another local repository and print JSON:

docfresh check --root fixtures/valid-docs --format json

Run opted-in smoke examples:

docfresh check --root fixtures/valid-docs --smoke

Run a copy-pasteable fixture demo that builds the CLI and captures both text and JSON reports:

bash examples/check-valid-docs-demo.sh

Smoke commands only run when the fenced block is explicitly marked:

```sh docfresh: smoke
node --version
```

What It Checks

  • Broken local markdown links such as [Guide](docs/missing.md).
  • Backticked file references such as src/index.ts.
  • Documented package commands such as npm run build or pnpm check.
  • Basic README install and usage coverage for package repositories.
  • Failing commands in fenced blocks marked with docfresh: smoke when --smoke is enabled.

Output

Text output is optimized for terminal review:

docfresh check --root fixtures/stale-docs

JSON output is stable enough for scripts and agents:

docfresh check --root fixtures/stale-docs --format json

DocFresh exits with 0 when no error findings are present and 1 when documentation drift is found.

Demo

Generate pass/fail JSON reports from the checked-in fixtures:

bash demo/run-json-drift-demo.sh

The script writes .docfresh-demo/valid-docs.json and .docfresh-demo/stale-docs.json so reviewers can inspect both sides of the drift signal. See JSON Drift Report Demo for the walkthrough.

Verify

npm run check
npm test
npm run build
npm run smoke
bash scripts/validate.sh

Examples

  • examples/basic passes.
  • examples/stale intentionally fails.
  • fixtures/valid-docs, fixtures/stale-docs, and fixtures/smoke-fail back the automated tests.
  • demo/run-docfresh-basic.sh runs a short README freshness demo and verifies the JSON report for the passing fixture.
  • bash examples/run-docfresh-demo.sh runs a fixture-backed freshness demo and checks a JSON report.

Demo and Promotion

Demo

Run the fixture-backed demo to capture passing, stale, JSON, and smoke-check outputs:

bash demo/readme-smoke-check.sh

See docs/tutorials/readme-smoke-gate.md for a pull request workflow that starts with regular docs drift checks and adds opted-in smoke commands.

For a fixture-backed demo that writes both a clean JSON report and a stale text report, run:

bash demo/readme-drift-smoke.sh

See the README drift demo for a walkthrough script and promotion-safe talking points.

Demo Recipes

Run a passing fixture and capture text and JSON reports:

bash examples/check-valid-docs-demo.sh

Run the stale-docs fixture and confirm DocFresh reports review-worthy drift:

bash demo/stale-docs-report.sh

Compare a clean README fixture with a thin README that needs install and usage metadata:

bash demo/readme-readiness-gate.sh

See docs/tutorials/readme-readiness-gate.md for a pre-release docs review workflow.

For promotion or screencast prep, see docs/promo/stale-docs-video-brief.md.

For a runnable CI-style drift check, see CI Docs Drift Check:

bash demo/ci-docs-drift.sh

For a pre-PR demo that writes both passing and stale-docs reports to a temporary directory:

npm run build
bash demo/run-docs-sweep.sh

See docs/tutorials/pre-pr-docs-sweep.md for the walkthrough and docs/promo/social-hooks.md for grounded promotion copy.

Source Attribution

Inspired by markdown link checkers, README smoke tests, and docs-as-tests practices. Reframed for local developer-tool repos and agent-generated documentation.

Contributing

See CONTRIBUTING.md. Keep changes local-first, fixture-backed, and free of telemetry.

Security

See SECURITY.md. Do not include secrets in fixtures, examples, tests, or issue reports.

Release readiness

Run the same checks expected before opening or cutting a release:

npm run check
npm run test
npm run build
npm run smoke
npm run package:smoke
npm run release:check

Use npm pack --dry-run to confirm the published package contains the CLI/runtime files plus README, license, security, support, and release notes.

Development

Use Node.js 20 or newer. Run these checks before opening a PR:

npm run build
npm run check
npm test
npm run smoke
npm run package:smoke
npm run release:check

License

MIT

Releases

No releases published

Packages

 
 
 

Contributors