|
1 | | -# AGENTS.md |
| 1 | +See [ARCHITECTURE.md](ARCHITECTURE.md) to understand the project. See [CONVENTIONS.md](CONVENTIONS.md) for naming, formatting, and other conventions. |
2 | 2 |
|
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. |
4 | 4 |
|
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 |
33 | 6 |
|
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: |
35 | 8 |
|
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 |
53 | 12 | ``` |
54 | 13 |
|
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). |
60 | 15 |
|
61 | 16 | ## Deployment & CI |
62 | 17 |
|
63 | 18 | - Hosted on GitHub Pages at `https://truman.mulholland.nz` |
64 | 19 | - 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 | +``` |
0 commit comments