@agentuity/cli 0.0.110 → 0.0.111

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.
Files changed (193) hide show
  1. package/dist/cli.d.ts.map +1 -1
  2. package/dist/cli.js +19 -4
  3. package/dist/cli.js.map +1 -1
  4. package/dist/cmd/build/vite/agent-discovery.d.ts +1 -1
  5. package/dist/cmd/build/vite/agent-discovery.d.ts.map +1 -1
  6. package/dist/cmd/build/vite/agent-discovery.js +3 -3
  7. package/dist/cmd/build/vite/agent-discovery.js.map +1 -1
  8. package/dist/cmd/build/vite/index.js +1 -1
  9. package/dist/cmd/build/vite/index.js.map +1 -1
  10. package/dist/cmd/build/vite/metadata-generator.js +1 -1
  11. package/dist/cmd/build/vite/metadata-generator.js.map +1 -1
  12. package/dist/cmd/build/vite/registry-generator.d.ts +1 -1
  13. package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
  14. package/dist/cmd/build/vite/registry-generator.js +70 -23
  15. package/dist/cmd/build/vite/registry-generator.js.map +1 -1
  16. package/dist/cmd/build/vite/route-discovery.d.ts +6 -0
  17. package/dist/cmd/build/vite/route-discovery.d.ts.map +1 -1
  18. package/dist/cmd/build/vite/route-discovery.js +19 -0
  19. package/dist/cmd/build/vite/route-discovery.js.map +1 -1
  20. package/dist/cmd/build/vite/vite-builder.js +1 -1
  21. package/dist/cmd/build/vite/vite-builder.js.map +1 -1
  22. package/dist/cmd/cloud/deploy.d.ts.map +1 -1
  23. package/dist/cmd/cloud/deploy.js +63 -1
  24. package/dist/cmd/cloud/deploy.js.map +1 -1
  25. package/dist/cmd/cloud/sandbox/create.d.ts.map +1 -1
  26. package/dist/cmd/cloud/sandbox/create.js +18 -0
  27. package/dist/cmd/cloud/sandbox/create.js.map +1 -1
  28. package/dist/cmd/cloud/sandbox/delete.d.ts.map +1 -1
  29. package/dist/cmd/cloud/sandbox/delete.js +2 -6
  30. package/dist/cmd/cloud/sandbox/delete.js.map +1 -1
  31. package/dist/cmd/cloud/sandbox/download.d.ts +3 -0
  32. package/dist/cmd/cloud/sandbox/download.d.ts.map +1 -0
  33. package/dist/cmd/cloud/sandbox/download.js +89 -0
  34. package/dist/cmd/cloud/sandbox/download.js.map +1 -0
  35. package/dist/cmd/cloud/sandbox/env.d.ts +3 -0
  36. package/dist/cmd/cloud/sandbox/env.d.ts.map +1 -0
  37. package/dist/cmd/cloud/sandbox/env.js +90 -0
  38. package/dist/cmd/cloud/sandbox/env.js.map +1 -0
  39. package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
  40. package/dist/cmd/cloud/sandbox/get.js +5 -0
  41. package/dist/cmd/cloud/sandbox/get.js.map +1 -1
  42. package/dist/cmd/cloud/sandbox/index.d.ts.map +1 -1
  43. package/dist/cmd/cloud/sandbox/index.js +14 -0
  44. package/dist/cmd/cloud/sandbox/index.js.map +1 -1
  45. package/dist/cmd/cloud/sandbox/ls.d.ts +3 -0
  46. package/dist/cmd/cloud/sandbox/ls.d.ts.map +1 -0
  47. package/dist/cmd/cloud/sandbox/ls.js +119 -0
  48. package/dist/cmd/cloud/sandbox/ls.js.map +1 -0
  49. package/dist/cmd/cloud/sandbox/mkdir.d.ts +3 -0
  50. package/dist/cmd/cloud/sandbox/mkdir.d.ts.map +1 -0
  51. package/dist/cmd/cloud/sandbox/mkdir.js +59 -0
  52. package/dist/cmd/cloud/sandbox/mkdir.js.map +1 -0
  53. package/dist/cmd/cloud/sandbox/rm.d.ts +3 -0
  54. package/dist/cmd/cloud/sandbox/rm.d.ts.map +1 -0
  55. package/dist/cmd/cloud/sandbox/rm.js +45 -0
  56. package/dist/cmd/cloud/sandbox/rm.js.map +1 -0
  57. package/dist/cmd/cloud/sandbox/rmdir.d.ts +3 -0
  58. package/dist/cmd/cloud/sandbox/rmdir.d.ts.map +1 -0
  59. package/dist/cmd/cloud/sandbox/rmdir.js +59 -0
  60. package/dist/cmd/cloud/sandbox/rmdir.js.map +1 -0
  61. package/dist/cmd/cloud/sandbox/snapshot/create.d.ts.map +1 -1
  62. package/dist/cmd/cloud/sandbox/snapshot/create.js +0 -2
  63. package/dist/cmd/cloud/sandbox/snapshot/create.js.map +1 -1
  64. package/dist/cmd/cloud/sandbox/snapshot/get.d.ts.map +1 -1
  65. package/dist/cmd/cloud/sandbox/snapshot/get.js +0 -2
  66. package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
  67. package/dist/cmd/cloud/sandbox/snapshot/list.d.ts.map +1 -1
  68. package/dist/cmd/cloud/sandbox/snapshot/list.js +0 -3
  69. package/dist/cmd/cloud/sandbox/snapshot/list.js.map +1 -1
  70. package/dist/cmd/cloud/sandbox/upload.d.ts +3 -0
  71. package/dist/cmd/cloud/sandbox/upload.d.ts.map +1 -0
  72. package/dist/cmd/cloud/sandbox/upload.js +77 -0
  73. package/dist/cmd/cloud/sandbox/upload.js.map +1 -0
  74. package/dist/cmd/dev/index.d.ts.map +1 -1
  75. package/dist/cmd/dev/index.js +17 -8
  76. package/dist/cmd/dev/index.js.map +1 -1
  77. package/dist/cmd/dev/sync.d.ts.map +1 -1
  78. package/dist/cmd/dev/sync.js +8 -14
  79. package/dist/cmd/dev/sync.js.map +1 -1
  80. package/dist/cmd/git/account/add.d.ts +17 -0
  81. package/dist/cmd/git/account/add.d.ts.map +1 -0
  82. package/dist/cmd/git/account/add.js +244 -0
  83. package/dist/cmd/git/account/add.js.map +1 -0
  84. package/dist/cmd/git/account/index.d.ts +3 -0
  85. package/dist/cmd/git/account/index.d.ts.map +1 -0
  86. package/dist/cmd/git/account/index.js +11 -0
  87. package/dist/cmd/git/account/index.js.map +1 -0
  88. package/dist/cmd/git/account/list.d.ts +2 -0
  89. package/dist/cmd/git/account/list.d.ts.map +1 -0
  90. package/dist/cmd/git/account/list.js +111 -0
  91. package/dist/cmd/git/account/list.js.map +1 -0
  92. package/dist/cmd/git/account/remove.d.ts +2 -0
  93. package/dist/cmd/git/account/remove.d.ts.map +1 -0
  94. package/dist/cmd/git/account/remove.js +171 -0
  95. package/dist/cmd/git/account/remove.js.map +1 -0
  96. package/dist/cmd/git/index.d.ts +3 -0
  97. package/dist/cmd/git/index.d.ts.map +1 -0
  98. package/dist/cmd/git/index.js +19 -0
  99. package/dist/cmd/git/index.js.map +1 -0
  100. package/dist/cmd/git/link.d.ts +32 -0
  101. package/dist/cmd/git/link.d.ts.map +1 -0
  102. package/dist/cmd/git/link.js +357 -0
  103. package/dist/cmd/git/link.js.map +1 -0
  104. package/dist/cmd/git/list.d.ts +2 -0
  105. package/dist/cmd/git/list.d.ts.map +1 -0
  106. package/dist/cmd/git/list.js +137 -0
  107. package/dist/cmd/git/list.js.map +1 -0
  108. package/dist/cmd/git/status.d.ts +2 -0
  109. package/dist/cmd/git/status.d.ts.map +1 -0
  110. package/dist/cmd/git/status.js +119 -0
  111. package/dist/cmd/git/status.js.map +1 -0
  112. package/dist/cmd/git/unlink.d.ts +2 -0
  113. package/dist/cmd/git/unlink.d.ts.map +1 -0
  114. package/dist/cmd/git/unlink.js +98 -0
  115. package/dist/cmd/git/unlink.js.map +1 -0
  116. package/dist/cmd/index.d.ts.map +1 -1
  117. package/dist/cmd/index.js +2 -0
  118. package/dist/cmd/index.js.map +1 -1
  119. package/dist/cmd/integration/api.d.ts +61 -0
  120. package/dist/cmd/integration/api.d.ts.map +1 -0
  121. package/dist/cmd/integration/api.js +176 -0
  122. package/dist/cmd/integration/api.js.map +1 -0
  123. package/dist/cmd/integration/github/connect.d.ts +2 -0
  124. package/dist/cmd/integration/github/connect.d.ts.map +1 -0
  125. package/dist/cmd/integration/github/connect.js +197 -0
  126. package/dist/cmd/integration/github/connect.js.map +1 -0
  127. package/dist/cmd/integration/github/disconnect.d.ts +2 -0
  128. package/dist/cmd/integration/github/disconnect.d.ts.map +1 -0
  129. package/dist/cmd/integration/github/disconnect.js +121 -0
  130. package/dist/cmd/integration/github/disconnect.js.map +1 -0
  131. package/dist/cmd/integration/github/index.d.ts +2 -0
  132. package/dist/cmd/integration/github/index.d.ts.map +1 -0
  133. package/dist/cmd/integration/github/index.js +21 -0
  134. package/dist/cmd/integration/github/index.js.map +1 -0
  135. package/dist/cmd/integration/index.d.ts +2 -0
  136. package/dist/cmd/integration/index.d.ts.map +1 -0
  137. package/dist/cmd/integration/index.js +16 -0
  138. package/dist/cmd/integration/index.js.map +1 -0
  139. package/dist/config.d.ts +2 -0
  140. package/dist/config.d.ts.map +1 -1
  141. package/dist/config.js +24 -0
  142. package/dist/config.js.map +1 -1
  143. package/dist/errors.d.ts +2 -1
  144. package/dist/errors.d.ts.map +1 -1
  145. package/dist/errors.js +5 -0
  146. package/dist/errors.js.map +1 -1
  147. package/dist/types.d.ts +2 -1
  148. package/dist/types.d.ts.map +1 -1
  149. package/dist/types.js +4 -0
  150. package/dist/types.js.map +1 -1
  151. package/package.json +6 -6
  152. package/src/cli.ts +20 -4
  153. package/src/cmd/build/vite/agent-discovery.ts +4 -4
  154. package/src/cmd/build/vite/index.ts +1 -1
  155. package/src/cmd/build/vite/metadata-generator.ts +1 -1
  156. package/src/cmd/build/vite/registry-generator.ts +78 -24
  157. package/src/cmd/build/vite/route-discovery.ts +20 -0
  158. package/src/cmd/build/vite/vite-builder.ts +1 -1
  159. package/src/cmd/cloud/deploy.ts +78 -1
  160. package/src/cmd/cloud/sandbox/create.ts +22 -0
  161. package/src/cmd/cloud/sandbox/delete.ts +2 -6
  162. package/src/cmd/cloud/sandbox/download.ts +96 -0
  163. package/src/cmd/cloud/sandbox/env.ts +104 -0
  164. package/src/cmd/cloud/sandbox/get.ts +5 -0
  165. package/src/cmd/cloud/sandbox/index.ts +14 -0
  166. package/src/cmd/cloud/sandbox/ls.ts +126 -0
  167. package/src/cmd/cloud/sandbox/mkdir.ts +65 -0
  168. package/src/cmd/cloud/sandbox/rm.ts +51 -0
  169. package/src/cmd/cloud/sandbox/rmdir.ts +65 -0
  170. package/src/cmd/cloud/sandbox/snapshot/create.ts +0 -2
  171. package/src/cmd/cloud/sandbox/snapshot/get.ts +0 -2
  172. package/src/cmd/cloud/sandbox/snapshot/list.ts +0 -3
  173. package/src/cmd/cloud/sandbox/upload.ts +83 -0
  174. package/src/cmd/dev/index.ts +32 -19
  175. package/src/cmd/dev/sync.ts +26 -30
  176. package/src/cmd/git/account/add.ts +317 -0
  177. package/src/cmd/git/account/index.ts +12 -0
  178. package/src/cmd/git/account/list.ts +139 -0
  179. package/src/cmd/git/account/remove.ts +212 -0
  180. package/src/cmd/git/index.ts +20 -0
  181. package/src/cmd/git/link.ts +468 -0
  182. package/src/cmd/git/list.ts +161 -0
  183. package/src/cmd/git/status.ts +144 -0
  184. package/src/cmd/git/unlink.ts +117 -0
  185. package/src/cmd/index.ts +2 -0
  186. package/src/cmd/integration/api.ts +379 -0
  187. package/src/cmd/integration/github/connect.ts +242 -0
  188. package/src/cmd/integration/github/disconnect.ts +149 -0
  189. package/src/cmd/integration/github/index.ts +21 -0
  190. package/src/cmd/integration/index.ts +16 -0
  191. package/src/config.ts +34 -0
  192. package/src/errors.ts +7 -0
  193. package/src/types.ts +4 -0
