@agentuity/cli 1.0.32 → 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/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/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/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/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 +7 -7
- 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/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/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 +37 -14
- 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/schema-parser.d.ts.map +1 -1
- package/dist/schema-parser.js +47 -5
- package/dist/schema-parser.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/package.json +6 -6
- package/src/catalyst.ts +9 -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/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/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 +24 -12
- 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 +12 -6
- 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/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/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 +52 -16
- 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/schema-parser.ts +48 -5
- package/src/types.ts +45 -0
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) {
|
|
@@ -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
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { resolve } from 'node:path';
|
|
3
|
-
import {
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { isTTY } from '../../auth';
|
|
4
4
|
import { getCommand } from '../../command-prefix';
|
|
5
|
-
import { runProjectImport } from './reconcile';
|
|
6
|
-
import * as tui from '../../tui';
|
|
7
5
|
import { ErrorCode } from '../../errors';
|
|
8
|
-
import
|
|
6
|
+
import * as tui from '../../tui';
|
|
7
|
+
import { createSubcommand } from '../../types';
|
|
8
|
+
import { runProjectImport } from './reconcile';
|
|
9
|
+
import { runRemoteImport } from './remote-import';
|
|
9
10
|
|
|
10
11
|
const ProjectImportResponseSchema = z.object({
|
|
11
12
|
success: z.boolean().describe('Whether the import succeeded'),
|
|
@@ -20,19 +21,37 @@ const ProjectImportResponseSchema = z.object({
|
|
|
20
21
|
|
|
21
22
|
export const importSubcommand = createSubcommand({
|
|
22
23
|
name: 'import',
|
|
23
|
-
description: 'Import or register a local project with Agentuity Cloud',
|
|
24
|
+
description: 'Import or register a local or remote project with Agentuity Cloud',
|
|
24
25
|
tags: ['mutating', 'creates-resource', 'requires-auth'],
|
|
25
26
|
examples: [
|
|
26
|
-
{
|
|
27
|
+
{
|
|
28
|
+
command: getCommand('project import'),
|
|
29
|
+
description: 'Import project in current directory',
|
|
30
|
+
},
|
|
27
31
|
{
|
|
28
32
|
command: getCommand('project import --dir ./my-agent'),
|
|
29
33
|
description: 'Import project from specified directory',
|
|
30
34
|
},
|
|
35
|
+
{
|
|
36
|
+
command: getCommand('project import --source owner/repo'),
|
|
37
|
+
description: 'Import a remote project from GitHub',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
command: getCommand('project import --source owner/repo --deploy --name my-agent'),
|
|
41
|
+
description: 'Import remote project, name it, and deploy',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
command: getCommand(
|
|
45
|
+
'project import --source owner/repo --remote owner/new-repo --env DATABASE_URL:my_db --env TASK_QUEUE:my_queue'
|
|
46
|
+
),
|
|
47
|
+
description: 'Import with resource provisioning and push to new repo',
|
|
48
|
+
},
|
|
31
49
|
],
|
|
32
50
|
requires: { auth: true, apiClient: true },
|
|
33
|
-
optional: { region: true },
|
|
51
|
+
optional: { region: true, org: true },
|
|
34
52
|
schema: {
|
|
35
53
|
options: z.object({
|
|
54
|
+
source: z.string().optional().describe('GitHub URL or owner/repo to import from'),
|
|
36
55
|
dir: z
|
|
37
56
|
.string()
|
|
38
57
|
.optional()
|
|
@@ -41,17 +60,60 @@ export const importSubcommand = createSubcommand({
|
|
|
41
60
|
.boolean()
|
|
42
61
|
.optional()
|
|
43
62
|
.describe('Only validate the project structure without prompting'),
|
|
63
|
+
deploy: z
|
|
64
|
+
.boolean()
|
|
65
|
+
.optional()
|
|
66
|
+
.default(false)
|
|
67
|
+
.describe('Deploy the project after importing'),
|
|
68
|
+
projectId: z.string().optional().describe('Use a pre-created project ID (skip creation)'),
|
|
69
|
+
remote: z
|
|
70
|
+
.string()
|
|
71
|
+
.optional()
|
|
72
|
+
.describe('Target GitHub repo (owner/repo) to push imported code to'),
|
|
73
|
+
name: z.string().optional().describe('Project name (for non-interactive mode)'),
|
|
74
|
+
env: z
|
|
75
|
+
.array(z.string())
|
|
76
|
+
.optional()
|
|
77
|
+
.describe('Set env vars or name resources (KEY:VALUE format, repeatable)'),
|
|
44
78
|
}),
|
|
45
79
|
response: ProjectImportResponseSchema,
|
|
46
80
|
},
|
|
47
81
|
|
|
48
82
|
async handler(ctx) {
|
|
49
|
-
const { opts, auth, apiClient, config, logger } = ctx;
|
|
83
|
+
const { opts, auth, apiClient, config, logger, orgId, region } = ctx;
|
|
50
84
|
|
|
51
85
|
if (!config) {
|
|
52
86
|
tui.fatal('Configuration not loaded. Please try again.', ErrorCode.CONFIG_INVALID);
|
|
53
87
|
}
|
|
54
88
|
|
|
89
|
+
// If --source is provided, run remote import flow
|
|
90
|
+
const source = opts.source;
|
|
91
|
+
if (source) {
|
|
92
|
+
// Normalize owner/repo shorthand to full GitHub URL
|
|
93
|
+
const url = source.includes('://') ? source : `https://github.com/${source}`;
|
|
94
|
+
await runRemoteImport({
|
|
95
|
+
url,
|
|
96
|
+
deploy: opts.deploy ?? false,
|
|
97
|
+
projectId: opts.projectId,
|
|
98
|
+
repo: opts.remote,
|
|
99
|
+
name: opts.name,
|
|
100
|
+
env: opts.env,
|
|
101
|
+
org: orgId,
|
|
102
|
+
region,
|
|
103
|
+
apiClient,
|
|
104
|
+
auth,
|
|
105
|
+
config,
|
|
106
|
+
logger,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
success: true,
|
|
111
|
+
status: 'imported' as const,
|
|
112
|
+
message: 'Remote project imported successfully',
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// No URL — fall through to existing local import behavior
|
|
55
117
|
const dir = opts.dir ? resolve(opts.dir) : process.cwd();
|
|
56
118
|
const validateOnly = opts.validateOnly ?? false;
|
|
57
119
|
|