@agentuity/cli 0.1.18 → 0.1.19

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/types.js CHANGED
@@ -70,19 +70,26 @@ export const ProjectSchema = zod.object({
70
70
  .describe('whether to skip the git integration setup prompt during deploy'),
71
71
  });
72
72
  export const BuildMetadataSchema = ServerBuildMetadataSchema;
73
- export const DeployOptionsSchema = zod.object({
73
+ /**
74
+ * Common git options schema for build commands (deploy, snapshot build, etc.)
75
+ * These can be provided via CLI flags to override auto-detected git values.
76
+ */
77
+ export const GitOptionsSchema = zod.object({
78
+ message: zod.string().optional().describe('The message to associate with this build'),
79
+ commit: zod.string().optional().describe('The git commit SHA'),
80
+ branch: zod.string().optional().describe('The git branch'),
81
+ repo: zod.string().optional().describe('The git repo URL'),
82
+ provider: zod.string().optional().describe('The git provider (github, gitlab, bitbucket)'),
83
+ commitUrl: zod.url().optional().describe('The URL to the commit'),
84
+ });
85
+ export const DeployOptionsSchema = zod
86
+ .object({
74
87
  logsUrl: zod.url().optional().describe('The url to the CI build logs'),
75
88
  trigger: zod
76
89
  .enum(['cli', 'workflow', 'webhook'])
77
90
  .default('cli')
78
91
  .optional()
79
92
  .describe('The trigger that caused the build'),
80
- commitUrl: zod.url().optional().describe('The url to the CI commit'),
81
- message: zod.string().optional().describe('The message to associate with this deployment'),
82
- commit: zod.string().optional().describe('The commit SHA for this deployment'),
83
- branch: zod.string().optional().describe('The git branch for this deployment'),
84
- provider: zod.string().optional().describe('The CI provider name (attempts to autodetect)'),
85
- repo: zod.string().optional().describe('The repo url'),
86
93
  event: zod
87
94
  .enum(['pull_request', 'push', 'manual', 'workflow'])
88
95
  .default('manual')
@@ -90,5 +97,6 @@ export const DeployOptionsSchema = zod.object({
90
97
  .describe('The event that triggered the deployment'),
91
98
  pullRequestNumber: zod.number().optional().describe('the pull request number'),
92
99
  pullRequestUrl: zod.url().optional().describe('the pull request url'),
93
- });
100
+ })
101
+ .merge(GitOptionsSchema);
94
102
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EACN,gBAAgB,EAChB,mBAAmB,IAAI,yBAAyB,GAChD,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,CAAC,IAAI,GAAG,EAAE,MAAM,KAAK,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAI5B,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;IAC3C,IAAI,EAAE,GAAG;SACP,MAAM,CAAC;QACP,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QACnE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;QACpD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;KAChF,CAAC;SACD,QAAQ,EAAE;SACV,QAAQ,CAAC,+DAA+D,CAAC;IAC3E,OAAO,EAAE,GAAG;SACV,MAAM,CAAC;QACP,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;KACvE,CAAC;SACD,QAAQ,EAAE;SACV,QAAQ,CAAC,gCAAgC,CAAC;IAC5C,SAAS,EAAE,GAAG;SACZ,MAAM,CAAC;QACP,OAAO,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;QAC/D,OAAO,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,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EAAE,GAAG;SACV,IAAI,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;SACpC,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,EAAE;SACV,QAAQ,CAAC,mCAAmC,CAAC;IAC/C,KAAK,EAAE,GAAG;SACR,IAAI,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;SACpD,OAAO,CAAC,QAAQ,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CAAC,yCAAyC,CAAC;IACrD,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IAC9E,cAAc,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;CACrE,CAAC;KACD,KAAK,CAAC,gBAAgB,CAAC,CAAC"}
@@ -0,0 +1,63 @@
1
+ import type { Logger } from '@agentuity/core';
2
+ /**
3
+ * Git information detected from the repository
4
+ */
5
+ export interface GitInfo {
6
+ branch?: string;
7
+ repo?: string;
8
+ provider?: string;
9
+ tags?: string[];
10
+ commit?: string;
11
+ message?: string;
12
+ }
13
+ /**
14
+ * Git options that can be provided via CLI flags to override auto-detected values
15
+ */
16
+ export interface GitOptions {
17
+ message?: string;
18
+ commit?: string;
19
+ branch?: string;
20
+ repo?: string;
21
+ provider?: string;
22
+ commitUrl?: string;
23
+ }
24
+ /**
25
+ * Extended git info that includes CI-related fields
26
+ */
27
+ export interface GitInfoExtended extends GitInfo {
28
+ commitUrl?: string;
29
+ logsUrl?: string;
30
+ trigger?: string;
31
+ event?: string;
32
+ pull_request?: {
33
+ number: number;
34
+ url?: string;
35
+ };
36
+ }
37
+ /**
38
+ * Detect git information from the repository at the given root directory.
39
+ * Walks up parent directories to find .git directory (supports monorepos).
40
+ *
41
+ * @param rootDir - The root directory to start searching for .git
42
+ * @param logger - Logger instance for trace output
43
+ * @returns Git information or undefined if not in a git repository
44
+ */
45
+ export declare function getGitInfo(rootDir: string, logger: Logger): Promise<GitInfo | undefined>;
46
+ /**
47
+ * Merge auto-detected git info with CLI-provided overrides.
48
+ * CLI options take precedence over auto-detected values.
49
+ *
50
+ * @param autoDetected - Git info auto-detected from the repository
51
+ * @param overrides - CLI options that override auto-detected values
52
+ * @returns Merged git info
53
+ */
54
+ export declare function mergeGitInfo(autoDetected: GitInfo | undefined, overrides: GitOptions): GitInfoExtended;
55
+ /**
56
+ * Build an array of tags from git info, including branch and short commit.
57
+ * Used for deployment tagging.
58
+ *
59
+ * @param gitInfo - Git information
60
+ * @returns Array of tags
61
+ */
62
+ export declare function buildGitTags(gitInfo: GitInfo | undefined): string[];
63
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAI9C;;GAEG;AACH,MAAM,WAAW,OAAO;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE;QACd,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;KACb,CAAC;CACF;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAsG9F;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC3B,YAAY,EAAE,OAAO,GAAG,SAAS,EACjC,SAAS,EAAE,UAAU,GACnB,eAAe,CAwBjB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,EAAE,CAUnE"}
@@ -0,0 +1,157 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ /**
4
+ * Detect git information from the repository at the given root directory.
5
+ * Walks up parent directories to find .git directory (supports monorepos).
6
+ *
7
+ * @param rootDir - The root directory to start searching for .git
8
+ * @param logger - Logger instance for trace output
9
+ * @returns Git information or undefined if not in a git repository
10
+ */
11
+ export async function getGitInfo(rootDir, logger) {
12
+ if (!Bun.which('git')) {
13
+ logger.trace('git not found in PATH');
14
+ return undefined;
15
+ }
16
+ try {
17
+ // Find .git directory (may be in parent directories for monorepos)
18
+ let gitDir = join(rootDir, '.git');
19
+ let parentDir = dirname(dirname(gitDir));
20
+ while (!existsSync(gitDir) && parentDir !== dirname(parentDir) && gitDir !== '/') {
21
+ gitDir = join(parentDir, '.git');
22
+ parentDir = dirname(parentDir);
23
+ }
24
+ if (!existsSync(gitDir)) {
25
+ logger.trace('No .git directory found');
26
+ return undefined;
27
+ }
28
+ const $ = Bun.$;
29
+ const gitInfo = {
30
+ provider: 'git',
31
+ };
32
+ // Get git tags pointing to HEAD
33
+ const tagResult = $ `git tag -l --points-at HEAD`.nothrow().quiet();
34
+ if (tagResult) {
35
+ const tagText = await tagResult.text();
36
+ if (tagText) {
37
+ gitInfo.tags = tagText
38
+ .trim()
39
+ .split(/\n/)
40
+ .map((s) => s.trim())
41
+ .filter(Boolean);
42
+ }
43
+ }
44
+ // Get current branch
45
+ const branchResult = $ `git branch --show-current`.nothrow().quiet();
46
+ if (branchResult) {
47
+ const branchText = await branchResult.text();
48
+ if (branchText) {
49
+ gitInfo.branch = branchText.trim();
50
+ }
51
+ }
52
+ // Get commit SHA
53
+ const commitResult = $ `git rev-parse HEAD`.nothrow().quiet();
54
+ if (commitResult) {
55
+ const commitText = await commitResult.text();
56
+ if (commitText) {
57
+ gitInfo.commit = commitText.trim();
58
+ // Get commit message
59
+ const msgResult = $ `git log --pretty=format:%s -n1 ${gitInfo.commit}`.nothrow().quiet();
60
+ if (msgResult) {
61
+ const msgText = await msgResult.text();
62
+ if (msgText) {
63
+ gitInfo.message = msgText.trim();
64
+ }
65
+ }
66
+ }
67
+ }
68
+ // Get remote origin URL and parse
69
+ const originResult = $ `git config --get remote.origin.url`.nothrow().quiet();
70
+ if (originResult) {
71
+ const originText = await originResult.text();
72
+ if (originText) {
73
+ const remoteUrl = originText.trim();
74
+ // Parse provider and repo from URL
75
+ if (remoteUrl.includes('github.com')) {
76
+ gitInfo.provider = 'github';
77
+ const match = remoteUrl.match(/github\.com[:/](.+?)(?:\.git)?$/);
78
+ if (match) {
79
+ gitInfo.repo = `https://github.com/${match[1]}`;
80
+ }
81
+ }
82
+ else if (remoteUrl.includes('gitlab.com')) {
83
+ gitInfo.provider = 'gitlab';
84
+ const match = remoteUrl.match(/gitlab\.com[:/](.+?)(?:\.git)?$/);
85
+ if (match) {
86
+ gitInfo.repo = `https://gitlab.com/${match[1]}`;
87
+ }
88
+ }
89
+ else if (remoteUrl.includes('bitbucket.org')) {
90
+ gitInfo.provider = 'bitbucket';
91
+ const match = remoteUrl.match(/bitbucket\.org[:/](.+?)(?:\.git)?$/);
92
+ if (match) {
93
+ gitInfo.repo = `https://bitbucket.org/${match[1]}`;
94
+ }
95
+ }
96
+ else {
97
+ gitInfo.repo = remoteUrl;
98
+ }
99
+ }
100
+ }
101
+ return gitInfo;
102
+ }
103
+ catch (error) {
104
+ logger.trace(`Failed to get git info: ${error}`);
105
+ return undefined;
106
+ }
107
+ }
108
+ /**
109
+ * Merge auto-detected git info with CLI-provided overrides.
110
+ * CLI options take precedence over auto-detected values.
111
+ *
112
+ * @param autoDetected - Git info auto-detected from the repository
113
+ * @param overrides - CLI options that override auto-detected values
114
+ * @returns Merged git info
115
+ */
116
+ export function mergeGitInfo(autoDetected, overrides) {
117
+ const result = { ...(autoDetected ?? {}) };
118
+ // CLI overrides take precedence
119
+ if (overrides.message !== undefined) {
120
+ result.message = overrides.message;
121
+ }
122
+ if (overrides.commit !== undefined) {
123
+ result.commit = overrides.commit;
124
+ }
125
+ if (overrides.branch !== undefined) {
126
+ result.branch = overrides.branch;
127
+ }
128
+ if (overrides.repo !== undefined) {
129
+ result.repo = overrides.repo;
130
+ }
131
+ if (overrides.provider !== undefined) {
132
+ result.provider = overrides.provider;
133
+ }
134
+ if (overrides.commitUrl !== undefined) {
135
+ result.commitUrl = overrides.commitUrl;
136
+ }
137
+ return result;
138
+ }
139
+ /**
140
+ * Build an array of tags from git info, including branch and short commit.
141
+ * Used for deployment tagging.
142
+ *
143
+ * @param gitInfo - Git information
144
+ * @returns Array of tags
145
+ */
146
+ export function buildGitTags(gitInfo) {
147
+ const tags = new Set(gitInfo?.tags ?? []);
148
+ tags.add('latest');
149
+ if (gitInfo?.branch) {
150
+ tags.add(gitInfo.branch);
151
+ }
152
+ if (gitInfo?.commit) {
153
+ tags.add(gitInfo.commit.substring(0, 7));
154
+ }
155
+ return Array.from(tags);
156
+ }
157
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources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AAO,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;IAC1C,IAAI,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.18",
3
+ "version": "0.1.19",
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.18",
44
- "@agentuity/core": "0.1.18",
45
- "@agentuity/server": "0.1.18",
43
+ "@agentuity/auth": "0.1.19",
44
+ "@agentuity/core": "0.1.19",
45
+ "@agentuity/server": "0.1.19",
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.18"
63
+ "@agentuity/frontend": "0.1.19"
64
64
  },
65
65
  "devDependencies": {
66
- "@agentuity/test-utils": "0.1.18",
66
+ "@agentuity/test-utils": "0.1.19",
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, dirname } from 'node:path';
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
  */
@@ -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,
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
- export const DeployOptionsSchema = zod.object({
657
- logsUrl: zod.url().optional().describe('The url to the CI build logs'),
658
- trigger: zod
659
- .enum(['cli', 'workflow', 'webhook'])
660
- .default('cli')
661
- .optional()
662
- .describe('The trigger that caused the build'),
663
- commitUrl: zod.url().optional().describe('The url to the CI commit'),
664
- message: zod.string().optional().describe('The message to associate with this deployment'),
665
- commit: zod.string().optional().describe('The commit SHA for this deployment'),
666
- branch: zod.string().optional().describe('The git branch for this deployment'),
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>;