mirror of
https://github.com/langgenius/dify.git
synced 2026-06-03 08:16:37 +08:00
refactor: use absolute path for inter dir importing (#36822)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
+2
-1
@@ -32,7 +32,7 @@
|
||||
"test:coverage": "vp test --coverage",
|
||||
"lint": "eslint",
|
||||
"lint:fix": "eslint --fix",
|
||||
"type-check": "tsc",
|
||||
"type-check": "tsgo",
|
||||
"tree:gen": "bun scripts/generate-command-tree.ts",
|
||||
"tree:check": "bun scripts/generate-command-tree.ts --check",
|
||||
"prebuild": "pnpm tree:gen",
|
||||
@@ -63,6 +63,7 @@
|
||||
"@types/js-yaml": "catalog:",
|
||||
"@types/lockfile": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"@typescript/native-preview": "catalog:",
|
||||
"@vitest/coverage-v8": "catalog:",
|
||||
"eslint": "catalog:",
|
||||
"hono": "catalog:",
|
||||
|
||||
@@ -49,9 +49,9 @@ describe('tokensToIdentifier', () => {
|
||||
describe('buildTree', () => {
|
||||
it('assembles a nested tree from entries', () => {
|
||||
const entries = [
|
||||
{ tokens: ['auth', 'login'], identifier: 'AuthLogin', importPath: './auth/login/index.js' },
|
||||
{ tokens: ['auth', 'devices', 'list'], identifier: 'AuthDevicesList', importPath: './auth/devices/list/index.js' },
|
||||
{ tokens: ['version'], identifier: 'Version', importPath: './version/index.js' },
|
||||
{ tokens: ['auth', 'login'], identifier: 'AuthLogin', importPath: '@/commands/auth/login/index' },
|
||||
{ tokens: ['auth', 'devices', 'list'], identifier: 'AuthDevicesList', importPath: '@/commands/auth/devices/list/index' },
|
||||
{ tokens: ['version'], identifier: 'Version', importPath: '@/commands/version/index' },
|
||||
]
|
||||
const tree = buildTree(entries)
|
||||
expect(tree.subcommands.get('auth')?.command).toBeUndefined()
|
||||
@@ -63,8 +63,8 @@ describe('buildTree', () => {
|
||||
|
||||
it('supports a parent command with its own children', () => {
|
||||
const entries = [
|
||||
{ tokens: ['run', 'app'], identifier: 'RunApp', importPath: './run/app/index.js' },
|
||||
{ tokens: ['run', 'app', 'resume'], identifier: 'RunAppResume', importPath: './run/app/resume/index.js' },
|
||||
{ tokens: ['run', 'app'], identifier: 'RunApp', importPath: '@/commands/run/app/index' },
|
||||
{ tokens: ['run', 'app', 'resume'], identifier: 'RunAppResume', importPath: '@/commands/run/app/resume/index' },
|
||||
]
|
||||
const tree = buildTree(entries)
|
||||
const runApp = tree.subcommands.get('run')?.subcommands.get('app')
|
||||
@@ -76,9 +76,9 @@ describe('buildTree', () => {
|
||||
describe('formatModule', () => {
|
||||
it('produces a deterministic ESM file with imports + tree literal', () => {
|
||||
const entries: CommandEntry[] = [
|
||||
{ tokens: ['auth', 'login'], identifier: 'AuthLogin', importPath: './auth/login/index.js' },
|
||||
{ tokens: ['version'], identifier: 'Version', importPath: './version/index.js' },
|
||||
{ tokens: ['auth', 'devices', 'list'], identifier: 'AuthDevicesList', importPath: './auth/devices/list/index.js' },
|
||||
{ tokens: ['auth', 'login'], identifier: 'AuthLogin', importPath: '@/commands/auth/login/index' },
|
||||
{ tokens: ['version'], identifier: 'Version', importPath: '@/commands/version/index' },
|
||||
{ tokens: ['auth', 'devices', 'list'], identifier: 'AuthDevicesList', importPath: '@/commands/auth/devices/list/index' },
|
||||
]
|
||||
const tree = buildTree(entries)
|
||||
const out = formatModule(entries, tree)
|
||||
@@ -86,10 +86,10 @@ describe('formatModule', () => {
|
||||
`// @generated by scripts/generate-command-tree.ts — DO NOT EDIT.
|
||||
// Regenerate via \`pnpm tree:gen\`. Drift gated by \`pnpm tree:check\` in CI.
|
||||
|
||||
import type { CommandTree } from '../framework/registry.js'
|
||||
import AuthDevicesList from './auth/devices/list/index.js'
|
||||
import AuthLogin from './auth/login/index.js'
|
||||
import Version from './version/index.js'
|
||||
import type { CommandTree } from '@/framework/registry'
|
||||
import AuthDevicesList from '@/commands/auth/devices/list/index'
|
||||
import AuthLogin from '@/commands/auth/login/index'
|
||||
import Version from '@/commands/version/index'
|
||||
|
||||
export const commandTree: CommandTree = {
|
||||
auth: {
|
||||
@@ -110,8 +110,8 @@ export const commandTree: CommandTree = {
|
||||
|
||||
it('emits parent-with-own-command shape', () => {
|
||||
const entries: CommandEntry[] = [
|
||||
{ tokens: ['run', 'app'], identifier: 'RunApp', importPath: './run/app/index.js' },
|
||||
{ tokens: ['run', 'app', 'resume'], identifier: 'RunAppResume', importPath: './run/app/resume/index.js' },
|
||||
{ tokens: ['run', 'app'], identifier: 'RunApp', importPath: '@/commands/run/app/index' },
|
||||
{ tokens: ['run', 'app', 'resume'], identifier: 'RunAppResume', importPath: '@/commands/run/app/resume/index' },
|
||||
]
|
||||
const tree = buildTree(entries)
|
||||
const out = formatModule(entries, tree)
|
||||
@@ -129,8 +129,8 @@ export const commandTree: CommandTree = {
|
||||
|
||||
it('imports sorted alphabetically by import path', () => {
|
||||
const entries: CommandEntry[] = [
|
||||
{ tokens: ['version'], identifier: 'Version', importPath: './version/index.js' },
|
||||
{ tokens: ['auth', 'login'], identifier: 'AuthLogin', importPath: './auth/login/index.js' },
|
||||
{ tokens: ['version'], identifier: 'Version', importPath: '@/commands/version/index' },
|
||||
{ tokens: ['auth', 'login'], identifier: 'AuthLogin', importPath: '@/commands/auth/login/index' },
|
||||
]
|
||||
const out = formatModule(entries, buildTree(entries))
|
||||
const authIdx = out.indexOf('AuthLogin')
|
||||
|
||||
@@ -112,7 +112,7 @@ function compareStrings(a: string, b: string): number {
|
||||
|
||||
function emitImports(entries: readonly CommandEntry[]): string {
|
||||
const sorted = [...entries].sort((a, b) => compareStrings(a.importPath, b.importPath))
|
||||
const lines = [`import type { CommandTree } from '../framework/registry.js'`]
|
||||
const lines = [`import type { CommandTree } from '@/framework/registry'`]
|
||||
for (const e of sorted)
|
||||
lines.push(`import ${e.identifier} from '${e.importPath}'`)
|
||||
return lines.join('\n')
|
||||
@@ -219,7 +219,7 @@ export async function discoverCommands(commandsDir: string): Promise<CommandEntr
|
||||
entries.push({
|
||||
tokens,
|
||||
identifier: tokensToIdentifier(tokens),
|
||||
importPath: `./${tokens.join('/')}/index.js`,
|
||||
importPath: `@/commands/${tokens.join('/')}/index`,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import type { DifyMock } from '../../test/fixtures/dify-mock/server.js'
|
||||
import type { DifyMock } from '@test/fixtures/dify-mock/server'
|
||||
import { mkdtemp, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { startMock } from '@test/fixtures/dify-mock/server'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { startMock } from '../../test/fixtures/dify-mock/server.js'
|
||||
import { loadAppInfoCache } from '../cache/app-info.js'
|
||||
import { createClient } from '../http/client.js'
|
||||
import { ENV_CACHE_DIR } from '../store/dir.js'
|
||||
import { CACHE_APP_INFO, getCache } from '../store/manager.js'
|
||||
import { FieldInfo, FieldParameters } from '../types/app-meta.js'
|
||||
import { AppMetaClient } from './app-meta.js'
|
||||
import { AppsClient } from './apps.js'
|
||||
import { loadAppInfoCache } from '@/cache/app-info'
|
||||
import { createClient } from '@/http/client'
|
||||
import { ENV_CACHE_DIR } from '@/store/dir'
|
||||
import { CACHE_APP_INFO, getCache } from '@/store/manager'
|
||||
import { FieldInfo, FieldParameters } from '@/types/app-meta'
|
||||
import { AppMetaClient } from './app-meta'
|
||||
import { AppsClient } from './apps'
|
||||
|
||||
describe('AppMetaClient', () => {
|
||||
let mock: DifyMock
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { AppInfoCache } from '../cache/app-info.js'
|
||||
import type { AppMeta, AppMetaFieldKey } from '../types/app-meta.js'
|
||||
import type { AppsClient } from './apps.js'
|
||||
import { covers, fromDescribe, mergeMeta } from '../types/app-meta.js'
|
||||
import type { AppsClient } from './apps'
|
||||
import type { AppInfoCache } from '@/cache/app-info'
|
||||
import type { AppMeta, AppMetaFieldKey } from '@/types/app-meta'
|
||||
import { covers, fromDescribe, mergeMeta } from '@/types/app-meta'
|
||||
|
||||
export type AppMetaClientOptions = {
|
||||
readonly apps: AppsClient
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { DifyMock } from '../../test/fixtures/dify-mock/server.js'
|
||||
import type { DifyMock } from '@test/fixtures/dify-mock/server'
|
||||
import { startMock } from '@test/fixtures/dify-mock/server'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { startMock } from '../../test/fixtures/dify-mock/server.js'
|
||||
import { createClient } from '../http/client.js'
|
||||
import { AppRunClient, buildRunBody } from './app-run.js'
|
||||
import { createClient } from '@/http/client'
|
||||
import { AppRunClient, buildRunBody } from './app-run'
|
||||
|
||||
describe('buildRunBody', () => {
|
||||
it('does not include response_mode', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { SseEvent } from '../http/sse.js'
|
||||
import { normalizeDifyStream } from '../http/sse-dify.js'
|
||||
import { parseSSE } from '../http/sse.js'
|
||||
import type { SseEvent } from '@/http/sse'
|
||||
import { parseSSE } from '@/http/sse'
|
||||
import { normalizeDifyStream } from '@/http/sse-dify'
|
||||
|
||||
export type RunBodyArgs = {
|
||||
readonly message?: string
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import type { DifyMock } from '@test/fixtures/dify-mock/server'
|
||||
import type { AddressInfo } from 'node:net'
|
||||
import type { DifyMock } from '../../test/fixtures/dify-mock/server.js'
|
||||
import type { CodeResponse } from './oauth-device.js'
|
||||
import type { CodeResponse } from './oauth-device'
|
||||
import { Buffer } from 'node:buffer'
|
||||
import * as http from 'node:http'
|
||||
import { startMock } from '@test/fixtures/dify-mock/server'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { startMock } from '../../test/fixtures/dify-mock/server.js'
|
||||
import { isBaseError } from '../errors/base.js'
|
||||
import { ErrorCode } from '../errors/codes.js'
|
||||
import { createClient } from '../http/client.js'
|
||||
import { DEFAULT_CLIENT_ID, DeviceFlowApi } from './oauth-device.js'
|
||||
import { isBaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
import { createClient } from '@/http/client'
|
||||
import { DEFAULT_CLIENT_ID, DeviceFlowApi } from './oauth-device'
|
||||
|
||||
type StubServer = {
|
||||
url: string
|
||||
|
||||
@@ -2,9 +2,9 @@ import type { AddressInfo } from 'node:net'
|
||||
import { Buffer } from 'node:buffer'
|
||||
import * as http from 'node:http'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { isBaseError } from '../errors/base.js'
|
||||
import { createClient } from '../http/client.js'
|
||||
import { MembersClient } from './members.js'
|
||||
import { isBaseError } from '@/errors/base'
|
||||
import { createClient } from '@/http/client'
|
||||
import { MembersClient } from './members'
|
||||
|
||||
type StubServer = {
|
||||
url: string
|
||||
@@ -84,7 +84,7 @@ describe('MembersClient.list', () => {
|
||||
const result = await makeClient(stub.url).list('ws-1')
|
||||
expect(captured.method).toBe('GET')
|
||||
expect(captured.url).toBe('/openapi/v1/workspaces/ws-1/members')
|
||||
expect(result.data[0].email).toBe('mia@e.com')
|
||||
expect(result.data[0]?.email).toBe('mia@e.com')
|
||||
})
|
||||
|
||||
it('URL-encodes workspace id', async () => {
|
||||
@@ -259,7 +259,7 @@ describe('WorkspacesClient.switch (integration with stub)', () => {
|
||||
)
|
||||
stub.lastRequest = captured
|
||||
|
||||
const { WorkspacesClient } = await import('./workspaces.js')
|
||||
const { WorkspacesClient } = await import('./workspaces')
|
||||
const client = new WorkspacesClient(createClient({ host: stub.url, bearer: 'dfoa_test' }))
|
||||
const result = await client.switch('ws-1')
|
||||
expect(captured.method).toBe('POST')
|
||||
@@ -271,7 +271,7 @@ describe('WorkspacesClient.switch (integration with stub)', () => {
|
||||
const captured: StubServer['lastRequest'] = {}
|
||||
stub = await startServer(jsonResponder(404, { error: 'not found' }, captured))
|
||||
|
||||
const { WorkspacesClient } = await import('./workspaces.js')
|
||||
const { WorkspacesClient } = await import('./workspaces')
|
||||
const client = new WorkspacesClient(createClient({ host: stub.url, bearer: 'dfoa_test' }))
|
||||
await expect(client.switch('ws-x')).rejects.toSatisfy(
|
||||
err => isBaseError(err) && err.httpStatus === 404,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { DifyMock } from '../../test/fixtures/dify-mock/server.js'
|
||||
import type { DifyMock } from '@test/fixtures/dify-mock/server'
|
||||
import { startMock } from '@test/fixtures/dify-mock/server'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { startMock } from '../../test/fixtures/dify-mock/server.js'
|
||||
import { createClient } from '../http/client.js'
|
||||
import { MetaClient } from './meta.js'
|
||||
import { createClient } from '@/http/client'
|
||||
import { MetaClient } from './meta'
|
||||
|
||||
describe('MetaClient', () => {
|
||||
let mock: DifyMock
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import { BaseError } from '../errors/base.js'
|
||||
import { ErrorCode } from '../errors/codes.js'
|
||||
import { BaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
|
||||
export const DEFAULT_CLIENT_ID = 'difyctl'
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ import { mkdtemp, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { ENV_CONFIG_DIR } from '../store/dir.js'
|
||||
import { HostsBundleSchema, loadHosts, saveHosts } from './hosts.js'
|
||||
import { ENV_CONFIG_DIR } from '@/store/dir'
|
||||
import { HostsBundleSchema, loadHosts, saveHosts } from './hosts'
|
||||
|
||||
describe('HostsBundleSchema', () => {
|
||||
it('parses a minimal logged-out bundle', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Store } from '../store/store.js'
|
||||
import type { Store } from '@/store/store'
|
||||
import { z } from 'zod'
|
||||
import { getHostStore, tokenKey } from '../store/manager.js'
|
||||
import { getHostStore, tokenKey } from '@/store/manager'
|
||||
|
||||
const StorageModeSchema = z.enum(['keychain', 'file'])
|
||||
export type StorageMode = z.infer<typeof StorageModeSchema>
|
||||
|
||||
Vendored
+6
-6
@@ -1,14 +1,14 @@
|
||||
import type { AppMeta } from '../types/app-meta.js'
|
||||
import type { AppMeta } from '@/types/app-meta'
|
||||
import { mkdtemp, readFile, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import yaml from 'js-yaml'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { ENV_CACHE_DIR } from '../store/dir.js'
|
||||
import { CACHE_APP_INFO, cachePath, getCache } from '../store/manager.js'
|
||||
import { platform } from '../sys/index.js'
|
||||
import { FieldInfo, FieldParameters } from '../types/app-meta.js'
|
||||
import { APP_INFO_TTL_MS, loadAppInfoCache } from './app-info.js'
|
||||
import { ENV_CACHE_DIR } from '@/store/dir'
|
||||
import { CACHE_APP_INFO, cachePath, getCache } from '@/store/manager'
|
||||
import { platform } from '@/sys/index'
|
||||
import { FieldInfo, FieldParameters } from '@/types/app-meta'
|
||||
import { APP_INFO_TTL_MS, loadAppInfoCache } from './app-info'
|
||||
|
||||
function appInfoPath(dir: string): string {
|
||||
return cachePath(dir, CACHE_APP_INFO)
|
||||
|
||||
Vendored
+4
-4
@@ -1,7 +1,7 @@
|
||||
import type { Store } from '../store/store.js'
|
||||
import type { AppMeta, AppMetaCacheRecord, AppMetaFieldKey } from '../types/app-meta.js'
|
||||
import { CACHE_APP_INFO, getCache } from '../store/manager.js'
|
||||
import { FieldInfo, FieldInputSchema, FieldParameters } from '../types/app-meta.js'
|
||||
import type { Store } from '@/store/store'
|
||||
import type { AppMeta, AppMetaCacheRecord, AppMetaFieldKey } from '@/types/app-meta'
|
||||
import { CACHE_APP_INFO, getCache } from '@/store/manager'
|
||||
import { FieldInfo, FieldInputSchema, FieldParameters } from '@/types/app-meta'
|
||||
|
||||
export const APP_INFO_TTL_MS = 60 * 60 * 1000
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -3,9 +3,9 @@ import { tmpdir } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import yaml from 'js-yaml'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { ENV_CACHE_DIR } from '../store/dir.js'
|
||||
import { CACHE_NUDGE, cachePath, getCache } from '../store/manager.js'
|
||||
import { loadNudgeStore, WARN_INTERVAL_MS } from './nudge-store.js'
|
||||
import { ENV_CACHE_DIR } from '@/store/dir'
|
||||
import { CACHE_NUDGE, cachePath, getCache } from '@/store/manager'
|
||||
import { loadNudgeStore, WARN_INTERVAL_MS } from './nudge-store'
|
||||
|
||||
function nudgeStorePath(dir: string): string {
|
||||
return cachePath(dir, CACHE_NUDGE)
|
||||
|
||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
||||
import type { Store } from '../store/store.js'
|
||||
import { CACHE_NUDGE, getCache } from '../store/manager.js'
|
||||
import type { Store } from '@/store/store'
|
||||
import { CACHE_NUDGE, getCache } from '@/store/manager'
|
||||
|
||||
export const WARN_INTERVAL_MS = 24 * 60 * 60 * 1000
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../auth/hosts.js'
|
||||
import type { AppInfoCache } from '../../cache/app-info.js'
|
||||
import type { Command } from '../../framework/command.js'
|
||||
import type { IOStreams } from '../../sys/io/streams'
|
||||
import { META_PROBE_TIMEOUT_MS, MetaClient } from '../../api/meta.js'
|
||||
import { loadHosts } from '../../auth/hosts.js'
|
||||
import { loadAppInfoCache } from '../../cache/app-info.js'
|
||||
import { loadNudgeStore } from '../../cache/nudge-store.js'
|
||||
import { getEnv } from '../../env/registry.js'
|
||||
import { BaseError } from '../../errors/base.js'
|
||||
import { ErrorCode } from '../../errors/codes.js'
|
||||
import { formatErrorForCli } from '../../errors/format.js'
|
||||
import { createClient } from '../../http/client.js'
|
||||
import { realStreams } from '../../sys/io/streams'
|
||||
import { hostWithScheme } from '../../util/host.js'
|
||||
import { versionInfo } from '../../version/info.js'
|
||||
import { maybeNudgeCompat } from '../../version/nudge.js'
|
||||
import { resolveRetryAttempts } from './global-flags.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { AppInfoCache } from '@/cache/app-info'
|
||||
import type { Command } from '@/framework/command'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { META_PROBE_TIMEOUT_MS, MetaClient } from '@/api/meta'
|
||||
import { loadHosts } from '@/auth/hosts'
|
||||
import { loadAppInfoCache } from '@/cache/app-info'
|
||||
import { loadNudgeStore } from '@/cache/nudge-store'
|
||||
import { getEnv } from '@/env/registry'
|
||||
import { BaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
import { formatErrorForCli } from '@/errors/format'
|
||||
import { createClient } from '@/http/client'
|
||||
import { realStreams } from '@/sys/io/streams'
|
||||
import { hostWithScheme } from '@/util/host'
|
||||
import { versionInfo } from '@/version/info'
|
||||
import { maybeNudgeCompat } from '@/version/nudge'
|
||||
import { resolveRetryAttempts } from './global-flags'
|
||||
|
||||
export type AuthedContext = {
|
||||
readonly bundle: HostsBundle
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AuthedContext, AuthedContextOptions } from './authed-command.js'
|
||||
import { Command } from '../../framework/command.js'
|
||||
import { buildAuthedContext } from './authed-command.js'
|
||||
import type { AuthedContext, AuthedContextOptions } from './authed-command'
|
||||
import { Command } from '@/framework/command'
|
||||
import { buildAuthedContext } from './authed-command'
|
||||
|
||||
export abstract class DifyCommand extends Command {
|
||||
protected async authedCtx(opts: AuthedContextOptions): Promise<AuthedContext> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { resolveRetryAttempts } from './global-flags.js'
|
||||
import { resolveRetryAttempts } from './global-flags'
|
||||
|
||||
describe('resolveRetryAttempts', () => {
|
||||
it('returns flag value when given', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { newError } from '../../errors/base.js'
|
||||
import { ErrorCode } from '../../errors/codes.js'
|
||||
import { Flags } from '../../framework/flags.js'
|
||||
import { newError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
import { Flags } from '@/framework/flags'
|
||||
|
||||
export const HTTP_RETRY_DEFAULT = 3
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import type { SessionListResponse, SessionRow } from '@dify/contracts/api/openapi/types.gen'
|
||||
import type { DifyMock } from '../../../../../test/fixtures/dify-mock/server.js'
|
||||
import type { AccountSessionsClient } from '../../../../api/account-sessions.js'
|
||||
import type { HostsBundle } from '../../../../auth/hosts.js'
|
||||
import type { Key, Store } from '../../../../store/store.js'
|
||||
import type { DifyMock } from '@test/fixtures/dify-mock/server'
|
||||
import type { AccountSessionsClient } from '@/api/account-sessions'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { Key, Store } from '@/store/store'
|
||||
import { mkdtemp, readFile, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { startMock } from '@test/fixtures/dify-mock/server'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { startMock } from '../../../../../test/fixtures/dify-mock/server.js'
|
||||
import { saveHosts } from '../../../../auth/hosts.js'
|
||||
import { createClient } from '../../../../http/client.js'
|
||||
import { ENV_CONFIG_DIR, resolveConfigDir } from '../../../../store/dir.js'
|
||||
import { tokenKey } from '../../../../store/manager.js'
|
||||
import { bufferStreams } from '../../../../sys/io/streams'
|
||||
import { listAllSessions, runDevicesList, runDevicesRevoke } from './devices.js'
|
||||
import { saveHosts } from '@/auth/hosts'
|
||||
import { createClient } from '@/http/client'
|
||||
import { ENV_CONFIG_DIR, resolveConfigDir } from '@/store/dir'
|
||||
import { tokenKey } from '@/store/manager'
|
||||
import { bufferStreams } from '@/sys/io/streams'
|
||||
import { listAllSessions, runDevicesList, runDevicesRevoke } from './devices'
|
||||
|
||||
class MemStore implements Store {
|
||||
readonly entries = new Map<string, unknown>()
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import type { SessionRow } from '@dify/contracts/api/openapi/types.gen'
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../../auth/hosts.js'
|
||||
import type { Store } from '../../../../store/store.js'
|
||||
import type { IOStreams } from '../../../../sys/io/streams'
|
||||
import { AccountSessionsClient } from '../../../../api/account-sessions.js'
|
||||
import { clearLocal } from '../../../../auth/hosts.js'
|
||||
import { BaseError } from '../../../../errors/base.js'
|
||||
import { ErrorCode } from '../../../../errors/codes.js'
|
||||
import { LIMIT_DEFAULT, LIMIT_MAX, parseLimit } from '../../../../limit/limit.js'
|
||||
import { getTokenStore } from '../../../../store/manager.js'
|
||||
import { colorEnabled, colorScheme } from '../../../../sys/io/color.js'
|
||||
import { runWithSpinner } from '../../../../sys/io/spinner.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { Store } from '@/store/store'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { AccountSessionsClient } from '@/api/account-sessions'
|
||||
import { clearLocal } from '@/auth/hosts'
|
||||
import { BaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
import { LIMIT_DEFAULT, LIMIT_MAX, parseLimit } from '@/limit/limit'
|
||||
import { getTokenStore } from '@/store/manager'
|
||||
import { colorEnabled, colorScheme } from '@/sys/io/color'
|
||||
import { runWithSpinner } from '@/sys/io/spinner'
|
||||
|
||||
export type DevicesListOptions = {
|
||||
readonly io: IOStreams
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Flags } from '../../../../framework/flags.js'
|
||||
import { DifyCommand } from '../../../_shared/dify-command.js'
|
||||
import { httpRetryFlag } from '../../../_shared/global-flags.js'
|
||||
import { runDevicesList } from '../_shared/devices.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { httpRetryFlag } from '@/commands/_shared/global-flags'
|
||||
import { runDevicesList } from '@/commands/auth/devices/_shared/devices'
|
||||
import { Flags } from '@/framework/flags'
|
||||
|
||||
export default class DevicesList extends DifyCommand {
|
||||
static override description = 'List active sessions for the current bearer'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Args, Flags } from '../../../../framework/flags.js'
|
||||
import { DifyCommand } from '../../../_shared/dify-command.js'
|
||||
import { httpRetryFlag } from '../../../_shared/global-flags.js'
|
||||
import { runDevicesRevoke } from '../_shared/devices.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { httpRetryFlag } from '@/commands/_shared/global-flags'
|
||||
import { runDevicesRevoke } from '@/commands/auth/devices/_shared/devices'
|
||||
import { Args, Flags } from '@/framework/flags'
|
||||
|
||||
export default class DevicesRevoke extends DifyCommand {
|
||||
static override description = 'Revoke one or all session devices'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { CodeResponse, PollRequest, PollResult, PollSuccess } from '../../../api/oauth-device.js'
|
||||
import type { Clock } from './device-flow.js'
|
||||
import type { Clock } from './device-flow'
|
||||
import type { CodeResponse, PollRequest, PollResult, PollSuccess } from '@/api/oauth-device'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { BaseError } from '../../../errors/base.js'
|
||||
import { ErrorCode } from '../../../errors/codes.js'
|
||||
import { BaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
import {
|
||||
awaitAuthorization,
|
||||
DEFAULT_INTERVAL_MS,
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
POLL_RETRY_ATTEMPTS,
|
||||
POLL_RETRY_CAP_MS,
|
||||
POLL_RETRY_INITIAL_MS,
|
||||
} from './device-flow.js'
|
||||
} from './device-flow'
|
||||
|
||||
const successPayload: PollSuccess = {
|
||||
token: 'dfoa_xyz',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { CodeResponse, PollRequest, PollResult, PollSuccess } from '../../../api/oauth-device.js'
|
||||
import { DEFAULT_CLIENT_ID } from '../../../api/oauth-device.js'
|
||||
import { BaseError } from '../../../errors/base.js'
|
||||
import { ErrorCode } from '../../../errors/codes.js'
|
||||
import type { CodeResponse, PollRequest, PollResult, PollSuccess } from '@/api/oauth-device'
|
||||
import { DEFAULT_CLIENT_ID } from '@/api/oauth-device'
|
||||
import { BaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
|
||||
export const DEFAULT_INTERVAL_MS = 5_000
|
||||
export const MAX_INTERVAL_MS = 60_000
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Flags } from '../../../framework/flags.js'
|
||||
import { realStreams } from '../../../sys/io/streams'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { runLogin } from './login.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { Flags } from '@/framework/flags'
|
||||
import { realStreams } from '@/sys/io/streams'
|
||||
import { runLogin } from './login'
|
||||
|
||||
export default class Login extends DifyCommand {
|
||||
static override description = 'Sign in to Dify via OAuth device flow'
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import type { DifyMock } from '../../../../test/fixtures/dify-mock/server.js'
|
||||
import type { Key, Store } from '../../../store/store.js'
|
||||
import type { Clock } from './device-flow.js'
|
||||
import type { DifyMock } from '@test/fixtures/dify-mock/server'
|
||||
import type { Clock } from './device-flow'
|
||||
import type { Key, Store } from '@/store/store'
|
||||
import { mkdtemp, readFile, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { startMock } from '@test/fixtures/dify-mock/server'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { startMock } from '../../../../test/fixtures/dify-mock/server.js'
|
||||
import { DeviceFlowApi } from '../../../api/oauth-device.js'
|
||||
import { createClient } from '../../../http/client.js'
|
||||
import { ENV_CONFIG_DIR } from '../../../store/dir.js'
|
||||
import { tokenKey } from '../../../store/manager.js'
|
||||
import { bufferStreams } from '../../../sys/io/streams'
|
||||
import { runLogin } from './login.js'
|
||||
import { DeviceFlowApi } from '@/api/oauth-device'
|
||||
import { createClient } from '@/http/client'
|
||||
import { ENV_CONFIG_DIR } from '@/store/dir'
|
||||
import { tokenKey } from '@/store/manager'
|
||||
import { bufferStreams } from '@/sys/io/streams'
|
||||
import { runLogin } from './login'
|
||||
|
||||
const noopClock: Clock = {
|
||||
sleepMs: async () => { /* immediate */ },
|
||||
@@ -106,7 +106,7 @@ describe('runLogin', () => {
|
||||
expect(bundle.account).toBeUndefined()
|
||||
expect(bundle.external_subject?.email).toBe('sso@dify.ai')
|
||||
expect(bundle.external_subject?.issuer).toBe('https://issuer.example')
|
||||
const stored = await store.get(bundle.current_host, 'sso@dify.ai')
|
||||
const stored = await store.get(tokenKey(bundle.current_host, 'sso@dify.ai'))
|
||||
expect(stored).toBe('dfoe_test')
|
||||
expect(io.outBuf()).toContain('external SSO')
|
||||
expect(io.outBuf()).toContain('sso@dify.ai')
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import type { CodeResponse, PollSuccess } from '../../../api/oauth-device.js'
|
||||
import type { HostsBundle, Workspace } from '../../../auth/hosts.js'
|
||||
import type { StorageMode, Store } from '../../../store/store.js'
|
||||
import type { IOStreams } from '../../../sys/io/streams'
|
||||
import type { BrowserEnv, BrowserOpener } from '../../../util/browser.js'
|
||||
import type { Clock } from './device-flow.js'
|
||||
import type { Clock } from './device-flow'
|
||||
import type { CodeResponse, PollSuccess } from '@/api/oauth-device'
|
||||
import type { HostsBundle, Workspace } from '@/auth/hosts'
|
||||
import type { StorageMode, Store } from '@/store/store'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import type { BrowserEnv, BrowserOpener } from '@/util/browser'
|
||||
import * as os from 'node:os'
|
||||
import * as readline from 'node:readline'
|
||||
import { DeviceFlowApi } from '../../../api/oauth-device.js'
|
||||
import { saveHosts } from '../../../auth/hosts.js'
|
||||
import { createClient } from '../../../http/client.js'
|
||||
import { getTokenStore, tokenKey } from '../../../store/manager.js'
|
||||
import { colorEnabled, colorScheme } from '../../../sys/io/color.js'
|
||||
import { decideOpen, OpenDecision, openUrl, realEnv } from '../../../util/browser.js'
|
||||
import { bareHost, DEFAULT_HOST, resolveHost, validateVerificationURI } from '../../../util/host.js'
|
||||
import { awaitAuthorization, realClock } from './device-flow.js'
|
||||
import { DeviceFlowApi } from '@/api/oauth-device'
|
||||
import { saveHosts } from '@/auth/hosts'
|
||||
import { createClient } from '@/http/client'
|
||||
import { getTokenStore, tokenKey } from '@/store/manager'
|
||||
import { colorEnabled, colorScheme } from '@/sys/io/color'
|
||||
import { decideOpen, OpenDecision, openUrl, realEnv } from '@/util/browser'
|
||||
import { bareHost, DEFAULT_HOST, resolveHost, validateVerificationURI } from '@/util/host'
|
||||
import { awaitAuthorization, realClock } from './device-flow'
|
||||
|
||||
export type LoginOptions = {
|
||||
readonly io: IOStreams
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import { loadHosts } from '../../../auth/hosts.js'
|
||||
import { createClient } from '../../../http/client.js'
|
||||
import { runWithSpinner } from '../../../sys/io/spinner.js'
|
||||
import { realStreams } from '../../../sys/io/streams'
|
||||
import { hostWithScheme } from '../../../util/host.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { runLogout } from './logout.js'
|
||||
import { loadHosts } from '@/auth/hosts'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { createClient } from '@/http/client'
|
||||
import { runWithSpinner } from '@/sys/io/spinner'
|
||||
import { realStreams } from '@/sys/io/streams'
|
||||
import { hostWithScheme } from '@/util/host'
|
||||
import { runLogout } from './logout'
|
||||
|
||||
export default class Logout extends DifyCommand {
|
||||
static override description = 'Log out of the active Dify host'
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import type { DifyMock } from '../../../../test/fixtures/dify-mock/server.js'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { Key, Store } from '../../../store/store.js'
|
||||
import type { DifyMock } from '@test/fixtures/dify-mock/server'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { Key, Store } from '@/store/store'
|
||||
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { startMock } from '@test/fixtures/dify-mock/server'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { startMock } from '../../../../test/fixtures/dify-mock/server.js'
|
||||
import { saveHosts } from '../../../auth/hosts.js'
|
||||
import { createClient } from '../../../http/client.js'
|
||||
import { ENV_CONFIG_DIR } from '../../../store/dir.js'
|
||||
import { tokenKey } from '../../../store/manager.js'
|
||||
import { bufferStreams } from '../../../sys/io/streams'
|
||||
import { runLogout } from './logout.js'
|
||||
import { saveHosts } from '@/auth/hosts'
|
||||
import { createClient } from '@/http/client'
|
||||
import { ENV_CONFIG_DIR } from '@/store/dir'
|
||||
import { tokenKey } from '@/store/manager'
|
||||
import { bufferStreams } from '@/sys/io/streams'
|
||||
import { runLogout } from './logout'
|
||||
|
||||
class MemStore implements Store {
|
||||
readonly entries = new Map<string, unknown>()
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { Store } from '../../../store/store.js'
|
||||
import type { IOStreams } from '../../../sys/io/streams'
|
||||
import { AccountSessionsClient } from '../../../api/account-sessions.js'
|
||||
import { clearLocal } from '../../../auth/hosts.js'
|
||||
import { BaseError } from '../../../errors/base.js'
|
||||
import { ErrorCode } from '../../../errors/codes.js'
|
||||
import { getTokenStore } from '../../../store/manager.js'
|
||||
import { colorEnabled, colorScheme } from '../../../sys/io/color.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { Store } from '@/store/store'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { AccountSessionsClient } from '@/api/account-sessions'
|
||||
import { clearLocal } from '@/auth/hosts'
|
||||
import { BaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
import { getTokenStore } from '@/store/manager'
|
||||
import { colorEnabled, colorScheme } from '@/sys/io/color'
|
||||
|
||||
export type LogoutOptions = {
|
||||
readonly io: IOStreams
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { loadHosts } from '../../../auth/hosts.js'
|
||||
import { Flags } from '../../../framework/flags.js'
|
||||
import { realStreams } from '../../../sys/io/streams'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { runStatus } from './status.js'
|
||||
import { loadHosts } from '@/auth/hosts'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { Flags } from '@/framework/flags'
|
||||
import { realStreams } from '@/sys/io/streams'
|
||||
import { runStatus } from './status'
|
||||
|
||||
export default class Status extends DifyCommand {
|
||||
static override description = 'Show authentication status for the active host'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { bufferStreams } from '../../../sys/io/streams'
|
||||
import { runStatus } from './status.js'
|
||||
import { bufferStreams } from '@/sys/io/streams'
|
||||
import { runStatus } from './status'
|
||||
|
||||
function accountBundle(): HostsBundle {
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { IOStreams } from '../../../sys/io/streams'
|
||||
import { BaseError } from '../../../errors/base.js'
|
||||
import { ErrorCode } from '../../../errors/codes.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { BaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
|
||||
export type StatusOptions = {
|
||||
readonly io: IOStreams
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { loadHosts } from '../../../auth/hosts.js'
|
||||
import { Flags } from '../../../framework/flags.js'
|
||||
import { realStreams } from '../../../sys/io/streams'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { runWhoami } from './whoami.js'
|
||||
import { loadHosts } from '@/auth/hosts'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { Flags } from '@/framework/flags'
|
||||
import { realStreams } from '@/sys/io/streams'
|
||||
import { runWhoami } from './whoami'
|
||||
|
||||
export default class Whoami extends DifyCommand {
|
||||
static override description = 'Print the active subject\'s identity'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { bufferStreams } from '../../../sys/io/streams'
|
||||
import { runWhoami } from './whoami.js'
|
||||
import { bufferStreams } from '@/sys/io/streams'
|
||||
import { runWhoami } from './whoami'
|
||||
|
||||
function accountBundle(): HostsBundle {
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { IOStreams } from '../../../sys/io/streams'
|
||||
import { BaseError } from '../../../errors/base.js'
|
||||
import { ErrorCode } from '../../../errors/codes.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { BaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
|
||||
export type WhoamiOptions = {
|
||||
readonly io: IOStreams
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Args } from '../../../framework/flags.js'
|
||||
import { raw } from '../../../framework/output.js'
|
||||
import { getConfigurationStore } from '../../../store/manager.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { runConfigGet } from './run.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { Args } from '@/framework/flags'
|
||||
import { raw } from '@/framework/output'
|
||||
import { getConfigurationStore } from '@/store/manager'
|
||||
import { runConfigGet } from './run'
|
||||
|
||||
export default class ConfigGet extends DifyCommand {
|
||||
static override description = 'Print one config key\'s value'
|
||||
|
||||
@@ -2,11 +2,11 @@ import { mkdtemp, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { isBaseError } from '../../../errors/base.js'
|
||||
import { ErrorCode } from '../../../errors/codes.js'
|
||||
import { ENV_CONFIG_DIR } from '../../../store/dir.js'
|
||||
import { getConfigurationStore } from '../../../store/manager.js'
|
||||
import { runConfigGet } from './run.js'
|
||||
import { isBaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
import { ENV_CONFIG_DIR } from '@/store/dir'
|
||||
import { getConfigurationStore } from '@/store/manager'
|
||||
import { runConfigGet } from './run'
|
||||
|
||||
describe('runConfigGet', () => {
|
||||
let dir: string
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { ConfigFile } from '../../../config/schema.js'
|
||||
import type { YamlStore } from '../../../store/store.js'
|
||||
import { loadConfig } from '../../../config/config-loader.js'
|
||||
import { getKey } from '../../../config/keys.js'
|
||||
import { emptyConfig } from '../../../config/schema.js'
|
||||
import type { ConfigFile } from '@/config/schema'
|
||||
import type { YamlStore } from '@/store/store'
|
||||
import { loadConfig } from '@/config/config-loader'
|
||||
import { getKey } from '@/config/keys'
|
||||
import { emptyConfig } from '@/config/schema'
|
||||
|
||||
export type RunConfigGetOptions = {
|
||||
readonly key: string
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { join } from 'node:path'
|
||||
import { raw } from '../../../framework/output.js'
|
||||
import { resolveConfigDir } from '../../../store/dir.js'
|
||||
import { CONFIG_FILE_NAME } from '../../../store/manager.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { raw } from '@/framework/output'
|
||||
import { resolveConfigDir } from '@/store/dir'
|
||||
import { CONFIG_FILE_NAME } from '@/store/manager'
|
||||
|
||||
export default class ConfigPath extends DifyCommand {
|
||||
static override description = 'Print the resolved config.yml path'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Args } from '../../../framework/flags.js'
|
||||
import { raw } from '../../../framework/output.js'
|
||||
import { getConfigurationStore } from '../../../store/manager.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { runConfigSet } from './run.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { Args } from '@/framework/flags'
|
||||
import { raw } from '@/framework/output'
|
||||
import { getConfigurationStore } from '@/store/manager'
|
||||
import { runConfigSet } from './run'
|
||||
|
||||
export default class ConfigSet extends DifyCommand {
|
||||
static override description = 'Set a config key (validates value)'
|
||||
|
||||
@@ -2,12 +2,12 @@ import { mkdtemp, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { loadConfig } from '../../../config/config-loader.js'
|
||||
import { isBaseError } from '../../../errors/base.js'
|
||||
import { ErrorCode, ExitCode } from '../../../errors/codes.js'
|
||||
import { ENV_CONFIG_DIR } from '../../../store/dir.js'
|
||||
import { getConfigurationStore } from '../../../store/manager.js'
|
||||
import { runConfigSet } from './run.js'
|
||||
import { loadConfig } from '@/config/config-loader'
|
||||
import { isBaseError } from '@/errors/base'
|
||||
import { ErrorCode, ExitCode } from '@/errors/codes'
|
||||
import { ENV_CONFIG_DIR } from '@/store/dir'
|
||||
import { getConfigurationStore } from '@/store/manager'
|
||||
import { runConfigSet } from './run'
|
||||
|
||||
describe('runConfigSet', () => {
|
||||
let dir: string
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { ConfigFile } from '../../../config/schema.js'
|
||||
import type { YamlStore } from '../../../store/store.js'
|
||||
import { loadConfig } from '../../../config/config-loader.js'
|
||||
import { setKey } from '../../../config/keys.js'
|
||||
import { emptyConfig } from '../../../config/schema.js'
|
||||
import { saveConfig } from '../../../store/config-writer.js'
|
||||
import type { ConfigFile } from '@/config/schema'
|
||||
import type { YamlStore } from '@/store/store'
|
||||
import { loadConfig } from '@/config/config-loader'
|
||||
import { setKey } from '@/config/keys'
|
||||
import { emptyConfig } from '@/config/schema'
|
||||
import { saveConfig } from '@/store/config-writer'
|
||||
|
||||
export type RunConfigSetOptions = {
|
||||
readonly key: string
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Args } from '../../../framework/flags.js'
|
||||
import { raw } from '../../../framework/output.js'
|
||||
import { getConfigurationStore } from '../../../store/manager.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { runConfigUnset } from './run.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { Args } from '@/framework/flags'
|
||||
import { raw } from '@/framework/output'
|
||||
import { getConfigurationStore } from '@/store/manager'
|
||||
import { runConfigUnset } from './run'
|
||||
|
||||
export default class ConfigUnset extends DifyCommand {
|
||||
static override description = 'Reset a config key to its zero value'
|
||||
|
||||
@@ -2,12 +2,12 @@ import { mkdtemp, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { loadConfig } from '../../../config/config-loader.js'
|
||||
import { isBaseError } from '../../../errors/base.js'
|
||||
import { ErrorCode } from '../../../errors/codes.js'
|
||||
import { ENV_CONFIG_DIR } from '../../../store/dir.js'
|
||||
import { getConfigurationStore } from '../../../store/manager.js'
|
||||
import { runConfigUnset } from './run.js'
|
||||
import { loadConfig } from '@/config/config-loader'
|
||||
import { isBaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
import { ENV_CONFIG_DIR } from '@/store/dir'
|
||||
import { getConfigurationStore } from '@/store/manager'
|
||||
import { runConfigUnset } from './run'
|
||||
|
||||
describe('runConfigUnset', () => {
|
||||
let dir: string
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { ConfigFile } from '../../../config/schema.js'
|
||||
import type { YamlStore } from '../../../store/store.js'
|
||||
import { loadConfig } from '../../../config/config-loader.js'
|
||||
import { unsetKey } from '../../../config/keys.js'
|
||||
import { emptyConfig } from '../../../config/schema.js'
|
||||
import { saveConfig } from '../../../store/config-writer.js'
|
||||
import type { ConfigFile } from '@/config/schema'
|
||||
import type { YamlStore } from '@/store/store'
|
||||
import { loadConfig } from '@/config/config-loader'
|
||||
import { unsetKey } from '@/config/keys'
|
||||
import { emptyConfig } from '@/config/schema'
|
||||
import { saveConfig } from '@/store/config-writer'
|
||||
|
||||
export type RunConfigUnsetOptions = {
|
||||
readonly key: string
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Flags } from '../../../framework/flags.js'
|
||||
import { raw } from '../../../framework/output.js'
|
||||
import { getConfigurationStore } from '../../../store/manager.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { runConfigView } from './run.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { Flags } from '@/framework/flags'
|
||||
import { raw } from '@/framework/output'
|
||||
import { getConfigurationStore } from '@/store/manager'
|
||||
import { runConfigView } from './run'
|
||||
|
||||
export default class ConfigView extends DifyCommand {
|
||||
static override description = 'Print the resolved config'
|
||||
|
||||
@@ -2,9 +2,9 @@ import { mkdtemp, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { ENV_CONFIG_DIR } from '../../../store/dir.js'
|
||||
import { getConfigurationStore } from '../../../store/manager.js'
|
||||
import { runConfigView } from './run.js'
|
||||
import { ENV_CONFIG_DIR } from '@/store/dir'
|
||||
import { getConfigurationStore } from '@/store/manager'
|
||||
import { runConfigView } from './run'
|
||||
|
||||
describe('runConfigView', () => {
|
||||
let dir: string
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { ConfigFile } from '../../../config/schema.js'
|
||||
import type { YamlStore } from '../../../store/store.js'
|
||||
import { loadConfig } from '../../../config/config-loader.js'
|
||||
import { knownKeyNames, lookupKey } from '../../../config/keys.js'
|
||||
import { emptyConfig } from '../../../config/schema.js'
|
||||
import type { ConfigFile } from '@/config/schema'
|
||||
import type { YamlStore } from '@/store/store'
|
||||
import { loadConfig } from '@/config/config-loader'
|
||||
import { knownKeyNames, lookupKey } from '@/config/keys'
|
||||
import { emptyConfig } from '@/config/schema'
|
||||
|
||||
export type RunConfigViewOptions = {
|
||||
readonly json?: boolean
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/// <reference types="vite/client" />
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { isExcludedCommandPath } from '../framework/command-fs.js'
|
||||
import { isExcludedCommandPath } from '@/framework/command-fs'
|
||||
|
||||
const INDEX_MODULES = import.meta.glob<{ default?: unknown }>(
|
||||
'./**/index.ts',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Flags } from '../../../framework/flags.js'
|
||||
import { formatted, OutputFormat } from '../../../framework/output.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { httpRetryFlag } from '../../_shared/global-flags.js'
|
||||
import { runCreateMember } from './run.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { httpRetryFlag } from '@/commands/_shared/global-flags'
|
||||
import { Flags } from '@/framework/flags'
|
||||
import { formatted, OutputFormat } from '@/framework/output'
|
||||
import { runCreateMember } from './run'
|
||||
|
||||
export default class CreateMember extends DifyCommand {
|
||||
static override description = 'Invite a member to the active (or specified) workspace by email'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { bufferStreams } from '../../../sys/io/streams.js'
|
||||
import { runCreateMember } from './run.js'
|
||||
import { bufferStreams } from '@/sys/io/streams'
|
||||
import { runCreateMember } from './run'
|
||||
|
||||
function bundle(): HostsBundle {
|
||||
return {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { IOStreams } from '../../../sys/io/streams.js'
|
||||
import { MembersClient } from '../../../api/members.js'
|
||||
import { BaseError } from '../../../errors/base.js'
|
||||
import { ErrorCode } from '../../../errors/codes.js'
|
||||
import { colorEnabled, colorScheme } from '../../../sys/io/color.js'
|
||||
import { runWithSpinner } from '../../../sys/io/spinner.js'
|
||||
import { nullStreams } from '../../../sys/io/streams.js'
|
||||
import { resolveWorkspaceId } from '../../../workspace/resolver.js'
|
||||
import { InviteOutput } from './handlers.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { MembersClient } from '@/api/members'
|
||||
import { BaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
import { colorEnabled, colorScheme } from '@/sys/io/color'
|
||||
import { runWithSpinner } from '@/sys/io/spinner'
|
||||
import { nullStreams } from '@/sys/io/streams'
|
||||
import { resolveWorkspaceId } from '@/workspace/resolver'
|
||||
import { InviteOutput } from './handlers'
|
||||
|
||||
export type CreateMemberOptions = {
|
||||
readonly email: string
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Args, Flags } from '../../../framework/flags.js'
|
||||
import { formatted, OutputFormat } from '../../../framework/output.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { httpRetryFlag } from '../../_shared/global-flags.js'
|
||||
import { runDeleteMember } from './run.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { httpRetryFlag } from '@/commands/_shared/global-flags'
|
||||
import { Args, Flags } from '@/framework/flags'
|
||||
import { formatted, OutputFormat } from '@/framework/output'
|
||||
import { runDeleteMember } from './run'
|
||||
|
||||
export default class DeleteMember extends DifyCommand {
|
||||
static override description = 'Remove a member from the active (or specified) workspace'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { bufferStreams } from '../../../sys/io/streams.js'
|
||||
import { runDeleteMember } from './run.js'
|
||||
import { bufferStreams } from '@/sys/io/streams'
|
||||
import { runDeleteMember } from './run'
|
||||
|
||||
function bundle(): HostsBundle {
|
||||
return {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { IOStreams } from '../../../sys/io/streams.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import * as readline from 'node:readline'
|
||||
import { MembersClient } from '../../../api/members.js'
|
||||
import { BaseError } from '../../../errors/base.js'
|
||||
import { ErrorCode } from '../../../errors/codes.js'
|
||||
import { colorEnabled, colorScheme } from '../../../sys/io/color.js'
|
||||
import { runWithSpinner } from '../../../sys/io/spinner.js'
|
||||
import { nullStreams } from '../../../sys/io/streams.js'
|
||||
import { resolveWorkspaceId } from '../../../workspace/resolver.js'
|
||||
import { DeleteMemberOutput } from './handlers.js'
|
||||
import { MembersClient } from '@/api/members'
|
||||
import { BaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
import { colorEnabled, colorScheme } from '@/sys/io/color'
|
||||
import { runWithSpinner } from '@/sys/io/spinner'
|
||||
import { nullStreams } from '@/sys/io/streams'
|
||||
import { resolveWorkspaceId } from '@/workspace/resolver'
|
||||
import { DeleteMemberOutput } from './handlers'
|
||||
|
||||
export type DeleteMemberOptions = {
|
||||
readonly memberId: string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { AppDescribeInfo, TagItem } from '@dify/contracts/api/openapi/types.gen'
|
||||
import type { AppMeta } from '../../../types/app-meta.js'
|
||||
import type { AppMeta } from '@/types/app-meta'
|
||||
|
||||
export const APP_DESCRIBE_MODE_KEY = 'app-describe'
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Args, Flags } from '../../../framework/flags.js'
|
||||
import { formatted, OutputFormat } from '../../../framework/output.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { httpRetryFlag } from '../../_shared/global-flags.js'
|
||||
import { runDescribeApp } from './run.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { httpRetryFlag } from '@/commands/_shared/global-flags'
|
||||
import { Args, Flags } from '@/framework/flags'
|
||||
import { formatted, OutputFormat } from '@/framework/output'
|
||||
import { runDescribeApp } from './run'
|
||||
|
||||
export default class DescribeApp extends DifyCommand {
|
||||
static override description = 'Describe a single app (kubectl-describe-style)'
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import type { DifyMock } from '../../../../test/fixtures/dify-mock/server.js'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { DifyMock } from '@test/fixtures/dify-mock/server'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import { mkdtemp, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { startMock } from '@test/fixtures/dify-mock/server'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { startMock } from '../../../../test/fixtures/dify-mock/server.js'
|
||||
import { loadAppInfoCache } from '../../../cache/app-info.js'
|
||||
import { formatted, stringifyOutput } from '../../../framework/output.js'
|
||||
import { createClient } from '../../../http/client.js'
|
||||
import { ENV_CACHE_DIR } from '../../../store/dir.js'
|
||||
import { CACHE_APP_INFO, getCache } from '../../../store/manager.js'
|
||||
import { runDescribeApp } from './run.js'
|
||||
import { loadAppInfoCache } from '@/cache/app-info'
|
||||
import { formatted, stringifyOutput } from '@/framework/output'
|
||||
import { createClient } from '@/http/client'
|
||||
import { ENV_CACHE_DIR } from '@/store/dir'
|
||||
import { CACHE_APP_INFO, getCache } from '@/store/manager'
|
||||
import { runDescribeApp } from './run'
|
||||
|
||||
function bundle(): HostsBundle {
|
||||
return {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { AppInfoCache } from '../../../cache/app-info.js'
|
||||
import type { IOStreams } from '../../../sys/io/streams'
|
||||
import { AppMetaClient } from '../../../api/app-meta.js'
|
||||
import { AppsClient } from '../../../api/apps.js'
|
||||
import { getEnv } from '../../../sys/index.js'
|
||||
import { runWithSpinner } from '../../../sys/io/spinner.js'
|
||||
import { nullStreams } from '../../../sys/io/streams'
|
||||
import { FieldInfo, FieldInputSchema, FieldParameters } from '../../../types/app-meta.js'
|
||||
import { resolveWorkspaceId } from '../../../workspace/resolver.js'
|
||||
import { AppDescribeOutput } from './handlers.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { AppInfoCache } from '@/cache/app-info'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { AppMetaClient } from '@/api/app-meta'
|
||||
import { AppsClient } from '@/api/apps'
|
||||
import { getEnv } from '@/sys/index'
|
||||
import { runWithSpinner } from '@/sys/io/spinner'
|
||||
import { nullStreams } from '@/sys/io/streams'
|
||||
import { FieldInfo, FieldInputSchema, FieldParameters } from '@/types/app-meta'
|
||||
import { resolveWorkspaceId } from '@/workspace/resolver'
|
||||
import { AppDescribeOutput } from './handlers'
|
||||
|
||||
export type DescribeAppOptions = {
|
||||
readonly appId: string
|
||||
|
||||
Vendored
+4
-4
@@ -1,7 +1,7 @@
|
||||
import { Flags } from '../../../framework/flags.js'
|
||||
import { raw } from '../../../framework/output.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { runEnvList } from './run-list.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { Flags } from '@/framework/flags'
|
||||
import { raw } from '@/framework/output'
|
||||
import { runEnvList } from './run-list'
|
||||
|
||||
export default class EnvList extends DifyCommand {
|
||||
static override description = 'Show every DIFY_* env var difyctl reads'
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { runEnvList } from './run-list.js'
|
||||
import { runEnvList } from './run-list'
|
||||
|
||||
const stub = (overrides: Record<string, string> = {}) => (name: string) => overrides[name]
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { ENV_REGISTRY } from '../../../env/registry.js'
|
||||
import { getEnv } from '../../../sys/index.js'
|
||||
import { ENV_REGISTRY } from '@/env/registry'
|
||||
import { getEnv } from '@/sys/index'
|
||||
|
||||
export type EnvLookup = (name: string) => string | undefined
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AppListResponse, AppListRow, TagItem } from '@dify/contracts/api/openapi/types.gen'
|
||||
import type { TableCell } from '../../../framework/output.js'
|
||||
import type { TableColumn } from '../../../printers/format-table.js'
|
||||
import type { TableCell } from '@/framework/output'
|
||||
import type { TableColumn } from '@/printers/format-table'
|
||||
|
||||
export const APP_MODE_KEY = 'app'
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { AppMode } from '@dify/contracts/api/openapi/types.gen'
|
||||
import { Args, Flags } from '../../../framework/flags.js'
|
||||
import { OutputFormat, table } from '../../../framework/output.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { httpRetryFlag } from '../../_shared/global-flags.js'
|
||||
import { runGetApp } from './run.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { httpRetryFlag } from '@/commands/_shared/global-flags'
|
||||
import { Args, Flags } from '@/framework/flags'
|
||||
import { OutputFormat, table } from '@/framework/output'
|
||||
import { runGetApp } from './run'
|
||||
|
||||
const APP_MODE_VALUES: readonly AppMode[] = [
|
||||
'advanced-chat',
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { DifyMock } from '../../../../test/fixtures/dify-mock/server.js'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { DifyMock } from '@test/fixtures/dify-mock/server'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import { startMock } from '@test/fixtures/dify-mock/server'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { startMock } from '../../../../test/fixtures/dify-mock/server.js'
|
||||
import { stringifyOutput, table } from '../../../framework/output.js'
|
||||
import { createClient } from '../../../http/client.js'
|
||||
import { AppListOutput } from './handlers.js'
|
||||
import { runGetApp } from './run.js'
|
||||
import { stringifyOutput, table } from '@/framework/output'
|
||||
import { createClient } from '@/http/client'
|
||||
import { AppListOutput } from './handlers'
|
||||
import { runGetApp } from './run'
|
||||
|
||||
const baseBundle: HostsBundle = {
|
||||
current_host: '127.0.0.1',
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { AppDescribeResponse, AppListResponse, AppMode } from '@dify/contracts/api/openapi/types.gen'
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { IOStreams } from '../../../sys/io/streams'
|
||||
import { AppsClient } from '../../../api/apps.js'
|
||||
import { WorkspacesClient } from '../../../api/workspaces.js'
|
||||
import { LIMIT_DEFAULT, parseLimit } from '../../../limit/limit.js'
|
||||
import { getEnv } from '../../../sys/index.js'
|
||||
import { runWithSpinner } from '../../../sys/io/spinner.js'
|
||||
import { nullStreams } from '../../../sys/io/streams'
|
||||
import { resolveWorkspaceId } from '../../../workspace/resolver.js'
|
||||
import { AppListOutput, AppRow } from './handlers.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { AppsClient } from '@/api/apps'
|
||||
import { WorkspacesClient } from '@/api/workspaces'
|
||||
import { LIMIT_DEFAULT, parseLimit } from '@/limit/limit'
|
||||
import { getEnv } from '@/sys/index'
|
||||
import { runWithSpinner } from '@/sys/io/spinner'
|
||||
import { nullStreams } from '@/sys/io/streams'
|
||||
import { resolveWorkspaceId } from '@/workspace/resolver'
|
||||
import { AppListOutput, AppRow } from './handlers'
|
||||
|
||||
export type GetAppOptions = {
|
||||
readonly appId?: string
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { MemberListResponse, MemberResponse } from '@dify/contracts/api/openapi/types.gen'
|
||||
import type { TableCell } from '../../../framework/output.js'
|
||||
import type { TableColumn } from '../../../printers/format-table.js'
|
||||
import type { TableCell } from '@/framework/output'
|
||||
import type { TableColumn } from '@/printers/format-table'
|
||||
|
||||
export const MEMBER_MODE_KEY = 'member'
|
||||
const CURRENT_MARKER = '*'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Flags } from '../../../framework/flags.js'
|
||||
import { OutputFormat, table } from '../../../framework/output.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { httpRetryFlag } from '../../_shared/global-flags.js'
|
||||
import { runGetMember } from './run.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { httpRetryFlag } from '@/commands/_shared/global-flags'
|
||||
import { Flags } from '@/framework/flags'
|
||||
import { OutputFormat, table } from '@/framework/output'
|
||||
import { runGetMember } from './run'
|
||||
|
||||
export default class GetMember extends DifyCommand {
|
||||
static override description = 'List members of the active (or specified) workspace'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { MemberListResponse } from '@dify/contracts/api/openapi/types.gen'
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { bufferStreams } from '../../../sys/io/streams.js'
|
||||
import { runGetMember } from './run.js'
|
||||
import { bufferStreams } from '@/sys/io/streams'
|
||||
import { runGetMember } from './run'
|
||||
|
||||
function bundle(): HostsBundle {
|
||||
return {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { IOStreams } from '../../../sys/io/streams.js'
|
||||
import { MembersClient } from '../../../api/members.js'
|
||||
import { LIMIT_DEFAULT, parseLimit } from '../../../limit/limit.js'
|
||||
import { runWithSpinner } from '../../../sys/io/spinner.js'
|
||||
import { nullStreams } from '../../../sys/io/streams.js'
|
||||
import { resolveWorkspaceId } from '../../../workspace/resolver.js'
|
||||
import { MemberListOutput, MemberRow } from './handlers.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { MembersClient } from '@/api/members'
|
||||
import { LIMIT_DEFAULT, parseLimit } from '@/limit/limit'
|
||||
import { runWithSpinner } from '@/sys/io/spinner'
|
||||
import { nullStreams } from '@/sys/io/streams'
|
||||
import { resolveWorkspaceId } from '@/workspace/resolver'
|
||||
import { MemberListOutput, MemberRow } from './handlers'
|
||||
|
||||
export type GetMemberOptions = {
|
||||
readonly workspace?: string
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { WorkspaceListResponse } from '@dify/contracts/api/openapi/types.gen'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { newWorkspaceObject, WORKSPACE_MODE_KEY, WorkspaceListOutput, WorkspaceRow } from './handlers.js'
|
||||
import { newWorkspaceObject, WORKSPACE_MODE_KEY, WorkspaceListOutput, WorkspaceRow } from './handlers'
|
||||
|
||||
function env(): WorkspaceListResponse {
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { WorkspaceListResponse } from '@dify/contracts/api/openapi/types.gen'
|
||||
import type { TableCell } from '../../../framework/output.js'
|
||||
import type { TableColumn, TableHandler, TableRow } from '../../../printers/format-table.js'
|
||||
import { isPayloadShape } from '../app/payload-shape.js'
|
||||
import type { TableCell } from '@/framework/output'
|
||||
import type { TableColumn, TableHandler, TableRow } from '@/printers/format-table'
|
||||
import { isPayloadShape } from '@/commands/get/app/payload-shape'
|
||||
|
||||
export const WORKSPACE_MODE_KEY = 'workspace'
|
||||
const CURRENT_MARKER = '*'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Flags } from '../../../framework/flags.js'
|
||||
import { OutputFormat, raw, table } from '../../../framework/output.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { httpRetryFlag } from '../../_shared/global-flags.js'
|
||||
import { runGetWorkspace } from './run.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { httpRetryFlag } from '@/commands/_shared/global-flags'
|
||||
import { Flags } from '@/framework/flags'
|
||||
import { OutputFormat, raw, table } from '@/framework/output'
|
||||
import { runGetWorkspace } from './run'
|
||||
|
||||
export default class GetWorkspace extends DifyCommand {
|
||||
static override description = 'List workspaces visible to the current bearer'
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { DifyMock } from '../../../../test/fixtures/dify-mock/server.js'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { DifyMock } from '@test/fixtures/dify-mock/server'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import { startMock } from '@test/fixtures/dify-mock/server'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { startMock } from '../../../../test/fixtures/dify-mock/server.js'
|
||||
import { stringifyOutput, table } from '../../../framework/output.js'
|
||||
import { createClient } from '../../../http/client.js'
|
||||
import { WorkspaceListOutput } from './handlers.js'
|
||||
import { EMPTY_WORKSPACES_MESSAGE, runGetWorkspace } from './run.js'
|
||||
import { stringifyOutput, table } from '@/framework/output'
|
||||
import { createClient } from '@/http/client'
|
||||
import { WorkspaceListOutput } from './handlers'
|
||||
import { EMPTY_WORKSPACES_MESSAGE, runGetWorkspace } from './run'
|
||||
|
||||
const baseBundle: HostsBundle = {
|
||||
current_host: '127.0.0.1',
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { IOStreams } from '../../../sys/io/streams'
|
||||
import { WorkspacesClient } from '../../../api/workspaces.js'
|
||||
import { runWithSpinner } from '../../../sys/io/spinner.js'
|
||||
import { nullStreams } from '../../../sys/io/streams'
|
||||
import { WorkspaceListOutput, WorkspaceRow } from './handlers.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { WorkspacesClient } from '@/api/workspaces'
|
||||
import { runWithSpinner } from '@/sys/io/spinner'
|
||||
import { nullStreams } from '@/sys/io/streams'
|
||||
import { WorkspaceListOutput, WorkspaceRow } from './handlers'
|
||||
|
||||
export const EMPTY_WORKSPACES_MESSAGE
|
||||
= 'No workspaces visible to this bearer (external-SSO subjects see empty data).\n'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { runHelpAccount } from './account.js'
|
||||
import { runHelpAccount } from './account'
|
||||
|
||||
describe('runHelpAccount', () => {
|
||||
it('mentions auth login device flow', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { raw } from '../../../framework/output.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { runHelpAccount } from './account.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { raw } from '@/framework/output'
|
||||
import { runHelpAccount } from './account'
|
||||
|
||||
export default class HelpAccount extends DifyCommand {
|
||||
static override description = 'Agent-onboarding text for account bearers (dfoa_)'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { ENV_REGISTRY } from '../../../env/registry.js'
|
||||
import { runHelpEnvironment } from './environment.js'
|
||||
import { ENV_REGISTRY } from '@/env/registry'
|
||||
import { runHelpEnvironment } from './environment'
|
||||
|
||||
describe('runHelpEnvironment', () => {
|
||||
it('starts with the ENVIRONMENT VARIABLES header', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ENV_REGISTRY } from '../../../env/registry.js'
|
||||
import { ENV_REGISTRY } from '@/env/registry'
|
||||
|
||||
export function runHelpEnvironment(): string {
|
||||
let out = 'ENVIRONMENT VARIABLES\n\n'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { raw } from '../../../framework/output.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { runHelpEnvironment } from './environment.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { raw } from '@/framework/output'
|
||||
import { runHelpEnvironment } from './environment'
|
||||
|
||||
export default class HelpEnvironment extends DifyCommand {
|
||||
static override description = 'Long-form documentation for every DIFY_* env var'
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { runHelpExternal } from './external.js'
|
||||
import { runHelpExternal } from './external'
|
||||
|
||||
describe('runHelpExternal', () => {
|
||||
it('mentions external bearer prefix and login flag', () => {
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
import { raw } from '../../../framework/output.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { runHelpExternal } from './external.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { raw } from '@/framework/output'
|
||||
import { runHelpExternal } from './external'
|
||||
|
||||
export default class HelpExternal extends DifyCommand {
|
||||
static override description = 'Agent-onboarding text for external-SSO bearers (dfoe_)'
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Args, Flags } from '../../../framework/flags.js'
|
||||
import { OutputFormat } from '../../../framework/output.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { httpRetryFlag } from '../../_shared/global-flags.js'
|
||||
import { resumeApp } from './run.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { httpRetryFlag } from '@/commands/_shared/global-flags'
|
||||
import { Args, Flags } from '@/framework/flags'
|
||||
import { OutputFormat } from '@/framework/output'
|
||||
import { resumeApp } from './run'
|
||||
|
||||
export default class ResumeApp extends DifyCommand {
|
||||
static override description = 'Resume a paused workflow app after submitting a human input form'
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { AppInfoCache } from '../../../cache/app-info.js'
|
||||
import type { IOStreams } from '../../../sys/io/streams'
|
||||
import type { RunContext } from '../../run/app/_strategies/index.js'
|
||||
import { AppMetaClient } from '../../../api/app-meta.js'
|
||||
import { AppRunClient } from '../../../api/app-run.js'
|
||||
import { AppsClient } from '../../../api/apps.js'
|
||||
import { getEnv, processExit } from '../../../sys/index.js'
|
||||
import { colorEnabled, colorScheme } from '../../../sys/io/color.js'
|
||||
import { FieldInfo } from '../../../types/app-meta.js'
|
||||
import { resolveWorkspaceId } from '../../../workspace/resolver.js'
|
||||
import { pickStrategy } from '../../run/app/_strategies/index.js'
|
||||
import { RUN_MODES } from '../../run/app/handlers.js'
|
||||
import { AppRunPrintFlags } from '../../run/app/print-flags.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { AppInfoCache } from '@/cache/app-info'
|
||||
import type { RunContext } from '@/commands/run/app/_strategies/index'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { AppMetaClient } from '@/api/app-meta'
|
||||
import { AppRunClient } from '@/api/app-run'
|
||||
import { AppsClient } from '@/api/apps'
|
||||
import { pickStrategy } from '@/commands/run/app/_strategies/index'
|
||||
import { RUN_MODES } from '@/commands/run/app/handlers'
|
||||
import { AppRunPrintFlags } from '@/commands/run/app/print-flags'
|
||||
import { getEnv, processExit } from '@/sys/index'
|
||||
import { colorEnabled, colorScheme } from '@/sys/io/color'
|
||||
import { FieldInfo } from '@/types/app-meta'
|
||||
import { resolveWorkspaceId } from '@/workspace/resolver'
|
||||
|
||||
export type ResumeAppOptions = {
|
||||
readonly appId: string
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { AppRunClient } from '../../../../api/app-run.js'
|
||||
import type { AppRunPrintFlags } from '../print-flags.js'
|
||||
import type { RunAppDeps, RunAppOptions } from '../run.js'
|
||||
import { StreamingStructuredStrategy } from './streaming-structured.js'
|
||||
import { StreamingTextStrategy } from './streaming-text.js'
|
||||
import type { AppRunClient } from '@/api/app-run'
|
||||
import type { AppRunPrintFlags } from '@/commands/run/app/print-flags'
|
||||
import type { RunAppDeps, RunAppOptions } from '@/commands/run/app/run'
|
||||
import { StreamingStructuredStrategy } from './streaming-structured'
|
||||
import { StreamingTextStrategy } from './streaming-text'
|
||||
|
||||
export type RunContext = {
|
||||
readonly opts: RunAppOptions & { inputs: Record<string, unknown> }
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { SseEvent } from '../../../../http/sse.js'
|
||||
import type { RunContext, RunStrategy } from './index.js'
|
||||
import { buildRunBody } from '../../../../api/app-run.js'
|
||||
import { colorEnabled, colorScheme } from '../../../../sys/io/color.js'
|
||||
import { startSpinner } from '../../../../sys/io/spinner.js'
|
||||
import { extractThinkBlocks, stripThinkBlocks } from '../../../../sys/io/think-filter.js'
|
||||
import { chatConversationHint, newAppRunObject, RUN_MODES } from '../handlers.js'
|
||||
import { renderHitlHint, renderHitlOutput } from '../hitl-render.js'
|
||||
import { collect, HitlPauseError } from '../sse-collector.js'
|
||||
import type { RunContext, RunStrategy } from './index'
|
||||
import type { SseEvent } from '@/http/sse'
|
||||
import { buildRunBody } from '@/api/app-run'
|
||||
import { chatConversationHint, newAppRunObject, RUN_MODES } from '@/commands/run/app/handlers'
|
||||
import { renderHitlHint, renderHitlOutput } from '@/commands/run/app/hitl-render'
|
||||
import { collect, HitlPauseError } from '@/commands/run/app/sse-collector'
|
||||
import { colorEnabled, colorScheme } from '@/sys/io/color'
|
||||
import { startSpinner } from '@/sys/io/spinner'
|
||||
import { extractThinkBlocks, stripThinkBlocks } from '@/sys/io/think-filter'
|
||||
|
||||
const CHAT_MODES: ReadonlySet<string> = new Set([RUN_MODES.Chat, RUN_MODES.AgentChat, RUN_MODES.AdvancedChat])
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { RunContext, RunStrategy } from './index.js'
|
||||
import { buildRunBody } from '../../../../api/app-run.js'
|
||||
import { handle, unhandle } from '../../../../sys/index.js'
|
||||
import { renderHitlHint, renderHitlOutput } from '../hitl-render.js'
|
||||
import { decodeStreamError, HitlPauseError } from '../sse-collector.js'
|
||||
import type { RunContext, RunStrategy } from './index'
|
||||
import { buildRunBody } from '@/api/app-run'
|
||||
import { renderHitlHint, renderHitlOutput } from '@/commands/run/app/hitl-render'
|
||||
import { decodeStreamError, HitlPauseError } from '@/commands/run/app/sse-collector'
|
||||
import { handle, unhandle } from '@/sys/index'
|
||||
|
||||
export class StreamingTextStrategy implements RunStrategy {
|
||||
async execute(ctx: RunContext): Promise<void> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import RunApp from './index.js'
|
||||
import RunApp from './index'
|
||||
|
||||
describe('run app agentGuide', () => {
|
||||
it('exposes non-empty agentGuide string', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ParsedFileFlag } from './file-flags.js'
|
||||
import type { ParsedFileFlag } from './file-flags'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { difyFileType, parseFileFlag, resolveFileInputs } from './file-flags.js'
|
||||
import { difyFileType, parseFileFlag, resolveFileInputs } from './file-flags'
|
||||
|
||||
describe('parseFileFlag', () => {
|
||||
it('parses local file with @ prefix', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { basename } from 'node:path'
|
||||
import { BaseError } from '../../../errors/base.js'
|
||||
import { ErrorCode } from '../../../errors/codes.js'
|
||||
import { BaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
|
||||
export type ParsedFileFlag
|
||||
= | { varname: string, kind: 'local', path: string }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { TextHandler } from '../../../printers/format-text.js'
|
||||
import type { ColorScheme } from '../../../sys/io/color.js'
|
||||
import type { TextHandler } from '@/printers/format-text'
|
||||
import type { ColorScheme } from '@/sys/io/color'
|
||||
|
||||
export const RUN_MODES = {
|
||||
Chat: 'chat',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { HitlPausePayload } from './sse-collector.js'
|
||||
import { colorEnabled, colorScheme } from '../../../sys/io/color.js'
|
||||
import type { HitlPausePayload } from './sse-collector'
|
||||
import { colorEnabled, colorScheme } from '@/sys/io/color'
|
||||
|
||||
export type HitlExitObject = {
|
||||
status: 'paused'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Args, Flags } from '../../../framework/flags.js'
|
||||
import { OutputFormat } from '../../../framework/output.js'
|
||||
import { DifyCommand } from '../../_shared/dify-command.js'
|
||||
import { httpRetryFlag } from '../../_shared/global-flags.js'
|
||||
import { agentGuide } from './guide.js'
|
||||
import { runApp } from './run.js'
|
||||
import { DifyCommand } from '@/commands/_shared/dify-command'
|
||||
import { httpRetryFlag } from '@/commands/_shared/global-flags'
|
||||
import { Args, Flags } from '@/framework/flags'
|
||||
import { OutputFormat } from '@/framework/output'
|
||||
import { agentGuide } from './guide'
|
||||
import { runApp } from './run'
|
||||
|
||||
export default class RunApp extends DifyCommand {
|
||||
static override description = 'Run an app and print the response'
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { PrintFlags } from '../../../printers/printer.js'
|
||||
import type { StreamPrinter } from '../../../printers/stream-printer.js'
|
||||
import { JsonYamlPrintFlags } from '../../../printers/format-json-yaml.js'
|
||||
import { TextPrintFlags } from '../../../printers/format-text.js'
|
||||
import { CompositePrintFlags } from '../../../printers/printer.js'
|
||||
import { chatTextHandler, completionTextHandler, RUN_MODES, workflowTextHandler } from './handlers.js'
|
||||
import { streamPrinterFor } from './stream-handlers.js'
|
||||
import type { PrintFlags } from '@/printers/printer'
|
||||
import type { StreamPrinter } from '@/printers/stream-printer'
|
||||
import { JsonYamlPrintFlags } from '@/printers/format-json-yaml'
|
||||
import { TextPrintFlags } from '@/printers/format-text'
|
||||
import { CompositePrintFlags } from '@/printers/printer'
|
||||
import { chatTextHandler, completionTextHandler, RUN_MODES, workflowTextHandler } from './handlers'
|
||||
import { streamPrinterFor } from './stream-handlers'
|
||||
|
||||
export class AppRunPrintFlags extends CompositePrintFlags {
|
||||
private readonly jsonYaml = new JsonYamlPrintFlags()
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import type { DifyMock } from '../../../../test/fixtures/dify-mock/server.js'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { DifyMock } from '@test/fixtures/dify-mock/server'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import { mkdtemp, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { startMock } from '@test/fixtures/dify-mock/server'
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
|
||||
import { startMock } from '../../../../test/fixtures/dify-mock/server.js'
|
||||
import { loadAppInfoCache } from '../../../cache/app-info.js'
|
||||
import { createClient } from '../../../http/client.js'
|
||||
import { ENV_CACHE_DIR } from '../../../store/dir.js'
|
||||
import { CACHE_APP_INFO, getCache } from '../../../store/manager.js'
|
||||
import { bufferStreams } from '../../../sys/io/streams'
|
||||
import { resumeApp } from '../../resume/app/run.js'
|
||||
import { runApp } from './run.js'
|
||||
import { loadAppInfoCache } from '@/cache/app-info'
|
||||
import { resumeApp } from '@/commands/resume/app/run'
|
||||
import { createClient } from '@/http/client'
|
||||
import { ENV_CACHE_DIR } from '@/store/dir'
|
||||
import { CACHE_APP_INFO, getCache } from '@/store/manager'
|
||||
import { bufferStreams } from '@/sys/io/streams'
|
||||
import { runApp } from './run'
|
||||
|
||||
function bundle(): HostsBundle {
|
||||
return {
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import type { KyInstance } from 'ky'
|
||||
import type { HostsBundle } from '../../../auth/hosts.js'
|
||||
import type { AppInfoCache } from '../../../cache/app-info.js'
|
||||
import type { IOStreams } from '../../../sys/io/streams'
|
||||
import { AppMetaClient } from '../../../api/app-meta.js'
|
||||
import { AppRunClient } from '../../../api/app-run.js'
|
||||
import { AppsClient } from '../../../api/apps.js'
|
||||
import { FileUploadClient } from '../../../api/file-upload.js'
|
||||
import { BaseError } from '../../../errors/base.js'
|
||||
import { ErrorCode } from '../../../errors/codes.js'
|
||||
import { getEnv, processExit } from '../../../sys/index.js'
|
||||
import { FieldInfo } from '../../../types/app-meta.js'
|
||||
import { resolveWorkspaceId } from '../../../workspace/resolver.js'
|
||||
import { pickStrategy } from './_strategies/index.js'
|
||||
import { resolveFileInputs } from './file-flags.js'
|
||||
import { RUN_MODES } from './handlers.js'
|
||||
import { AppRunPrintFlags } from './print-flags.js'
|
||||
import type { HostsBundle } from '@/auth/hosts'
|
||||
import type { AppInfoCache } from '@/cache/app-info'
|
||||
import type { IOStreams } from '@/sys/io/streams'
|
||||
import { AppMetaClient } from '@/api/app-meta'
|
||||
import { AppRunClient } from '@/api/app-run'
|
||||
import { AppsClient } from '@/api/apps'
|
||||
import { FileUploadClient } from '@/api/file-upload'
|
||||
import { pickStrategy } from '@/commands/run/app/_strategies/index'
|
||||
import { BaseError } from '@/errors/base'
|
||||
import { ErrorCode } from '@/errors/codes'
|
||||
import { getEnv, processExit } from '@/sys/index'
|
||||
import { FieldInfo } from '@/types/app-meta'
|
||||
import { resolveWorkspaceId } from '@/workspace/resolver'
|
||||
import { resolveFileInputs } from './file-flags'
|
||||
import { RUN_MODES } from './handlers'
|
||||
import { AppRunPrintFlags } from './print-flags'
|
||||
|
||||
export type RunAppOptions = {
|
||||
readonly appId: string
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user