@@ -0,0 +1,149 @@
1
+ import { createSubcommand } from '../../../types';
2
+ import * as tui from '../../../tui';
3
+ import { getCommand } from '../../../command-prefix';
4
+ import { ErrorCode } from '../../../errors';
5
+ import { listOrganizations } from '@agentuity/server';
6
+ import enquirer from 'enquirer';
7
+ import {
8
+ getGithubIntegrationStatus,
9
+ disconnectGithubIntegration,
10
+ type GithubIntegration,
11
+ } from '../api';
12
+
13
+ export const disconnectSubcommand = createSubcommand({
14
+ name: 'disconnect',
15
+ description: 'Disconnect a GitHub account from your organization',
16
+ tags: ['mutating', 'destructive', 'slow'],
17
+ idempotent: false,
18
+ requires: { auth: true, apiClient: true },
19
+ examples: [
20
+ {
21
+ command: getCommand('integration github disconnect'),
22
+ description: 'Disconnect a GitHub account from your organization',
23
+ },
24
+ ],
25
+
26
+ async handler(ctx) {
27
+ const { logger, apiClient } = ctx;
28
+
29
+ try {
30
+ // Fetch organizations
31
+ const orgs = await tui.spinner({
32
+ message: 'Fetching organizations...',
33
+ clearOnSuccess: true,
34
+ callback: () => listOrganizations(apiClient),
35
+ });
36
+
37
+ if (orgs.length === 0) {
38
+ tui.fatal('No organizations found for your account');
39
+ }
40
+
41
+ // Check GitHub status for each org
42
+ const orgStatuses = await tui.spinner({
43
+ message: 'Checking GitHub integration status...',
44
+ clearOnSuccess: true,
45
+ callback: async () => {
46
+ const statuses = await Promise.all(
47
+ orgs.map(async (org) => {
48
+ const status = await getGithubIntegrationStatus(apiClient, org.id);
49
+ return {
50
+ ...org,
51
+ connected: status.connected,
52
+ integrations: status.integrations,
53
+ };
54
+ })
55
+ );
56
+ return statuses;
57
+ },
58
+ });
59
+
60
+ // Flatten all integrations across orgs
61
+ const allIntegrations: Array<{
62
+ orgId: string;
63
+ orgName: string;
64
+ integration: GithubIntegration;
65
+ }> = [];
66
+
67
+ for (const org of orgStatuses) {
68
+ for (const integration of org.integrations) {
69
+ allIntegrations.push({
70
+ orgId: org.id,
71
+ orgName: org.name,
72
+ integration,
73
+ });
74
+ }
75
+ }
76
+
77
+ if (allIntegrations.length === 0) {
78
+ tui.newline();
79
+ tui.info('No GitHub accounts are connected.');
80
+ return;
81
+ }
82
+
83
+ // Build choices showing GitHub account and org
84
+ const choices = allIntegrations.map((item) => ({
85
+ name: `${tui.bold(item.integration.githubAccountName)} ${tui.muted(`(${item.integration.githubAccountType})`)} → ${tui.bold(item.orgName)}`,
86
+ value: `${item.orgId}:${item.integration.id}`,
87
+ }));
88
+
89
+ // Show picker
90
+ const response = await enquirer.prompt<{ selection: string }>({
91
+ type: 'select',
92
+ name: 'selection',
93
+ message: 'Select a GitHub account to disconnect',
94
+ choices,
95
+ result(name: string) {
96
+ // Return the value (IDs) instead of the display name
97
+ const choice = choices.find((c) => c.name === name);
98
+ return choice?.value ?? name;
99
+ },
100
+ });
101
+
102
+ const colonIdx = response.selection.indexOf(':');
103
+ if (colonIdx === -1) {
104
+ logger.fatal('Invalid selection format');
105
+ }
106
+ const orgId = response.selection.slice(0, colonIdx);
107
+ const integrationId = response.selection.slice(colonIdx + 1);
108
+ const selected = allIntegrations.find(
109
+ (i) => i.orgId === orgId && i.integration.id === integrationId
110
+ );
111
+ const displayName = selected
112
+ ? `${tui.bold(selected.integration.githubAccountName)} from ${tui.bold(selected.orgName)}`
113
+ : response.selection;
114
+
115
+ // Confirm
116
+ const confirmed = await tui.confirm(`Are you sure you want to disconnect ${displayName}?`);
117
+
118
+ if (!confirmed) {
119
+ tui.newline();
120
+ tui.info('Cancelled');
121
+ return;
122
+ }
123
+
124
+ await tui.spinner({
125
+ message: 'Disconnecting GitHub...',
126
+ clearOnSuccess: true,
127
+ callback: () => disconnectGithubIntegration(apiClient, orgId, integrationId),
128
+ });
129
+
130
+ tui.newline();
131
+ tui.success(`Disconnected ${displayName}`);
132
+ } catch (error) {
133
+ // Handle user cancellation (Ctrl+C)
134
+ const isCancel =
135
+ error === '' ||
136
+ (error instanceof Error &&
137
+ (error.message === '' || error.message === 'User cancelled'));
138
+
139
+ if (isCancel) {
140
+ tui.newline();
141
+ tui.info('Cancelled');
142
+ return;
143
+ }
144
+
145
+ logger.trace(error);
146
+ logger.fatal('GitHub disconnect failed: %s', error, ErrorCode.INTEGRATION_FAILED);
147
+ }
148
+ },
149
+ });
@@ -0,0 +1,21 @@
1
+ import { createCommand } from '../../../types';
2
+ import { getCommand } from '../../../command-prefix';
3
+ import { connectSubcommand } from './connect';
4
+ import { disconnectSubcommand } from './disconnect';
5
+
6
+ export const githubCommand = createCommand({
7
+ name: 'github',
8
+ description: 'GitHub integration commands',
9
+ tags: ['requires-auth'],
10
+ examples: [
11
+ {
12
+ command: getCommand('integration github connect'),
13
+ description: 'Connect GitHub to your organization',
14
+ },
15
+ {
16
+ command: getCommand('integration github disconnect'),
17
+ description: 'Disconnect GitHub from your organization',
18
+ },
19
+ ],
20
+ subcommands: [connectSubcommand, disconnectSubcommand],
21
+ });
@@ -0,0 +1,16 @@
1
+ import { createCommand } from '../../types';
2
+ import { getCommand } from '../../command-prefix';
3
+ import { githubCommand } from './github';
4
+
5
+ export const command = createCommand({
6
+ name: 'integration',
7
+ description: 'Manage integrations with external services',
8
+ tags: ['requires-auth'],
9
+ examples: [
10
+ {
11
+ command: getCommand('integration github connect'),
12
+ description: 'Connect GitHub to your organization',
13
+ },
14
+ ],
15
+ subcommands: [githubCommand],
16
+ });
package/src/config.ts CHANGED
@@ -596,6 +596,40 @@ export async function createProjectConfig(dir: string, config: InitialProjectCon
596
596
  await Bun.write(join(vscodeDir, 'settings.json'), JSON.stringify(settings, null, 2));
597
597
  }
