@capgo/cli 4.9.3 → 4.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
- "version": "4.9.3",
3
+ "version": "4.10.0",
4
4
  "description": "A CLI to upload to capgo servers",
5
5
  "author": "github.com/riderx",
6
6
  "license": "Apache 2.0",
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { program } from 'commander'
2
+ import { getUserId } from 'user/account'
2
3
  import pack from '../package.json'
3
4
  import { zipBundle } from './bundle/zip'
4
5
  import { initApp } from './init'
@@ -293,4 +294,14 @@ program
293
294
  'Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel',
294
295
  )
295
296
 
297
+ const user = program
298
+ .command('user')
299
+ .description('Manage user')
300
+
301
+ user.command('account')
302
+ .alias('a')
303
+ .description('Get your account ID')
304
+ .action(getUserId)
305
+ .option('-a, --apikey <apikey>', 'apikey to link to your account')
306
+
296
307
  program.parseAsync()
@@ -0,0 +1,11 @@
1
+ import * as p from '@clack/prompts'
2
+ import { createSupabaseClient, findSavedKey, verifyUser } from '../utils'
3
+ import type { Options } from '../api/app'
4
+
5
+ export async function getUserId(options: Options) {
6
+ p.intro(`Getting user id`)
7
+ options.apikey = options.apikey || findSavedKey()
8
+ const supabase = await createSupabaseClient(options.apikey)
9
+ const userId = await verifyUser(supabase, options.apikey, ['read'])
10
+ p.outro(`Done ✅: ${userId}`)
11
+ }