fix(cli): send --force through to the API when deleting a collection - #3016
fix(cli): send --force through to the API when deleting a collection#3016jakevis wants to merge 2 commits into
Conversation
`emdash schema delete --force` consumed the flag to skip its own prompt and
then called the client without it, so the API refused any collection that
still had content — with an error naming the very option the user had just
passed. There was no other CLI path through, so scripted cleanup had to
hand-roll the DELETE request and its auth.
The client method now takes `{ force }` and sends it the way the route
already reads it, and the command passes its flag along. The flag keeps its
single meaning — "don't ask, just delete" — since the prompt existed to
guard exactly the destructive case.
Fixes emdash-cms#2994
🦋 Changeset detectedLatest commit: 911c93f The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 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 |
@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/registry-moderation
@emdash-cms/registry-verification
@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: |
There was a problem hiding this comment.
This is a small, targeted fix for the right problem: emdash schema delete --force was swallowing the flag after using it only to skip the local confirmation prompt. The change threads the flag through EmDashClient.deleteCollection as ?force=true, which matches the existing API route (packages/core/src/astro/routes/api/schema/collections/[slug]/index.ts reads url.searchParams.get("force") === "true"). The signature change is backwards-compatible, the new client unit test covers all three states (no options, force: false, force: true), and the updated help text now describes the combined behavior accurately.
I reviewed the CLI command, client implementation, API route, registry handler, related tests, and the changeset. No logic bugs or regressions found. One AGENTS.md convention issue remains: the inline comment in packages/core/src/cli/commands/schema.ts narrates the pre-fix bug / PR context rather than serving as evergreen code explanation, and should be removed.
What does this PR do?
emdash schema delete --forceconsumed the flag to skip its own confirmation prompt and then called the client without it, so the API refused any collection that still had content — with an error naming the very option the user had just passed. There was no other CLI path through.EmDashClient.deleteCollectionnow takes{ force?: boolean }and sends it as?force=true, the way the route already reads it; the command passes its flag along. The flag keeps a single meaning — "don't ask, just delete" — since the prompt existed to guard exactly the destructive case. Test added for the client's query string; changeset included.Closes #2994
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runAI-generated code disclosure
Screenshots / test output