598
598
 
599
+ export async function updateProjectConfig(
600
+ dir: string,
601
+ updates: Partial<z.infer<typeof ProjectSchema>>,
602
+ config?: Config | null
603
+ ): Promise<void> {
604
+ let configPath = join(dir, 'agentuity.json');
605
+
606
+ if (config?.name) {
607
+ const profileConfigPath = join(dir, `agentuity.${config.name}.json`);
608
+ if (await Bun.file(profileConfigPath).exists()) {
609
+ configPath = profileConfigPath;
610
+ }
611
+ }
612
+
613
+ const file = Bun.file(configPath);
614
+ if (!(await file.exists())) {
615
+ throw new Error(`Project config not found at ${configPath}`);
616
+ }
617
+
618
+ const text = await file.text();
619
+ const existing = JSON5.parse(text);
620
+ const updated = { ...existing, ...updates };
621
+
622
+ const result = ProjectSchema.safeParse(updated);
623
+ if (!result.success) {
624
+ const issues = result.error.issues
625
+ .map((i) => `${i.path.join('.') || 'root'}: ${i.message}`)
626
+ .join(', ');
627
+ throw new Error(`Invalid project config after update: ${issues}`);
628
+ }
629
+
630
+ await Bun.write(configPath, JSON.stringify(updated, null, 2) + '\n');
631
+ }
632
+
599
633
  const BuildMetadataNotFoundError = StructuredError('BuildMetadataNotFoundError');
