11import { 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'
44import { globalFlags } from '@shopify/cli-kit/node/cli'
55import { 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