Skip to content

Commit 00a5e7b

Browse files
authored
Quality improvements (#18)
- Switch to oxc for format/lint - Clearer agent instruction - Use convention defined in clearer agent instruction - Update and pin actions and runner images
1 parent d67dc4f commit 00a5e7b

17 files changed

Lines changed: 1169 additions & 1826 deletions

.github/workflows/ci.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,34 @@ concurrency:
1717

1818
jobs:
1919
lint-format:
20-
runs-on: ubuntu-latest
20+
runs-on: ubuntu-24.04
2121
steps:
22-
- uses: actions/checkout@v4
23-
- uses: actions/setup-node@v4
24-
with:
25-
node-version: 24
26-
cache: npm
22+
- uses: actions/checkout@v6.0.2
23+
- uses: volta-cli/action@615a78f6c83e116339c53b94f3f82b4d6c0b7d18 # v5.0.0
2724
- run: npm ci
28-
- run: npm run prettier
29-
- run: npx astro sync
25+
- run: npm run fmt:check
3026
- run: npm run lint
27+
- run: npx astro sync
3128

3229
build:
33-
runs-on: ubuntu-latest
30+
runs-on: ubuntu-24.04
3431
steps:
35-
- uses: actions/checkout@v4
36-
- uses: actions/configure-pages@v4
37-
- uses: actions/setup-node@v4
38-
with:
39-
node-version: 24
40-
cache: npm
32+
- uses: actions/checkout@v6.0.2
33+
- uses: actions/configure-pages@v6
34+
- uses: volta-cli/action@615a78f6c83e116339c53b94f3f82b4d6c0b7d18 # v5.0.0
4135
- run: npm ci
4236
- run: npm run build
43-
- uses: actions/upload-pages-artifact@v3
37+
- uses: actions/upload-pages-artifact@v5
4438
with:
4539
path: ./dist
4640

4741
deploy:
48-
runs-on: ubuntu-latest
42+
runs-on: ubuntu-24.04
4943
needs: [lint-format, build]
5044
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
5145
environment:
5246
name: github-pages
5347
url: ${{ steps.deployment.outputs.page_url }}
5448
steps:
55-
- uses: actions/deploy-pages@v4
49+
- uses: actions/deploy-pages@v5
5650
id: deployment

.oxfmtrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 120,
3+
"trailingComma": "es5",
4+
"ignorePatterns": ["dist/**", ".astro/**", ".claude/**", ".vscode/**"]
5+
}

.oxlintrc.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"plugins": ["typescript"],
3+
"categories": {
4+
"correctness": "off"
5+
},
6+
"options": {
7+
"typeAware": true
8+
},
9+
"rules": {
10+
"typescript/consistent-type-imports": ["error", { "fixStyle": "inline-type-imports" }]
11+
},
12+
"ignorePatterns": ["dist/**", ".astro/**", ".claude/**", ".vscode/**"]
13+
}

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"recommendations": ["astro-build.astro-vscode"],
2+
"recommendations": ["astro-build.astro-vscode", "oxc.oxc-vscode"],
33
"unwantedRecommendations": []
44
}

.vscode/settings.json

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
{
2-
"eslint.validate": ["javascript", "javascriptreact", "astro", "typescript", "typescriptreact"],
3-
"[javascript]": {
4-
"editor.defaultFormatter": "esbenp.prettier-vscode"
5-
},
6-
"[javascriptreact]": {
7-
"editor.defaultFormatter": "esbenp.prettier-vscode"
8-
},
9-
"[typescript]": {
10-
"editor.defaultFormatter": "esbenp.prettier-vscode"
11-
},
12-
"[typescriptreact]": {
13-
"editor.defaultFormatter": "esbenp.prettier-vscode"
2+
"oxc.fmt.configPath": ".oxfmtrc.json",
3+
"oxc.configPath": ".oxlintrc.json",
4+
"oxc.path.tsgolint": "node_modules/.bin/tsgolint",
5+
"editor.formatOnSave": false,
6+
"[javascript][typescript][javascriptreact][typescriptreact][json][jsonc]": {
7+
"editor.defaultFormatter": "oxc.oxc-vscode"
148
},
159
"[astro]": {
1610
"editor.defaultFormatter": "astro-build.astro-vscode"
11+
},
12+
"editor.codeActionsOnSave": {
13+
"source.format.oxc": "always",
14+
"source.fixAll.oxc": "always"
1715
}
18-
}
16+
}

