@agentuity/cli 0.0.12 → 0.0.15

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 (115) hide show
  1. package/dist/api.d.ts +5 -0
  2. package/dist/api.d.ts.map +1 -1
  3. package/dist/auth.d.ts +2 -0
  4. package/dist/auth.d.ts.map +1 -1
  5. package/dist/cli.d.ts.map +1 -1
  6. package/dist/cmd/auth/api.d.ts +8 -1
  7. package/dist/cmd/auth/api.d.ts.map +1 -1
  8. package/dist/cmd/auth/index.d.ts +1 -1
  9. package/dist/cmd/auth/index.d.ts.map +1 -1
  10. package/dist/cmd/auth/login.d.ts +1 -1
  11. package/dist/cmd/auth/login.d.ts.map +1 -1
  12. package/dist/cmd/auth/logout.d.ts +1 -1
  13. package/dist/cmd/auth/logout.d.ts.map +1 -1
  14. package/dist/cmd/auth/signup.d.ts +3 -0
  15. package/dist/cmd/auth/signup.d.ts.map +1 -0
  16. package/dist/cmd/bundle/index.d.ts +1 -1
  17. package/dist/cmd/bundle/index.d.ts.map +1 -1
  18. package/dist/cmd/dev/index.d.ts +1 -1
  19. package/dist/cmd/dev/index.d.ts.map +1 -1
  20. package/dist/cmd/example/create-user.d.ts +1 -1
  21. package/dist/cmd/example/create-user.d.ts.map +1 -1
  22. package/dist/cmd/example/create.d.ts +1 -1
  23. package/dist/cmd/example/create.d.ts.map +1 -1
  24. package/dist/cmd/example/deploy.d.ts +1 -1
  25. package/dist/cmd/example/deploy.d.ts.map +1 -1
  26. package/dist/cmd/example/index.d.ts +1 -1
  27. package/dist/cmd/example/index.d.ts.map +1 -1
  28. package/dist/cmd/example/list.d.ts +1 -1
  29. package/dist/cmd/example/list.d.ts.map +1 -1
  30. package/dist/cmd/example/optional-auth.d.ts +3 -0
  31. package/dist/cmd/example/optional-auth.d.ts.map +1 -0
  32. package/dist/cmd/example/run-command.d.ts +1 -1
  33. package/dist/cmd/example/run-command.d.ts.map +1 -1
  34. package/dist/cmd/example/spinner.d.ts +1 -1
  35. package/dist/cmd/example/spinner.d.ts.map +1 -1
  36. package/dist/cmd/example/steps.d.ts +1 -1
  37. package/dist/cmd/example/steps.d.ts.map +1 -1
  38. package/dist/cmd/example/version.d.ts +1 -1
  39. package/dist/cmd/example/version.d.ts.map +1 -1
  40. package/dist/cmd/profile/create.d.ts +1 -1
  41. package/dist/cmd/profile/create.d.ts.map +1 -1
  42. package/dist/cmd/profile/delete.d.ts +1 -1
  43. package/dist/cmd/profile/delete.d.ts.map +1 -1
  44. package/dist/cmd/profile/index.d.ts +1 -1
  45. package/dist/cmd/profile/index.d.ts.map +1 -1
  46. package/dist/cmd/profile/list.d.ts +1 -1
  47. package/dist/cmd/profile/list.d.ts.map +1 -1
  48. package/dist/cmd/profile/show.d.ts +1 -1
  49. package/dist/cmd/profile/show.d.ts.map +1 -1
  50. package/dist/cmd/profile/use.d.ts +1 -1
  51. package/dist/cmd/profile/use.d.ts.map +1 -1
  52. package/dist/cmd/project/create.d.ts +1 -1
  53. package/dist/cmd/project/create.d.ts.map +1 -1
  54. package/dist/cmd/project/delete.d.ts +1 -1
  55. package/dist/cmd/project/delete.d.ts.map +1 -1
  56. package/dist/cmd/project/download.d.ts +1 -1
  57. package/dist/cmd/project/download.d.ts.map +1 -1
  58. package/dist/cmd/project/index.d.ts +1 -1
  59. package/dist/cmd/project/index.d.ts.map +1 -1
  60. package/dist/cmd/project/list.d.ts +1 -1
  61. package/dist/cmd/project/list.d.ts.map +1 -1
  62. package/dist/cmd/project/show.d.ts +1 -1
  63. package/dist/cmd/project/show.d.ts.map +1 -1
  64. package/dist/cmd/project/template-flow.d.ts +1 -1
  65. package/dist/cmd/project/template-flow.d.ts.map +1 -1
  66. package/dist/cmd/version/index.d.ts +1 -1
  67. package/dist/cmd/version/index.d.ts.map +1 -1
  68. package/dist/config.d.ts.map +1 -1
  69. package/dist/index.d.ts +1 -0
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/tui.d.ts +22 -0
  72. package/dist/tui.d.ts.map +1 -1
  73. package/dist/types.d.ts +29 -4
  74. package/dist/types.d.ts.map +1 -1
  75. package/package.json +1 -1
  76. package/src/api.ts +16 -2
  77. package/src/auth.ts +79 -4
  78. package/src/cli.ts +51 -1
  79. package/src/cmd/auth/README.md +37 -3
  80. package/src/cmd/auth/api.ts +67 -3
  81. package/src/cmd/auth/index.ts +3 -2
  82. package/src/cmd/auth/login.ts +15 -7
  83. package/src/cmd/auth/logout.ts +3 -3
  84. package/src/cmd/auth/signup.ts +51 -0
  85. package/src/cmd/bundle/index.ts +1 -1
  86. package/src/cmd/dev/index.ts +137 -50
  87. package/src/cmd/example/create-user.ts +1 -1
  88. package/src/cmd/example/create.ts +1 -1
  89. package/src/cmd/example/deploy.ts +1 -1
  90. package/src/cmd/example/index.ts +3 -1
  91. package/src/cmd/example/list.ts +1 -1
  92. package/src/cmd/example/optional-auth.ts +38 -0
  93. package/src/cmd/example/run-command.ts +2 -2
  94. package/src/cmd/example/sound.ts +2 -2
  95. package/src/cmd/example/spinner.ts +2 -2
  96. package/src/cmd/example/steps.ts +2 -2
  97. package/src/cmd/example/version.ts +1 -1
  98. package/src/cmd/profile/create.ts +3 -3
  99. package/src/cmd/profile/delete.ts +3 -3
  100. package/src/cmd/profile/index.ts +1 -1
  101. package/src/cmd/profile/list.ts +3 -3
  102. package/src/cmd/profile/show.ts +3 -3
  103. package/src/cmd/profile/use.ts +3 -3
  104. package/src/cmd/project/create.ts +1 -1
  105. package/src/cmd/project/delete.ts +1 -1
  106. package/src/cmd/project/download.ts +3 -3
  107. package/src/cmd/project/index.ts +1 -1
  108. package/src/cmd/project/list.ts +1 -1
  109. package/src/cmd/project/show.ts +1 -1
  110. package/src/cmd/project/template-flow.ts +3 -3
  111. package/src/cmd/version/index.ts +3 -3
  112. package/src/config.ts +9 -2
  113. package/src/index.ts +1 -0
  114. package/src/tui.ts +121 -6
  115. package/src/types.ts +47 -2
