fix(cli): treat --with-content=all as include-all sentinel#1389
Conversation
The args help text for `emdash export-seed --with-content` documents `all` as a valid value, but the implementation only treated empty and `true` as the include-every-collection sentinel. The literal string `all` was passed through to the collection-name filter, matched no collection, and produced an empty `content` block. Treat `all` as a synonym for the existing sentinels so the CLI matches its own help text. Closes emdash-cms#1329
🦋 Changeset detectedLatest commit: df81338 The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
All contributors have signed the CLA ✍️ ✅ |
There was a problem hiding this comment.
This is a clean, targeted bug fix that solves exactly the right problem.
Approach: The PR adds "all" to the existing sentinel check in exportSeed(), matching the behaviour already documented in the CLI help text. This is the minimal correct fix — no refactoring, no scope creep.
What I checked:
- Read the full diff and the changed files (
export-seed.ts, the new regression test, and the changeset). - Verified the sentinel logic against the
cittyarg definition and the existing("" | "true")checks. - Grepped the tree for sibling CLI commands, existing
with-contenttests, and theRESERVED_COLLECTION_SLUGSlist. - Reviewed AGENTS.md conventions: no SQL, no API routes, no admin UI, no locale-filtering, no index changes — none apply here.
Headline conclusion: The implementation is correct. The regression test covers the four sentinel/filter shapes. The changeset is present and well-written. One minor suggestion on the test description (see inline), but it doesn't block approval.
| }); | ||
|
|
||
| it("matches the explicit `true` sentinel's behaviour", async () => { | ||
| const seedAll = await exportSeed(db, "all"); |
There was a problem hiding this comment.
[suggestion] The test description says "comma-separated list", but the value passed is "posts" (a single collection name, no comma). Consider updating the description to match the data, or passing an actual comma-separated value like "posts,pages" to exercise the .split(",") path.
|
I have read the CLA Document and I hereby sign the CLA |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/auth-atproto
@emdash-cms/blocks
@emdash-cms/cloudflare
@emdash-cms/contentful-to-portable-text
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/plugin-cli
@emdash-cms/plugin-types
@emdash-cms/registry-client
@emdash-cms/registry-lexicons
@emdash-cms/sandbox-workerd
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-field-kit
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
What does this PR do?
Treats
--with-content=allas a synonym for the existing include-every-collection sentinel inemdash export-seed, so the CLI matches its own help text.The args definition in
packages/core/src/cli/commands/export-seed.tsdocumentsallas a valid value:…but
exportSeed()only treated""and"true"as the "include every collection" sentinel. The literal string"all"was passed through to the collection-name filter, matched no collection (no collection is namedall), and produced an emptycontentblock. Passing an explicit collection name (e.g.--with-content posts) or omitting the value still worked — only the documentedallshortcut was broken.The fix adds
"all"to the same sentinel check. Behaviour for every other input is unchanged. A regression test covers all four shapes (all,"","true","posts").Closes #1329
Type of change
Checklist
pnpm typecheckpasses (verified viatsgo --noEmitonpackages/coreafter building workspace deps)pnpm lintpasses (oxlint clean on changed files)pnpm testpasses (targeted: 4/4 new tests + 117/117 intests/unit/seed/)pnpm formathas been run (oxfmt clean on changed files)emdashpatch)AI-generated code disclosure
Screenshots / test output
Local verification on Node 22.22.3, pnpm 11.1.3 (matches
package.json#packageManager):Regression test (with fix applied):
Same test against the upstream code (fix reverted) — confirms the test catches the bug:
(The 1 passing case is the negative test that asserts
--with-content=postsstill works as a collection-name filter — that path was not affected by the bug.)Full seed test suite (regression check):