@agentuity/cli 1.0.7 → 1.0.9
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/cli.d.ts.map +1 -1
- package/dist/cli.js +32 -4
- package/dist/cli.js.map +1 -1
- package/dist/cmd/ai/claude-code/constants.d.ts +13 -0
- package/dist/cmd/ai/claude-code/constants.d.ts.map +1 -0
- package/dist/cmd/ai/claude-code/constants.js +16 -0
- package/dist/cmd/ai/claude-code/constants.js.map +1 -0
- package/dist/cmd/ai/claude-code/index.d.ts +3 -0
- package/dist/cmd/ai/claude-code/index.d.ts.map +1 -0
- package/dist/cmd/ai/claude-code/index.js +22 -0
- package/dist/cmd/ai/claude-code/index.js.map +1 -0
- package/dist/cmd/ai/claude-code/install.d.ts +3 -0
- package/dist/cmd/ai/claude-code/install.d.ts.map +1 -0
- package/dist/cmd/ai/claude-code/install.js +133 -0
- package/dist/cmd/ai/claude-code/install.js.map +1 -0
- package/dist/cmd/ai/claude-code/uninstall.d.ts +3 -0
- package/dist/cmd/ai/claude-code/uninstall.d.ts.map +1 -0
- package/dist/cmd/ai/claude-code/uninstall.js +105 -0
- package/dist/cmd/ai/claude-code/uninstall.js.map +1 -0
- package/dist/cmd/ai/index.d.ts.map +1 -1
- package/dist/cmd/ai/index.js +6 -0
- package/dist/cmd/ai/index.js.map +1 -1
- package/dist/cmd/build/vite/db-rewrite.d.ts +50 -0
- package/dist/cmd/build/vite/db-rewrite.d.ts.map +1 -0
- package/dist/cmd/build/vite/db-rewrite.js +169 -0
- package/dist/cmd/build/vite/db-rewrite.js.map +1 -0
- package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
- package/dist/cmd/build/vite/registry-generator.js +7 -0
- package/dist/cmd/build/vite/registry-generator.js.map +1 -1
- package/dist/cmd/build/vite/server-bundler.d.ts.map +1 -1
- package/dist/cmd/build/vite/server-bundler.js +71 -1
- package/dist/cmd/build/vite/server-bundler.js.map +1 -1
- package/dist/cmd/canary/index.d.ts.map +1 -1
- package/dist/cmd/canary/index.js +3 -1
- package/dist/cmd/canary/index.js.map +1 -1
- package/dist/cmd/cloud/agent/list.d.ts.map +1 -1
- package/dist/cmd/cloud/agent/list.js +17 -4
- package/dist/cmd/cloud/agent/list.js.map +1 -1
- package/dist/cmd/cloud/apikey/list.d.ts.map +1 -1
- package/dist/cmd/cloud/apikey/list.js +3 -0
- package/dist/cmd/cloud/apikey/list.js.map +1 -1
- package/dist/cmd/cloud/db/list.d.ts.map +1 -1
- package/dist/cmd/cloud/db/list.js +2 -1
- package/dist/cmd/cloud/db/list.js.map +1 -1
- package/dist/cmd/cloud/deployment/list.d.ts.map +1 -1
- package/dist/cmd/cloud/deployment/list.js +14 -6
- package/dist/cmd/cloud/deployment/list.js.map +1 -1
- package/dist/cmd/cloud/deployment/remove.js +2 -2
- package/dist/cmd/cloud/deployment/remove.js.map +1 -1
- package/dist/cmd/cloud/deployment/rollback.js +2 -2
- package/dist/cmd/cloud/deployment/rollback.js.map +1 -1
- package/dist/cmd/cloud/deployment/show.js +2 -2
- package/dist/cmd/cloud/deployment/show.js.map +1 -1
- package/dist/cmd/cloud/deployment/undeploy.js +2 -2
- package/dist/cmd/cloud/deployment/undeploy.js.map +1 -1
- package/dist/cmd/cloud/env/list.d.ts.map +1 -1
- package/dist/cmd/cloud/env/list.js +14 -4
- package/dist/cmd/cloud/env/list.js.map +1 -1
- package/dist/cmd/cloud/eval/list.d.ts.map +1 -1
- package/dist/cmd/cloud/eval/list.js +6 -1
- package/dist/cmd/cloud/eval/list.js.map +1 -1
- package/dist/cmd/cloud/eval-run/list.d.ts.map +1 -1
- package/dist/cmd/cloud/eval-run/list.js +6 -1
- package/dist/cmd/cloud/eval-run/list.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/list-namespaces.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/list-namespaces.js +5 -2
- package/dist/cmd/cloud/keyvalue/list-namespaces.js.map +1 -1
- package/dist/cmd/cloud/keyvalue/util.d.ts +1 -1
- package/dist/cmd/cloud/keyvalue/util.d.ts.map +1 -1
- package/dist/cmd/cloud/keyvalue/util.js +3 -2
- package/dist/cmd/cloud/keyvalue/util.js.map +1 -1
- package/dist/cmd/cloud/machine/list.d.ts.map +1 -1
- package/dist/cmd/cloud/machine/list.js +5 -2
- package/dist/cmd/cloud/machine/list.js.map +1 -1
- package/dist/cmd/cloud/queue/list.d.ts.map +1 -1
- package/dist/cmd/cloud/queue/list.js +3 -1
- package/dist/cmd/cloud/queue/list.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 -3
- package/dist/cmd/cloud/sandbox/execution/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/list.js +4 -1
- package/dist/cmd/cloud/sandbox/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 -2
- package/dist/cmd/cloud/sandbox/runtime/list.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 -2
- package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -1
- package/dist/cmd/cloud/session/list.d.ts.map +1 -1
- package/dist/cmd/cloud/session/list.js +6 -1
- package/dist/cmd/cloud/session/list.js.map +1 -1
- package/dist/cmd/cloud/storage/list.d.ts.map +1 -1
- package/dist/cmd/cloud/storage/list.js +2 -1
- package/dist/cmd/cloud/storage/list.js.map +1 -1
- package/dist/cmd/cloud/stream/list.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/list.js +5 -2
- package/dist/cmd/cloud/stream/list.js.map +1 -1
- package/dist/cmd/cloud/thread/list.d.ts.map +1 -1
- package/dist/cmd/cloud/thread/list.js +4 -1
- package/dist/cmd/cloud/thread/list.js.map +1 -1
- package/dist/cmd/cloud/vector/list-namespaces.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/list-namespaces.js +5 -2
- package/dist/cmd/cloud/vector/list-namespaces.js.map +1 -1
- package/dist/cmd/cloud/vector/util.d.ts +1 -1
- package/dist/cmd/cloud/vector/util.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/util.js +3 -2
- package/dist/cmd/cloud/vector/util.js.map +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +2 -0
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/cmd/project/add/database.d.ts.map +1 -1
- package/dist/cmd/project/add/database.js +43 -3
- package/dist/cmd/project/add/database.js.map +1 -1
- package/dist/cmd/project/add/storage.d.ts.map +1 -1
- package/dist/cmd/project/add/storage.js +43 -3
- package/dist/cmd/project/add/storage.js.map +1 -1
- package/dist/cmd/upgrade/index.d.ts.map +1 -1
- package/dist/cmd/upgrade/index.js +25 -10
- package/dist/cmd/upgrade/index.js.map +1 -1
- package/dist/cmd/upgrade/npm-availability.d.ts +45 -12
- package/dist/cmd/upgrade/npm-availability.d.ts.map +1 -1
- package/dist/cmd/upgrade/npm-availability.js +73 -26
- package/dist/cmd/upgrade/npm-availability.js.map +1 -1
- package/dist/version-check.d.ts.map +1 -1
- package/dist/version-check.js +15 -2
- package/dist/version-check.js.map +1 -1
- package/package.json +6 -6
- package/src/cli.ts +41 -4
- package/src/cmd/ai/claude-code/constants.ts +26 -0
- package/src/cmd/ai/claude-code/index.ts +23 -0
- package/src/cmd/ai/claude-code/install.ts +181 -0
- package/src/cmd/ai/claude-code/uninstall.ts +122 -0
- package/src/cmd/ai/index.ts +6 -0
- package/src/cmd/build/vite/db-rewrite.ts +189 -0
- package/src/cmd/build/vite/registry-generator.ts +7 -0
- package/src/cmd/build/vite/server-bundler.ts +89 -3
- package/src/cmd/canary/index.ts +3 -1
- package/src/cmd/cloud/agent/list.ts +19 -4
- package/src/cmd/cloud/apikey/list.ts +4 -0
- package/src/cmd/cloud/db/list.ts +2 -1
- package/src/cmd/cloud/deployment/list.ts +16 -6
- package/src/cmd/cloud/deployment/remove.ts +2 -2
- package/src/cmd/cloud/deployment/rollback.ts +2 -2
- package/src/cmd/cloud/deployment/show.ts +2 -2
- package/src/cmd/cloud/deployment/undeploy.ts +2 -2
- package/src/cmd/cloud/env/list.ts +17 -4
- package/src/cmd/cloud/eval/list.ts +7 -1
- package/src/cmd/cloud/eval-run/list.ts +7 -1
- package/src/cmd/cloud/keyvalue/list-namespaces.ts +5 -2
- package/src/cmd/cloud/keyvalue/util.ts +12 -8
- package/src/cmd/cloud/machine/list.ts +5 -2
- package/src/cmd/cloud/queue/list.ts +3 -1
- package/src/cmd/cloud/sandbox/execution/list.ts +11 -3
- package/src/cmd/cloud/sandbox/list.ts +5 -1
- package/src/cmd/cloud/sandbox/runtime/list.ts +4 -2
- package/src/cmd/cloud/sandbox/snapshot/list.ts +4 -2
- package/src/cmd/cloud/session/list.ts +7 -1
- package/src/cmd/cloud/storage/list.ts +2 -1
- package/src/cmd/cloud/stream/list.ts +7 -2
- package/src/cmd/cloud/thread/list.ts +5 -1
- package/src/cmd/cloud/vector/list-namespaces.ts +5 -2
- package/src/cmd/cloud/vector/util.ts +12 -8
- package/src/cmd/dev/index.ts +2 -0
- package/src/cmd/project/add/database.ts +54 -3
- package/src/cmd/project/add/storage.ts +54 -3
- package/src/cmd/upgrade/index.ts +36 -11
- package/src/cmd/upgrade/npm-availability.ts +106 -36
- package/src/version-check.ts +22 -2
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import { readdir, stat } from 'node:fs/promises';
|
|
8
8
|
import type { Logger } from '../../../types';
|
|
9
|
-
import type { BunPlugin } from 'bun';
|
|
9
|
+
import type { BunPlugin, BuildOutput } from 'bun';
|
|
10
10
|
import { generatePatches, applyPatch } from '../patch';
|
|
11
|
+
import { getLoaderForPath, rewriteBunImports, rewritePgImports } from './db-rewrite';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Format a Bun build log (BuildMessage or ResolveMessage) into a readable string
|
|
@@ -73,6 +74,7 @@ export async function installExternalsAndBuild(options: ServerBundleOptions): Pr
|
|
|
73
74
|
// Load custom externals and define from agentuity.config.ts if it exists
|
|
74
75
|
const customExternals: string[] = [];
|
|
75
76
|
let userDefine: Record<string, string> = {};
|
|
77
|
+
let dbRewriteEnabled = true;
|
|
76
78
|
const configPath = join(rootDir, 'agentuity.config.ts');
|
|
77
79
|
if (await Bun.file(configPath).exists()) {
|
|
78
80
|
try {
|
|
@@ -96,6 +98,12 @@ export async function installExternalsAndBuild(options: ServerBundleOptions): Pr
|
|
|
96
98
|
);
|
|
97
99
|
}
|
|
98
100
|
}
|
|
101
|
+
|
|
102
|
+
// Allow users to disable db rewrite plugin
|
|
103
|
+
if (userConfig?.build?.dbRewrite === false) {
|
|
104
|
+
dbRewriteEnabled = false;
|
|
105
|
+
logger.debug('DB rewrite: disabled via agentuity.config.ts');
|
|
106
|
+
}
|
|
99
107
|
} catch (error) {
|
|
100
108
|
logger.debug('Failed to load agentuity.config.ts for externals:', error);
|
|
101
109
|
}
|
|
@@ -308,6 +316,84 @@ export async function installExternalsAndBuild(options: ServerBundleOptions): Pr
|
|
|
308
316
|
},
|
|
309
317
|
};
|
|
310
318
|
|
|
319
|
+
// Detect files belonging to @agentuity/postgres or @agentuity/drizzle.
|
|
320
|
+
// Matches both published paths (node_modules/@agentuity/postgres/) and
|
|
321
|
+
// symlinked/monorepo paths (packages/postgres/dist/, packages/postgres/src/).
|
|
322
|
+
const isAgentuityPostgres = (filePath: string) =>
|
|
323
|
+
filePath.includes('/@agentuity/postgres/') ||
|
|
324
|
+
filePath.includes('\\@agentuity\\postgres\\') ||
|
|
325
|
+
filePath.includes('/packages/postgres/');
|
|
326
|
+
|
|
327
|
+
const isAgentuityDrizzle = (filePath: string) =>
|
|
328
|
+
filePath.includes('/@agentuity/drizzle/') ||
|
|
329
|
+
filePath.includes('\\@agentuity\\drizzle\\') ||
|
|
330
|
+
filePath.includes('/packages/drizzle/');
|
|
331
|
+
|
|
332
|
+
const dbRewritePlugin: BunPlugin = {
|
|
333
|
+
name: 'agentuity:db-rewrite',
|
|
334
|
+
setup(build) {
|
|
335
|
+
build.onResolve({ filter: /^drizzle-orm\/bun-sql$/ }, (args) => {
|
|
336
|
+
// Don't redirect if the importer is @agentuity/drizzle itself — that would create a cycle.
|
|
337
|
+
// Matches both published packages in node_modules and symlinked monorepo paths.
|
|
338
|
+
if (args.importer && isAgentuityDrizzle(args.importer)) {
|
|
339
|
+
return; // Let default resolution handle it
|
|
340
|
+
}
|
|
341
|
+
// Resolve to @agentuity/drizzle — the bundler will find it in node_modules
|
|
342
|
+
// and bundle it into .agentuity/app.js (NOT kept external).
|
|
343
|
+
const resolved = import.meta.resolveSync('@agentuity/drizzle', args.importer);
|
|
344
|
+
logger.debug('DB rewrite: redirected drizzle-orm/bun-sql → @agentuity/drizzle');
|
|
345
|
+
return { path: resolved };
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
build.onLoad(
|
|
349
|
+
{
|
|
350
|
+
filter: /\.[cm]?[jt]sx?$/,
|
|
351
|
+
namespace: 'file',
|
|
352
|
+
},
|
|
353
|
+
async (args) => {
|
|
354
|
+
// Skip node_modules and the rewrite-target packages themselves.
|
|
355
|
+
// The symlink check is needed because symlinked packages (e.g. via
|
|
356
|
+
// workspace links) resolve to paths outside node_modules/ (like
|
|
357
|
+
// ../../sdk/packages/postgres/dist/) and would otherwise be rewritten,
|
|
358
|
+
// creating circular imports (postgres importing from itself).
|
|
359
|
+
if (
|
|
360
|
+
args.path.includes('/node_modules/') ||
|
|
361
|
+
isAgentuityPostgres(args.path) ||
|
|
362
|
+
isAgentuityDrizzle(args.path)
|
|
363
|
+
) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const contents = await Bun.file(args.path).text();
|
|
367
|
+
let updated = contents;
|
|
368
|
+
let didRewrite = false;
|
|
369
|
+
|
|
370
|
+
const bunResult = rewriteBunImports(updated);
|
|
371
|
+
if (bunResult.changed) {
|
|
372
|
+
logger.debug('DB rewrite: redirected bun → @agentuity/postgres');
|
|
373
|
+
updated = bunResult.contents;
|
|
374
|
+
didRewrite = true;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const pgResult = rewritePgImports(updated);
|
|
378
|
+
if (pgResult.changed) {
|
|
379
|
+
logger.debug('DB rewrite: redirected pg → @agentuity/postgres');
|
|
380
|
+
updated = pgResult.contents;
|
|
381
|
+
didRewrite = true;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (!didRewrite) {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
return {
|
|
389
|
+
contents: updated,
|
|
390
|
+
loader: getLoaderForPath(args.path) as Bun.Loader,
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
);
|
|
394
|
+
},
|
|
395
|
+
};
|
|
396
|
+
|
|
311
397
|
const buildConfig = {
|
|
312
398
|
entrypoints: [entryPath],
|
|
313
399
|
outdir: outDir, // Output to .agentuity/ directly (not .agentuity/server/)
|
|
@@ -322,7 +408,7 @@ export async function installExternalsAndBuild(options: ServerBundleOptions): Pr
|
|
|
322
408
|
// Without this, NODE_ENV and other env vars get inlined as string literals
|
|
323
409
|
env: 'disable' as const,
|
|
324
410
|
define: userDefine, // Include custom define values from agentuity.config.ts
|
|
325
|
-
plugins: [patchPlugin],
|
|
411
|
+
plugins: dbRewriteEnabled ? [patchPlugin, dbRewritePlugin] : [patchPlugin],
|
|
326
412
|
naming: {
|
|
327
413
|
entry: 'app.js', // Output as app.js (not app.generated.js)
|
|
328
414
|
},
|
|
@@ -345,7 +431,7 @@ export async function installExternalsAndBuild(options: ServerBundleOptions): Pr
|
|
|
345
431
|
|
|
346
432
|
logger.debug(`Entry point verified: ${entryPath}`);
|
|
347
433
|
|
|
348
|
-
let result;
|
|
434
|
+
let result: BuildOutput;
|
|
349
435
|
try {
|
|
350
436
|
result = await Bun.build(buildConfig);
|
|
351
437
|
} catch (error: unknown) {
|
package/src/cmd/canary/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createCommand } from '../../types';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { $ } from 'bun';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
4
5
|
import * as tui from '../../tui';
|
|
5
6
|
|
|
6
7
|
const CANARY_BASE_URL = 'https://agentuity-sdk-objects.t3.storageapi.dev/npm';
|
|
@@ -99,7 +100,8 @@ export const command = createCommand({
|
|
|
99
100
|
|
|
100
101
|
try {
|
|
101
102
|
// Install the canary version globally using the tarball URL
|
|
102
|
-
|
|
103
|
+
// Run from tmpdir to avoid interference from any local package.json/node_modules
|
|
104
|
+
const installResult = await $`bun add -g ${tarballUrl}`.cwd(tmpdir()).quiet().nothrow();
|
|
103
105
|
|
|
104
106
|
if (installResult.exitCode !== 0) {
|
|
105
107
|
const stderr = installResult.stderr.toString();
|
|
@@ -11,7 +11,8 @@ export const listSubcommand = createSubcommand({
|
|
|
11
11
|
name: 'list',
|
|
12
12
|
description: 'List agents for a project',
|
|
13
13
|
aliases: ['ls'],
|
|
14
|
-
requires: { auth: true, apiClient: true
|
|
14
|
+
requires: { auth: true, apiClient: true },
|
|
15
|
+
optional: { project: true },
|
|
15
16
|
examples: [
|
|
16
17
|
{ command: getCommand('cloud agent list'), description: 'List items' },
|
|
17
18
|
{ command: getCommand('cloud agent list --verbose'), description: 'Use verbose option' },
|
|
@@ -21,13 +22,26 @@ export const listSubcommand = createSubcommand({
|
|
|
21
22
|
options: z.object({
|
|
22
23
|
deploymentId: z.string().optional().describe('Filter by deployment ID'),
|
|
23
24
|
verbose: z.boolean().optional().default(false).describe('Show full descriptions'),
|
|
25
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
26
|
+
projectId: z.string().optional().describe('filter by project id'),
|
|
24
27
|
}),
|
|
25
28
|
response: z.array(AgentSchema),
|
|
26
29
|
},
|
|
27
|
-
webUrl: (ctx) =>
|
|
30
|
+
webUrl: (ctx) => {
|
|
31
|
+
const projectId = ctx.opts?.projectId || ctx.project?.projectId;
|
|
32
|
+
return projectId ? `/projects/${encodeURIComponent(projectId)}/agents` : undefined;
|
|
33
|
+
},
|
|
28
34
|
async handler(ctx) {
|
|
29
|
-
const { opts,
|
|
30
|
-
|
|
35
|
+
const { opts, project, options, apiClient } = ctx;
|
|
36
|
+
|
|
37
|
+
if (opts?.orgId && opts?.projectId) {
|
|
38
|
+
tui.fatal('--org-id and --project-id are mutually exclusive. Use one or the other.');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const projectId = opts?.projectId || project?.projectId;
|
|
42
|
+
if (!projectId) {
|
|
43
|
+
tui.fatal('Project ID is required. Use --project-id or run from a project directory.');
|
|
44
|
+
}
|
|
31
45
|
const verbose = opts?.verbose ?? false;
|
|
32
46
|
|
|
33
47
|
const agents = await tui.spinner({
|
|
@@ -36,6 +50,7 @@ export const listSubcommand = createSubcommand({
|
|
|
36
50
|
callback: async () => {
|
|
37
51
|
return projectAgentList(apiClient, projectId, {
|
|
38
52
|
deploymentId: opts?.deploymentId,
|
|
53
|
+
orgId: opts?.orgId,
|
|
39
54
|
});
|
|
40
55
|
},
|
|
41
56
|
});
|
|
@@ -25,6 +25,10 @@ export const listSubcommand = createSubcommand({
|
|
|
25
25
|
async handler(ctx) {
|
|
26
26
|
const { opts, apiClient, options } = ctx;
|
|
27
27
|
|
|
28
|
+
if (opts?.orgId && opts?.projectId) {
|
|
29
|
+
tui.fatal('--org-id and --project-id are mutually exclusive. Use one or the other.');
|
|
30
|
+
}
|
|
31
|
+
|
|
28
32
|
const apiKeys = await tui.spinner('Fetching API keys', () => {
|
|
29
33
|
return apikeyList(apiClient, {
|
|
30
34
|
orgId: opts?.orgId,
|
package/src/cmd/cloud/db/list.ts
CHANGED
|
@@ -38,6 +38,7 @@ export const listSubcommand = createSubcommand({
|
|
|
38
38
|
],
|
|
39
39
|
schema: {
|
|
40
40
|
options: z.object({
|
|
41
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
41
42
|
showCredentials: z
|
|
42
43
|
.boolean()
|
|
43
44
|
.optional()
|
|
@@ -59,7 +60,7 @@ export const listSubcommand = createSubcommand({
|
|
|
59
60
|
message: 'Fetching databases',
|
|
60
61
|
clearOnSuccess: true,
|
|
61
62
|
callback: async () => {
|
|
62
|
-
return listOrgResources(catalystClient, { type: 'db' });
|
|
63
|
+
return listOrgResources(catalystClient, { type: 'db', orgId: opts?.orgId });
|
|
63
64
|
},
|
|
64
65
|
});
|
|
65
66
|
|
|
@@ -2,7 +2,6 @@ import { z } from 'zod';
|
|
|
2
2
|
import { createSubcommand } from '../../../types';
|
|
3
3
|
import * as tui from '../../../tui';
|
|
4
4
|
import { projectDeploymentList } from '@agentuity/server';
|
|
5
|
-
import { resolveProjectId } from './utils';
|
|
6
5
|
import { getCommand } from '../../../command-prefix';
|
|
7
6
|
import { ErrorCode } from '../../../errors';
|
|
8
7
|
|
|
@@ -49,7 +48,8 @@ export const listSubcommand = createSubcommand({
|
|
|
49
48
|
},
|
|
50
49
|
schema: {
|
|
51
50
|
options: z.object({
|
|
52
|
-
|
|
51
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
52
|
+
projectId: z.string().optional().describe('filter by project id'),
|
|
53
53
|
count: z.coerce
|
|
54
54
|
.number()
|
|
55
55
|
.int()
|
|
@@ -61,15 +61,25 @@ export const listSubcommand = createSubcommand({
|
|
|
61
61
|
response: DeploymentListResponseSchema,
|
|
62
62
|
},
|
|
63
63
|
webUrl: (ctx) => {
|
|
64
|
-
const projectId = ctx.opts?.
|
|
64
|
+
const projectId = ctx.opts?.projectId || ctx.project?.projectId;
|
|
65
65
|
return projectId ? `/projects/${encodeURIComponent(projectId)}/deployments` : undefined;
|
|
66
66
|
},
|
|
67
67
|
async handler(ctx) {
|
|
68
|
-
const
|
|
69
|
-
|
|
68
|
+
const { opts, options, project, apiClient } = ctx;
|
|
69
|
+
|
|
70
|
+
if (opts?.orgId && opts?.projectId) {
|
|
71
|
+
tui.fatal('--org-id and --project-id are mutually exclusive. Use one or the other.');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const projectId = opts?.projectId || project?.projectId;
|
|
75
|
+
if (!projectId) {
|
|
76
|
+
tui.fatal('Project ID is required. Use --project-id or run from a project directory.');
|
|
77
|
+
}
|
|
70
78
|
|
|
71
79
|
try {
|
|
72
|
-
const deployments = await projectDeploymentList(apiClient, projectId, opts.count
|
|
80
|
+
const deployments = await projectDeploymentList(apiClient, projectId, opts.count, {
|
|
81
|
+
orgId: opts?.orgId,
|
|
82
|
+
});
|
|
73
83
|
|
|
74
84
|
const result = deployments.map((d) => ({
|
|
75
85
|
id: d.id,
|
|
@@ -40,13 +40,13 @@ export const removeSubcommand = createSubcommand({
|
|
|
40
40
|
deployment_id: z.string().describe('Deployment ID'),
|
|
41
41
|
}),
|
|
42
42
|
options: z.object({
|
|
43
|
-
|
|
43
|
+
projectId: z.string().optional().describe('filter by project id'),
|
|
44
44
|
force: z.boolean().default(false).describe('Force removal without confirmation'),
|
|
45
45
|
}),
|
|
46
46
|
response: DeploymentRemoveResponseSchema,
|
|
47
47
|
},
|
|
48
48
|
async handler(ctx) {
|
|
49
|
-
const projectId = resolveProjectId(ctx, { projectId: ctx.opts
|
|
49
|
+
const projectId = resolveProjectId(ctx, { projectId: ctx.opts.projectId });
|
|
50
50
|
const { apiClient, args, opts } = ctx;
|
|
51
51
|
|
|
52
52
|
if (!opts.force) {
|
|
@@ -38,12 +38,12 @@ export const rollbackSubcommand = createSubcommand({
|
|
|
38
38
|
prerequisites: ['cloud deploy'],
|
|
39
39
|
schema: {
|
|
40
40
|
options: z.object({
|
|
41
|
-
|
|
41
|
+
projectId: z.string().optional().describe('filter by project id'),
|
|
42
42
|
}),
|
|
43
43
|
response: DeploymentRollbackResponseSchema,
|
|
44
44
|
},
|
|
45
45
|
async handler(ctx) {
|
|
46
|
-
const projectId = resolveProjectId(ctx, { projectId: ctx.opts
|
|
46
|
+
const projectId = resolveProjectId(ctx, { projectId: ctx.opts.projectId });
|
|
47
47
|
const { apiClient } = ctx;
|
|
48
48
|
|
|
49
49
|
try {
|
|
@@ -77,13 +77,13 @@ export const showSubcommand = createSubcommand({
|
|
|
77
77
|
deployment_id: z.string().describe('Deployment ID'),
|
|
78
78
|
}),
|
|
79
79
|
options: z.object({
|
|
80
|
-
|
|
80
|
+
projectId: z.string().optional().describe('filter by project id'),
|
|
81
81
|
}),
|
|
82
82
|
response: DeploymentShowResponseSchema,
|
|
83
83
|
},
|
|
84
84
|
idempotent: true,
|
|
85
85
|
async handler(ctx) {
|
|
86
|
-
const projectId = resolveProjectId(ctx, { projectId: ctx.opts
|
|
86
|
+
const projectId = resolveProjectId(ctx, { projectId: ctx.opts.projectId });
|
|
87
87
|
const { apiClient, args, options } = ctx;
|
|
88
88
|
|
|
89
89
|
try {
|
|
@@ -28,12 +28,12 @@ export const undeploySubcommand = createSubcommand({
|
|
|
28
28
|
prerequisites: ['cloud deploy'],
|
|
29
29
|
schema: {
|
|
30
30
|
options: z.object({
|
|
31
|
-
|
|
31
|
+
projectId: z.string().optional().describe('filter by project id'),
|
|
32
32
|
force: z.boolean().default(false).describe('Force undeploy without confirmation'),
|
|
33
33
|
}),
|
|
34
34
|
},
|
|
35
35
|
async handler(ctx) {
|
|
36
|
-
const projectId = resolveProjectId(ctx, { projectId: ctx.opts
|
|
36
|
+
const projectId = resolveProjectId(ctx, { projectId: ctx.opts.projectId });
|
|
37
37
|
const { apiClient, opts } = ctx;
|
|
38
38
|
|
|
39
39
|
if (!opts.force) {
|
|
@@ -43,6 +43,8 @@ export const listSubcommand = createSubcommand({
|
|
|
43
43
|
.union([z.boolean(), z.string()])
|
|
44
44
|
.optional()
|
|
45
45
|
.describe('list organization-level variables only (use --org for default org)'),
|
|
46
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
47
|
+
projectId: z.string().optional().describe('filter by project id'),
|
|
46
48
|
}),
|
|
47
49
|
response: EnvListResponseSchema,
|
|
48
50
|
},
|
|
@@ -58,7 +60,12 @@ export const listSubcommand = createSubcommand({
|
|
|
58
60
|
|
|
59
61
|
async handler(ctx) {
|
|
60
62
|
const { opts, apiClient, project, options, config } = ctx;
|
|
61
|
-
|
|
63
|
+
|
|
64
|
+
if (opts?.orgId && opts?.projectId) {
|
|
65
|
+
tui.fatal('--org-id and --project-id are mutually exclusive. Use one or the other.');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const useOrgScope = isOrgScope(opts?.org) || !!opts?.orgId;
|
|
62
69
|
|
|
63
70
|
// Build combined result with type info and scope
|
|
64
71
|
const result: Record<string, { value: string; secret: boolean; scope: 'project' | 'org' }> =
|
|
@@ -70,7 +77,12 @@ export const listSubcommand = createSubcommand({
|
|
|
70
77
|
|
|
71
78
|
if (useOrgScope) {
|
|
72
79
|
// Organization scope only
|
|
73
|
-
const orgId =
|
|
80
|
+
const orgId =
|
|
81
|
+
opts?.orgId ??
|
|
82
|
+
(opts?.org ? await resolveOrgId(apiClient, config, opts.org) : undefined);
|
|
83
|
+
if (!orgId) {
|
|
84
|
+
tui.fatal('Organization ID is required. Use --org-id or --org flag.');
|
|
85
|
+
}
|
|
74
86
|
|
|
75
87
|
const orgData = await tui.spinner('Fetching organization variables', () => {
|
|
76
88
|
return orgEnvGet(apiClient, { id: orgId, mask: false });
|
|
@@ -90,11 +102,12 @@ export const listSubcommand = createSubcommand({
|
|
|
90
102
|
result[key] = { value, secret: true, scope: 'org' };
|
|
91
103
|
}
|
|
92
104
|
}
|
|
93
|
-
} else if (project) {
|
|
105
|
+
} else if (opts?.projectId || project) {
|
|
94
106
|
// Project context: show merged view (org + project, project takes precedence)
|
|
95
107
|
// First, get project's org ID and fetch org env
|
|
108
|
+
const effectiveProjectId = opts?.projectId || project!.projectId;
|
|
96
109
|
const projectData = await tui.spinner('Fetching variables', () => {
|
|
97
|
-
return projectGet(apiClient, { id:
|
|
110
|
+
return projectGet(apiClient, { id: effectiveProjectId, mask: false });
|
|
98
111
|
});
|
|
99
112
|
|
|
100
113
|
const projectEnv = projectData.env || {};
|
|
@@ -56,6 +56,7 @@ export const listSubcommand = createSubcommand({
|
|
|
56
56
|
},
|
|
57
57
|
schema: {
|
|
58
58
|
options: z.object({
|
|
59
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
59
60
|
count: z.coerce
|
|
60
61
|
.number()
|
|
61
62
|
.int()
|
|
@@ -76,10 +77,15 @@ export const listSubcommand = createSubcommand({
|
|
|
76
77
|
async handler(ctx) {
|
|
77
78
|
const { apiClient, project, opts, options } = ctx;
|
|
78
79
|
|
|
79
|
-
|
|
80
|
+
if (opts?.orgId && opts?.projectId) {
|
|
81
|
+
tui.fatal('--org-id and --project-id are mutually exclusive. Use one or the other.');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const projectId = opts.all || opts.orgId ? undefined : opts.projectId || project?.projectId;
|
|
80
85
|
|
|
81
86
|
try {
|
|
82
87
|
const evals = await evalList(apiClient, {
|
|
88
|
+
orgId: opts?.orgId,
|
|
83
89
|
projectId,
|
|
84
90
|
agentId: opts.agentId,
|
|
85
91
|
});
|
|
@@ -65,6 +65,7 @@ export const listSubcommand = createSubcommand({
|
|
|
65
65
|
},
|
|
66
66
|
schema: {
|
|
67
67
|
options: z.object({
|
|
68
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
68
69
|
count: z.coerce
|
|
69
70
|
.number()
|
|
70
71
|
.int()
|
|
@@ -87,10 +88,15 @@ export const listSubcommand = createSubcommand({
|
|
|
87
88
|
async handler(ctx) {
|
|
88
89
|
const { apiClient, project, opts, options } = ctx;
|
|
89
90
|
|
|
90
|
-
|
|
91
|
+
if (opts?.orgId && opts?.projectId) {
|
|
92
|
+
tui.fatal('--org-id and --project-id are mutually exclusive. Use one or the other.');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const projectId = opts.all || opts.orgId ? undefined : opts.projectId || project?.projectId;
|
|
91
96
|
|
|
92
97
|
try {
|
|
93
98
|
const evalRuns = await evalRunList(apiClient, {
|
|
99
|
+
orgId: opts?.orgId,
|
|
94
100
|
projectId,
|
|
95
101
|
evalId: opts.evalId,
|
|
96
102
|
sessionId: opts.sessionId,
|
|
@@ -18,14 +18,17 @@ export const listNamespacesSubcommand = createCommand({
|
|
|
18
18
|
{ command: getCommand('kv ns'), description: 'List namespaces (short alias)' },
|
|
19
19
|
],
|
|
20
20
|
schema: {
|
|
21
|
+
options: z.object({
|
|
22
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
23
|
+
}),
|
|
21
24
|
response: NamespaceListResponseSchema,
|
|
22
25
|
},
|
|
23
26
|
webUrl: '/services/kv',
|
|
24
27
|
idempotent: true,
|
|
25
28
|
|
|
26
29
|
async handler(ctx) {
|
|
27
|
-
const { options } = ctx;
|
|
28
|
-
const storage = await createStorageAdapter(ctx);
|
|
30
|
+
const { options, opts } = ctx;
|
|
31
|
+
const storage = await createStorageAdapter(ctx, opts?.orgId);
|
|
29
32
|
const namespaces = await storage.getNamespaces();
|
|
30
33
|
|
|
31
34
|
if (!options.json) {
|
|
@@ -4,15 +4,19 @@ import type { AuthData, Config, GlobalOptions, ProjectConfig } from '../../../ty
|
|
|
4
4
|
import { getCatalystUrl } from '../../../catalyst';
|
|
5
5
|
import * as tui from '../../../tui';
|
|
6
6
|
|
|
7
|
-
export function createStorageAdapter(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
export function createStorageAdapter(
|
|
8
|
+
ctx: {
|
|
9
|
+
logger: Logger;
|
|
10
|
+
auth: AuthData;
|
|
11
|
+
region: string;
|
|
12
|
+
project?: ProjectConfig;
|
|
13
|
+
config: Config | null;
|
|
14
|
+
options: GlobalOptions;
|
|
15
|
+
},
|
|
16
|
+
explicitOrgId?: string
|
|
17
|
+
) {
|
|
15
18
|
const orgId =
|
|
19
|
+
explicitOrgId ??
|
|
16
20
|
ctx.project?.orgId ??
|
|
17
21
|
ctx.options.orgId ??
|
|
18
22
|
(process.env.AGENTUITY_CLOUD_ORG_ID || ctx.config?.preferences?.orgId);
|
|
@@ -35,15 +35,18 @@ export const listSubcommand = createSubcommand({
|
|
|
35
35
|
requires: { auth: true },
|
|
36
36
|
idempotent: true,
|
|
37
37
|
schema: {
|
|
38
|
+
options: z.object({
|
|
39
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
40
|
+
}),
|
|
38
41
|
response: MachineListResponseSchema,
|
|
39
42
|
},
|
|
40
43
|
async handler(ctx) {
|
|
41
|
-
const { options, logger, auth, config } = ctx;
|
|
44
|
+
const { options, opts, logger, auth, config } = ctx;
|
|
42
45
|
|
|
43
46
|
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
|
|
44
47
|
|
|
45
48
|
try {
|
|
46
|
-
const machines = await machineList(catalystClient);
|
|
49
|
+
const machines = await machineList(catalystClient, { orgId: opts?.orgId });
|
|
47
50
|
|
|
48
51
|
const result = machines.map((m) => ({
|
|
49
52
|
id: m.id,
|
|
@@ -31,6 +31,7 @@ export const listSubcommand = createCommand({
|
|
|
31
31
|
schema: {
|
|
32
32
|
args: z.object({}),
|
|
33
33
|
options: z.object({
|
|
34
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
34
35
|
limit: z.coerce.number().optional().describe('Maximum number of queues to return'),
|
|
35
36
|
offset: z.coerce.number().optional().describe('Offset for pagination'),
|
|
36
37
|
}),
|
|
@@ -41,13 +42,14 @@ export const listSubcommand = createCommand({
|
|
|
41
42
|
async handler(ctx) {
|
|
42
43
|
const { options, opts } = ctx;
|
|
43
44
|
const client = await createQueueAPIClient(ctx);
|
|
45
|
+
const queueOptions = opts?.orgId ? { orgId: opts.orgId } : getQueueApiOptions(ctx);
|
|
44
46
|
const result = await listQueues(
|
|
45
47
|
client,
|
|
46
48
|
{
|
|
47
49
|
limit: opts.limit,
|
|
48
50
|
offset: opts.offset,
|
|
49
51
|
},
|
|
50
|
-
|
|
52
|
+
queueOptions
|
|
51
53
|
);
|
|
52
54
|
|
|
53
55
|
if (!options.json) {
|
|
@@ -43,18 +43,26 @@ export const listSubcommand = createCommand({
|
|
|
43
43
|
}),
|
|
44
44
|
options: z.object({
|
|
45
45
|
limit: z.number().optional().describe('Maximum number of results (default: 50, max: 100)'),
|
|
46
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
46
47
|
}),
|
|
47
48
|
response: ExecutionListResponseSchema,
|
|
48
49
|
},
|
|
49
50
|
|
|
50
51
|
async handler(ctx) {
|
|
51
|
-
const { args, opts, options, auth, logger, orgId, config } = ctx;
|
|
52
|
-
const
|
|
52
|
+
const { args, opts, options, auth, logger, orgId: ctxOrgId, config } = ctx;
|
|
53
|
+
const effectiveOrgId = opts?.orgId || ctxOrgId;
|
|
54
|
+
const region = await getSandboxRegion(
|
|
55
|
+
logger,
|
|
56
|
+
auth,
|
|
57
|
+
config?.name,
|
|
58
|
+
args.sandboxId,
|
|
59
|
+
effectiveOrgId
|
|
60
|
+
);
|
|
53
61
|
const client = createSandboxClient(logger, auth, region);
|
|
54
62
|
|
|
55
63
|
const result = await executionList(client, {
|
|
56
64
|
sandboxId: args.sandboxId,
|
|
57
|
-
orgId,
|
|
65
|
+
orgId: effectiveOrgId,
|
|
58
66
|
limit: opts.limit,
|
|
59
67
|
});
|
|
60
68
|
|
|
@@ -82,7 +82,11 @@ export const listSubcommand = createCommand({
|
|
|
82
82
|
async handler(ctx) {
|
|
83
83
|
const { opts, options, project, apiClient } = ctx;
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
if (opts?.orgId && opts?.projectId) {
|
|
86
|
+
tui.fatal('--org-id and --project-id are mutually exclusive. Use one or the other.');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const projectId = opts.all || opts.orgId ? undefined : opts.projectId || project?.projectId;
|
|
86
90
|
|
|
87
91
|
const result = await cliSandboxList(apiClient, {
|
|
88
92
|
projectId,
|
|
@@ -33,16 +33,18 @@ export const listSubcommand = createCommand({
|
|
|
33
33
|
options: z.object({
|
|
34
34
|
limit: z.number().optional().describe('Maximum number of results'),
|
|
35
35
|
offset: z.number().optional().describe('Offset for pagination'),
|
|
36
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
36
37
|
}),
|
|
37
38
|
response: RuntimeListResponseSchema,
|
|
38
39
|
},
|
|
39
40
|
|
|
40
41
|
async handler(ctx) {
|
|
41
|
-
const { opts, options,
|
|
42
|
+
const { opts, options, orgId: ctxOrgId, logger, auth, config } = ctx;
|
|
42
43
|
const client = await getGlobalCatalystAPIClient(logger, auth, config?.name);
|
|
44
|
+
const effectiveOrgId = opts?.orgId || ctxOrgId;
|
|
43
45
|
|
|
44
46
|
const result = await runtimeList(client, {
|
|
45
|
-
orgId,
|
|
47
|
+
orgId: effectiveOrgId,
|
|
46
48
|
limit: opts.limit,
|
|
47
49
|
offset: opts.offset,
|
|
48
50
|
});
|
|
@@ -46,19 +46,21 @@ export const listSubcommand = createCommand({
|
|
|
46
46
|
sandbox: z.string().optional().describe('Filter by sandbox ID'),
|
|
47
47
|
limit: z.number().optional().describe('Maximum number of results'),
|
|
48
48
|
offset: z.number().optional().describe('Offset for pagination'),
|
|
49
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
49
50
|
}),
|
|
50
51
|
response: SnapshotListResponseSchema,
|
|
51
52
|
},
|
|
52
53
|
|
|
53
54
|
async handler(ctx) {
|
|
54
|
-
const { opts, options,
|
|
55
|
+
const { opts, options, orgId: ctxOrgId, logger, auth, config } = ctx;
|
|
55
56
|
const client = await getGlobalCatalystAPIClient(logger, auth, config?.name);
|
|
57
|
+
const effectiveOrgId = opts?.orgId || ctxOrgId;
|
|
56
58
|
|
|
57
59
|
const result = await snapshotList(client, {
|
|
58
60
|
sandboxId: opts.sandbox,
|
|
59
61
|
limit: opts.limit,
|
|
60
62
|
offset: opts.offset,
|
|
61
|
-
orgId,
|
|
63
|
+
orgId: effectiveOrgId,
|
|
62
64
|
});
|
|
63
65
|
|
|
64
66
|
if (!options.json) {
|
|
@@ -72,6 +72,7 @@ export const listSubcommand = createSubcommand({
|
|
|
72
72
|
},
|
|
73
73
|
schema: {
|
|
74
74
|
options: z.object({
|
|
75
|
+
orgId: z.string().optional().describe('filter by organization id'),
|
|
75
76
|
count: z.coerce
|
|
76
77
|
.number()
|
|
77
78
|
.int()
|
|
@@ -101,11 +102,16 @@ export const listSubcommand = createSubcommand({
|
|
|
101
102
|
const { logger, auth, project, opts, options, config } = ctx;
|
|
102
103
|
const catalystClient = await getGlobalCatalystAPIClient(logger, auth, config?.name);
|
|
103
104
|
|
|
104
|
-
|
|
105
|
+
if (opts?.orgId && opts?.projectId) {
|
|
106
|
+
tui.fatal('--org-id and --project-id are mutually exclusive. Use one or the other.');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const projectId = opts.all || opts.orgId ? undefined : opts.projectId || project?.projectId;
|
|
105
110
|
|
|
106
111
|
try {
|
|
107
112
|
const sessions = await sessionList(catalystClient, {
|
|
108
113
|
count: opts.count,
|
|
114
|
+
orgId: opts?.orgId,
|
|
109
115
|
projectId,
|
|
110
116
|
deploymentId: opts.deploymentId,
|
|
111
117
|
trigger: opts.trigger,
|