Skip to content

Add member template creation - #20

Open
naotiki wants to merge 1 commit into
feat/writeup-generatorfrom
codex/refactor-scripts/writeup-generator
Open

naotiki wants to merge 1 commit into
feat/writeup-generatorfrom
codex/refactor-scripts/writeup-generator

Conversation

@naotiki

@naotiki naotiki commented Jun 13, 2025

Copy link
Copy Markdown
Member

Summary

  • when entering a new author, automatically scaffold a member file
  • allow blank image fields and validate frontmatter
  • centralize content schemas for validation and config

Testing

  • pnpm install
  • pnpm check

https://chatgpt.com/codex/tasks/task_e_684c2fb95910832bad3b48c87385a8aa

@naotiki
naotiki requested a review from Copilot June 13, 2025 15:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Add centralized frontmatter schemas, scaffold member files automatically, and tighten validation in writeup-generation scripts.

  • Centralized frontmatter and category schemas in src/content/schemas.ts and updated src/content.config.ts to import them.
  • Refactored writeup-generator scripts to reuse shared schemas, add member template creation (createMemberFile), and validate frontmatter.
  • Enhanced prompts with custom category normalization and contest ID validation, and updated the new-writeup script to scaffold member files for new authors.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/content/schemas.ts Define shared Zod schemas for writeups and members, and centralize categories.
src/content.config.ts Replace inline frontmatter definitions with imported centralized schemas.
scripts/writeup-generator/validation.ts Add functions to validate writeup and member frontmatter using shared schemas.
scripts/writeup-generator/utils.ts Clean up imports; fix regex in generateFileName for valid filename characters.
scripts/writeup-generator/types.ts Remove duplicated categories; re-export from centralized schemas; add MemberTemplateData.
scripts/writeup-generator/template.ts Introduce member template generation, file creation, and frontmatter validation.
scripts/writeup-generator/prompts.ts Add validateContestId, custom category prefixing, and consolidate validators.
scripts/new-writeup.ts Detect new authors and scaffold member files before creating writeups.
Comments suppressed due to low confidence (3)

scripts/writeup-generator/template.ts:79

  • [nitpick] Consider adding unit tests for the createMemberFile function and its frontmatter validation to ensure member scaffolding behaves as expected.
await validateMemberFrontmatter(data.filePath);

scripts/writeup-generator/prompts.ts:7

  • [nitpick] The function name addCustomPrefix may not clearly convey that it also trims and normalizes categories. Consider renaming to something like normalizeCategoryPrefix for clarity.
function addCustomPrefix(category: string): string {

scripts/new-writeup.ts:73

  • The existsSync function is used here but not imported. Please add import { existsSync } from 'node:fs'; at the top of the file.
if (isNewAuthor && !existsSync(memberFilePath)) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants