This file is for automated coding agents working in this repo.
- Hexo theme implementation with browser JS in
source/js/**, Hexo Node scripts inscripts/**, and Stylus/Tailwind CSS insource/css/**. - Build outputs are committed to
source/js/build/**andsource/css/build/tailwind.css. - The theme config lives in
_config.ymland is exported at build/runtime byscripts/config-export.js.
- Package manager: npm (CI uses
npm install). - Node versions seen in CI: 20.x for build, 18 for release workflows.
- No TypeScript, no test runner configured.
- Install deps:
npm install. - Build all assets:
npm run build(runs CSS + JS builds). - Build CSS only:
npm run build:css(Tailwind CLI). - Build JS only:
npm run build:js(minifies intosource/js/build). - Watch CSS:
npm run watch:css. - Pre-commit hook blocks committing build outputs on non-
main/devbranches (see.husky/pre-commit). - Lint: no npm script or config present; add one if needed.
- Tests: no test runner configured.
- Single test: N/A (no unit/integration test tooling configured).
- Manual verification (if you have a Hexo site):
hexo clean && hexo gin the site repo.
source/css/build/tailwind.cssis generated fromsource/css/tailwind.source.css.source/js/build/**is generated bysource/js/build.js(Terser minification + lib copy).- If you touch
source/js/**orsource/css/**, rerunnpm run buildfor verification. Build outputs are committed by CI ondev/mainafter merge.
- Module system: ES modules with
import/export; keep imports at top. - Formatting: 2-space indentation, semicolons, double quotes.
- Prefer
const; useletonly when reassigning. - Use trailing commas in multi-line objects/arrays/params (matches existing files).
- Naming:
camelCasefor variables/functions,PascalCasefor classes,UPPER_SNAKE_CASEfor constants. - Init patterns: exported functions commonly named
initX,onX,handleX. - Guards: early returns for invalid inputs or missing DOM nodes.
- Optional chaining and nullish coalescing are used; keep null-safe checks.
- Event listeners: prefer
{ signal }and pass anAbortSignalwhen available. - Side effects: keep in
onReady/onPageViewhooks or explicit init functions.
- Module system: CommonJS with
require(...)and"use strict";at top. - Use
hexo.extend.*APIs (helpers, filters, events) as seen in existing scripts. - Keep functions small and mostly pure; use
try/catcharound external data parsing. - Avoid direct DOM usage here; this layer runs in Node during Hexo build.
- Use
try/catchfor unsafe operations (JSON/YAML parsing, URL parsing, fetch). - Log with
console.warn/console.errorfor non-fatal failures. - Prefer to return early after logging; avoid throwing unless it should break the build.
- Stylus files use
//comments and section separators; mirror existing structure. - Variables use
$prefix and hyphenated names (seesource/css/common/variables.styl). - Reuse mixins like
redefine-tablet()andredefine-mobile()for breakpoints. - Read config in Stylus via
hexo-config('path.to.setting'). - Class naming: favor existing kebab-case classes and theme-specific names.
- Tailwind source lives in
source/css/tailwind.source.css; never edit the generated file.
_config.ymlis the theme config; new options should be exported inscripts/config-export.js.scripts/config-export.jswriteswindow.config,window.theme, and language data into the page.- Keep JS code resilient to missing config by using optional chaining and defaults.
- Prefer local relative imports within
source/js/**. - Keep import lists grouped by path depth; avoid reordering unless needed.
- Avoid adding new dependencies unless required; check impact on Hexo users.
- Browser JS filenames are mostly
camelCase.js(e.g.,homeBanner.js). - Hexo script filenames often use
kebab-case.js(e.g.,config-export.js). - Keep new files in the same naming style as their folder.
- Language files live in
languages/**and are loaded byscripts/config-export.js. - If you add new UI strings, update the language YAMLs accordingly.
- GitHub Actions build workflow runs
npm run buildonmain/devchanges to JS/CSS. - CI commits updated build assets back to the branch when they change.
- PRs should target the
devbranch. - Commit message format:
[section]: [brief info](example:footer: optimize style). - Test changes locally before opening a PR.
- No
.cursor/rules/,.cursorrules, or.github/copilot-instructions.mdfound in this repo.
- Locate relevant source in
source/js/**,source/css/**, orscripts/**. - Make changes in source files, not generated build outputs.
- Run
npm run buildto refresh compiled assets. - If you cannot run builds, state the missing verification in your report.
- Main client entry:
source/js/main.js. - JS build script:
source/js/build.js. - Tailwind entry:
source/css/tailwind.source.css. - Core Stylus vars:
source/css/common/variables.styl. - Hexo helper for config export:
scripts/config-export.js.
- There is no test framework configured, so single-test execution is not applicable.
- If a test runner is added later, document the exact single-test command here.
- Keep changes minimal and consistent with existing style.
- Do not edit auto-generated build files by hand.
- Preserve license headers or top-of-file banners when present.
- Avoid adding non-ASCII characters unless the file already uses them.
- Update
source/js/**orsource/css/**first. - Rebuild with
npm run buildfor verification. - Build outputs are committed by CI on
dev/mainafter merge.
- Add defaults in
_config.yml. - Export them in
scripts/config-export.js. - Consume with optional chaining and defaults in JS.
- Consider adding Stylus variables via
hexo-config()if needed.
- Keep functions pure and avoid heavy computation in filters.
- Use defensive checks for config and data fields.
- Keep init logic in
init*functions and register via lifecycle hooks. - Use
AbortSignalor cleanup patterns to avoid duplicate listeners.
- Do not log or expose user secrets from
_config.yml. - Treat external URLs as untrusted; validate before use where possible.
- Developer docs: https://redefine-docs.ohevan.com/developer
- User docs: https://redefine-docs.ohevan.com/
- Keep this file updated when tooling or conventions change.