feat: add kiqr seed command for demo content#20
Merged
Conversation
Add `kiqr seed [--preset blog|portfolio|woocommerce]` which generates a deterministic, valid WXR 1.2 document of realistic demo content in the current directory and prints the import command. - src/lib/seed.ts: pure, deterministic generateSeedWxr(preset). All dates are fixed literals; no Date/random APIs, so output is byte-for-byte stable. Content is block-editor friendly (core wp: block comments). - src/commands/seed.tsx: thin Pastel command, validates --preset against SEED_PRESETS, refuses to overwrite an existing file. - tests/lib/seed.test.ts: well-formedness, item/post-type counts, CDATA, determinism, and per-preset content checks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A populated site in one command
A fresh WordPress install is empty: no posts, no pages, no products. That makes it hard to judge a theme's typography, spacing, archives, and edge cases (long titles, missing media, empty states). Building demo content by hand is a well-known agency pain point — every new theme project starts with the same tedious copy-paste.
kiqr seedfixes that. It writes a ready-to-import WXR file in one command:It then tells you exactly how to load it:
Presets
All content is block-editor friendly (core
<!-- wp:paragraph -->/ heading / list / cover / columns block comments), so it imports as native Gutenberg blocks rather than a Classic blob.Design notes
src/lib/seed.tsis pure and deterministic — every date is a fixed literal and there are noDate/random calls, so the output is byte-for-byte identical on every run (diff-friendly, fully unit-testable). The.tsxcommand is thin: it validates--preset, refuses to overwrite an existing file, writes the document, and renders the next steps.<rss version="2.0" xmlns:wp/content/dc/excerpt...>, a<channel>, and<item>s with<wp:post_type>,<wp:status>publish</wp:status>,<wp:post_name>,<content:encoded>CDATA, and dates).seedonly touches the filesystem.Sample output (blog preset)
Tests
tests/lib/seed.test.tschecks each preset for: well-formed XML (via a small dependency-free structural validator), the WXR 1.2 envelope, expected item counts and post types, CDATA-wrapped content, block markup, and byte-for-byte determinism across calls.All gates pass:
typecheck,test(143 total),build,lint.🤖 Generated with Claude Code