@agentuity/cli 1.0.31 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-detection.js +1 -1
- package/dist/agent-detection.js.map +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +1 -1
- package/dist/api.js.map +1 -1
- package/dist/cache/agent-intro.d.ts.map +1 -1
- package/dist/cache/agent-intro.js.map +1 -1
- package/dist/cache/resource-region.d.ts.map +1 -1
- package/dist/cache/resource-region.js.map +1 -1
- package/dist/cache/user-cache.d.ts.map +1 -1
- package/dist/cache/user-cache.js.map +1 -1
- package/dist/catalyst.d.ts +3 -1
- package/dist/catalyst.d.ts.map +1 -1
- package/dist/catalyst.js +5 -1
- package/dist/catalyst.js.map +1 -1
- package/dist/cmd/ai/opencode/install.js +1 -1
- package/dist/cmd/ai/opencode/install.js.map +1 -1
- package/dist/cmd/build/ast.js +2 -2
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/patch/_util.d.ts +1 -1
- package/dist/cmd/build/patch/_util.d.ts.map +1 -1
- package/dist/cmd/build/patch/_util.js +2 -2
- package/dist/cmd/build/patch/_util.js.map +1 -1
- package/dist/cmd/build/vite/bun-dev-server.js +9 -1
- package/dist/cmd/build/vite/bun-dev-server.js.map +1 -1
- package/dist/cmd/build/vite/config-loader.js +9 -1
- package/dist/cmd/build/vite/config-loader.js.map +1 -1
- package/dist/cmd/build/vite/registry-generator.js.map +1 -1
- package/dist/cmd/build/vite/server-bundler.js +9 -1
- package/dist/cmd/build/vite/server-bundler.js.map +1 -1
- package/dist/cmd/build/vite/static-renderer.js +11 -3
- package/dist/cmd/build/vite/static-renderer.js.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server-config.js +9 -1
- package/dist/cmd/build/vite/vite-asset-server-config.js.map +1 -1
- package/dist/cmd/build/vite/vite-asset-server.js +9 -1
- package/dist/cmd/build/vite/vite-asset-server.js.map +1 -1
- package/dist/cmd/build/vite/vite-builder.js +10 -2
- package/dist/cmd/build/vite/vite-builder.js.map +1 -1
- package/dist/cmd/build/vite/workbench-generator.d.ts +1 -1
- package/dist/cmd/build/vite/workbench-generator.d.ts.map +1 -1
- package/dist/cmd/build/vite/workbench-generator.js +1 -1
- package/dist/cmd/build/vite/workbench-generator.js.map +1 -1
- package/dist/cmd/cloud/db/create.d.ts.map +1 -1
- package/dist/cmd/cloud/db/create.js +8 -10
- package/dist/cmd/cloud/db/create.js.map +1 -1
- package/dist/cmd/cloud/db/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/db/delete.js +12 -14
- package/dist/cmd/cloud/db/delete.js.map +1 -1
- package/dist/cmd/cloud/db/get.d.ts.map +1 -1
- package/dist/cmd/cloud/db/get.js +7 -7
- package/dist/cmd/cloud/db/get.js.map +1 -1
- package/dist/cmd/cloud/db/list.d.ts.map +1 -1
- package/dist/cmd/cloud/db/list.js +5 -5
- package/dist/cmd/cloud/db/list.js.map +1 -1
- package/dist/cmd/cloud/db/logs.d.ts.map +1 -1
- package/dist/cmd/cloud/db/logs.js +7 -7
- package/dist/cmd/cloud/db/logs.js.map +1 -1
- package/dist/cmd/cloud/db/sql.js +5 -5
- package/dist/cmd/cloud/db/sql.js.map +1 -1
- package/dist/cmd/cloud/db/stats.d.ts.map +1 -1
- package/dist/cmd/cloud/db/stats.js +5 -5
- package/dist/cmd/cloud/db/stats.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +1 -1
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/email/stats.d.ts.map +1 -1
- package/dist/cmd/cloud/email/stats.js +5 -5
- package/dist/cmd/cloud/email/stats.js.map +1 -1
- package/dist/cmd/cloud/email/util.d.ts +2 -2
- package/dist/cmd/cloud/email/util.d.ts.map +1 -1
- package/dist/cmd/cloud/email/util.js +2 -2
- package/dist/cmd/cloud/email/util.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/repl.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/repl.js +4 -2
- package/dist/cmd/cloud/keyvalue/repl.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/search.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/search.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/util.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/util.js +1 -1
- package/dist/cmd/cloud/keyvalue/util.js.map +1 -1
- package/dist/cmd/cloud/machine/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/machine/delete.js +6 -6
- package/dist/cmd/cloud/machine/delete.js.map +1 -1
- package/dist/cmd/cloud/machine/deployments.d.ts.map +1 -1
- package/dist/cmd/cloud/machine/deployments.js +5 -5
- package/dist/cmd/cloud/machine/deployments.js.map +1 -1
- package/dist/cmd/cloud/machine/get.d.ts.map +1 -1
- package/dist/cmd/cloud/machine/get.js +5 -5
- package/dist/cmd/cloud/machine/get.js.map +1 -1
- package/dist/cmd/cloud/machine/list.d.ts.map +1 -1
- package/dist/cmd/cloud/machine/list.js +5 -5
- package/dist/cmd/cloud/machine/list.js.map +1 -1
- package/dist/cmd/cloud/queue/util.d.ts +1 -1
- package/dist/cmd/cloud/queue/util.d.ts.map +1 -1
- package/dist/cmd/cloud/queue/util.js +1 -1
- package/dist/cmd/cloud/queue/util.js.map +1 -1
- package/dist/cmd/cloud/redis/get.js +5 -5
- package/dist/cmd/cloud/redis/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/cp.js +2 -2
- package/dist/cmd/cloud/sandbox/cp.js.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/get.js +4 -4
- package/dist/cmd/cloud/sandbox/execution/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/execution/list.js +5 -5
- package/dist/cmd/cloud/sandbox/execution/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/runtime/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/runtime/list.js +4 -4
- package/dist/cmd/cloud/sandbox/runtime/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/create.js +5 -5
- package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/delete.js +4 -4
- package/dist/cmd/cloud/sandbox/snapshot/delete.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js +4 -4
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/list.js +4 -4
- package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/tag.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/tag.js +4 -4
- package/dist/cmd/cloud/sandbox/snapshot/tag.js.map +1 -1
- package/dist/cmd/cloud/sandbox/stats.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/stats.js +5 -5
- package/dist/cmd/cloud/sandbox/stats.js.map +1 -1
- package/dist/cmd/cloud/sandbox/util.d.ts +3 -3
- package/dist/cmd/cloud/sandbox/util.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/util.js +5 -5
- package/dist/cmd/cloud/sandbox/util.js.map +1 -1
- package/dist/cmd/cloud/schedule/stats.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/stats.js +5 -5
- package/dist/cmd/cloud/schedule/stats.js.map +1 -1
- package/dist/cmd/cloud/schedule/util.d.ts +1 -1
- package/dist/cmd/cloud/schedule/util.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/util.js +1 -1
- package/dist/cmd/cloud/schedule/util.js.map +1 -1
- package/dist/cmd/cloud/services/stats.d.ts.map +1 -1
- package/dist/cmd/cloud/services/stats.js +5 -5
- package/dist/cmd/cloud/services/stats.js.map +1 -1
- package/dist/cmd/cloud/session/get.d.ts.map +1 -1
- package/dist/cmd/cloud/session/get.js +5 -5
- package/dist/cmd/cloud/session/get.js.map +1 -1
- package/dist/cmd/cloud/session/list.d.ts.map +1 -1
- package/dist/cmd/cloud/session/list.js +5 -5
- package/dist/cmd/cloud/session/list.js.map +1 -1
- package/dist/cmd/cloud/storage/config.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/config.js +8 -9
- package/dist/cmd/cloud/storage/config.js.map +1 -1
- package/dist/cmd/cloud/storage/create.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/create.js +8 -10
- package/dist/cmd/cloud/storage/create.js.map +1 -1
- package/dist/cmd/cloud/storage/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/delete.js +12 -14
- package/dist/cmd/cloud/storage/delete.js.map +1 -1
- package/dist/cmd/cloud/storage/download.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/download.js +6 -6
- package/dist/cmd/cloud/storage/download.js.map +1 -1
- package/dist/cmd/cloud/storage/get.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/get.js +6 -6
- package/dist/cmd/cloud/storage/get.js.map +1 -1
- package/dist/cmd/cloud/storage/list.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/list.js +6 -6
- package/dist/cmd/cloud/storage/list.js.map +1 -1
- package/dist/cmd/cloud/storage/upload.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/upload.js +7 -7
- package/dist/cmd/cloud/storage/upload.js.map +1 -1
- package/dist/cmd/cloud/stream/create.js +1 -1
- package/dist/cmd/cloud/stream/create.js.map +1 -1
- package/dist/cmd/cloud/stream/stats.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/stats.js +5 -5
- package/dist/cmd/cloud/stream/stats.js.map +1 -1
- package/dist/cmd/cloud/task/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/task/delete.js +6 -1
- package/dist/cmd/cloud/task/delete.js.map +1 -1
- package/dist/cmd/cloud/task/stats.d.ts.map +1 -1
- package/dist/cmd/cloud/task/stats.js +5 -5
- package/dist/cmd/cloud/task/stats.js.map +1 -1
- package/dist/cmd/cloud/task/util.d.ts +1 -1
- package/dist/cmd/cloud/task/util.d.ts.map +1 -1
- package/dist/cmd/cloud/task/util.js +2 -2
- package/dist/cmd/cloud/task/util.js.map +1 -1
- package/dist/cmd/cloud/thread/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/thread/delete.js +5 -5
- package/dist/cmd/cloud/thread/delete.js.map +1 -1
- package/dist/cmd/cloud/thread/get.d.ts.map +1 -1
- package/dist/cmd/cloud/thread/get.js +5 -5
- package/dist/cmd/cloud/thread/get.js.map +1 -1
- package/dist/cmd/cloud/thread/list.d.ts.map +1 -1
- package/dist/cmd/cloud/thread/list.js +5 -5
- package/dist/cmd/cloud/thread/list.js.map +1 -1
- package/dist/cmd/cloud/vector/util.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/util.js +1 -1
- package/dist/cmd/cloud/vector/util.js.map +1 -1
- package/dist/cmd/cloud/webhook/util.d.ts +1 -1
- package/dist/cmd/cloud/webhook/util.d.ts.map +1 -1
- package/dist/cmd/cloud/webhook/util.js +1 -1
- package/dist/cmd/cloud/webhook/util.js.map +1 -1
- package/dist/cmd/dev/dev-lock.js +2 -2
- package/dist/cmd/dev/dev-lock.js.map +1 -1
- package/dist/cmd/dev/templates.d.ts.map +1 -1
- package/dist/cmd/dev/templates.js +0 -1
- package/dist/cmd/dev/templates.js.map +1 -1
- package/dist/cmd/git/api.d.ts +38 -0
- package/dist/cmd/git/api.d.ts.map +1 -1
- package/dist/cmd/git/api.js +55 -0
- package/dist/cmd/git/api.js.map +1 -1
- package/dist/cmd/project/add/database.js +8 -8
- package/dist/cmd/project/add/database.js.map +1 -1
- package/dist/cmd/project/add/storage.js +8 -8
- package/dist/cmd/project/add/storage.js.map +1 -1
- package/dist/cmd/project/auth/init.d.ts.map +1 -1
- package/dist/cmd/project/auth/init.js +7 -6
- package/dist/cmd/project/auth/init.js.map +1 -1
- package/dist/cmd/project/auth/shared.d.ts +2 -3
- package/dist/cmd/project/auth/shared.d.ts.map +1 -1
- package/dist/cmd/project/auth/shared.js +7 -7
- package/dist/cmd/project/auth/shared.js.map +1 -1
- package/dist/cmd/project/download.d.ts +12 -1
- package/dist/cmd/project/download.d.ts.map +1 -1
- package/dist/cmd/project/download.js +38 -15
- package/dist/cmd/project/download.js.map +1 -1
- package/dist/cmd/project/import.d.ts.map +1 -1
- package/dist/cmd/project/import.js +67 -9
- package/dist/cmd/project/import.js.map +1 -1
- package/dist/cmd/project/remote-import.d.ts +41 -0
- package/dist/cmd/project/remote-import.d.ts.map +1 -0
- package/dist/cmd/project/remote-import.js +1074 -0
- package/dist/cmd/project/remote-import.js.map +1 -0
- package/dist/cmd/project/template-flow.d.ts +1 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.js +27 -11
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/dist/config.d.ts +29 -5
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -14
- package/dist/config.js.map +1 -1
- package/dist/domain.js +1 -1
- package/dist/domain.js.map +1 -1
- package/dist/schema-generator.d.ts +1 -1
- package/dist/schema-generator.d.ts.map +1 -1
- package/dist/schema-generator.js +1 -1
- package/dist/schema-generator.js.map +1 -1
- package/dist/schema-parser.d.ts.map +1 -1
- package/dist/schema-parser.js +48 -6
- package/dist/schema-parser.js.map +1 -1
- package/dist/terminal.d.ts.map +1 -1
- package/dist/terminal.js +12 -17
- package/dist/terminal.js.map +1 -1
- package/dist/tui.js +1 -1
- package/dist/tui.js.map +1 -1
- package/dist/types.d.ts +28 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +42 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/date.js +1 -1
- package/dist/utils/date.js.map +1 -1
- package/package.json +6 -6
- package/src/agent-detection.ts +1 -1
- package/src/api.ts +1 -1
- package/src/cache/agent-intro.ts +3 -4
- package/src/cache/resource-region.ts +3 -1
- package/src/cache/user-cache.ts +3 -4
- package/src/catalyst.ts +9 -1
- package/src/cmd/ai/opencode/install.ts +1 -1
- package/src/cmd/build/ast.ts +2 -2
- package/src/cmd/build/patch/_util.ts +2 -2
- package/src/cmd/build/vite/registry-generator.ts +4 -4
- package/src/cmd/build/vite/workbench-generator.ts +1 -1
- package/src/cmd/cloud/db/create.ts +8 -9
- package/src/cmd/cloud/db/delete.ts +18 -13
- package/src/cmd/cloud/db/get.ts +13 -7
- package/src/cmd/cloud/db/list.ts +11 -5
- package/src/cmd/cloud/db/logs.ts +13 -7
- package/src/cmd/cloud/db/sql.ts +5 -5
- package/src/cmd/cloud/db/stats.ts +11 -5
- package/src/cmd/cloud/deploy.ts +7 -1
- package/src/cmd/cloud/email/stats.ts +11 -5
- package/src/cmd/cloud/email/util.ts +4 -4
- package/src/cmd/cloud/keyvalue/repl.ts +6 -2
- package/src/cmd/cloud/keyvalue/search.ts +2 -1
- package/src/cmd/cloud/keyvalue/util.ts +2 -2
- package/src/cmd/cloud/machine/delete.ts +12 -6
- package/src/cmd/cloud/machine/deployments.ts +11 -5
- package/src/cmd/cloud/machine/get.ts +11 -5
- package/src/cmd/cloud/machine/list.ts +11 -5
- package/src/cmd/cloud/queue/util.ts +2 -2
- package/src/cmd/cloud/redis/get.ts +5 -5
- package/src/cmd/cloud/sandbox/cp.ts +2 -2
- package/src/cmd/cloud/sandbox/execution/get.ts +10 -4
- package/src/cmd/cloud/sandbox/execution/list.ts +6 -5
- package/src/cmd/cloud/sandbox/runtime/list.ts +10 -4
- package/src/cmd/cloud/sandbox/snapshot/build.ts +1 -1
- package/src/cmd/cloud/sandbox/snapshot/create.ts +12 -5
- package/src/cmd/cloud/sandbox/snapshot/delete.ts +10 -4
- package/src/cmd/cloud/sandbox/snapshot/get.ts +12 -6
- package/src/cmd/cloud/sandbox/snapshot/list.ts +10 -4
- package/src/cmd/cloud/sandbox/snapshot/tag.ts +10 -4
- package/src/cmd/cloud/sandbox/stats.ts +11 -5
- package/src/cmd/cloud/sandbox/util.ts +14 -7
- package/src/cmd/cloud/schedule/stats.ts +11 -5
- package/src/cmd/cloud/schedule/util.ts +3 -3
- package/src/cmd/cloud/services/stats.ts +13 -7
- package/src/cmd/cloud/session/get.ts +14 -8
- package/src/cmd/cloud/session/list.ts +11 -5
- package/src/cmd/cloud/storage/config.ts +27 -20
- package/src/cmd/cloud/storage/create.ts +8 -9
- package/src/cmd/cloud/storage/delete.ts +18 -13
- package/src/cmd/cloud/storage/download.ts +12 -6
- package/src/cmd/cloud/storage/get.ts +12 -6
- package/src/cmd/cloud/storage/list.ts +20 -9
- package/src/cmd/cloud/storage/upload.ts +13 -7
- package/src/cmd/cloud/stream/create.ts +1 -1
- package/src/cmd/cloud/stream/stats.ts +11 -5
- package/src/cmd/cloud/task/delete.ts +13 -2
- package/src/cmd/cloud/task/stats.ts +11 -5
- package/src/cmd/cloud/task/util.ts +4 -4
- package/src/cmd/cloud/thread/delete.ts +11 -5
- package/src/cmd/cloud/thread/get.ts +11 -5
- package/src/cmd/cloud/thread/list.ts +11 -5
- package/src/cmd/cloud/vector/util.ts +2 -2
- package/src/cmd/cloud/webhook/util.ts +2 -2
- package/src/cmd/dev/dev-lock.ts +2 -2
- package/src/cmd/dev/templates.ts +0 -1
- package/src/cmd/git/api.ts +127 -0
- package/src/cmd/project/add/database.ts +9 -9
- package/src/cmd/project/add/storage.ts +9 -9
- package/src/cmd/project/auth/init.ts +11 -10
- package/src/cmd/project/auth/shared.ts +15 -10
- package/src/cmd/project/download.ts +53 -17
- package/src/cmd/project/import.ts +71 -9
- package/src/cmd/project/remote-import.ts +1347 -0
- package/src/cmd/project/template-flow.ts +38 -22
- package/src/config.ts +23 -18
- package/src/domain.ts +3 -3
- package/src/schema-generator.ts +1 -1
- package/src/schema-parser.ts +49 -6
- package/src/terminal.ts +12 -14
- package/src/tui.ts +1 -1
- package/src/types.ts +45 -0
- package/src/utils/date.ts +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Logger, TaskStorageService } from '@agentuity/core';
|
|
2
2
|
import { createServerFetchAdapter } from '@agentuity/server';
|
|
3
|
-
import type { AuthData, Config, GlobalOptions } from '../../../types';
|
|
4
|
-
import { getCatalystUrl } from '../../../catalyst';
|
|
5
3
|
import { setResourceInfo } from '../../../cache';
|
|
4
|
+
import { getCatalystUrl } from '../../../catalyst';
|
|
6
5
|
import { defaultProfileName, getDefaultRegion } from '../../../config';
|
|
7
6
|
import * as tui from '../../../tui';
|
|
7
|
+
import type { AuthData, Config, GlobalOptions } from '../../../types';
|
|
8
8
|
|
|
9
9
|
export interface TaskContext {
|
|
10
10
|
logger: Logger;
|
|
@@ -32,7 +32,7 @@ export async function createStorageAdapter(ctx: TaskContext) {
|
|
|
32
32
|
|
|
33
33
|
// Task tenant DB is not regional — any Catalyst can serve the request.
|
|
34
34
|
const region = await getDefaultRegion(ctx.config?.name ?? defaultProfileName, ctx.config);
|
|
35
|
-
const baseUrl = getCatalystUrl(region);
|
|
35
|
+
const baseUrl = getCatalystUrl(region, ctx.config?.overrides);
|
|
36
36
|
return new TaskStorageService(baseUrl, adapter);
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { APIError, threadDelete } from '@agentuity/server';
|
|
1
2
|
import { z } from 'zod';
|
|
2
|
-
import { createSubcommand } from '../../../types';
|
|
3
|
-
import * as tui from '../../../tui';
|
|
4
|
-
import { threadDelete, APIError } from '@agentuity/server';
|
|
5
3
|
import { getCommand } from '../../../command-prefix';
|
|
6
|
-
import { ErrorCode } from '../../../errors';
|
|
7
4
|
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
5
|
+
import { ErrorCode } from '../../../errors';
|
|
6
|
+
import * as tui from '../../../tui';
|
|
7
|
+
import { createSubcommand } from '../../../types';
|
|
8
8
|
|
|
9
9
|
export const deleteSubcommand = createSubcommand({
|
|
10
10
|
name: 'delete',
|
|
@@ -25,7 +25,13 @@ export const deleteSubcommand = createSubcommand({
|
|
|
25
25
|
},
|
|
26
26
|
async handler(ctx) {
|
|
27
27
|
const { logger, auth, args, config } = ctx;
|
|
28
|
-
const catalystClient = await getGlobalCatalystAPIClient(
|
|
28
|
+
const catalystClient = await getGlobalCatalystAPIClient(
|
|
29
|
+
logger,
|
|
30
|
+
auth,
|
|
31
|
+
config?.name,
|
|
32
|
+
undefined,
|
|
33
|
+
config
|
|
34
|
+
);
|
|
29
35
|
|
|
30
36
|
try {
|
|
31
37
|
await threadDelete(catalystClient, { id: args.thread_id });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { APIError, threadGet } from '@agentuity/server';
|
|
1
2
|
import { z } from 'zod';
|
|
2
|
-
import { createSubcommand } from '../../../types';
|
|
3
|
-
import * as tui from '../../../tui';
|
|
4
|
-
import { threadGet, APIError } from '@agentuity/server';
|
|
5
3
|
import { getCommand } from '../../../command-prefix';
|
|
6
|
-
import { ErrorCode } from '../../../errors';
|
|
7
4
|
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
5
|
+
import { ErrorCode } from '../../../errors';
|
|
6
|
+
import * as tui from '../../../tui';
|
|
7
|
+
import { createSubcommand } from '../../../types';
|
|
8
8
|
|
|
9
9
|
const ThreadGetResponseSchema = z.object({
|
|
10
10
|
id: z.string().describe('Thread ID'),
|
|
@@ -38,7 +38,13 @@ export const getSubcommand = createSubcommand({
|
|
|
38
38
|
},
|
|
39
39
|
async handler(ctx) {
|
|
40
40
|
const { logger, auth, args, options, config } = ctx;
|
|
41
|
-
const catalystClient = await getGlobalCatalystAPIClient(
|
|
41
|
+
const catalystClient = await getGlobalCatalystAPIClient(
|
|
42
|
+
logger,
|
|
43
|
+
auth,
|
|
44
|
+
config?.name,
|
|
45
|
+
undefined,
|
|
46
|
+
config
|
|
47
|
+
);
|
|
42
48
|
|
|
43
49
|
try {
|
|
44
50
|
const thread = await threadGet(catalystClient, { id: args.thread_id });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { type Thread, threadList } from '@agentuity/server';
|
|
1
2
|
import { z } from 'zod';
|
|
2
|
-
import { createSubcommand } from '../../../types';
|
|
3
|
-
import * as tui from '../../../tui';
|
|
4
|
-
import { threadList, type Thread } from '@agentuity/server';
|
|
5
3
|
import { getCommand } from '../../../command-prefix';
|
|
6
|
-
import { ErrorCode } from '../../../errors';
|
|
7
4
|
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
5
|
+
import { ErrorCode } from '../../../errors';
|
|
6
|
+
import * as tui from '../../../tui';
|
|
7
|
+
import { createSubcommand } from '../../../types';
|
|
8
8
|
|
|
9
9
|
const ThreadListResponseSchema = z.array(
|
|
10
10
|
z.object({
|
|
@@ -73,7 +73,13 @@ export const listSubcommand = createSubcommand({
|
|
|
73
73
|
},
|
|
74
74
|
async handler(ctx) {
|
|
75
75
|
const { logger, auth, project, opts, options, config } = ctx;
|
|
76
|
-
const catalystClient = await getGlobalCatalystAPIClient(
|
|
76
|
+
const catalystClient = await getGlobalCatalystAPIClient(
|
|
77
|
+
logger,
|
|
78
|
+
auth,
|
|
79
|
+
config?.name,
|
|
80
|
+
undefined,
|
|
81
|
+
config
|
|
82
|
+
);
|
|
77
83
|
|
|
78
84
|
if (opts?.orgId && opts?.projectId) {
|
|
79
85
|
tui.fatal('--org-id and --project-id are mutually exclusive. Use one or the other.');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Logger, VectorStorageService } from '@agentuity/core';
|
|
2
2
|
import { createServerFetchAdapter } from '@agentuity/server';
|
|
3
|
-
import type { AuthData, Config, GlobalOptions, ProjectConfig } from '../../../types';
|
|
4
3
|
import { getCatalystUrl } from '../../../catalyst';
|
|
5
4
|
import * as tui from '../../../tui';
|
|
5
|
+
import type { AuthData, Config, GlobalOptions, ProjectConfig } from '../../../types';
|
|
6
6
|
|
|
7
7
|
export function createStorageAdapter(
|
|
8
8
|
ctx: {
|
|
@@ -36,6 +36,6 @@ export function createStorageAdapter(
|
|
|
36
36
|
ctx.logger
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
-
const baseUrl = getCatalystUrl(ctx.region);
|
|
39
|
+
const baseUrl = getCatalystUrl(ctx.region, ctx.config?.overrides);
|
|
40
40
|
return new VectorStorageService(baseUrl, adapter);
|
|
41
41
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Logger } from '@agentuity/core';
|
|
2
|
-
import { APIClient,
|
|
2
|
+
import type { APIClient, WebhookApiOptions } from '@agentuity/server';
|
|
3
3
|
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
4
4
|
import type { AuthData, Config, GlobalOptions } from '../../../types';
|
|
5
5
|
|
|
@@ -21,7 +21,7 @@ export interface WebhookContext {
|
|
|
21
21
|
* Uses the global Catalyst API client with user authentication.
|
|
22
22
|
*/
|
|
23
23
|
export async function createWebhookAPIClient(ctx: WebhookContext): Promise<APIClient> {
|
|
24
|
-
return getGlobalCatalystAPIClient(ctx.logger, ctx.auth, ctx.config?.name);
|
|
24
|
+
return getGlobalCatalystAPIClient(ctx.logger, ctx.auth, ctx.config?.name, undefined, ctx.config);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
package/src/cmd/dev/dev-lock.ts
CHANGED
|
@@ -205,7 +205,7 @@ async function cleanupStaleLock(
|
|
|
205
205
|
*/
|
|
206
206
|
async function ensureNoActiveDevForProject(
|
|
207
207
|
rootDir: string,
|
|
208
|
-
|
|
208
|
+
_port: number,
|
|
209
209
|
logger: LoggerLike
|
|
210
210
|
): Promise<void> {
|
|
211
211
|
const lockPath = getLockPath(rootDir);
|
|
@@ -214,7 +214,7 @@ async function ensureNoActiveDevForProject(
|
|
|
214
214
|
|
|
215
215
|
const now = Date.now();
|
|
216
216
|
const createdAt = Date.parse(existing.createdAt || '');
|
|
217
|
-
const ageMs = isFinite(createdAt) ? now - createdAt : Infinity;
|
|
217
|
+
const ageMs = Number.isFinite(createdAt) ? now - createdAt : Infinity;
|
|
218
218
|
|
|
219
219
|
const mainAlive = pidExists(existing.mainPid);
|
|
220
220
|
|
package/src/cmd/dev/templates.ts
CHANGED
|
@@ -35,7 +35,6 @@ export default router;
|
|
|
35
35
|
|
|
36
36
|
const invalidDirRegex = /[<>:"/\\|?*]/;
|
|
37
37
|
|
|
38
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex: checking for invalid control characters in directory names
|
|
39
38
|
const invalidControlChars = /[\u0000-\u001F]/;
|
|
40
39
|
const reservedWindowsNames = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i;
|
|
41
40
|
const invalidTrailing = /[. ]$/;
|
package/src/cmd/git/api.ts
CHANGED
|
@@ -315,3 +315,130 @@ export async function getProjectGithubStatus(
|
|
|
315
315
|
|
|
316
316
|
return resp.data;
|
|
317
317
|
}
|
|
318
|
+
|
|
319
|
+
// ─── GitHub Token ───
|
|
320
|
+
|
|
321
|
+
const GithubTokenDataSchema = z.object({
|
|
322
|
+
token: z.string(),
|
|
323
|
+
username: z.string(),
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
export type GithubTokenResult = z.infer<typeof GithubTokenDataSchema>;
|
|
327
|
+
|
|
328
|
+
const GithubTokenError = StructuredError(
|
|
329
|
+
'GithubTokenError',
|
|
330
|
+
'Failed to retrieve GitHub token from Agentuity'
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
export async function getGithubToken(apiClient: APIClient): Promise<GithubTokenResult> {
|
|
334
|
+
const resp = await apiClient.get('/cli/github/token', APIResponseSchema(GithubTokenDataSchema));
|
|
335
|
+
|
|
336
|
+
if (!resp.success || !resp.data) {
|
|
337
|
+
throw new GithubTokenError();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
return resp.data;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const GithubRepoCheckDataSchema = z.object({
|
|
344
|
+
available: z.boolean(),
|
|
345
|
+
exists: z.boolean(),
|
|
346
|
+
error: z.string().optional(),
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
export type GithubRepoCheckResult = z.infer<typeof GithubRepoCheckDataSchema>;
|
|
350
|
+
|
|
351
|
+
const GithubRepoCheckError = StructuredError(
|
|
352
|
+
'GithubRepoCheckError',
|
|
353
|
+
'Error checking GitHub repository availability'
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
export async function checkGithubRepo(
|
|
357
|
+
apiClient: APIClient,
|
|
358
|
+
params: { owner: string; name: string }
|
|
359
|
+
): Promise<GithubRepoCheckResult> {
|
|
360
|
+
const resp = await apiClient.get(
|
|
361
|
+
`/cli/github/repo/check?owner=${encodeURIComponent(params.owner)}&name=${encodeURIComponent(params.name)}`,
|
|
362
|
+
APIResponseSchema(GithubRepoCheckDataSchema)
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
if (!resp.success || !resp.data) {
|
|
366
|
+
throw new GithubRepoCheckError();
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return resp.data;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// Repo creation
|
|
373
|
+
|
|
374
|
+
const GithubRepoCreateDataSchema = z.object({
|
|
375
|
+
url: z.string(),
|
|
376
|
+
cloneUrl: z.string(),
|
|
377
|
+
fullName: z.string(),
|
|
378
|
+
private: z.boolean(),
|
|
379
|
+
created: z.boolean(),
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
export interface GithubRepoCreateResult {
|
|
383
|
+
url: string;
|
|
384
|
+
cloneUrl: string;
|
|
385
|
+
fullName: string;
|
|
386
|
+
private: boolean;
|
|
387
|
+
created: boolean;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export interface GithubRepoCreateOptions {
|
|
391
|
+
name: string;
|
|
392
|
+
owner: string;
|
|
393
|
+
private: boolean;
|
|
394
|
+
description?: string;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const GithubRepoCreateError = StructuredError(
|
|
398
|
+
'GithubRepoCreateError',
|
|
399
|
+
'Error creating GitHub repository'
|
|
400
|
+
);
|
|
401
|
+
|
|
402
|
+
export async function createGithubRepo(
|
|
403
|
+
apiClient: APIClient,
|
|
404
|
+
params: GithubRepoCreateOptions
|
|
405
|
+
): Promise<GithubRepoCreateResult> {
|
|
406
|
+
const resp = await apiClient.post(
|
|
407
|
+
'/cli/github/repo',
|
|
408
|
+
params,
|
|
409
|
+
APIResponseSchema(GithubRepoCreateDataSchema)
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
if (!resp.success || !resp.data) {
|
|
413
|
+
throw new GithubRepoCreateError();
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
return resp.data;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// ─── Bot Identity ───
|
|
420
|
+
|
|
421
|
+
const GithubBotIdentityDataSchema = z.object({
|
|
422
|
+
name: z.string(),
|
|
423
|
+
email: z.string(),
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
export type GithubBotIdentity = z.infer<typeof GithubBotIdentityDataSchema>;
|
|
427
|
+
|
|
428
|
+
const GithubBotIdentityError = StructuredError(
|
|
429
|
+
'GithubBotIdentityError',
|
|
430
|
+
'Error fetching GitHub App bot identity'
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
export async function getGithubBotIdentity(apiClient: APIClient): Promise<GithubBotIdentity> {
|
|
434
|
+
const resp = await apiClient.get(
|
|
435
|
+
'/cli/github/bot-identity',
|
|
436
|
+
APIResponseSchema(GithubBotIdentityDataSchema)
|
|
437
|
+
);
|
|
438
|
+
|
|
439
|
+
if (!resp.success || !resp.data) {
|
|
440
|
+
throw new GithubBotIdentityError();
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
return resp.data;
|
|
444
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { listResources, projectEnvUpdate } from '@agentuity/server';
|
|
3
|
-
import {
|
|
4
|
-
import * as tui from '../../../tui';
|
|
5
|
-
import { createPrompt } from '../../../tui';
|
|
6
|
-
import { getCatalystAPIClient } from '../../../config';
|
|
2
|
+
import { z } from 'zod';
|
|
7
3
|
import { getCommand } from '../../../command-prefix';
|
|
8
|
-
import {
|
|
9
|
-
import { ErrorCode } from '../../../errors';
|
|
4
|
+
import { getCatalystAPIClient } from '../../../config';
|
|
10
5
|
import {
|
|
11
6
|
addResourceEnvVars,
|
|
7
|
+
filterAgentuitySdkKeys,
|
|
12
8
|
findExistingEnvFile,
|
|
13
9
|
readEnvFile,
|
|
14
|
-
filterAgentuitySdkKeys,
|
|
15
10
|
splitEnvAndSecrets,
|
|
16
11
|
} from '../../../env-util';
|
|
12
|
+
import { ErrorCode } from '../../../errors';
|
|
13
|
+
import { isDryRunMode, outputDryRun } from '../../../explain';
|
|
14
|
+
import * as tui from '../../../tui';
|
|
15
|
+
import { createPrompt } from '../../../tui';
|
|
16
|
+
import { createSubcommand } from '../../../types';
|
|
17
17
|
|
|
18
18
|
export const databaseSubcommand = createSubcommand({
|
|
19
19
|
name: 'database',
|
|
@@ -65,7 +65,7 @@ export const databaseSubcommand = createSubcommand({
|
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
const catalystClient = getCatalystAPIClient(logger, auth, region);
|
|
68
|
+
const catalystClient = getCatalystAPIClient(logger, auth, region, undefined, ctx.config);
|
|
69
69
|
|
|
70
70
|
const resources = await tui.spinner({
|
|
71
71
|
message: 'Fetching databases',
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { listResources, projectEnvUpdate } from '@agentuity/server';
|
|
3
|
-
import {
|
|
4
|
-
import * as tui from '../../../tui';
|
|
5
|
-
import { createPrompt } from '../../../tui';
|
|
6
|
-
import { getCatalystAPIClient } from '../../../config';
|
|
2
|
+
import { z } from 'zod';
|
|
7
3
|
import { getCommand } from '../../../command-prefix';
|
|
8
|
-
import {
|
|
9
|
-
import { ErrorCode } from '../../../errors';
|
|
4
|
+
import { getCatalystAPIClient } from '../../../config';
|
|
10
5
|
import {
|
|
11
6
|
addResourceEnvVars,
|
|
7
|
+
filterAgentuitySdkKeys,
|
|
12
8
|
findExistingEnvFile,
|
|
13
9
|
readEnvFile,
|
|
14
|
-
filterAgentuitySdkKeys,
|
|
15
10
|
splitEnvAndSecrets,
|
|
16
11
|
} from '../../../env-util';
|
|
12
|
+
import { ErrorCode } from '../../../errors';
|
|
13
|
+
import { isDryRunMode, outputDryRun } from '../../../explain';
|
|
14
|
+
import * as tui from '../../../tui';
|
|
15
|
+
import { createPrompt } from '../../../tui';
|
|
16
|
+
import { createSubcommand } from '../../../types';
|
|
17
17
|
|
|
18
18
|
export const storageSubcommand = createSubcommand({
|
|
19
19
|
name: 'storage',
|
|
@@ -65,7 +65,7 @@ export const storageSubcommand = createSubcommand({
|
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
const catalystClient = getCatalystAPIClient(logger, auth, region);
|
|
68
|
+
const catalystClient = getCatalystAPIClient(logger, auth, region, undefined, ctx.config);
|
|
69
69
|
|
|
70
70
|
const resources = await tui.spinner({
|
|
71
71
|
message: 'Fetching storage buckets',
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
+
import enquirer from 'enquirer';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
1
4
|
import { z } from 'zod';
|
|
2
|
-
import { createSubcommand } from '../../../types';
|
|
3
|
-
import * as tui from '../../../tui';
|
|
4
5
|
import { getCommand } from '../../../command-prefix';
|
|
6
|
+
import { readEnvFile, writeEnvFile } from '../../../env-util';
|
|
7
|
+
import * as tui from '../../../tui';
|
|
8
|
+
import { createSubcommand } from '../../../types';
|
|
5
9
|
import {
|
|
6
|
-
|
|
10
|
+
detectOrmSetup,
|
|
7
11
|
ensureAuthDependencies,
|
|
8
|
-
runAuthMigrations,
|
|
9
12
|
generateAuthFileContent,
|
|
10
|
-
printIntegrationExamples,
|
|
11
|
-
detectOrmSetup,
|
|
12
13
|
generateAuthSchemaSql,
|
|
13
14
|
getGeneratedSqlDir,
|
|
15
|
+
printIntegrationExamples,
|
|
16
|
+
runAuthMigrations,
|
|
17
|
+
selectOrCreateDatabase,
|
|
14
18
|
} from './shared';
|
|
15
|
-
import { readEnvFile, writeEnvFile } from '../../../env-util';
|
|
16
|
-
import enquirer from 'enquirer';
|
|
17
|
-
import * as fs from 'fs';
|
|
18
|
-
import * as path from 'path';
|
|
19
19
|
|
|
20
20
|
export const initSubcommand = createSubcommand({
|
|
21
21
|
name: 'init',
|
|
@@ -232,6 +232,7 @@ export const initSubcommand = createSubcommand({
|
|
|
232
232
|
region,
|
|
233
233
|
databaseName,
|
|
234
234
|
sql,
|
|
235
|
+
config,
|
|
235
236
|
});
|
|
236
237
|
migrationsRun = true;
|
|
237
238
|
}
|
|
@@ -3,18 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as path from 'node:path';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
6
|
+
import { createResources, dbQuery, listOrgResources } from '@agentuity/server';
|
|
7
|
+
import enquirer from 'enquirer';
|
|
8
8
|
import {
|
|
9
9
|
getCatalystAPIClient,
|
|
10
10
|
getGlobalCatalystAPIClient,
|
|
11
11
|
loadProjectConfig,
|
|
12
12
|
ProjectConfigNotFoundException,
|
|
13
13
|
} from '../../../config';
|
|
14
|
-
import
|
|
15
|
-
import type { AuthData } from '../../../types';
|
|
16
|
-
import type { Config } from '../../../types';
|
|
17
|
-
import enquirer from 'enquirer';
|
|
14
|
+
import * as tui from '../../../tui';
|
|
15
|
+
import type { AuthData, Config, Logger } from '../../../types';
|
|
18
16
|
|
|
19
17
|
/**
|
|
20
18
|
* Database info returned from selection
|
|
@@ -39,7 +37,13 @@ export async function selectOrCreateDatabase(options: {
|
|
|
39
37
|
}): Promise<DatabaseInfo> {
|
|
40
38
|
const { logger, auth, orgId, config, existingUrl, projectDir } = options;
|
|
41
39
|
const profileName = config?.name;
|
|
42
|
-
const globalClient = await getGlobalCatalystAPIClient(
|
|
40
|
+
const globalClient = await getGlobalCatalystAPIClient(
|
|
41
|
+
logger,
|
|
42
|
+
auth,
|
|
43
|
+
profileName,
|
|
44
|
+
undefined,
|
|
45
|
+
config
|
|
46
|
+
);
|
|
43
47
|
|
|
44
48
|
const resources = await tui.spinner({
|
|
45
49
|
message: `Fetching databases for ${orgId}`,
|
|
@@ -122,7 +126,7 @@ export async function selectOrCreateDatabase(options: {
|
|
|
122
126
|
logger.trace(`[auth init] Using fallback region: ${region}`);
|
|
123
127
|
}
|
|
124
128
|
|
|
125
|
-
const regionalClient = getCatalystAPIClient(logger, auth, region);
|
|
129
|
+
const regionalClient = getCatalystAPIClient(logger, auth, region, undefined, config);
|
|
126
130
|
|
|
127
131
|
const created = await tui.spinner({
|
|
128
132
|
message: `Creating database in ${region}`,
|
|
@@ -393,9 +397,10 @@ export async function runAuthMigrations(options: {
|
|
|
393
397
|
region: string;
|
|
394
398
|
databaseName: string;
|
|
395
399
|
sql: string;
|
|
400
|
+
config?: Config | null;
|
|
396
401
|
}): Promise<void> {
|
|
397
|
-
const { logger, auth, orgId, region, databaseName, sql } = options;
|
|
398
|
-
const catalystClient = getCatalystAPIClient(logger, auth, region);
|
|
402
|
+
const { logger, auth, orgId, region, databaseName, sql, config } = options;
|
|
403
|
+
const catalystClient = getCatalystAPIClient(logger, auth, region, undefined, config);
|
|
399
404
|
|
|
400
405
|
const statements = splitSqlStatements(sql);
|
|
401
406
|
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { join, resolve } from 'node:path';
|
|
2
1
|
import {
|
|
2
|
+
cpSync,
|
|
3
|
+
createReadStream,
|
|
3
4
|
existsSync,
|
|
4
5
|
mkdirSync,
|
|
5
6
|
mkdtempSync,
|
|
6
|
-
renameSync,
|
|
7
7
|
readdirSync,
|
|
8
|
-
|
|
8
|
+
renameSync,
|
|
9
9
|
rmSync,
|
|
10
|
-
createReadStream,
|
|
11
10
|
} from 'node:fs';
|
|
12
11
|
import { tmpdir } from 'node:os';
|
|
12
|
+
import { join, resolve } from 'node:path';
|
|
13
13
|
import { finished } from 'node:stream/promises';
|
|
14
14
|
import { createGunzip } from 'node:zlib';
|
|
15
|
+
import { type Logger, StructuredError } from '@agentuity/core';
|
|
15
16
|
import { extract, type Headers } from 'tar-fs';
|
|
16
|
-
import { StructuredError, type Logger } from '@agentuity/core';
|
|
17
|
-
import * as tui from '../../tui';
|
|
18
|
-
import { downloadWithSpinner } from '../../download';
|
|
19
17
|
import { writeAgentsDocs } from '../../agents-docs';
|
|
18
|
+
import { downloadWithSpinner } from '../../download';
|
|
19
|
+
import * as tui from '../../tui';
|
|
20
20
|
import type { TemplateInfo } from './templates';
|
|
21
21
|
|
|
22
22
|
const GITHUB_BRANCH = 'main';
|
|
@@ -122,7 +122,7 @@ async function _cleanup(sourceDir: string, dest: string) {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
await tui.spinner(
|
|
125
|
+
await tui.spinner('📦 Copying template files...', async () => {
|
|
126
126
|
// Copy all files from source to dest
|
|
127
127
|
const files = readdirSync(sourceDir);
|
|
128
128
|
for (const file of files) {
|
|
@@ -275,7 +275,7 @@ export async function downloadTemplate(options: DownloadOptions): Promise<void>
|
|
|
275
275
|
},
|
|
276
276
|
// ignore callback: called AFTER map, receives the MAPPED name
|
|
277
277
|
// Return true to skip the entry, false to extract it
|
|
278
|
-
ignore: (
|
|
278
|
+
ignore: (_name: string, header?: Headers) => {
|
|
279
279
|
if (!header) {
|
|
280
280
|
ignoredCount++;
|
|
281
281
|
return true;
|
|
@@ -396,7 +396,21 @@ export async function setupProject(options: SetupOptions): Promise<{ success: bo
|
|
|
396
396
|
return { success: !hasError };
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
-
|
|
399
|
+
interface InitGitRepoOptions {
|
|
400
|
+
/** Project name (e.g. "My Agent") */
|
|
401
|
+
projectName?: string;
|
|
402
|
+
/** Where the template came from (e.g. "github.com/owner/repo" or "TypeScript / Hello World") */
|
|
403
|
+
source?: string;
|
|
404
|
+
/** Git commit author (e.g. { name: "app-slug[bot]", email: "id+slug[bot]@users.noreply.github.com" }) */
|
|
405
|
+
author?: { name: string; email: string };
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export async function initGitRepo(dest: string, options?: InitGitRepoOptions): Promise<void> {
|
|
409
|
+
// Safety: refuse to init if .git already exists (prevents clobbering existing repos)
|
|
410
|
+
if (existsSync(join(dest, '.git'))) {
|
|
411
|
+
throw new Error(`Refusing to initialize git: "${dest}" already contains a .git directory.`);
|
|
412
|
+
}
|
|
413
|
+
|
|
400
414
|
// Initialize git repository if git is available
|
|
401
415
|
// Check for real git (not macOS stub that triggers Xcode CLT popup)
|
|
402
416
|
const { isGitAvailable, getDefaultBranch } = await import('../../git-helper');
|
|
@@ -414,19 +428,22 @@ export async function initGitRepo(dest: string): Promise<void> {
|
|
|
414
428
|
clearOnSuccess: true,
|
|
415
429
|
});
|
|
416
430
|
|
|
417
|
-
// Configure git user in CI environments (where git config may not be set)
|
|
418
|
-
if (process.env.CI) {
|
|
431
|
+
// Configure git user in CI/sandbox environments (where git config may not be set)
|
|
432
|
+
if (process.env.CI || process.env.AGENTUITY_SANDBOX_ID) {
|
|
433
|
+
const cfgEmail = options?.author?.email ?? 'bot@agentuity.com';
|
|
434
|
+
const cfgName = options?.author?.name ?? 'Agentuity';
|
|
435
|
+
|
|
419
436
|
await tui.runCommand({
|
|
420
437
|
command: 'git config user.email',
|
|
421
438
|
cwd: dest,
|
|
422
|
-
cmd: ['git', 'config', 'user.email',
|
|
439
|
+
cmd: ['git', 'config', 'user.email', cfgEmail],
|
|
423
440
|
clearOnSuccess: true,
|
|
424
441
|
});
|
|
425
442
|
|
|
426
443
|
await tui.runCommand({
|
|
427
444
|
command: 'git config user.name',
|
|
428
445
|
cwd: dest,
|
|
429
|
-
cmd: ['git', 'config', 'user.name',
|
|
446
|
+
cmd: ['git', 'config', 'user.name', cfgName],
|
|
430
447
|
clearOnSuccess: true,
|
|
431
448
|
});
|
|
432
449
|
}
|
|
@@ -439,11 +456,30 @@ export async function initGitRepo(dest: string): Promise<void> {
|
|
|
439
456
|
clearOnSuccess: true,
|
|
440
457
|
});
|
|
441
458
|
|
|
442
|
-
|
|
459
|
+
const commitMessage = 'Initial Setup';
|
|
460
|
+
|
|
461
|
+
// Create initial commit — authored by the GitHub App bot if available,
|
|
462
|
+
// otherwise fallback to generic Agentuity identity
|
|
463
|
+
const authorName = options?.author?.name ?? 'Agentuity';
|
|
464
|
+
const authorEmail = options?.author?.email ?? 'bot@agentuity.com';
|
|
465
|
+
const authorStr = `${authorName} <${authorEmail}>`;
|
|
466
|
+
|
|
443
467
|
await tui.runCommand({
|
|
444
|
-
command: 'git commit
|
|
468
|
+
command: 'git commit',
|
|
445
469
|
cwd: dest,
|
|
446
|
-
cmd: [
|
|
470
|
+
cmd: [
|
|
471
|
+
'git',
|
|
472
|
+
'-c',
|
|
473
|
+
'commit.gpgsign=false',
|
|
474
|
+
'commit',
|
|
475
|
+
`--author=${authorStr}`,
|
|
476
|
+
'-m',
|
|
477
|
+
commitMessage,
|
|
478
|
+
],
|
|
479
|
+
env: {
|
|
480
|
+
GIT_COMMITTER_NAME: authorName,
|
|
481
|
+
GIT_COMMITTER_EMAIL: authorEmail,
|
|
482
|
+
},
|
|
447
483
|
clearOnSuccess: true,
|
|
448
484
|
});
|
|
449
485
|
}
|