|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is the documentation site for Hinode, a Hugo theme based on Bootstrap 5. The site is published to https://gethinode.com and deployed via Netlify. |
| 8 | + |
| 9 | +## Common Commands |
| 10 | + |
| 11 | +### Development |
| 12 | + |
| 13 | +```bash |
| 14 | +npm start # Start dev server with live reload (auto-vendors modules) |
| 15 | +npm run start:prod # Start server in production mode with minification |
| 16 | +``` |
| 17 | + |
| 18 | +### Building |
| 19 | + |
| 20 | +```bash |
| 21 | +npm run build # Production build with minification (auto-cleans public/) |
| 22 | +npm run build:cache # CI build with cache optimizations |
| 23 | +npm run build:debug # Debug build with verbose output (auto-updates modules) |
| 24 | +npm run build:preview # Preview build with drafts and future posts |
| 25 | +npm run build:headers # Generate Netlify headers and server config |
| 26 | +``` |
| 27 | + |
| 28 | +### Linting |
| 29 | + |
| 30 | +```bash |
| 31 | +npm test # Run all lints (alias for lint:markdown) |
| 32 | +npm run lint # Run all lints |
| 33 | +npm run lint:markdown # Lint markdown files |
| 34 | +npm run lint:markdown-fix # Auto-fix markdown issues |
| 35 | +npm run lint:scripts # Lint JavaScript with ESLint (neostandard) |
| 36 | +npm run lint:styles # Lint SCSS files with Stylelint |
| 37 | +``` |
| 38 | + |
| 39 | +### Hugo Modules |
| 40 | + |
| 41 | +```bash |
| 42 | +npm run mod:update # Update all modules, vendor, and tidy |
| 43 | +npm run mod:vendor # Vendor Hugo modules to _vendor/ |
| 44 | +npm run mod:tidy # Clean up go.sum |
| 45 | +npm run mod:clean # Clean Hugo module cache |
| 46 | +``` |
| 47 | + |
| 48 | +### Utilities |
| 49 | + |
| 50 | +```bash |
| 51 | +npm run clean:public # Remove public/ directory |
| 52 | +npm run clean:install # Remove package-lock.json and node_modules |
| 53 | +npm run upgrade # Upgrade npm dependencies and Hugo modules |
| 54 | +npm run env # Display Hugo environment info |
| 55 | +npm run check # Display Hugo version |
| 56 | +``` |
| 57 | + |
| 58 | +## Architecture |
| 59 | + |
| 60 | +### Hugo Module System |
| 61 | + |
| 62 | +- Main theme imported from `github.com/gethinode/hinode` |
| 63 | +- Additional modules in `go.mod` provide features like FontAwesome, Mermaid, KaTeX, FlexSearch |
| 64 | +- Vendored modules stored in `_vendor/` directory |
| 65 | +- Module mounts defined in `config/_default/hugo.toml` |
| 66 | + |
| 67 | +### Configuration Structure |
| 68 | + |
| 69 | +- `config/_default/` - Default configuration files |
| 70 | + - `hugo.toml` - Main Hugo config |
| 71 | + - `params.toml` - Site parameters |
| 72 | + - `languages.toml` - Language settings |
| 73 | + - `markup.toml` - Markdown rendering options |
| 74 | + - `menus/` - Navigation menus |
| 75 | +- `config/production/` - Production overrides |
| 76 | +- `config/ci/` - CI environment config |
| 77 | + |
| 78 | +### Content Organization |
| 79 | + |
| 80 | +- `content/en/` - English content |
| 81 | + - `docs/latest/` - Current documentation (mounted to `/docs/`) |
| 82 | + - `guides/` - Tutorial guides |
| 83 | +- Content uses Hugo page bundles with front matter |
| 84 | + |
| 85 | +### Asset Pipeline |
| 86 | + |
| 87 | +- SCSS in `assets/scss/` processed with Dart Sass (via Netlify plugin) |
| 88 | +- JavaScript in `assets/js/` |
| 89 | +- PostCSS with autoprefixer, cssnano, and PurgeCSS |
| 90 | +- Build stats written to `hugo_stats.json` for PurgeCSS |
| 91 | + |
| 92 | +### Layouts |
| 93 | + |
| 94 | +Custom layouts in `layouts/` override theme templates. The site uses Hugo's template inheritance from the Hinode theme. |
| 95 | + |
| 96 | +## Release Workflow |
| 97 | + |
| 98 | +The project uses automated releases with semantic versioning: |
| 99 | + |
| 100 | +### Commit Conventions |
| 101 | + |
| 102 | +- Follows [Conventional Commits](https://www.conventionalcommits.org/) specification |
| 103 | +- Enforced via commitlint with `@commitlint/config-conventional` |
| 104 | +- Commit format: `type(scope): description` |
| 105 | + - Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `build`, `ci` |
| 106 | + - Example: `feat(docs): add new search functionality` |
| 107 | + |
| 108 | +### Git Hooks (Husky) |
| 109 | + |
| 110 | +Husky manages Git hooks to ensure code quality: |
| 111 | + |
| 112 | +- **pre-commit**: Runs `npm test` (markdown linting) |
| 113 | +- **commit-msg**: Validates commit messages with commitlint |
| 114 | +- Hooks are skipped in CI and production environments |
| 115 | + |
| 116 | +### Semantic Release |
| 117 | + |
| 118 | +Automated versioning and releases on the `main` branch: |
| 119 | + |
| 120 | +- **Trigger**: Pushes to `main` or manual workflow dispatch |
| 121 | +- **Process**: |
| 122 | + 1. Analyzes commits since last release |
| 123 | + 2. Determines version bump (major/minor/patch) |
| 124 | + 3. Generates release notes |
| 125 | + 4. Creates GitHub release |
| 126 | + 5. Updates `package.json` and `package-lock.json` |
| 127 | +- **Plugins**: |
| 128 | + - `@semantic-release/commit-analyzer` - Determines version bump |
| 129 | + - `@semantic-release/release-notes-generator` - Generates changelog |
| 130 | + - `@semantic-release/github` - Creates GitHub releases |
| 131 | + - `@semantic-release/git` - Commits version updates |
| 132 | +- **Workflow**: `.github/release.yml` |
| 133 | + |
| 134 | +## Key Files |
| 135 | + |
| 136 | +### Core Configuration |
| 137 | + |
| 138 | +- `netlify.toml` - Netlify deployment configuration |
| 139 | +- `go.mod` / `go.sum` - Hugo module dependencies |
| 140 | +- `package.json` - npm scripts and dependencies |
| 141 | +- `config/_default/hugo.toml` - Main Hugo configuration |
| 142 | + |
| 143 | +### Linting Configuration |
| 144 | + |
| 145 | +- `.markdownlint-cli2.jsonc` - Markdown linting rules |
| 146 | + - Disabled rules: MD013 (line length), MD024 (duplicate headings), MD026 (trailing punctuation), MD034 (bare URLs), MD053 (link definitions), MD055 (table pipe alignment), MD056 (table column count) |
| 147 | + - Ignores: `node_modules`, `CHANGELOG.md` |
| 148 | +- `eslint.config.js` - JavaScript linting with neostandard preset |
| 149 | +- Stylelint uses `stylelint-config-standard-scss` (configured in package.json) |
| 150 | + |
| 151 | +### Release & Git Hooks |
| 152 | + |
| 153 | +- `commitlint.config.js` - Conventional commits configuration |
| 154 | +- `.husky/commit-msg` - Commit message validation hook |
| 155 | +- `.husky/pre-commit` - Pre-commit linting hook |
| 156 | +- `.github/release.yml` - Semantic release workflow |
0 commit comments