diff --git a/.agents/rules/blog-system.md b/.agents/rules/blog-system.md index 42af3e9..c7e16dd 100644 --- a/.agents/rules/blog-system.md +++ b/.agents/rules/blog-system.md @@ -54,3 +54,18 @@ - Wikilinks `[[slug]]` or `[[slug|Label]]` must be transformed into standard web URLs (`/posts/slug/`). - Callout blocks (`> [!NOTE]`, `> [!WARNING]`, etc.) must render as terminal-style alert callouts. - Images must be processed into `src/assets/images/posts/` and linked via standard `` or Markdown image syntax. + +--- + +## 5. Test-Driven Development (TDD) & Adversarial Verification +1. **Red-Green-Refactor Lifecycle:** + - Write tests in `test/*.test.js` using Node's native test runner (`node:test`, `node:assert/strict`). + - Test inputs before implementing filters, data loaders, or template macros. +2. **Adversarial Test Coverage Required:** + - **Data & Configuration:** Test that missing required environment variables (e.g. `SITE_DOMAIN`) throw fatal errors. + - **Filters:** Test edge cases: empty strings, undefined values, single-word inputs, massive word counts, non-date objects. + - **Content Schemas:** Validate all Markdown files in `src/posts/` against frontmatter schemas. + - **Design Spec Compliance:** Automate regex/AST assertions on `src/assets/css/` ensuring zero violations of the "Do Not Use" list (`backdrop-filter`, `box-shadow`, `text-shadow`, gradients, floaty transitions). + - **Link & Anchor Integrity:** Verify that every compiled page has zero broken internal links and that all Table of Contents anchor links resolve to valid heading IDs. +3. **Execution Invariant:** + - Always run `npm test` before committing. All tests must pass cleanly with 0 failures. diff --git a/AGENTS.md b/AGENTS.md index d945b50..317c787 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -30,6 +30,16 @@ Every component, style, and layout change must strictly adhere to [`sample-desig - **Interactivity:** Instant binary hover state transitions (no 300ms easing); high-contrast 1px/2px focus outlines for keyboard navigation. - **Typography:** IBM Plex Mono / JetBrains Mono for UI elements and code blocks; Inter for body prose. +### 1.4 Strict Test-Driven Development (TDD) & Adversarial Verification Mandate +- **Test-First Development:** For all new features, custom filters, template helpers, frontmatter schemas, or configuration changes, write automated tests asserting expected behaviors and edge cases *before* or alongside implementing the code. +- **Adversarial Mindset:** Actively design tests to break assumptions: + - Missing environment variables (e.g. unset `SITE_DOMAIN` must throw). + - Malformed frontmatter (missing titles, invalid dates, empty tags). + - Edge-case inputs to filters (empty strings, giant numbers, special characters). + - Design rule violations (asserting 0 instances of `backdrop-filter`, `box-shadow`, gradients, or floaty animations). + - Broken internal links and missing anchor tags in generated HTML. +- **Verification Gate:** Every code change must be verified by running `npm test`. No feature or commit is considered complete unless 100% of the test suite passes. + --- ## 2. Code Modularity & Isolation Guidelines diff --git a/eleventy.config.js b/eleventy.config.js index d8fa67d..2afa0cd 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,7 +1,7 @@ import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight"; import markdownIt from "markdown-it"; import markdownItAnchor from "markdown-it-anchor"; -import { DateTime } from "luxon"; +import { filters } from "./src/_filters/index.js"; export default function (eleventyConfig) { // 1. Static Asset Passthrough Copy @@ -32,57 +32,10 @@ export default function (eleventyConfig) { eleventyConfig.setLibrary("md", markdownLib); - // 4. Custom Filters - // Format readable dates: SEP 12, 2026 - eleventyConfig.addFilter("postDate", (dateObj) => { - if (!dateObj) return ""; - return DateTime.fromJSDate(new Date(dateObj), { zone: "utc" }) - .toFormat("LLL dd, yyyy") - .toUpperCase(); - }); - - // ISO date format for