600
634
 
601
635
  export async function loadBuildMetadata(dir: string): Promise<BuildMetadata> {
package/src/errors.ts CHANGED
@@ -72,6 +72,9 @@ export enum ErrorCode {
72
72
 
73
73
  // Build failed error
74
74
  BUILD_FAILED = 'BUILD_FAILED',
75
+
76
+ // Integration errors
77
+ INTEGRATION_FAILED = 'INTEGRATION_FAILED',
75
78
  }
76
79
 
77
80
  /**
@@ -129,6 +132,10 @@ export function getExitCode(errorCode: ErrorCode): ExitCode {
129
132
  case ErrorCode.BUILD_FAILED:
130
133
  return ExitCode.BUILD_FAILED;
131
134
 
135
+ // Integration errors
136
+ case ErrorCode.INTEGRATION_FAILED:
137
+ return ExitCode.NETWORK_ERROR;
138
+
132
139
  // Resource conflicts and other errors
133
140
  case ErrorCode.RESOURCE_ALREADY_EXISTS:
134
141
  case ErrorCode.RESOURCE_CONFLICT:
package/src/types.ts CHANGED
@@ -554,6 +554,10 @@ export const ProjectSchema = zod.object({
554
554
  orgId: zod.string().describe('the organization id'),
555
555
  region: zod.string().describe('the region identifier that the project is deployed into'),
556
556
  deployment: DeploymentConfig.optional().describe('the deployment configuration'),
557
+ skipGitSetup: zod
558
+ .boolean()
559
+ .optional()
560
+ .describe('whether to skip the git integration setup prompt during deploy'),
557
561
  });
558
562
 
559
563
  export const BuildMetadataSchema = ServerBuildMetadataSchema;