@agentuity/cli 0.1.37 → 0.1.39

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 (89) hide show
  1. package/bin/cli.ts +31 -9
  2. package/dist/agent-detection.d.ts +71 -0
  3. package/dist/agent-detection.d.ts.map +1 -0
  4. package/dist/agent-detection.js +232 -0
  5. package/dist/agent-detection.js.map +1 -0
  6. package/dist/cache/index.d.ts +1 -0
  7. package/dist/cache/index.d.ts.map +1 -1
  8. package/dist/cache/index.js +1 -0
  9. package/dist/cache/index.js.map +1 -1
  10. package/dist/cache/project-cache.d.ts +16 -0
  11. package/dist/cache/project-cache.d.ts.map +1 -0
  12. package/dist/cache/project-cache.js +36 -0
  13. package/dist/cache/project-cache.js.map +1 -0
  14. package/dist/cli.d.ts.map +1 -1
  15. package/dist/cli.js +10 -2
  16. package/dist/cli.js.map +1 -1
  17. package/dist/cmd/auth/index.d.ts.map +1 -1
  18. package/dist/cmd/auth/index.js +0 -2
  19. package/dist/cmd/auth/index.js.map +1 -1
  20. package/dist/cmd/auth/org/enroll.d.ts +2 -0
  21. package/dist/cmd/auth/org/enroll.d.ts.map +1 -0
  22. package/dist/cmd/auth/{machine/setup.js → org/enroll.js} +14 -14
  23. package/dist/cmd/auth/org/enroll.js.map +1 -0
  24. package/dist/cmd/auth/org/index.d.ts.map +1 -1
  25. package/dist/cmd/auth/org/index.js +53 -10
  26. package/dist/cmd/auth/org/index.js.map +1 -1
  27. package/dist/cmd/auth/org/status.d.ts +2 -0
  28. package/dist/cmd/auth/org/status.d.ts.map +1 -0
  29. package/dist/cmd/auth/org/status.js +60 -0
  30. package/dist/cmd/auth/org/status.js.map +1 -0
  31. package/dist/cmd/auth/org/unenroll.d.ts +2 -0
  32. package/dist/cmd/auth/org/unenroll.d.ts.map +1 -0
  33. package/dist/cmd/auth/org/unenroll.js +68 -0
  34. package/dist/cmd/auth/org/unenroll.js.map +1 -0
  35. package/dist/cmd/build/vite/registry-generator.d.ts.map +1 -1
  36. package/dist/cmd/build/vite/registry-generator.js +24 -3
  37. package/dist/cmd/build/vite/registry-generator.js.map +1 -1
  38. package/dist/cmd/cloud/deploy.d.ts.map +1 -1
  39. package/dist/cmd/cloud/deploy.js +11 -4
  40. package/dist/cmd/cloud/deploy.js.map +1 -1
  41. package/dist/cmd/dev/templates.d.ts.map +1 -1
  42. package/dist/cmd/dev/templates.js +1 -4
  43. package/dist/cmd/dev/templates.js.map +1 -1
  44. package/dist/cmd/project/reconcile.d.ts.map +1 -1
  45. package/dist/cmd/project/reconcile.js +15 -2
  46. package/dist/cmd/project/reconcile.js.map +1 -1
  47. package/dist/cmd/support/report.d.ts.map +1 -1
  48. package/dist/cmd/support/report.js.map +1 -1
  49. package/dist/cmd/support/system.d.ts.map +1 -1
  50. package/dist/cmd/support/system.js +5 -0
  51. package/dist/cmd/support/system.js.map +1 -1
  52. package/dist/internal-logger.d.ts +4 -0
  53. package/dist/internal-logger.d.ts.map +1 -1
  54. package/dist/internal-logger.js +18 -0
  55. package/dist/internal-logger.js.map +1 -1
  56. package/dist/types.d.ts +13 -0
  57. package/dist/types.d.ts.map +1 -1
  58. package/dist/types.js.map +1 -1
  59. package/package.json +6 -6
  60. package/src/agent-detection.ts +262 -0
  61. package/src/cache/index.ts +2 -0
  62. package/src/cache/project-cache.ts +41 -0
  63. package/src/cli.ts +10 -2
  64. package/src/cmd/auth/index.ts +0 -2
  65. package/src/cmd/auth/{machine/setup.ts → org/enroll.ts} +13 -13
  66. package/src/cmd/auth/org/index.ts +54 -10
  67. package/src/cmd/auth/org/status.ts +64 -0
  68. package/src/cmd/auth/org/unenroll.ts +80 -0
  69. package/src/cmd/build/vite/registry-generator.ts +24 -3
  70. package/src/cmd/cloud/deploy.ts +11 -4
  71. package/src/cmd/dev/templates.ts +1 -5
  72. package/src/cmd/project/reconcile.ts +15 -2
  73. package/src/cmd/support/report.ts +1 -3
  74. package/src/cmd/support/system.ts +6 -0
  75. package/src/internal-logger.ts +18 -0
  76. package/src/types.ts +13 -0
  77. package/dist/cmd/auth/machine/index.d.ts +0 -2
  78. package/dist/cmd/auth/machine/index.d.ts.map +0 -1
  79. package/dist/cmd/auth/machine/index.js +0 -16
  80. package/dist/cmd/auth/machine/index.js.map +0 -1
  81. package/dist/cmd/auth/machine/setup.d.ts +0 -2
  82. package/dist/cmd/auth/machine/setup.d.ts.map +0 -1
  83. package/dist/cmd/auth/machine/setup.js.map +0 -1
  84. package/dist/legacy-check.d.ts +0 -6
  85. package/dist/legacy-check.d.ts.map +0 -1
  86. package/dist/legacy-check.js +0 -112
  87. package/dist/legacy-check.js.map +0 -1
  88. package/src/cmd/auth/machine/index.ts +0 -16
  89. package/src/legacy-check.ts +0 -137
