Skip to content

Commit ce67b98

Browse files
committed
app connection setup step 1
1 parent 2a60aef commit ce67b98

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed
Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {appFlags} from '../../flags.js'
2-
import AppUnlinkedCommand, {AppUnlinkedCommandOutput} from '../../utilities/app-unlinked-command.js'
3-
import {AppInterface} from '../../models/app/app.js'
2+
import AppLinkedCommand, {AppLinkedCommandOutput} from '../../utilities/app-linked-command.js'
3+
import {linkedAppContext} from '../../services/app-context.js'
44
import {globalFlags} from '@shopify/cli-kit/node/cli'
55
import {renderSuccess} from '@shopify/cli-kit/node/ui'
66

7-
export default class Execute extends AppUnlinkedCommand {
8-
static summary = 'Execute app operations.'
7+
export default class Execute extends AppLinkedCommand {
8+
static summary = 'Execute bulk operations.'
99

10-
static description = 'Execute app operations.'
10+
static description = 'Execute bulk operations against the Shopify Admin API.'
1111

1212
static hidden = true
1313

@@ -16,14 +16,21 @@ export default class Execute extends AppUnlinkedCommand {
1616
...appFlags,
1717
}
1818

19-
async run(): Promise<AppUnlinkedCommandOutput> {
20-
await this.parse(Execute)
19+
async run(): Promise<AppLinkedCommandOutput> {
20+
const {flags} = await this.parse(Execute)
21+
22+
const appContextResult = await linkedAppContext({
23+
directory: flags.path,
24+
clientId: flags['client-id'],
25+
forceRelink: flags.reset,
26+
userProvidedConfigName: flags.config,
27+
})
2128

2229
renderSuccess({
23-
headline: 'Execute command ran successfully!',
24-
body: 'Placeholder command. Add execution logic here.',
30+
headline: 'App context loaded successfully!',
31+
body: `App: ${appContextResult.app.name}\nOrganization: ${appContextResult.organization.businessName}`,
2532
})
2633

27-
return {app: undefined as unknown as AppInterface}
34+
return {app: appContextResult.app}
2835
}
2936
}

0 commit comments

Comments
 (0)