GScan validates Ghost themes for compatibility with Ghost versions v1-v6. It can run as:
- A library (
lib/index.js) - A CLI (
bin/cli.js) - A web app (
app/index.js)
- Node.js (supported:
^20.11.1 || ^22.13.1 || ^24.0.0) - CommonJS modules
- Vitest with V8 coverage
- ESLint for linting
yarn install
yarn test
yarn lintRun local web server:
yarn dev
# http://localhost:2369Run CLI checks:
./bin/cli.js /path/to/theme
./bin/cli.js -z /path/to/theme.zip
./bin/cli.js /path/to/theme --v6lib/checker.js: orchestrates loading theme input and running checkslib/checks/: rule checks (auto-loaded)lib/ast-linter/: Handlebars AST parser and ruleslib/specs/v1.js...lib/specs/v6.js: version-specific rule metadatalib/format.js: transforms results for CLI/web outputtest/*.test.js: tests for checks and core behaviortest/fixtures/themes/: fixture themes used by testsapp/: web interface for zip uploads
- Keep implementations consistent with existing CommonJS style.
- Prefer minimal, targeted edits over broad refactors.
- Add or update tests for behavior changes.
- Run
yarn testandyarn lintbefore finalizing significant changes. - Do not change rule code identifiers unless explicitly requested; they are user-facing and versioned.
- Add check file in
lib/checks/(auto-loaded by checker). - Define corresponding rule metadata in each relevant version spec under
lib/specs/. - Add fixtures under
test/fixtures/themes/. - Add test coverage in
test/*.test.js. - Update any strict pass-count assertions in
test/checker.test.jsif needed.
- Missing rule metadata in one spec can break formatting and test output.
test/checker.test.jscontains exact expectations and may need synchronized updates.- Path handling should remain cross-platform; reuse utilities in
lib/utils/.