Stedefast

stedefast check

2 min read

stedefast check

The check command audits the built dist/ directory for common site quality issues. Run it after stedefast build.

stedefast check [options]

Checks Performed

Check Type Description
Internal links Error href / src paths that don't resolve to a file in dist/
Alt text Warning <img> tags missing an alt attribute
Meta descriptions Warning Pages without <meta name="description"> or <meta property="og:description">
Image sizes Warning Images larger than 500 KB
Empty pages Warning HTML files with fewer than 100 characters of visible text

Options

Option Default Description
--config <path> ./stedefast.config.ts Path to Stedefast config
--dist <dir> From config Override output directory to scan
--json Output results as JSON (exits 1 on errors)

Example Output

stedefast check

  ✓  Internal links         48 links checked, 0 issues
  ⚠  Alt text               3 issues
       posts/hello/index.html: <img> missing alt: src="/images/banner.jpg"
       posts/world/index.html: <img> missing alt: src="/images/cover.png"
       index.html: <img> missing alt: src="/logo.svg"
  ✓  Meta descriptions      12/12 pages have descriptions
  ✓  Image sizes             0 issues
  ✓  Empty pages             0 issues

  3 warnings found.

JSON Mode

stedefast check --json
{
  "results": [
    {
      "check": "Internal links",
      "passed": true,
      "count": 48,
      "issues": []
    },
    {
      "check": "Alt text",
      "passed": false,
      "count": 3,
      "issues": [
        {
          "type": "warning",
          "check": "Alt text",
          "file": "posts/hello/index.html",
          "detail": "<img> missing alt: src=\"/images/banner.jpg\""
        }
      ]
    }
  ],
  "totalErrors": 0,
  "totalWarnings": 3
}

JSON mode exits with code 1 if there are any errors (not warnings).

CI Integration

# .github/workflows/build.yml
- run: pnpm stedefast build
- run: pnpm stedefast check

The command exits with code 0 if there are no errors (warnings are allowed). Use --json for machine-readable output in CI pipelines that parse results.