Skip to content

Commit dbe00fd

Browse files
nickwesselmanclaude
andcommitted
Explain the empty-organization store creation prompts in app dev
An organization with no dev stores drops straight into "Name for the new development store", which arrives without context: the developer asked to run `app dev`, not to create a store. Render a short notice first. The store picker's "Create a new dev store" choice stays quiet, because there the developer already expressed the intent. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Assisted-By: devx/a27b4557-3ac8-448a-8860-7a5ed6b20687
1 parent 93e375a commit dbe00fd

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

packages/app/src/cli/services/dev/select-store.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import {testDeveloperPlatformClient} from '../../models/app/app.test-data.js'
1313
import {ClientName} from '../../utilities/developer-platform-client.js'
1414
import {sleep} from '@shopify/cli-kit/node/system'
15-
import {isTTY, renderSuccess, renderTasks, Task} from '@shopify/cli-kit/node/ui'
15+
import {isTTY, renderInfo, renderSuccess, renderTasks, Task} from '@shopify/cli-kit/node/ui'
1616
import {AbortError, CancelExecution} from '@shopify/cli-kit/node/error'
1717
import {createDevStore} from '@shopify/organizations'
1818
import {beforeEach, describe, expect, vi, test} from 'vitest'
@@ -404,6 +404,8 @@ describe('selectStore', async () => {
404404
json: false,
405405
summary: false,
406406
})
407+
// The developer picked the create choice, so no explanatory notice is needed.
408+
expect(renderInfo).not.toHaveBeenCalled()
407409
expect(renderSuccess).toHaveBeenCalledWith({headline: 'Development store "store1" created successfully.'})
408410
})
409411

@@ -477,6 +479,9 @@ describe('selectStore', async () => {
477479
})
478480
expect(fetchStore).toHaveBeenCalledTimes(2)
479481
expect(sleep).toHaveBeenCalledWith(3)
482+
expect(renderInfo).toHaveBeenCalledWith({
483+
body: "You don't have any dev stores associated with org1's Dev Dashboard. Let's create one.",
484+
})
480485
expect(renderSuccess).toHaveBeenCalledWith({headline: 'Development store "store1" created successfully.'})
481486
})
482487

packages/app/src/cli/services/dev/select-store.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ export async function selectStore(
5353
if (isTTY() === false) {
5454
throw new AbortError('No development store was specified.', createDevStoreTryMessage(org.id))
5555
}
56-
onCreateStoreWhenEmpty = createStoreInline
56+
// The developer never asked to create a store here, so explain why they are being
57+
// prompted. The picker's create choice is self-explanatory and stays quiet.
58+
onCreateStoreWhenEmpty = async () => {
59+
renderInfo({body: emptyOrgNoticeBody(org)})
60+
return createStoreInline()
61+
}
5762
} else if (storeCreationEnabled && storeCreationMode === 'selection-option') {
5863
if (isTTY() === false && (storesSearch.stores.length > 1 || storesSearch.hasMorePages)) {
5964
throw new AbortError(
@@ -175,6 +180,10 @@ async function waitForCreatedStore(
175180

176181
const devStoreCapReachedMessage = 'Your organization has reached its development store limit.'
177182

183+
function emptyOrgNoticeBody(org: Organization): string {
184+
return `You don't have any dev stores associated with ${org.businessName}'s Dev Dashboard. Let's create one.`
185+
}
186+
178187
function devStoreCreationCommand(orgId: string): string {
179188
return `shopify store create dev --organization-id ${orgId} --name <store-name> --plan <plan>`
180189
}

0 commit comments

Comments
 (0)