@@ -1,9 +1,9 @@
1
- import { createCommand } from '@/types';
1
+ import { createCommand } from '../../types';
2
2
  import { z } from 'zod';
3
- import { resolve } from 'node:path';
3
+ import { resolve, join } from 'node:path';
4
4
  import { bundle } from '../bundle/bundler';
5
- import { existsSync } from 'node:fs';
6
- import * as tui from '@/tui';
5
+ import { existsSync, FSWatcher, watch } from 'node:fs';
6
+ import * as tui from '../../tui';
7
7
 
8
8
  export const command = createCommand({
9
9
  name: 'dev',
@@ -13,69 +13,156 @@ export const command = createCommand({
13
13
  dir: z.string().optional().describe('Root directory of the project'),
14
14
  }),
15
15
  },
16
+ optionalAuth: 'Continue without an account (local only)',
16
17
 
17
18
  async handler(ctx) {
18
- const { opts } = ctx;
19
+ const { opts, logger } = ctx;
20
+
19
21
  const rootDir = resolve(opts.dir || process.cwd());
22
+ const appTs = join(rootDir, 'app.ts');
23
+ const srcDir = join(rootDir, 'src');
24
+ const mustHaves = [join(rootDir, 'package.json'), appTs, srcDir];
25
+ const missing: string[] = [];
26
+
27
+ for (const filename of mustHaves) {
28
+ if (!existsSync(filename)) {
29
+ missing.push(filename);
30
+ }
31
+ }
32
+
33
+ if (missing.length) {
34
+ tui.error(`${rootDir} does not appear to be a valid Agentuity project`);
35
+ for (const filename of missing) {
36
+ tui.bullet(`Missing ${filename}`);
37
+ }
38
+ process.exit(1);
39
+ }
40
+
20
41
  const agentuityDir = resolve(rootDir, '.agentuity');
21
42
  const appPath = resolve(agentuityDir, 'app.js');
22
43
 
23
- try {
24
- await tui.spinner('Building project...', async () => {
25
- await bundle({
26
- rootDir,
27
- dev: true,
28
- });
29
- });
44
+ const watches = [appTs, srcDir];
45
+ const watchers: FSWatcher[] = [];
46
+ let failures = 0;
47
+ let running = false;
48
+ let pid = 0;
49
+ let failed = false;
50
+ let devServer: Bun.Subprocess | undefined;
30
51
 
31
- tui.success('Build complete');
52
+ function failure(msg: string) {
53
+ failed = true;
54
+ failures++;
55
+ if (failures >= 5) {
56
+ tui.error(msg);
57
+ tui.fatal('too many failures, exiting');
58
+ } else {
59
+ setImmediate(() => tui.error(msg));
60
+ }
61
+ }
32
62
 
33
- if (!existsSync(appPath)) {
34
- tui.error(`App file not found: ${appPath}`);
35
- process.exit(1);
63
+ const kill = () => {
64
+ running = false;
65
+ try {
66
+ // Kill the process group (negative PID kills entire group)
67
+ process.kill(-pid, 'SIGTERM');
68
+ } catch {
69
+ // Fallback: kill the direct process
70
+ try {
71
+ if (devServer) {
72
+ devServer.kill();
73
+ }
74
+ } catch {
75
+ // Ignore if already dead
76
+ }
77
+ } finally {
78
+ devServer = undefined;
36
79
  }
80
+ };
37
81
 
38
- tui.info('Starting development server...');
39
-
40
- // Use shell to run in a process group for proper cleanup
41
- // The 'exec' ensures the shell is replaced by the actual process
42
- const devServer = Bun.spawn(['sh', '-c', `exec bun run "${appPath}"`], {
43
- cwd: rootDir,
44
- stdout: 'inherit',
45
- stderr: 'inherit',
46
- stdin: 'inherit',
47
- });
48
-
49
- // Handle signals to ensure entire process tree is killed
50
- const cleanup = () => {
51
- if (devServer.pid) {
52
- try {
53
- // Kill the process group (negative PID kills entire group)
54
- process.kill(-devServer.pid, 'SIGTERM');
55
- } catch {
56
- // Fallback: kill the direct process
82
+ // Handle signals to ensure entire process tree is killed
83
+ const cleanup = () => {
84
+ if (pid && running) {
85
+ kill();
86
+ }
87
+ for (const watcher of watchers) {
88
+ watcher.close();
89
+ }
90
+ watchers.length = 0;
91
+ process.exit(0);
92
+ };
93
+
94
+ process.on('SIGINT', cleanup);
95
+ process.on('SIGTERM', cleanup);
96
+
97
+ async function restart() {
98
+ try {
99
+ if (running) {
100
+ tui.info('Restarting on file change');
101
+ kill();
102
+ return;
103
+ }
104
+ await Promise.all([
105
+ tui.runCommand({
106
+ command: 'tsc',
107
+ cmd: ['bunx', 'tsc', '--noEmit'],
108
+ cwd: rootDir,
109
+ clearOnSuccess: true,
110
+ truncate: false,
111
+ maxLinesOutput: 1,
112
+ maxLinesOnFailure: 15,
113
+ }),
114
+ tui.spinner('Building project', async () => {
57
115
  try {
58
- devServer.kill();
116
+ await bundle({
117
+ rootDir,
118
+ dev: true,
119
+ });
59
120
  } catch {
60
- // Ignore if already dead
121
+ failure('Build failed');
61
122
  }
62
- }
123
+ }),
124
+ ]);
125
+
126
+ if (failed) {
127
+ return;
63
128
  }
64
- process.exit(0);
65
- };
66
129
 
67
- process.on('SIGINT', cleanup);
68
- process.on('SIGTERM', cleanup);
130
+ if (!existsSync(appPath)) {
131
+ failure(`App file not found: ${appPath}`);
132
+ return;
133
+ }
69
134
 
70
- const exitCode = await devServer.exited;
71
- process.exit(exitCode);
72
- } catch (error) {
73
- if (error instanceof Error) {
74
- tui.error(`Dev server failed: ${error.message}`);
75
- } else {
76
- tui.error('Dev server failed');
135
+ // Use shell to run in a process group for proper cleanup
136
+ // The 'exec' ensures the shell is replaced by the actual process
137
+ const devServer = Bun.spawn(['sh', '-c', `exec bun run "${appPath}"`], {
138
+ cwd: rootDir,
139
+ stdout: 'inherit',
140
+ stderr: 'inherit',
141
+ stdin: 'inherit',
142
+ });
143
+
144
+ running = true;
145
+ failed = false;
146
+ pid = devServer.pid;
147
+
148
+ const exitCode = await devServer.exited;
149
+ if (exitCode === 0) {
150
+ process.exit(exitCode);
151
+ }
152
+ } catch (error) {
153
+ if (error instanceof Error) {
154
+ failure(`Dev server failed: ${error.message}`);
155
+ } else {
156
+ failure('Dev server failed');
157
+ }
158
+ } finally {
159
+ running = false;
77
160
  }
78
- process.exit(1);
161
+ }
162
+ await restart();
163
+ for (const filename of watches) {
164
+ logger.trace('watching %s', filename);
165
+ watchers.push(watch(filename, { recursive: true }, restart));
79
166
  }
80
167
  },
81
168
  });
@@ -1,4 +1,4 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
  import { z } from 'zod';
3
3
 
4
4
  export const createUserSubcommand = createSubcommand({
@@ -1,4 +1,4 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
  import { z } from 'zod';
3
3
 
4
4
  export const createCommand = createSubcommand({
@@ -1,4 +1,4 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
  import { z } from 'zod';
3
3
 
4
4
  export const deploySubcommand = createSubcommand({
@@ -1,4 +1,4 @@
1
- import { createCommand } from '@/types';
1
+ import { createCommand } from '../../types';
2
2
  import { createCommand as createSubCmd } from './create';
3
3
  import { listSubcommand } from './list';
4
4
  import { stepsSubcommand } from './steps';
@@ -8,6 +8,7 @@ import { versionSubcommand } from './version';
8
8
  import { createUserSubcommand } from './create-user';
9
9
  import { runCommandSubcommand } from './run-command';
10
10
  import { soundSubcommand } from './sound';
11
+ import { optionalAuthSubcommand } from './optional-auth';
11
12
 
12
13
  export const command = createCommand({
13
14
  name: 'example',
@@ -23,5 +24,6 @@ export const command = createCommand({
23
24
  createUserSubcommand,
24
25
  runCommandSubcommand,
25
26
  soundSubcommand,
27
+ optionalAuthSubcommand,
26
28
  ],
27
29
  });
@@ -1,4 +1,4 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
  import { z } from 'zod';
3
3
 
4
4
  export const listSubcommand = createSubcommand({
@@ -0,0 +1,38 @@
1
+ import type { SubcommandDefinition, CommandContext, AuthData } from '../../types';
2
+ import * as tui from '../../tui';
3
+
4
+ export const optionalAuthSubcommand: SubcommandDefinition = {
5
+ name: 'optional-auth',
6
+ description: 'Test optional authentication flow',
7
+ optionalAuth: 'Continue with local features only',
8
+ handler: async (ctx: CommandContext) => {
9
+ tui.newline();
10
+
11
+ // Type guard to check if auth is present
12
+ const ctxWithAuth = ctx as CommandContext<true>;
13
+ if ('auth' in ctx && ctxWithAuth.auth) {
14
+ const auth = ctxWithAuth.auth as AuthData;
15
+ // User chose to authenticate
16
+ tui.success('You are authenticated!');
17
+ tui.info(`User ID: ${auth.userId}`);
18
+ tui.info(`Session expires: ${auth.expires.toLocaleString()}`);
19
+ tui.newline();
20
+ tui.info('You can now access cloud features:');
21
+ tui.bullet('Deploy to production');
22
+ tui.bullet('Access remote resources');
23
+ tui.bullet('View team analytics');
24
+ } else {
25
+ // User chose to continue without auth
26
+ tui.info('Running in local mode (no authentication)');
27
+ tui.newline();
28
+ tui.info('Available local features:');
29
+ tui.bullet('Local development');
30
+ tui.bullet('Offline testing');
31
+ tui.bullet('Build and bundle');
32
+ tui.newline();
33
+ tui.warning('Some cloud features are unavailable without authentication');
34
+ }
35
+
36
+ tui.newline();
37
+ },
38
+ };
@@ -1,5 +1,5 @@
1
- import { createSubcommand } from '@/types';
2
- import * as tui from '@/tui';
1
+ import { createSubcommand } from '../../types';
2
+ import * as tui from '../../tui';
3
3
 
4
4
  export const runCommandSubcommand = createSubcommand({
5
5
  name: 'run-command',
@@ -1,6 +1,6 @@
1
1
  import type { SubcommandDefinition } from '../../types';
2
- import * as tui from '@/tui';
3
- import { playSound } from '@/sound';
2
+ import * as tui from '../../tui';
3
+ import { playSound } from '../../sound';
4
4
 
5
5
  export const soundSubcommand: SubcommandDefinition = {
6
6
  name: 'sound',
@@ -1,5 +1,5 @@
1
- import { createSubcommand } from '@/types';
2
- import * as tui from '@/tui';
1
+ import { createSubcommand } from '../../types';
2
+ import * as tui from '../../tui';
3
3
 
4
4
  export const spinnerSubcommand = createSubcommand({
5
5
  name: 'spinner',
@@ -1,5 +1,5 @@
1
- import { createSubcommand } from '@/types';
2
- import { runSteps, stepSuccess, stepSkipped, stepError } from '@/steps';
1
+ import { createSubcommand } from '../../types';
2
+ import { runSteps, stepSuccess, stepSkipped, stepError } from '../../steps';
3
3
 
4
4
  export const stepsSubcommand = createSubcommand({
5
5
  name: 'steps',
@@ -1,4 +1,4 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
 
3
3
  export const versionSubcommand = createSubcommand({
4
4
  name: 'version',
@@ -1,14 +1,14 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
  import { z } from 'zod';
3
3
  import {
4
4
  fetchProfiles,
5
5
  getDefaultConfigDir,
6
6
  ensureConfigDir,
7
7
  generateYAMLTemplate,
8
- } from '@/config';
8
+ } from '../../config';
9
9
  import { join } from 'node:path';
10
10
  import { writeFile } from 'node:fs/promises';
11
- import * as tui from '@/tui';
11
+ import * as tui from '../../tui';
12
12
 
13
13
  const PROFILE_NAME_REGEX = /^[\w_-]{3,}$/;
14
14
 
@@ -1,8 +1,8 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
  import { z } from 'zod';
3
- import { fetchProfiles } from '@/config';
3
+ import { fetchProfiles } from '../../config';
4
4
  import { unlink } from 'node:fs/promises';
5
- import * as tui from '@/tui';
5
+ import * as tui from '../../tui';
6
6
 
7
7
  export const deleteCommand = createSubcommand({
8
8
  name: 'delete',
@@ -1,4 +1,4 @@
1
- import { createCommand } from '@/types';
1
+ import { createCommand } from '../../types';
2
2
  import { createCommand as createProfileCmd } from './create';
3
3
  import { useCommand } from './use';
4
4
  import { listCommand } from './list';
@@ -1,7 +1,7 @@
1
- import type { SubcommandDefinition } from '@/types';
2
- import { fetchProfiles } from '@/config';
1
+ import type { SubcommandDefinition } from '../../types';
2
+ import { fetchProfiles } from '../../config';
3
3
  import { basename, dirname } from 'node:path';
4
- import * as tui from '@/tui';
4
+ import * as tui from '../../tui';
5
5
 
6
6
  export const listCommand: SubcommandDefinition = {
7
7
  name: 'list',
@@ -1,8 +1,8 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
  import { z } from 'zod';
3
- import { getProfile, fetchProfiles } from '@/config';
3
+ import { getProfile, fetchProfiles } from '../../config';
4
4
  import { readFile } from 'node:fs/promises';
5
- import * as tui from '@/tui';
5
+ import * as tui from '../../tui';
6
6
 
7
7
  export const showCommand = createSubcommand({
8
8
  name: 'show',
@@ -1,7 +1,7 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
  import { z } from 'zod';
3
- import { fetchProfiles, saveProfile } from '@/config';
4
- import * as tui from '@/tui';
3
+ import { fetchProfiles, saveProfile } from '../../config';
4
+ import * as tui from '../../tui';
5
5
 
6
6
  export const useCommand = createSubcommand({
7
7
  name: 'use',
@@ -1,4 +1,4 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
  import { z } from 'zod';
3
3
  import { runCreateFlow } from './template-flow';
4
4
 
@@ -1,4 +1,4 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
 
3
3
  export const deleteSubcommand = createSubcommand({
4
4
  name: 'delete',
@@ -4,9 +4,9 @@ import { homedir } from 'node:os';
4
4
  import { pipeline } from 'node:stream/promises';
5
5
  import { createGunzip } from 'node:zlib';
6
6
  import { extract, type Headers } from 'tar-fs';
7
- import type { Logger } from '@/logger';
8
- import * as tui from '@/tui';
9
- import { downloadWithSpinner } from '@/download';
7
+ import type { Logger } from '../../logger';
8
+ import * as tui from '../../tui';
9
+ import { downloadWithSpinner } from '../../download';
10
10
  import type { TemplateInfo } from './templates';
11
11
 
12
12
  const GITHUB_REPO = 'agentuity/sdk';
@@ -1,4 +1,4 @@
1
- import { createCommand } from '@/types';
1
+ import { createCommand } from '../../types';
2
2
  import { createProjectSubcommand } from './create';
3
3
  import { listSubcommand } from './list';
4
4
  import { deleteSubcommand } from './delete';
@@ -1,4 +1,4 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
 
3
3
  export const listSubcommand = createSubcommand({
4
4
  name: 'list',
@@ -1,4 +1,4 @@
1
- import { createSubcommand } from '@/types';
1
+ import { createSubcommand } from '../../types';
2
2
 
3
3
  export const showSubcommand = createSubcommand({
4
4
  name: 'show',
@@ -3,9 +3,9 @@ import { existsSync, readdirSync, rmSync } from 'node:fs';
3
3
  import { cwd } from 'node:process';
4
4
  import { homedir } from 'node:os';
5
5
  import enquirer from 'enquirer';
6
- import type { Logger } from '@/logger';
7
- import * as tui from '@/tui';
8
- import { playSound } from '@/sound';
6
+ import type { Logger } from '../../logger';
7
+ import * as tui from '../../tui';
8
+ import { playSound } from '../../sound';
9
9
  import { fetchTemplates, type TemplateInfo } from './templates';
10
10
  import { downloadTemplate, setupProject } from './download';
11
11
 
@@ -1,6 +1,6 @@
1
- import { createCommand } from '@/types';
2
- import { getVersion } from '@/version';
3
- import { logger } from '@/logger';
1
+ import { createCommand } from '../../types';
2
+ import { getVersion } from '../../version';
3
+ import { logger } from '../../logger';
4
4
 
5
5
  export const command = createCommand({
6
6
  name: 'version',
package/src/config.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { YAML } from 'bun';
2
- import { join, extname } from 'node:path';
2
+ import { join, extname, basename } from 'node:path';
3
3
  import { homedir } from 'node:os';
4
4
  import { mkdir, readdir, readFile, writeFile, chmod } from 'node:fs/promises';
5
5
  import type { Config, Profile, AuthData } from './types';
6
6
  import { ConfigSchema } from './types';
7
- import * as tui from '@/tui';
7
+ import * as tui from './tui';
8
8
  import { z } from 'zod';
9
9
 
10
10
  export function getDefaultConfigDir(): string {
@@ -104,6 +104,13 @@ export async function loadConfig(customPath?: string): Promise<Config | null> {
104
104
  const content = await file.text();
105
105
  const config = YAML.parse(content);
106
106
 
107
+ // check to see if this is a legacy config file that might not have the required name
108
+ // and in this case we can just use the filename
109
+ const _config = config as { name?: string };
110
+ if (!_config.name) {
111
+ _config.name = basename(configPath).replace(extname(configPath), '');
112
+ }
113
+
107
114
  const result = ConfigSchema.safeParse(config);
108
115
  if (!result.success) {
109
116
  tui.error(`Invalid config in ${configPath}:`);
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { createCLI, registerCommands } from './cli';
2
2
  export { validateRuntime, isBun } from './runtime';
3
3
  export { getVersion, getRevision, getPackageName, getPackage } from './version';
4
+ export { requireAuth, optionalAuth, withAuth, withOptionalAuth } from './auth';
4
5
  export {
5
6
  loadConfig,
6
7
  saveConfig,