@gizai/cli 2.2.3 → 2.2.4

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.
Files changed (2) hide show
  1. package/cli/giz.mjs +7 -1
  2. package/package.json +1 -1
package/cli/giz.mjs CHANGED
@@ -25,6 +25,8 @@ const { version: CLI_VERSION } = createRequire(import.meta.url)('../package.json
25
25
  const DEFAULT_URL = 'https://www.giz.ai'
26
26
  const CLIENT_ID = 'giz-cli'
27
27
  const SCOPES = ['giz.read', 'giz.inference', 'giz.write', 'giz.execute', 'giz.destructive', 'offline_access']
28
+ // Named at sign-in: giz.ai exchanges a refresh token only for a resource the sign-in named (signin.giz gizstackToken).
29
+ const GIZSTACK_RESOURCE = 'https://gizstack.com'
28
30
  const BOOLEAN_OPTIONS = new Set(['help', 'json', 'no-open', 'version', 'device'])
29
31
  const configPath = path.resolve(process.env.GIZ_CONFIG ||
30
32
  path.join(os.homedir(), '.config', 'giz', 'credentials.json'))
@@ -269,6 +271,7 @@ async function login(baseUrl, options) {
269
271
  prompt: 'consent',
270
272
  state
271
273
  })) authorization.searchParams.set(name, value)
274
+ authorization.searchParams.append('resource', GIZSTACK_RESOURCE)
272
275
  process.stderr.write(`Opening Giz sign-in:\n${authorization}\n`)
273
276
  if (options.open !== 'false' && options['no-open'] !== true) openBrowser(authorization.href)
274
277
  const code = await callback.code
@@ -282,7 +285,10 @@ async function deviceLogin(baseUrl, metadata) {
282
285
  if (!metadata.device_authorization_endpoint) throw new CliError('OAuth device authorization is not supported.')
283
286
  const response = await fetch(metadata.device_authorization_endpoint, {
284
287
  method: 'POST', headers: { 'content-type': 'application/x-www-form-urlencoded' },
285
- body: new URLSearchParams({ client_id: CLIENT_ID, scope: SCOPES.join(' '), resource: new URL('/api/mcp', baseUrl).href }),
288
+ body: new URLSearchParams([
289
+ ['client_id', CLIENT_ID], ['scope', SCOPES.join(' ')], ['resource', new URL('/api/mcp', baseUrl).href],
290
+ ['resource', GIZSTACK_RESOURCE]
291
+ ]),
286
292
  signal: AbortSignal.timeout(30_000)
287
293
  })
288
294
  const device = await response.json()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gizai/cli",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "The official command-line interface for giz.ai: run AI models, Drive, Computers and Apps, connect Claude Code, Codex and other agents over MCP, and run Gizlang (giz init, run, deploy), installed on first use.",
5
5
  "keywords": [
6
6
  "giz",