@@ -719,9 +719,30 @@ export async function generateRouteRegistry(
719
719
  const withoutSrc = normalized.startsWith('src/') ? normalized.substring(4) : normalized;
720
720
  // Make it relative from src/generated/
721
721
  resolvedPath = `../${withoutSrc}`;
722
- // Add .js extension if not already present
723
- if (!resolvedPath.endsWith('.js')) {
724
- resolvedPath = resolvedPath.replace(/\.tsx?$/, '') + '.js';
722
+ // Check if this is a directory import (no file extension) vs a file import
723
+ // Directory imports like '../agent/translate' should resolve to '../agent/translate/index.js'
724
+ // File imports like '../agent/translate/agent' should resolve to '../agent/translate/agent.js'
725
+ const hasExtension = /\.(ts|tsx|js|jsx|mjs|cjs)$/.test(resolvedPath);
726
+ if (!hasExtension) {
727
+ // No extension - check if it's a directory or a file
728
+ // Try to resolve the actual path on disk to determine
729
+ const absolutePath = join(srcDir, withoutSrc);
730
+ const isDirectory =
731
+ existsSync(absolutePath) ||
732
+ existsSync(join(absolutePath, 'index.ts')) ||
733
+ existsSync(join(absolutePath, 'index.tsx'));
734
+ const isFile = existsSync(`${absolutePath}.ts`) || existsSync(`${absolutePath}.tsx`);
735
+
736
+ if (isDirectory && !isFile) {
737
+ // It's a directory import, add /index.js
738
+ resolvedPath = `${resolvedPath}/index.js`;
739
+ } else {
740
+ // It's a file import (or we can't determine), add .js
741
+ resolvedPath = `${resolvedPath}.js`;
742
+ }
743
+ } else {
744
+ // Has extension - replace with .js
745
+ resolvedPath = resolvedPath.replace(/\.tsx?$/, '.js');
725
746
  }
726
747
  }
727
748
 
@@ -61,6 +61,7 @@ import { BuildReportCollector, setGlobalCollector, clearGlobalCollector } from '
61
61
  import { runForkedDeploy } from './deploy-fork';
62
62
  import { validateAptDependencies } from '../../utils/apt-validator';
63
63
  import { extractDependencies } from '../../utils/deps';
64
+ import { getCachedProject, setCachedProject } from '../../cache';
64
65
 
65
66
  const DeploymentCancelledError = StructuredError(
66
67
  'DeploymentCancelled',
@@ -168,10 +169,16 @@ export const deploySubcommand = createSubcommand({
168
169
  const hasTTY = process.stdin.isTTY && process.stdout.isTTY;
169
170
  if (project.region) {
170
171
  try {
171
- const serverProject = await projectGet(apiClient, {
172
- id: project.projectId,
173
- keys: false,
174
- });
172
+ // Check cache first to avoid duplicate API calls
173
+ const profile = config?.name ?? 'default';
174
+ let serverProject = getCachedProject(profile, project.projectId);
175
+ if (!serverProject) {
176
+ serverProject = await projectGet(apiClient, {
177
+ id: project.projectId,
178
+ keys: false,
179
+ });
180
+ setCachedProject(profile, project.projectId, serverProject);
181
+ }
175
182
  const serverRegion = serverProject.cloudRegion;
176
183
 
177
184
  if (serverRegion && serverRegion !== project.region) {
@@ -19,9 +19,6 @@ export default createAgent('${name}', {
19
19
  });
20
20
  `;
21
21
 
22
- const newAgentIndexTemplate = (_name: string) => `export { default } from './agent';
23
- `;
24
-
25
22
  const newRouteTemplate = () => {
26
23
  return `import { createRouter } from '@agentuity/runtime';
27
24
 
@@ -58,8 +55,7 @@ export function createAgentTemplates(dir: string) {
58
55
  return;
59
56
  }
60
57
  const agentName = toPascalCase(name);
61
- writeFileSync(join(dir, 'agent.ts'), newAgentTemplate(agentName));
62
- writeFileSync(join(dir, 'index.ts'), newAgentIndexTemplate(agentName));
58
+ writeFileSync(join(dir, 'index.ts'), newAgentTemplate(agentName));
63
59
  }
64
60
 
65
61
  export function createAPITemplates(dir: string) {
@@ -23,6 +23,7 @@ import {
23
23
  splitEnvAndSecrets,
24
24
  } from '../../env-util';
25
25
  import { fetchRegionsWithCache } from '../../regions';
26
+ import { getCachedProject, setCachedProject } from '../../cache';
26
27
 
27
28
  export interface ReconcileResult {
28
29
  status: 'valid' | 'imported' | 'skipped' | 'error';
@@ -468,7 +469,13 @@ export async function reconcileProject(opts: ReconcileOptions): Promise<Reconcil
468
469
  if (projectConfig) {
469
470
  // 2. Validate access to existing project
470
471
  try {
471
- const project = await projectGet(apiClient, { id: projectConfig.projectId, keys: false });
472
+ // Check cache first to avoid duplicate API calls
473
+ const profile = config?.name ?? 'default';
474
+ let project = getCachedProject(profile, projectConfig.projectId);
475
+ if (!project) {
476
+ project = await projectGet(apiClient, { id: projectConfig.projectId, keys: false });
477
+ setCachedProject(profile, projectConfig.projectId, project);
478
+ }
472
479
 
473
480
  // 3. Check if orgId matches user's orgs
474
481
  const userOrgs = await listOrganizations(apiClient);
@@ -542,7 +549,13 @@ export async function runProjectImport(opts: ReconcileOptions): Promise<Reconcil
542
549
 
543
550
  if (projectConfig) {
544
551
  try {
545
- const project = await projectGet(apiClient, { id: projectConfig.projectId, keys: false });
552
+ // Check cache first to avoid duplicate API calls
553
+ const profile = config?.name ?? 'default';
554
+ let project = getCachedProject(profile, projectConfig.projectId);
555
+ if (!project) {
556
+ project = await projectGet(apiClient, { id: projectConfig.projectId, keys: false });
557
+ setCachedProject(profile, projectConfig.projectId, project);
558
+ }
546
559
  const userOrgs = await listOrganizations(apiClient);
547
560
  const hasAccess = userOrgs.some((org) => org.id === project.orgId);
548
561
 
@@ -257,9 +257,7 @@ export default createSubcommand({
257
257
  if (isJsonMode) {
258
258
  console.log(JSON.stringify({ success: false, error: 'Description is required' }));
259
259
  } else {
260
- tui.error(
261
- 'Description is required. Use --description flag or pipe input via stdin.'
262
- );
260
+ tui.error('Description is required. Use --description flag or pipe input via stdin.');
263
261
  }
264
262
  return;
265
263
  }
@@ -7,6 +7,7 @@ import { getLatestLogSession } from '../../internal-logger';
7
7
  import * as tui from '../../tui';
8
8
  import { getVersion, getPackageName } from '../../version';
9
9
  import { getAuth } from '../../config';
10
+ import { isExecutingFromAgent } from '../../agent-detection';
10
11
 
11
12
  const argsSchema = z.object({});
12
13
 
@@ -75,6 +76,9 @@ export default createSubcommand({
75
76
  }
76
77
  }
77
78
 
79
+ // Get detected agent (if any)
80
+ const detectedAgent = await isExecutingFromAgent();
81
+
78
82
  // Gather system information
79
83
  const systemInfo = {
80
84
  cli: {
@@ -100,6 +104,7 @@ export default createSubcommand({
100
104
  user: {
101
105
  userId: userId,
102
106
  },
107
+ agent: detectedAgent || null,
103
108
  };
104
109
 
105
110
  if (isJsonMode) {
@@ -122,6 +127,7 @@ export default createSubcommand({
122
127
  { Property: 'Home Directory', Value: systemInfo.paths.home },
123
128
  { Property: 'Config Directory', Value: systemInfo.paths.configDir },
124
129
  { Property: 'User ID', Value: systemInfo.user.userId },
130
+ { Property: 'Detected Agent', Value: systemInfo.agent || 'none' },
125
131
  ];
126
132
 
127
133
  tui.table(tableData, ['Property', 'Value'], { layout: 'vertical' });
@@ -388,6 +388,24 @@ export class InternalLogger implements Logger {
388
388
  }
389
389
  }
390
390
 
391
+ /**
392
+ * Update the session with detected agent name
393
+ */
394
+ setDetectedAgent(agent: string): void {
395
+ if (!this.initialized || this.disabled) return;
396
+
397
+ try {
398
+ // Read existing session data
399
+ const existingData = JSON.parse(readFileSync(this.sessionFile, 'utf-8'));
400
+ existingData.detectedAgent = agent;
401
+ // Write updated session data
402
+ writeFileSync(this.sessionFile, JSON.stringify(existingData, null, 2));
403
+ } catch (err) {
404
+ // Ignore errors - this is a best-effort update
405
+ console.debug(`Failed to update detectedAgent in session: ${err}`);
406
+ }
407
+ }
408
+
391
409
  /**
392
410
  * Disable the internal logger (prevents init and logging)
393
411
  */
package/src/types.ts CHANGED
@@ -422,6 +422,19 @@ export type CommandContextFromSpecs<
422
422
  config: Config | null;
423
423
  logger: Logger;
424
424
  options: GlobalOptions;
425
+ /**
426
+ * Check if the CLI is being executed from a known coding agent.
427
+ * Returns the agent name if detected, undefined otherwise.
428
+ *
429
+ * @example
430
+ * ```typescript
431
+ * const agent = await ctx.isExecutingFromAgent();
432
+ * if (agent) {
433
+ * logger.debug(`Running from agent: ${agent}`);
434
+ * }
435
+ * ```
436
+ */
437
+ isExecutingFromAgent: () => Promise<string | undefined>;
425
438
  } & AddArgs<A> &
426
439
  AddOpts<Op> &
427
440
  AddAuth<AuthMode<R, O>> &
@@ -1,2 +0,0 @@
1
- export declare const machineSubcommand: import("../../..").CommandDefinition;
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cmd/auth/machine/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,sCAW5B,CAAC"}
@@ -1,16 +0,0 @@
1
- import { createCommand } from '../../../types';
2
- import { setupSubcommand } from './setup';
3
- import { getCommand } from '../../../command-prefix';
4
- export const machineSubcommand = createCommand({
5
- name: 'machine',
6
- description: 'Manage machine authentication for self-hosted infrastructure',
7
- tags: ['fast', 'requires-auth'],
8
- examples: [
9
- {
10
- command: getCommand('auth machine setup --file ./public-key.pem'),
11
- description: 'Set up machine authentication with a public key',
12
- },
13
- ],
14
- subcommands: [setupSubcommand],
15
- });
16
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cmd/auth/machine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;IAC9C,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,8DAA8D;IAC3E,IAAI,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE;QACT;YACC,OAAO,EAAE,UAAU,CAAC,4CAA4C,CAAC;YACjE,WAAW,EAAE,iDAAiD;SAC9D;KACD;IACD,WAAW,EAAE,CAAC,eAAe,CAAC;CAC9B,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare const setupSubcommand: import("../../..").SubcommandDefinition;
2
- //# sourceMappingURL=setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../../src/cmd/auth/machine/setup.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,eAAe,yCA0F1B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../../src/cmd/auth/machine/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAElC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC5D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CACjD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAC;IAC/C,IAAI,EAAE,OAAO;IACb,WAAW,EACV,wFAAwF;IACzF,IAAI,EAAE,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GAAG,CAAC,IAAI,CACP,qFAAqF,CACrF,CAAC;YACH,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;QAC/C,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACb,GAAG,CAAC,KAAK,CAAC,4CAA4C,EAAE,EAAE,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClF,CAAC;IACF,CAAC;CACD,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Check if the legacy (Go-based) Agentuity CLI is installed
3
- * and block execution with migration instructions
4
- */
5
- export declare function checkLegacyCLI(): Promise<void>;
6
- //# sourceMappingURL=legacy-check.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"legacy-check.d.ts","sourceRoot":"","sources":["../src/legacy-check.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CA2HpD"}
@@ -1,112 +0,0 @@
1
- import { homedir } from 'node:os';
2
- import { join } from 'node:path';
3
- import * as tui from './tui';
4
- /**
5
- * Check if the legacy (Go-based) Agentuity CLI is installed
6
- * and block execution with migration instructions
7
- */
8
- export async function checkLegacyCLI() {
9
- const homeDir = homedir();
10
- const legacyLocations = [
11
- '/opt/homebrew/bin/agentuity', // Homebrew ARM64 (M1/M2/M3 Macs)
12
- '/usr/local/bin/agentuity', // Homebrew Intel Macs / Linux
13
- '/usr/bin/agentuity', // System install
14
- join(homeDir, '.bin/agentuity'), // User bin from install script
15
- join(homeDir, 'bin/agentuity'), // User bin alternate
16
- join(homeDir, '.local/bin/agentuity'), // XDG user bin
17
- ];
18
- // Exclude the currently running executable from the legacy check
19
- // This prevents the new CLI from detecting itself as legacy when installed
20
- // in standard system locations like /usr/local/bin
21
- const currentExecutable = process.execPath;
22
- const foundInstalls = [];
23
- // Check if Homebrew manages the agentuity package
24
- let isBrewManaged = false;
25
- try {
26
- const brewCheck = Bun.spawn(['brew', 'list', '--versions', 'agentuity'], {
27
- stdout: 'ignore',
28
- stderr: 'ignore',
29
- });
30
- const exitCode = await brewCheck.exited;
31
- isBrewManaged = exitCode === 0;
32
- }
33
- catch {
34
- // Homebrew not installed or command failed
35
- }
36
- // Check file system locations
37
- for (const location of legacyLocations) {
38
- // Skip if this is the currently running executable
39
- if (location === currentExecutable) {
40
- continue;
41
- }
42
- const file = Bun.file(location);
43
- if (await file.exists()) {
44
- try {
45
- // Check if it's a compiled binary (not TypeScript)
46
- const proc = Bun.spawn(['file', location], { stdout: 'pipe' });
47
- const output = await new Response(proc.stdout).text();
48
- await proc.exited;
49
- if (output.includes('Mach-O') || output.includes('ELF')) {
50
- // Determine method: if brew manages the package, mark all installs as homebrew
51
- // otherwise check if it's in user home (install-script) or system (manual)
52
- const method = isBrewManaged
53
- ? 'homebrew'
54
- : location.includes(homeDir)
55
- ? 'install-script'
56
- : 'manual';
57
- foundInstalls.push({ path: location, method });
58
- }
59
- }
60
- catch {
61
- // Ignore errors
62
- }
63
- }
64
- }
65
- if (foundInstalls.length === 0 && !isBrewManaged) {
66
- return; // No legacy CLI found
67
- }
68
- // Block execution and show removal instructions
69
- tui.newline();
70
- tui.error('Legacy CLI Conflict Detected');
71
- tui.newline();
72
- console.log(' The legacy (Go-based) Agentuity CLI is installed and conflicts with the new');
73
- console.log(' TypeScript-based CLI. Please remove it before continuing.');
74
- tui.newline();
75
- // Filter installs into brew-managed and manual
76
- const brewInstalls = foundInstalls.filter((install) => isBrewManaged || install.method === 'homebrew');
77
- const manualInstalls = foundInstalls.filter((install) => !isBrewManaged && install.method !== 'homebrew');
78
- // Show Homebrew removal section if any brew-managed installs
79
- if (brewInstalls.length > 0) {
80
- console.log(' ' + tui.bold('Remove via Homebrew:'));
81
- tui.bullet('brew uninstall agentuity');
82
- tui.newline();
83
- // Show which files will be removed by brew
84
- console.log(' ' + tui.muted('This will remove:'));
85
- for (const install of brewInstalls) {
86
- console.log(` "${install.path}"`);
87
- }
88
- tui.newline();
89
- }
90
- // Show manual removal section if any manual installs
91
- if (manualInstalls.length > 0) {
92
- console.log(' ' + tui.bold('Remove the following legacy CLI installations:'));
93
- tui.newline();
94
- for (const install of manualInstalls) {
95
- console.log(` ${tui.muted('"' + install.path + '"')}`);
96
- if (install.method === 'install-script') {
97
- tui.bullet(`rm "${install.path}"`);
98
- }
99
- else {
100
- tui.bullet(`sudo rm "${install.path}"`);
101
- }
102
- }
103
- tui.newline();
104
- }
105
- console.log(' ' + tui.bold('After removal, install the new CLI:'));
106
- tui.bullet('curl -sSL https://agentuity.sh | sh');
107
- tui.newline();
108
- console.log(` Learn more: ${tui.link('https://agentuity.dev/Reference/migration-guide')}`);
109
- tui.newline();
110
- process.exit(1);
111
- }
112
- //# sourceMappingURL=legacy-check.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"legacy-check.js","sourceRoot":"","sources":["../src/legacy-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAO7B;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IACnC,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC;IAE1B,MAAM,eAAe,GAAG;QACvB,6BAA6B,EAAE,iCAAiC;QAChE,0BAA0B,EAAE,8BAA8B;QAC1D,oBAAoB,EAAE,iBAAiB;QACvC,IAAI,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,+BAA+B;QAChE,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,EAAE,qBAAqB;QACrD,IAAI,CAAC,OAAO,EAAE,sBAAsB,CAAC,EAAE,eAAe;KACtD,CAAC;IAEF,iEAAiE;IACjE,2EAA2E;IAC3E,mDAAmD;IACnD,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAE3C,MAAM,aAA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AI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC"}
@@ -1,16 +0,0 @@
1
- import { createCommand } from '../../../types';
2
- import { setupSubcommand } from './setup';
3
- import { getCommand } from '../../../command-prefix';
4
-
5
- export const machineSubcommand = createCommand({
6
- name: 'machine',
7
- description: 'Manage machine authentication for self-hosted infrastructure',
8
- tags: ['fast', 'requires-auth'],
9
- examples: [
10
- {
11
- command: getCommand('auth machine setup --file ./public-key.pem'),
12
- description: 'Set up machine authentication with a public key',
13
- },
14
- ],
15
- subcommands: [setupSubcommand],
16
- });
@@ -1,137 +0,0 @@
1
- import { homedir } from 'node:os';
2
- import { join } from 'node:path';
3
- import * as tui from './tui';
4
-
5
- interface LegacyInstall {
6
- path: string;
7
- method: 'homebrew' | 'manual' | 'install-script';
8
- }
9
-
10
- /**
11
- * Check if the legacy (Go-based) Agentuity CLI is installed
12
- * and block execution with migration instructions
13
- */
14
- export async function checkLegacyCLI(): Promise<void> {
15
- const homeDir = homedir();
16
-
17
- const legacyLocations = [
18
- '/opt/homebrew/bin/agentuity', // Homebrew ARM64 (M1/M2/M3 Macs)
19
- '/usr/local/bin/agentuity', // Homebrew Intel Macs / Linux
20
- '/usr/bin/agentuity', // System install
21
- join(homeDir, '.bin/agentuity'), // User bin from install script
22
- join(homeDir, 'bin/agentuity'), // User bin alternate
23
- join(homeDir, '.local/bin/agentuity'), // XDG user bin
24
- ];
25
-
26
- // Exclude the currently running executable from the legacy check
27
- // This prevents the new CLI from detecting itself as legacy when installed
28
- // in standard system locations like /usr/local/bin
29
- const currentExecutable = process.execPath;
30
-
31
- const foundInstalls: LegacyInstall[] = [];
32
-
33
- // Check if Homebrew manages the agentuity package
34
- let isBrewManaged = false;
35
- try {
36
- const brewCheck = Bun.spawn(['brew', 'list', '--versions', 'agentuity'], {
37
- stdout: 'ignore',
38
- stderr: 'ignore',
39
- });
40
- const exitCode = await brewCheck.exited;
41
- isBrewManaged = exitCode === 0;
42
- } catch {
43
- // Homebrew not installed or command failed
44
- }
45
-
46
- // Check file system locations
47
- for (const location of legacyLocations) {
48
- // Skip if this is the currently running executable
49
- if (location === currentExecutable) {
50
- continue;
51
- }
52
-
53
- const file = Bun.file(location);
54
- if (await file.exists()) {
55
- try {
56
- // Check if it's a compiled binary (not TypeScript)
57
- const proc = Bun.spawn(['file', location], { stdout: 'pipe' });
58
- const output = await new Response(proc.stdout).text();
59
- await proc.exited;
60
-
61
- if (output.includes('Mach-O') || output.includes('ELF')) {
62
- // Determine method: if brew manages the package, mark all installs as homebrew
63
- // otherwise check if it's in user home (install-script) or system (manual)
64
- const method = isBrewManaged
65
- ? 'homebrew'
66
- : location.includes(homeDir)
67
- ? 'install-script'
68
- : 'manual';
69
- foundInstalls.push({ path: location, method });
70
- }
71
- } catch {
72
- // Ignore errors
73
- }
74
- }
75
- }
76
-
77
- if (foundInstalls.length === 0 && !isBrewManaged) {
78
- return; // No legacy CLI found
79
- }
80
-
81
- // Block execution and show removal instructions
82
- tui.newline();
83
- tui.error('Legacy CLI Conflict Detected');
84
- tui.newline();
85
-
86
- console.log(' The legacy (Go-based) Agentuity CLI is installed and conflicts with the new');
87
- console.log(' TypeScript-based CLI. Please remove it before continuing.');
88
- tui.newline();
89
-
90
- // Filter installs into brew-managed and manual
91
- const brewInstalls = foundInstalls.filter(
92
- (install) => isBrewManaged || install.method === 'homebrew'
93
- );
94
- const manualInstalls = foundInstalls.filter(
95
- (install) => !isBrewManaged && install.method !== 'homebrew'
96
- );
97
-
98
- // Show Homebrew removal section if any brew-managed installs
99
- if (brewInstalls.length > 0) {
100
- console.log(' ' + tui.bold('Remove via Homebrew:'));
101
- tui.bullet('brew uninstall agentuity');
102
- tui.newline();
103
-
104
- // Show which files will be removed by brew
105
- console.log(' ' + tui.muted('This will remove:'));
106
- for (const install of brewInstalls) {
107
- console.log(` "${install.path}"`);
108
- }
109
- tui.newline();
110
- }
111
-
112
- // Show manual removal section if any manual installs
113
- if (manualInstalls.length > 0) {
114
- console.log(' ' + tui.bold('Remove the following legacy CLI installations:'));
115
- tui.newline();
116
-
117
- for (const install of manualInstalls) {
118
- console.log(` ${tui.muted('"' + install.path + '"')}`);
119
-
120
- if (install.method === 'install-script') {
121
- tui.bullet(`rm "${install.path}"`);
122
- } else {
123
- tui.bullet(`sudo rm "${install.path}"`);
124
- }
125
- }
126
- tui.newline();
127
- }
128
-
129
- console.log(' ' + tui.bold('After removal, install the new CLI:'));
130
- tui.bullet('curl -sSL https://agentuity.sh | sh');
131
- tui.newline();
132
-
133
- console.log(` Learn more: ${tui.link('https://agentuity.dev/Reference/migration-guide')}`);
134
- tui.newline();
135
-
136
- process.exit(1);
137
- }