Skip to content

feat: add kiqr seed command for demo content#20

Merged
kjellberg merged 1 commit into
kiqr:mainfrom
kjellbergzoey:feat/seed-command
Jun 7, 2026
Merged

feat: add kiqr seed command for demo content#20
kjellberg merged 1 commit into
kiqr:mainfrom
kjellbergzoey:feat/seed-command

Conversation

@kjellbergzoey

Copy link
Copy Markdown
Contributor

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 seed fixes that. It writes a ready-to-import WXR file in one command:

kiqr seed                          # blog (default)
kiqr seed --preset portfolio       # or -p portfolio
kiqr seed --preset woocommerce

It then tells you exactly how to load it:

kiqr wp import kiqr-seed-blog.xml --authors=create

Presets

  • blog — 5 posts + an About page
  • portfolio — an intro page + 4 project pages (cover/columns block markup)
  • woocommerce — 6 demo products with descriptions and prices

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.ts is pure and deterministic — every date is a fixed literal and there are no Date/random calls, so the output is byte-for-byte identical on every run (diff-friendly, fully unit-testable). The .tsx command is thin: it validates --preset, refuses to overwrite an existing file, writes the document, and renders the next steps.
  • Output is a valid WXR 1.2 envelope (<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).
  • No Docker / runtime dependency — seed only touches the filesystem.

Sample output (blog preset)

<?xml version="1.0" encoding="UTF-8" ?>
<!-- This is a WordPress eXtended RSS file generated by the Kiqr CLI. -->
<rss version="2.0"
	xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:wp="http://wordpress.org/export/1.2/"
>
	<channel>
		<title>Kiqr Demo Site</title>
		<wp:wxr_version>1.2</wp:wxr_version>
		<item>
			<title>Welcome to the Kiqr Demo</title>
			<pubDate>Mon, 15 Jan 2024 10:00:00 +0000</pubDate>
			<content:encoded><![CDATA[<!-- wp:paragraph -->
<p>This post and the rest of this demo content were generated by the Kiqr CLI...</p>
<!-- /wp:paragraph -->]]></content:encoded>
			<wp:post_name><![CDATA[welcome-to-the-kiqr-demo]]></wp:post_name>
			<wp:status><![CDATA[publish]]></wp:status>
			<wp:post_type><![CDATA[post]]></wp:post_type>
		</item>
	</channel>
</rss>

Tests

tests/lib/seed.test.ts checks 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

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>
@kjellberg
kjellberg merged commit db33d04 into kiqr:main Jun 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants