Skip to content

fix(cli): treat --with-content=all as include-all sentinel#1389

Merged
ascorbic merged 1 commit into
emdash-cms:mainfrom
nanangdev:fix/export-seed-with-content-all-1329
Jun 24, 2026
Merged

fix(cli): treat --with-content=all as include-all sentinel#1389
ascorbic merged 1 commit into
emdash-cms:mainfrom
nanangdev:fix/export-seed-with-content-all-1329

Conversation

@nanangdev

Copy link
Copy Markdown
Contributor

What does this PR do?

Treats --with-content=all as a synonym for the existing include-every-collection sentinel in emdash export-seed, so the CLI matches its own help text.

The args definition in packages/core/src/cli/commands/export-seed.ts documents all as a valid value:

"with-content": {
  description: "Include content (all or comma-separated collection names)",
}

…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 named all), and produced an empty content block. Passing an explicit collection name (e.g. --with-content posts) or omitting the value still worked — only the documented all shortcut 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

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes (verified via tsgo --noEmit on packages/core after building workspace deps)
  • pnpm lint passes (oxlint clean on changed files)
  • pnpm test passes (targeted: 4/4 new tests + 117/117 in tests/unit/seed/)
  • pnpm format has been run (oxfmt clean on changed files)
  • I have added/updated tests for my changes
  • User-visible strings in the admin UI are wrapped for translation — n/a (CLI-only change, no admin strings)
  • I have added a changeset (emdash patch)
  • New features link to an approved Discussion — n/a (bug fix, not a feature)

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Claude Opus 4.7

Screenshots / test output

Local verification on Node 22.22.3, pnpm 11.1.3 (matches package.json#packageManager):

Regression test (with fix applied):

RUN  v4.1.5 packages/core
 Test Files  1 passed (1)
      Tests  4 passed (4)
   Duration  6.18s

Same test against the upstream code (fix reverted) — confirms the test catches the bug:

 FAIL  tests/unit/seed/export-seed-with-content-all.test.ts > matches the explicit `true` sentinel's behaviour
AssertionError: expected [] to deeply equal [ 'pages', 'posts' ]

- Expected
+ Received
- [
-   "pages",
-   "posts",
- ]
+ []

 Test Files  1 failed (1)
      Tests  3 failed | 1 passed (4)

(The 1 passing case is the negative test that asserts --with-content=posts still works as a collection-name filter — that path was not affected by the bug.)

Full seed test suite (regression check):

RUN  v4.1.5 packages/core
 Test Files  8 passed (8)
      Tests  117 passed (117)
   Duration  17.86s

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
@github-actions github-actions Bot added review/needs-review No maintainer or bot review yet area/core size/M labels Jun 8, 2026
@changeset-bot

changeset-bot Bot commented Jun 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: df81338

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

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

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 citty arg definition and the existing ("" | "true") checks.
  • Grepped the tree for sibling CLI commands, existing with-content tests, and the RESERVED_COLLECTION_SLUGS list.
  • 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");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[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.

@nanangdev

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jun 8, 2026
@github-actions github-actions Bot added cla: signed review/approved Approved; no new commits since and removed cla: needed review/needs-review No maintainer or bot review yet labels Jun 8, 2026

@ascorbic ascorbic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@ascorbic ascorbic enabled auto-merge (squash) June 24, 2026 06:30
@pkg-pr-new

pkg-pr-new Bot commented Jun 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@1389

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@1389

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@1389

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@1389

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@1389

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@1389

emdash

npm i https://pkg.pr.new/emdash@1389

create-emdash

npm i https://pkg.pr.new/create-emdash@1389

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@1389

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@1389

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@1389

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@1389

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@1389

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@1389

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@1389

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@1389

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@1389

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@1389

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@1389

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@1389

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@1389

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@1389

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@1389

commit: df81338

@ascorbic ascorbic merged commit 9ebb47e into emdash-cms:main Jun 24, 2026
47 of 48 checks passed
@emdashbot emdashbot Bot mentioned this pull request Jun 24, 2026
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.

export-seed: --with-content=all exports nothing (treated as a collection named "all")

2 participants