@agentuity/cli 0.1.18 → 0.1.20
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/cmd/build/vite/metadata-generator.d.ts.map +1 -1
- package/dist/cmd/build/vite/metadata-generator.js +7 -111
- package/dist/cmd/build/vite/metadata-generator.js.map +1 -1
- package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/get.js +25 -18
- package/dist/cmd/cloud/sandbox/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/list.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/list.js +40 -9
- package/dist/cmd/cloud/sandbox/list.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js +37 -0
- package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js +16 -0
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
- package/dist/types.d.ts +19 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +16 -8
- package/dist/types.js.map +1 -1
- package/dist/utils/git.d.ts +63 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +157 -0
- package/dist/utils/git.js.map +1 -0
- package/package.json +6 -6
- package/src/cmd/build/vite/metadata-generator.ts +8 -139
- package/src/cmd/cloud/sandbox/get.ts +28 -19
- package/src/cmd/cloud/sandbox/list.ts +44 -9
- package/src/cmd/cloud/sandbox/snapshot/build.ts +41 -1
- package/src/cmd/cloud/sandbox/snapshot/get.ts +18 -0
- package/src/types.ts +31 -20
- package/src/utils/git.ts +209 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAA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I,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnB,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IACD,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentuity/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "Agentuity employees and contributors",
|
|
6
6
|
"type": "module",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"prepublishOnly": "bun run clean && bun run build"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@agentuity/auth": "0.1.
|
|
44
|
-
"@agentuity/core": "0.1.
|
|
45
|
-
"@agentuity/server": "0.1.
|
|
43
|
+
"@agentuity/auth": "0.1.20",
|
|
44
|
+
"@agentuity/core": "0.1.20",
|
|
45
|
+
"@agentuity/server": "0.1.20",
|
|
46
46
|
"@datasert/cronjs-parser": "^1.4.0",
|
|
47
47
|
"@terascope/fetch-github-release": "^2.2.1",
|
|
48
48
|
"@vitejs/plugin-react": "^5.1.2",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"typescript": "^5.9.0",
|
|
61
61
|
"vite": "^7.2.7",
|
|
62
62
|
"zod": "^4.3.5",
|
|
63
|
-
"@agentuity/frontend": "0.1.
|
|
63
|
+
"@agentuity/frontend": "0.1.20"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@agentuity/test-utils": "0.1.
|
|
66
|
+
"@agentuity/test-utils": "0.1.20",
|
|
67
67
|
"@types/adm-zip": "^0.5.7",
|
|
68
68
|
"@types/bun": "latest",
|
|
69
69
|
"@types/tar-fs": "^2.0.4",
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* Generates agentuity.metadata.json and .routemapping.json from discovered agents and routes
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { join
|
|
7
|
+
import { join } from 'node:path';
|
|
8
8
|
import { writeFileSync, mkdirSync, existsSync, readFileSync, statSync, readdirSync } from 'node:fs';
|
|
9
9
|
import type { BuildMetadata } from '@agentuity/server';
|
|
10
10
|
import type { AgentMetadata } from './agent-discovery';
|
|
11
11
|
import type { RouteMetadata } from './route-discovery';
|
|
12
12
|
import type { Logger, DeployOptions } from '../../../types';
|
|
13
13
|
import { getVersion } from '../../../version';
|
|
14
|
+
import { getGitInfo, buildGitTags } from '../../../utils/git';
|
|
14
15
|
|
|
15
16
|
interface ViteManifestEntry {
|
|
16
17
|
file: string;
|
|
@@ -473,6 +474,12 @@ export async function generateMetadata(options: MetadataGeneratorOptions): Promi
|
|
|
473
474
|
},
|
|
474
475
|
};
|
|
475
476
|
|
|
477
|
+
// Build tags from git info (includes 'latest', branch, and short commit)
|
|
478
|
+
const gitInfo = metadata.deployment.git;
|
|
479
|
+
if (gitInfo) {
|
|
480
|
+
gitInfo.tags = buildGitTags(gitInfo);
|
|
481
|
+
}
|
|
482
|
+
|
|
476
483
|
if (options.deploymentOptions) {
|
|
477
484
|
const git = { ...(metadata.deployment.git ?? {}), ...options.deploymentOptions };
|
|
478
485
|
if (options.deploymentOptions.pullRequestNumber) {
|
|
@@ -489,144 +496,6 @@ export async function generateMetadata(options: MetadataGeneratorOptions): Promi
|
|
|
489
496
|
return metadata;
|
|
490
497
|
}
|
|
491
498
|
|
|
492
|
-
/**
|
|
493
|
-
* Get git information (branch, repo, provider, tags)
|
|
494
|
-
*/
|
|
495
|
-
async function getGitInfo(
|
|
496
|
-
rootDir: string,
|
|
497
|
-
logger: Logger
|
|
498
|
-
): Promise<
|
|
499
|
-
| {
|
|
500
|
-
branch?: string;
|
|
501
|
-
repo?: string;
|
|
502
|
-
provider?: string;
|
|
503
|
-
tags?: string[];
|
|
504
|
-
commit?: string;
|
|
505
|
-
message?: string;
|
|
506
|
-
}
|
|
507
|
-
| undefined
|
|
508
|
-
> {
|
|
509
|
-
if (!Bun.which('git')) {
|
|
510
|
-
logger.trace('git not found in PATH');
|
|
511
|
-
return undefined;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
try {
|
|
515
|
-
// Find .git directory (may be in parent directories for monorepos)
|
|
516
|
-
let gitDir = join(rootDir, '.git');
|
|
517
|
-
let parentDir = dirname(dirname(gitDir));
|
|
518
|
-
while (!existsSync(gitDir) && parentDir !== dirname(parentDir) && gitDir !== '/') {
|
|
519
|
-
gitDir = join(parentDir, '.git');
|
|
520
|
-
parentDir = dirname(parentDir);
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
if (!existsSync(gitDir)) {
|
|
524
|
-
logger.trace('No .git directory found');
|
|
525
|
-
return undefined;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
const $ = Bun.$;
|
|
529
|
-
const gitInfo: {
|
|
530
|
-
branch?: string;
|
|
531
|
-
repo?: string;
|
|
532
|
-
provider?: string;
|
|
533
|
-
tags?: string[];
|
|
534
|
-
commit?: string;
|
|
535
|
-
message?: string;
|
|
536
|
-
} = {
|
|
537
|
-
provider: 'git',
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
// Get git tags pointing to HEAD
|
|
541
|
-
const tagResult = $`git tag -l --points-at HEAD`.nothrow().quiet();
|
|
542
|
-
if (tagResult) {
|
|
543
|
-
const tagText = await tagResult.text();
|
|
544
|
-
if (tagText) {
|
|
545
|
-
gitInfo.tags = tagText
|
|
546
|
-
.trim()
|
|
547
|
-
.split(/\n/)
|
|
548
|
-
.map((s) => s.trim())
|
|
549
|
-
.filter(Boolean);
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
// Get current branch
|
|
554
|
-
const branchResult = $`git branch --show-current`.nothrow().quiet();
|
|
555
|
-
if (branchResult) {
|
|
556
|
-
const branchText = await branchResult.text();
|
|
557
|
-
if (branchText) {
|
|
558
|
-
gitInfo.branch = branchText.trim();
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
// Get commit SHA
|
|
563
|
-
const commitResult = $`git rev-parse HEAD`.nothrow().quiet();
|
|
564
|
-
if (commitResult) {
|
|
565
|
-
const commitText = await commitResult.text();
|
|
566
|
-
if (commitText) {
|
|
567
|
-
gitInfo.commit = commitText.trim();
|
|
568
|
-
|
|
569
|
-
// Get commit message
|
|
570
|
-
const msgResult = $`git log --pretty=format:%s -n1 ${gitInfo.commit}`.nothrow().quiet();
|
|
571
|
-
if (msgResult) {
|
|
572
|
-
const msgText = await msgResult.text();
|
|
573
|
-
if (msgText) {
|
|
574
|
-
gitInfo.message = msgText.trim();
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
// Get remote origin URL and parse
|
|
581
|
-
const originResult = $`git config --get remote.origin.url`.nothrow().quiet();
|
|
582
|
-
if (originResult) {
|
|
583
|
-
const originText = await originResult.text();
|
|
584
|
-
if (originText) {
|
|
585
|
-
const remoteUrl = originText.trim();
|
|
586
|
-
|
|
587
|
-
// Parse provider and repo from URL
|
|
588
|
-
if (remoteUrl.includes('github.com')) {
|
|
589
|
-
gitInfo.provider = 'github';
|
|
590
|
-
const match = remoteUrl.match(/github\.com[:/](.+?)(?:\.git)?$/);
|
|
591
|
-
if (match) {
|
|
592
|
-
gitInfo.repo = `https://github.com/${match[1]}`;
|
|
593
|
-
}
|
|
594
|
-
} else if (remoteUrl.includes('gitlab.com')) {
|
|
595
|
-
gitInfo.provider = 'gitlab';
|
|
596
|
-
const match = remoteUrl.match(/gitlab\.com[:/](.+?)(?:\.git)?$/);
|
|
597
|
-
if (match) {
|
|
598
|
-
gitInfo.repo = `https://gitlab.com/${match[1]}`;
|
|
599
|
-
}
|
|
600
|
-
} else if (remoteUrl.includes('bitbucket.org')) {
|
|
601
|
-
gitInfo.provider = 'bitbucket';
|
|
602
|
-
const match = remoteUrl.match(/bitbucket\.org[:/](.+?)(?:\.git)?$/);
|
|
603
|
-
if (match) {
|
|
604
|
-
gitInfo.repo = `https://bitbucket.org/${match[1]}`;
|
|
605
|
-
}
|
|
606
|
-
} else {
|
|
607
|
-
gitInfo.repo = remoteUrl;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
// Build tags array with defaults
|
|
613
|
-
const tags = new Set(gitInfo.tags ?? []);
|
|
614
|
-
tags.add('latest');
|
|
615
|
-
if (gitInfo.branch) {
|
|
616
|
-
tags.add(gitInfo.branch);
|
|
617
|
-
}
|
|
618
|
-
if (gitInfo.commit) {
|
|
619
|
-
tags.add(gitInfo.commit.substring(0, 7));
|
|
620
|
-
}
|
|
621
|
-
gitInfo.tags = Array.from(tags);
|
|
622
|
-
|
|
623
|
-
return gitInfo;
|
|
624
|
-
} catch (error) {
|
|
625
|
-
logger.trace(`Failed to get git info: ${error}`);
|
|
626
|
-
return undefined;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
|
|
630
499
|
/**
|
|
631
500
|
* Generate AGENTS.md content for AI coding agents
|
|
632
501
|
*/
|
|
@@ -12,6 +12,22 @@ const SandboxResourcesSchema = z.object({
|
|
|
12
12
|
disk: z.string().optional().describe('Disk limit (e.g., "1Gi", "10Gi")'),
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
+
const SandboxRuntimeInfoSchema = z.object({
|
|
16
|
+
id: z.string().describe('Runtime ID'),
|
|
17
|
+
name: z.string().describe('Runtime name'),
|
|
18
|
+
iconUrl: z.string().optional().describe('URL for runtime icon'),
|
|
19
|
+
brandColor: z.string().optional().describe('Brand color for the runtime'),
|
|
20
|
+
tags: z.array(z.string()).optional().describe('Runtime tags'),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const SandboxSnapshotInfoSchema = z.object({
|
|
24
|
+
id: z.string().describe('Snapshot ID'),
|
|
25
|
+
name: z.string().optional().describe('Snapshot name'),
|
|
26
|
+
tag: z.string().optional().describe('Snapshot tag'),
|
|
27
|
+
fullName: z.string().optional().describe('Full name with org slug'),
|
|
28
|
+
public: z.boolean().describe('Whether snapshot is public'),
|
|
29
|
+
});
|
|
30
|
+
|
|
15
31
|
const SandboxGetResponseSchema = z.object({
|
|
16
32
|
sandboxId: z.string().describe('Sandbox ID'),
|
|
17
33
|
name: z.string().optional().describe('Sandbox name'),
|
|
@@ -19,10 +35,8 @@ const SandboxGetResponseSchema = z.object({
|
|
|
19
35
|
status: z.string().describe('Current status'),
|
|
20
36
|
createdAt: z.string().describe('Creation timestamp'),
|
|
21
37
|
region: z.string().optional().describe('Region where sandbox is running'),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
snapshotId: z.string().optional().describe('Snapshot ID sandbox was created from'),
|
|
25
|
-
snapshotTag: z.string().optional().describe('Snapshot tag sandbox was created from'),
|
|
38
|
+
runtime: SandboxRuntimeInfoSchema.optional().describe('Runtime information'),
|
|
39
|
+
snapshot: SandboxSnapshotInfoSchema.optional().describe('Snapshot information'),
|
|
26
40
|
executions: z.number().describe('Number of executions'),
|
|
27
41
|
stdoutStreamUrl: z.string().optional().describe('URL to stdout output stream'),
|
|
28
42
|
stderrStreamUrl: z.string().optional().describe('URL to stderr output stream'),
|
|
@@ -73,15 +87,6 @@ export const getSubcommand = createCommand({
|
|
|
73
87
|
? tui.colorError
|
|
74
88
|
: tui.colorMuted;
|
|
75
89
|
|
|
76
|
-
const snapshotDisplay =
|
|
77
|
-
result.snapshotId || result.snapshotTag
|
|
78
|
-
? result.snapshotTag
|
|
79
|
-
? result.snapshotId
|
|
80
|
-
? `${result.snapshotTag} ${tui.muted('(' + result.snapshotId + ')')}`
|
|
81
|
-
: result.snapshotTag
|
|
82
|
-
: result.snapshotId
|
|
83
|
-
: undefined;
|
|
84
|
-
|
|
85
90
|
let streamDisplay: string | undefined;
|
|
86
91
|
if (
|
|
87
92
|
result.stdoutStreamUrl &&
|
|
@@ -106,9 +111,15 @@ export const getSubcommand = createCommand({
|
|
|
106
111
|
if (result.description) tableData['Description'] = result.description;
|
|
107
112
|
tableData['Status'] = statusColor(result.status);
|
|
108
113
|
tableData['Created'] = result.createdAt;
|
|
109
|
-
if (result.
|
|
114
|
+
if (result.runtime?.name) tableData['Runtime'] = result.runtime.name;
|
|
110
115
|
if (result.region) tableData['Region'] = result.region;
|
|
111
|
-
if (
|
|
116
|
+
if (result.snapshot?.id) {
|
|
117
|
+
const snapshotDisplay =
|
|
118
|
+
result.snapshot.public && result.snapshot.fullName
|
|
119
|
+
? result.snapshot.fullName
|
|
120
|
+
: result.snapshot.tag || result.snapshot.id;
|
|
121
|
+
tableData['Snapshot'] = snapshotDisplay;
|
|
122
|
+
}
|
|
112
123
|
tableData['Executions'] = result.executions;
|
|
113
124
|
if (streamDisplay) {
|
|
114
125
|
tableData['Stream'] = streamDisplay;
|
|
@@ -141,10 +152,8 @@ export const getSubcommand = createCommand({
|
|
|
141
152
|
status: result.status,
|
|
142
153
|
createdAt: result.createdAt,
|
|
143
154
|
region: result.region,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
snapshotId: result.snapshotId,
|
|
147
|
-
snapshotTag: result.snapshotTag,
|
|
155
|
+
runtime: result.runtime,
|
|
156
|
+
snapshot: result.snapshot,
|
|
148
157
|
executions: result.executions,
|
|
149
158
|
stdoutStreamUrl: result.stdoutStreamUrl,
|
|
150
159
|
stderrStreamUrl: result.stderrStreamUrl,
|
|
@@ -6,6 +6,45 @@ import { sandboxList } from '@agentuity/server';
|
|
|
6
6
|
import { getGlobalCatalystAPIClient } from '../../../config';
|
|
7
7
|
import type { SandboxStatus } from '@agentuity/core';
|
|
8
8
|
|
|
9
|
+
const SandboxRuntimeInfoSchema = z.object({
|
|
10
|
+
id: z.string().describe('Runtime ID'),
|
|
11
|
+
name: z.string().describe('Runtime name'),
|
|
12
|
+
iconUrl: z.string().optional().describe('URL for runtime icon'),
|
|
13
|
+
brandColor: z.string().optional().describe('Brand color for the runtime'),
|
|
14
|
+
tags: z.array(z.string()).optional().describe('Runtime tags'),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const SandboxSnapshotUserInfoSchema = z.object({
|
|
18
|
+
id: z.string().describe('User ID'),
|
|
19
|
+
firstName: z.string().optional().describe("User's first name"),
|
|
20
|
+
lastName: z.string().optional().describe("User's last name"),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const SandboxSnapshotOrgInfoSchema = z.object({
|
|
24
|
+
id: z.string().describe('Organization ID'),
|
|
25
|
+
name: z.string().describe('Organization name'),
|
|
26
|
+
slug: z.string().optional().describe('Organization slug'),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const SandboxSnapshotInfoSchema = z.discriminatedUnion('public', [
|
|
30
|
+
z.object({
|
|
31
|
+
id: z.string().describe('Snapshot ID'),
|
|
32
|
+
name: z.string().optional().describe('Snapshot name'),
|
|
33
|
+
tag: z.string().nullable().optional().describe('Snapshot tag'),
|
|
34
|
+
fullName: z.string().optional().describe('Full name with org slug'),
|
|
35
|
+
public: z.literal(true).describe('Public snapshot'),
|
|
36
|
+
org: SandboxSnapshotOrgInfoSchema.describe('Organization that owns the public snapshot'),
|
|
37
|
+
}),
|
|
38
|
+
z.object({
|
|
39
|
+
id: z.string().describe('Snapshot ID'),
|
|
40
|
+
name: z.string().optional().describe('Snapshot name'),
|
|
41
|
+
tag: z.string().nullable().optional().describe('Snapshot tag'),
|
|
42
|
+
fullName: z.string().optional().describe('Full name with org slug'),
|
|
43
|
+
public: z.literal(false).describe('Private snapshot'),
|
|
44
|
+
user: SandboxSnapshotUserInfoSchema.describe('User who created the private snapshot'),
|
|
45
|
+
}),
|
|
46
|
+
]);
|
|
47
|
+
|
|
9
48
|
const SandboxInfoSchema = z.object({
|
|
10
49
|
sandboxId: z.string().describe('Sandbox ID'),
|
|
11
50
|
name: z.string().optional().describe('Sandbox name'),
|
|
@@ -13,10 +52,8 @@ const SandboxInfoSchema = z.object({
|
|
|
13
52
|
status: z.string().describe('Current status'),
|
|
14
53
|
createdAt: z.string().describe('Creation timestamp'),
|
|
15
54
|
region: z.string().optional().describe('Region where sandbox is running'),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
snapshotId: z.string().optional().describe('Snapshot ID sandbox was created from'),
|
|
19
|
-
snapshotTag: z.string().optional().describe('Snapshot tag sandbox was created from'),
|
|
55
|
+
runtime: SandboxRuntimeInfoSchema.optional().describe('Runtime information'),
|
|
56
|
+
snapshot: SandboxSnapshotInfoSchema.optional().describe('Snapshot information'),
|
|
20
57
|
executions: z.number().describe('Number of executions'),
|
|
21
58
|
});
|
|
22
59
|
|
|
@@ -100,7 +137,7 @@ export const listSubcommand = createCommand({
|
|
|
100
137
|
return {
|
|
101
138
|
ID: sandbox.sandboxId,
|
|
102
139
|
Name: sandbox.name || '-',
|
|
103
|
-
Runtime: sandbox.
|
|
140
|
+
Runtime: sandbox.runtime?.name || '-',
|
|
104
141
|
Status: sandbox.status,
|
|
105
142
|
'Created At': sandbox.createdAt,
|
|
106
143
|
Executions: sandbox.executions,
|
|
@@ -127,10 +164,8 @@ export const listSubcommand = createCommand({
|
|
|
127
164
|
status: s.status,
|
|
128
165
|
createdAt: s.createdAt,
|
|
129
166
|
region: s.region,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
snapshotId: s.snapshotId,
|
|
133
|
-
snapshotTag: s.snapshotTag,
|
|
167
|
+
runtime: s.runtime,
|
|
168
|
+
snapshot: s.snapshot,
|
|
134
169
|
executions: s.executions,
|
|
135
170
|
})),
|
|
136
171
|
total: result.total,
|
|
@@ -13,9 +13,10 @@ import {
|
|
|
13
13
|
snapshotUpload,
|
|
14
14
|
SnapshotBuildFileSchema,
|
|
15
15
|
} from '@agentuity/server';
|
|
16
|
-
import type { SnapshotFileInfo } from '@agentuity/server';
|
|
16
|
+
import type { SnapshotFileInfo, SnapshotBuildGitInfo } from '@agentuity/server';
|
|
17
17
|
import { getCatalystAPIClient } from '../../../../config';
|
|
18
18
|
import { validateAptDependencies } from '../../../../utils/apt-validator';
|
|
19
|
+
import { getGitInfo, mergeGitInfo } from '../../../../utils/git';
|
|
19
20
|
import { encryptFIPSKEMDEMStream } from '../../../../crypto/box';
|
|
20
21
|
import { tmpdir } from 'node:os';
|
|
21
22
|
import { randomUUID, createHash, createPublicKey } from 'node:crypto';
|
|
@@ -351,6 +352,15 @@ export const buildSubcommand = createCommand({
|
|
|
351
352
|
name: z.string().optional().describe('Snapshot name (overrides build file)'),
|
|
352
353
|
tag: z.string().optional().describe('Snapshot tag (defaults to "latest")'),
|
|
353
354
|
description: z.string().optional().describe('Snapshot description (overrides build file)'),
|
|
355
|
+
message: z.string().optional().describe('Build message for this snapshot'),
|
|
356
|
+
commit: z.string().optional().describe('Git commit SHA (auto-detected if not provided)'),
|
|
357
|
+
branch: z.string().optional().describe('Git branch (auto-detected if not provided)'),
|
|
358
|
+
repo: z.string().optional().describe('Git repo URL (auto-detected if not provided)'),
|
|
359
|
+
provider: z
|
|
360
|
+
.string()
|
|
361
|
+
.optional()
|
|
362
|
+
.describe('Git provider (github, gitlab, bitbucket - auto-detected)'),
|
|
363
|
+
commitUrl: z.string().optional().describe('URL to the commit'),
|
|
354
364
|
metadata: z.array(z.string()).optional().describe('Metadata key-value pairs (KEY=VALUE)'),
|
|
355
365
|
force: z.boolean().optional().describe('Force rebuild even if content is unchanged'),
|
|
356
366
|
public: z
|
|
@@ -658,6 +668,34 @@ export const buildSubcommand = createCommand({
|
|
|
658
668
|
|
|
659
669
|
const client = getCatalystAPIClient(logger, auth, region);
|
|
660
670
|
|
|
671
|
+
// Auto-detect git info and merge with CLI overrides
|
|
672
|
+
const autoDetectedGit = await getGitInfo(directory, logger);
|
|
673
|
+
const mergedGitInfo = mergeGitInfo(autoDetectedGit, {
|
|
674
|
+
message: opts.message,
|
|
675
|
+
commit: opts.commit,
|
|
676
|
+
branch: opts.branch,
|
|
677
|
+
repo: opts.repo,
|
|
678
|
+
provider: opts.provider,
|
|
679
|
+
commitUrl: opts.commitUrl,
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
// Build git info for API (only include if we have any git data)
|
|
683
|
+
const hasGitInfo =
|
|
684
|
+
mergedGitInfo.branch ||
|
|
685
|
+
mergedGitInfo.commit ||
|
|
686
|
+
mergedGitInfo.repo ||
|
|
687
|
+
mergedGitInfo.provider ||
|
|
688
|
+
mergedGitInfo.commitUrl;
|
|
689
|
+
const gitInfo: SnapshotBuildGitInfo | undefined = hasGitInfo
|
|
690
|
+
? {
|
|
691
|
+
branch: mergedGitInfo.branch,
|
|
692
|
+
commit: mergedGitInfo.commit,
|
|
693
|
+
repo: mergedGitInfo.repo,
|
|
694
|
+
provider: mergedGitInfo.provider,
|
|
695
|
+
commitUrl: mergedGitInfo.commitUrl,
|
|
696
|
+
}
|
|
697
|
+
: undefined;
|
|
698
|
+
|
|
661
699
|
const initResult = await tui.spinner({
|
|
662
700
|
message: 'Initializing snapshot build...',
|
|
663
701
|
clearOnSuccess: true,
|
|
@@ -667,6 +705,8 @@ export const buildSubcommand = createCommand({
|
|
|
667
705
|
name: finalName,
|
|
668
706
|
tag: opts.tag ?? 'latest',
|
|
669
707
|
description: finalDescription,
|
|
708
|
+
message: mergedGitInfo.message,
|
|
709
|
+
git: gitInfo,
|
|
670
710
|
contentHash,
|
|
671
711
|
force: opts.force,
|
|
672
712
|
encrypt: !isPublic,
|
|
@@ -15,11 +15,29 @@ const SnapshotFileSchema = z.object({
|
|
|
15
15
|
mode: z.number(),
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
const SandboxRuntimeInfoSchema = z.object({
|
|
19
|
+
id: z.string().describe('Runtime ID'),
|
|
20
|
+
name: z.string().describe('Runtime name'),
|
|
21
|
+
iconUrl: z.string().optional().describe('URL for runtime icon'),
|
|
22
|
+
brandColor: z.string().optional().describe('Brand color for the runtime'),
|
|
23
|
+
tags: z.array(z.string()).optional().describe('Runtime tags'),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const SandboxSnapshotInfoSchema = z.object({
|
|
27
|
+
id: z.string().describe('Snapshot ID'),
|
|
28
|
+
name: z.string().optional().describe('Snapshot name'),
|
|
29
|
+
tag: z.string().optional().describe('Snapshot tag'),
|
|
30
|
+
fullName: z.string().optional().describe('Full name with org slug'),
|
|
31
|
+
public: z.boolean().describe('Whether snapshot is public'),
|
|
32
|
+
});
|
|
33
|
+
|
|
18
34
|
const SandboxInfoSchema = z.object({
|
|
19
35
|
sandboxId: z.string().describe('Sandbox ID'),
|
|
20
36
|
status: z.string().describe('Current status'),
|
|
21
37
|
createdAt: z.string().describe('Creation timestamp'),
|
|
22
38
|
executions: z.number().describe('Number of executions'),
|
|
39
|
+
runtime: SandboxRuntimeInfoSchema.optional().describe('Runtime information'),
|
|
40
|
+
snapshot: SandboxSnapshotInfoSchema.optional().describe('Snapshot information'),
|
|
23
41
|
});
|
|
24
42
|
|
|
25
43
|
const SnapshotGetResponseSchema = z.object({
|
package/src/types.ts
CHANGED
|
@@ -653,26 +653,37 @@ export const BuildMetadataSchema = ServerBuildMetadataSchema;
|
|
|
653
653
|
export type BuildMetadata = zod.infer<typeof BuildMetadataSchema>;
|
|
654
654
|
export type Project = zod.infer<typeof ProjectSchema>;
|
|
655
655
|
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
provider: zod.string().optional().describe('The CI provider name (attempts to autodetect)'),
|
|
668
|
-
repo: zod.string().optional().describe('The repo url'),
|
|
669
|
-
event: zod
|
|
670
|
-
.enum(['pull_request', 'push', 'manual', 'workflow'])
|
|
671
|
-
.default('manual')
|
|
672
|
-
.optional()
|
|
673
|
-
.describe('The event that triggered the deployment'),
|
|
674
|
-
pullRequestNumber: zod.number().optional().describe('the pull request number'),
|
|
675
|
-
pullRequestUrl: zod.url().optional().describe('the pull request url'),
|
|
656
|
+
/**
|
|
657
|
+
* Common git options schema for build commands (deploy, snapshot build, etc.)
|
|
658
|
+
* These can be provided via CLI flags to override auto-detected git values.
|
|
659
|
+
*/
|
|
660
|
+
export const GitOptionsSchema = zod.object({
|
|
661
|
+
message: zod.string().optional().describe('The message to associate with this build'),
|
|
662
|
+
commit: zod.string().optional().describe('The git commit SHA'),
|
|
663
|
+
branch: zod.string().optional().describe('The git branch'),
|
|
664
|
+
repo: zod.string().optional().describe('The git repo URL'),
|
|
665
|
+
provider: zod.string().optional().describe('The git provider (github, gitlab, bitbucket)'),
|
|
666
|
+
commitUrl: zod.url().optional().describe('The URL to the commit'),
|
|
676
667
|
});
|
|
677
668
|
|
|
669
|
+
export type GitOptions = z.infer<typeof GitOptionsSchema>;
|
|
670
|
+
|
|
671
|
+
export const DeployOptionsSchema = zod
|
|
672
|
+
.object({
|
|
673
|
+
logsUrl: zod.url().optional().describe('The url to the CI build logs'),
|
|
674
|
+
trigger: zod
|
|
675
|
+
.enum(['cli', 'workflow', 'webhook'])
|
|
676
|
+
.default('cli')
|
|
677
|
+
.optional()
|
|
678
|
+
.describe('The trigger that caused the build'),
|
|
679
|
+
event: zod
|
|
680
|
+
.enum(['pull_request', 'push', 'manual', 'workflow'])
|
|
681
|
+
.default('manual')
|
|
682
|
+
.optional()
|
|
683
|
+
.describe('The event that triggered the deployment'),
|
|
684
|
+
pullRequestNumber: zod.number().optional().describe('the pull request number'),
|
|
685
|
+
pullRequestUrl: zod.url().optional().describe('the pull request url'),
|
|
686
|
+
})
|
|
687
|
+
.merge(GitOptionsSchema);
|
|
688
|
+
|
|
678
689
|
export type DeployOptions = z.infer<typeof DeployOptionsSchema>;
|