.vscode/tasks.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{
2222
"label": "New Post",
2323
"type": "shell",
24-
"command": "node .vscode/new-post.mjs \"${input:newPostSlug}\"",
24+
"command": "node .vscode/new-post.mts \"${input:newPostSlug}\"",
2525
"presentation": {
2626
"reveal": "always",
2727
"panel": "shared"
@@ -31,7 +31,7 @@
3131
{
3232
"label": "New Comment",
3333
"type": "shell",
34-
"command": "node .vscode/new-comment.mjs \"${input:postSlug}\" \"${input:authorName}\"",
34+
"command": "node .vscode/new-comment.mts \"${input:postSlug}\" \"${input:authorName}\"",
3535
"presentation": {
3636
"reveal": "always",
3737
"panel": "shared"

AGENTS.md

Lines changed: 22 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,33 @@
1-
# AGENTS.md
1+
See [ARCHITECTURE.md](ARCHITECTURE.md) to understand the project. See [CONVENTIONS.md](CONVENTIONS.md) for naming, formatting, and other conventions.
22

3-
This file provides guidance to AI agents working with code in this repository.
3+
Oxfmt used for JS/TS code formatting. Oxfmt + Prettier used for Astro code formatting.
44

5-
## Commands
6-
7-
```sh
8-
npm run dev # Start dev server at localhost:4321
9-
npm run build # Build production site to ./dist/
10-
npm run preview # Preview production build locally
11-
npm run astro ... # Run Astro CLI commands (e.g. astro add, astro check)
12-
npm run lint # Run ESLint
13-
npm run lint:fix # Auto-fix ESLint issues
14-
npm run prettier # Check formatting
15-
npm run prettier:fix # Auto-fix formatting
16-
```
17-
18-
## Architecture
19-
20-
This is an [Astro](https://astro.build) blog site using the minimal template with strict TypeScript.
21-
22-
- `src/pages/` — File-based routing. `.astro` and `.md` files become routes based on filename.
23-
- `src/components/` — Astro components: `BlogPost.astro`, `Comment.astro`, `Comments.astro`, `Footer.astro`, `Header.astro`, `Navigation.astro`, `Social.astro`, `ThemeIcon.astro`.
24-
- `src/layouts/` — Page layouts: `BaseLayout.astro`, `MarkdownPostLayout.astro`.
25-
- `src/blog/` — Markdown blog post content files.
26-
- `src/content/comments/` — Markdown comment files linked to blog posts.
27-
- `src/styles/` — Global CSS (`global.css`).
28-
- `src/assets/` — Static assets imported by components.
29-
- `src/utils/` — Utility functions (e.g. `date.ts`).
30-
- `src/content.config.ts` — Content collection schema for the blog.
31-
- `public/` — Static assets served at root (e.g. `public/favicon.svg``/favicon.svg`).
32-
- `astro.config.mts` — Astro configuration.
5+
## Content creation
336

34-
Astro pages use a frontmatter fence (`---`) at the top for server-side JavaScript, followed by HTML/component markup. TypeScript is configured in strict mode via `astro/tsconfigs/strict`.
7+
Use these scripts (not manual file creation) — they set correct paths, timestamps, and frontmatter:
358

36-
## Content Schemas
37-
38-
**Blog post** (`src/blog/*.md`) frontmatter (all required):
39-
40-
```yaml
41-
title: "Post Title"
42-
date: 2026-01-01
43-
description: "Short description"
44-
tags: ["tag1", "tag2"]
45-
```
46-
47-
**Comment** (`src/content/comments/*.md`) frontmatter:
48-
49-
```yaml
50-
author: "Name" # required
51-
date: 2026-01-01 # required
52-
url: "https://..." # optional
9+
```sh
10+
node .vscode/new-post.mts <post-slug> # creates src/blog/<slug>.md
11+
node .vscode/new-comment.mts <post-slug> <author-name> # creates src/content/comments/<postSlug>/<ts>-<authorSlug>.md
5312
```
5413

55-
## Tooling
56-
57-
- **ESLint** — `eslint-plugin-astro`, `typescript-eslint` (strictTypeChecked), `eslint-config-prettier`
58-
- **Prettier** — `prettier-plugin-astro`, 120-character print width
59-
- **TypeScript** — strict mode via `astro/tsconfigs/strict`
14+
Also available as VS Code tasks: **New Post** / **New Comment** (prompts for inputs).
6015

6116
## Deployment & CI
6217

6318
- Hosted on GitHub Pages at `https://truman.mulholland.nz`
6419
- CI runs lint + build on every push and PR
65-
- Merges to `main` deploy to production; PRs get a deploy preview
20+
- Merges to `main` deploy to production
21+
22+
## Commands
23+
24+
```sh
25+
npm run dev # Start dev server at localhost:4321
26+
npm run build # Build production site to ./dist/
27+
npm run preview # Preview production build locally
28+
npm run astro ... # Run Astro CLI commands (e.g. astro add, astro check)
29+
npm run lint # Run oxlint
30+
npm run lint:fix # Auto-fix oxlint issues
31+
npm run fmt:check # Check formatting
32+
npm run fmt # Auto-fix formatting
33+
```

ARCHITECTURE.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Architecture
2+
3+
An [Astro](https://astro.build) blog site using minimal template.
4+
5+
- `src/pages/` — File-based routing. `.astro`, `.md`, and `.js` files become routes. Includes `posts/`, `tags/` subdirs and `rss.xml.js` endpoint.
6+
- `src/components/` — Astro components: `BlogPost.astro`, `Comment.astro`, `Comments.astro`, `Footer.astro`, `Header.astro`, `Navigation.astro`, `Social.astro`, `ThemeIcon.astro`.
7+
- `src/layouts/` — Page layouts: `BaseLayout.astro`, `MarkdownPostLayout.astro`.
8+
- `src/blog/` — Markdown blog post content files.
9+
- `src/content/comments/` — Markdown comment files. Organized as `src/content/comments/<postSlug>/<unixTimestamp>-<authorSlug>.md`.
10+
- `src/styles/` — Global CSS (`global.css`).
11+
- `src/assets/` — Static assets imported by components.
12+
- `src/utils/` — Utility functions (e.g. `date.ts`).
13+
- `src/content.config.ts` — Content collection schema for the blog.
14+
- `public/` — Static assets served at root (e.g. `public/favicon.svg``/favicon.svg`).
15+
- `astro.config.mts` — Astro configuration.
16+
17+
Astro pages use a frontmatter fence (`---`) at the top for server-side JavaScript, followed by HTML/component markup. TypeScript is configured in strict mode via `astro/tsconfigs/strict`.

0 commit comments

Comments
 (0)