feat: add reviews content collection
Move all 24 review entries from skills-review/catalog.js +
skills-review/submitted-catalog.js into a typed Astro content collection at
src/content/reviews/. Each entry is a Markdown file with frontmatter for the
review metadata (id, author, focus, wins, improve, extras, name, description)
and a body that holds the 'improved' SKILL.md content.
Re-point scripts/build-skill-review.mjs at the new collection. The generator
reads each .md file, parses its YAML frontmatter, and writes
skill-reviews/improved/{id}/SKILL.md in the same shape the legacy catalog
produced — verified byte-identical via 'git diff --exit-code skill-reviews/'.
The 'name' field is preserved separately from 'id' because two entries
renamed the skill during review (id angular-accessibility-root → name
angular-accessibility; id confectionary-skill-hub → name confectionery-orders).
Without it the generator output would drift on those two files.
Does not yet delete skills-review/catalog.js or submitted-catalog.js —
verify.mjs and the legacy review-desk page both still read them, so they
stay as a mirror until task 16 rewires the page to the collection. Adding a
new submission today requires editing both the .md file (new source of
truth) and the legacy catalog.js (until task 16).
Done-when:
- 24 entries under src/content/reviews/ ✓
- verify.mjs's id:' count assertion still passes ✓
- git diff --exit-code skill-reviews/ clean after regenerating ✓
- astro check passes (22 files: 0 errors, 0 warnings, 2 hints) ✓
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
+14
-7
@@ -15,6 +15,7 @@
|
||||
// migrator agent owns this file end-to-end.
|
||||
|
||||
import { defineCollection, z } from 'astro:content';
|
||||
import { glob } from 'astro/loaders';
|
||||
|
||||
// One localized field. `en` and `pt` are mandatory strings; no nullish,
|
||||
// no default. A missing `pt` is a build error, not a silent fallback.
|
||||
@@ -131,13 +132,18 @@ const chapters = defineCollection({
|
||||
});
|
||||
|
||||
// Review desk entries from skills-review/catalog.js +
|
||||
// skills-review/submitted-catalog.js: 24 in total. `improved` is Markdown
|
||||
// source text, kept as a string here so the diff view that compares
|
||||
// original-vs-improved still has the raw text available. When the
|
||||
// markdown render path lands, this can become a body field without
|
||||
// changing the entry shape.
|
||||
// skills-review/submitted-catalog.js: 24 in total. Each entry is a Markdown
|
||||
// file with frontmatter for the metadata and a body that holds the
|
||||
// `improved` SKILL.md content. Astro renders the body via `<Content />` and
|
||||
// exposes the raw markdown via `entry.body` for the review desk's diff view.
|
||||
//
|
||||
// `name` is preserved separately from `id`: two entries renamed the skill
|
||||
// during review (id `angular-accessibility-root` → name
|
||||
// `angular-accessibility`, id `confectionary-skill-hub` → name
|
||||
// `confectionery-orders`). The build script uses `name` to keep
|
||||
// `skill-reviews/improved/**/SKILL.md` byte-identical.
|
||||
const reviews = defineCollection({
|
||||
type: 'data',
|
||||
loader: glob({ pattern: '**/*.md', base: './src/content/reviews' }),
|
||||
schema: z.object({
|
||||
id: z.string(),
|
||||
author: z.string(),
|
||||
@@ -148,7 +154,8 @@ const reviews = defineCollection({
|
||||
wins: z.array(z.string()),
|
||||
improve: z.array(z.string()),
|
||||
extras: z.string(),
|
||||
improved: z.string(),
|
||||
name: z.string(),
|
||||
description: z.string(),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user