@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.
- package/dist/api.d.ts +5 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/auth.d.ts +2 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cmd/auth/api.d.ts +8 -1
- package/dist/cmd/auth/api.d.ts.map +1 -1
- package/dist/cmd/auth/index.d.ts +1 -1
- package/dist/cmd/auth/index.d.ts.map +1 -1
- package/dist/cmd/auth/login.d.ts +1 -1
- package/dist/cmd/auth/login.d.ts.map +1 -1
- package/dist/cmd/auth/logout.d.ts +1 -1
- package/dist/cmd/auth/logout.d.ts.map +1 -1
- package/dist/cmd/auth/signup.d.ts +3 -0
- package/dist/cmd/auth/signup.d.ts.map +1 -0
- package/dist/cmd/bundle/index.d.ts +1 -1
- package/dist/cmd/bundle/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.d.ts +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/example/create-user.d.ts +1 -1
- package/dist/cmd/example/create-user.d.ts.map +1 -1
- package/dist/cmd/example/create.d.ts +1 -1
- package/dist/cmd/example/create.d.ts.map +1 -1
- package/dist/cmd/example/deploy.d.ts +1 -1
- package/dist/cmd/example/deploy.d.ts.map +1 -1
- package/dist/cmd/example/index.d.ts +1 -1
- package/dist/cmd/example/index.d.ts.map +1 -1
- package/dist/cmd/example/list.d.ts +1 -1
- package/dist/cmd/example/list.d.ts.map +1 -1
- package/dist/cmd/example/optional-auth.d.ts +3 -0
- package/dist/cmd/example/optional-auth.d.ts.map +1 -0
- package/dist/cmd/example/run-command.d.ts +1 -1
- package/dist/cmd/example/run-command.d.ts.map +1 -1
- package/dist/cmd/example/spinner.d.ts +1 -1
- package/dist/cmd/example/spinner.d.ts.map +1 -1
- package/dist/cmd/example/steps.d.ts +1 -1
- package/dist/cmd/example/steps.d.ts.map +1 -1
- package/dist/cmd/example/version.d.ts +1 -1
- package/dist/cmd/example/version.d.ts.map +1 -1
- package/dist/cmd/profile/create.d.ts +1 -1
- package/dist/cmd/profile/create.d.ts.map +1 -1
- package/dist/cmd/profile/delete.d.ts +1 -1
- package/dist/cmd/profile/delete.d.ts.map +1 -1
- package/dist/cmd/profile/index.d.ts +1 -1
- package/dist/cmd/profile/index.d.ts.map +1 -1
- package/dist/cmd/profile/list.d.ts +1 -1
- package/dist/cmd/profile/list.d.ts.map +1 -1
- package/dist/cmd/profile/show.d.ts +1 -1
- package/dist/cmd/profile/show.d.ts.map +1 -1
- package/dist/cmd/profile/use.d.ts +1 -1
- package/dist/cmd/profile/use.d.ts.map +1 -1
- package/dist/cmd/project/create.d.ts +1 -1
- package/dist/cmd/project/create.d.ts.map +1 -1
- package/dist/cmd/project/delete.d.ts +1 -1
- package/dist/cmd/project/delete.d.ts.map +1 -1
- package/dist/cmd/project/download.d.ts +1 -1
- package/dist/cmd/project/download.d.ts.map +1 -1
- package/dist/cmd/project/index.d.ts +1 -1
- package/dist/cmd/project/index.d.ts.map +1 -1
- package/dist/cmd/project/list.d.ts +1 -1
- package/dist/cmd/project/list.d.ts.map +1 -1
- package/dist/cmd/project/show.d.ts +1 -1
- package/dist/cmd/project/show.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.d.ts +1 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/version/index.d.ts +1 -1
- package/dist/cmd/version/index.d.ts.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/tui.d.ts +22 -0
- package/dist/tui.d.ts.map +1 -1
- package/dist/types.d.ts +29 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +16 -2
- package/src/auth.ts +79 -4
- package/src/cli.ts +51 -1
- package/src/cmd/auth/README.md +37 -3
- package/src/cmd/auth/api.ts +67 -3
- package/src/cmd/auth/index.ts +3 -2
- package/src/cmd/auth/login.ts +15 -7
- package/src/cmd/auth/logout.ts +3 -3
- package/src/cmd/auth/signup.ts +51 -0
- package/src/cmd/bundle/index.ts +1 -1
- package/src/cmd/dev/index.ts +137 -50
- package/src/cmd/example/create-user.ts +1 -1
- package/src/cmd/example/create.ts +1 -1
- package/src/cmd/example/deploy.ts +1 -1
- package/src/cmd/example/index.ts +3 -1
- package/src/cmd/example/list.ts +1 -1
- package/src/cmd/example/optional-auth.ts +38 -0
- package/src/cmd/example/run-command.ts +2 -2
- package/src/cmd/example/sound.ts +2 -2
- package/src/cmd/example/spinner.ts +2 -2
- package/src/cmd/example/steps.ts +2 -2
- package/src/cmd/example/version.ts +1 -1
- package/src/cmd/profile/create.ts +3 -3
- package/src/cmd/profile/delete.ts +3 -3
- package/src/cmd/profile/index.ts +1 -1
- package/src/cmd/profile/list.ts +3 -3
- package/src/cmd/profile/show.ts +3 -3
- package/src/cmd/profile/use.ts +3 -3
- package/src/cmd/project/create.ts +1 -1
- package/src/cmd/project/delete.ts +1 -1
- package/src/cmd/project/download.ts +3 -3
- package/src/cmd/project/index.ts +1 -1
- package/src/cmd/project/list.ts +1 -1
- package/src/cmd/project/show.ts +1 -1
- package/src/cmd/project/template-flow.ts +3 -3
- package/src/cmd/version/index.ts +3 -3
- package/src/config.ts +9 -2
- package/src/index.ts +1 -0
- package/src/tui.ts +121 -6
- package/src/types.ts +47 -2
package/src/cmd/dev/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createCommand } from '
|
|
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 '
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
116
|
+
await bundle({
|
|
117
|
+
rootDir,
|
|
118
|
+
dev: true,
|
|
119
|
+
});
|
|
59
120
|
} catch {
|
|
60
|
-
|
|
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
|
-
|
|
68
|
-
|
|
130
|
+
if (!existsSync(appPath)) {
|
|
131
|
+
failure(`App file not found: ${appPath}`);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
69
134
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
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
|
});
|
package/src/cmd/example/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createCommand } from '
|
|
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
|
});
|
package/src/cmd/example/list.ts
CHANGED
|
@@ -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
|
+
};
|
package/src/cmd/example/sound.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SubcommandDefinition } from '../../types';
|
|
2
|
-
import * as tui from '
|
|
3
|
-
import { playSound } from '
|
|
2
|
+
import * as tui from '../../tui';
|
|
3
|
+
import { playSound } from '../../sound';
|
|
4
4
|
|
|
5
5
|
export const soundSubcommand: SubcommandDefinition = {
|
|
6
6
|
name: 'sound',
|
package/src/cmd/example/steps.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createSubcommand } from '
|
|
2
|
-
import { runSteps, stepSuccess, stepSkipped, stepError } from '
|
|
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,14 +1,14 @@
|
|
|
1
|
-
import { createSubcommand } from '
|
|
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 '
|
|
8
|
+
} from '../../config';
|
|
9
9
|
import { join } from 'node:path';
|
|
10
10
|
import { writeFile } from 'node:fs/promises';
|
|
11
|
-
import * as tui from '
|
|
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 '
|
|
1
|
+
import { createSubcommand } from '../../types';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { fetchProfiles } from '
|
|
3
|
+
import { fetchProfiles } from '../../config';
|
|
4
4
|
import { unlink } from 'node:fs/promises';
|
|
5
|
-
import * as tui from '
|
|
5
|
+
import * as tui from '../../tui';
|
|
6
6
|
|
|
7
7
|
export const deleteCommand = createSubcommand({
|
|
8
8
|
name: 'delete',
|
package/src/cmd/profile/index.ts
CHANGED
package/src/cmd/profile/list.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { SubcommandDefinition } from '
|
|
2
|
-
import { fetchProfiles } from '
|
|
1
|
+
import type { SubcommandDefinition } from '../../types';
|
|
2
|
+
import { fetchProfiles } from '../../config';
|
|
3
3
|
import { basename, dirname } from 'node:path';
|
|
4
|
-
import * as tui from '
|
|
4
|
+
import * as tui from '../../tui';
|
|
5
5
|
|
|
6
6
|
export const listCommand: SubcommandDefinition = {
|
|
7
7
|
name: 'list',
|
package/src/cmd/profile/show.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createSubcommand } from '
|
|
1
|
+
import { createSubcommand } from '../../types';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { getProfile, fetchProfiles } from '
|
|
3
|
+
import { getProfile, fetchProfiles } from '../../config';
|
|
4
4
|
import { readFile } from 'node:fs/promises';
|
|
5
|
-
import * as tui from '
|
|
5
|
+
import * as tui from '../../tui';
|
|
6
6
|
|
|
7
7
|
export const showCommand = createSubcommand({
|
|
8
8
|
name: 'show',
|
package/src/cmd/profile/use.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createSubcommand } from '
|
|
1
|
+
import { createSubcommand } from '../../types';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { fetchProfiles, saveProfile } from '
|
|
4
|
-
import * as tui from '
|
|
3
|
+
import { fetchProfiles, saveProfile } from '../../config';
|
|
4
|
+
import * as tui from '../../tui';
|
|
5
5
|
|
|
6
6
|
export const useCommand = createSubcommand({
|
|
7
7
|
name: 'use',
|
|
@@ -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 '
|
|
8
|
-
import * as tui from '
|
|
9
|
-
import { downloadWithSpinner } from '
|
|
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';
|
package/src/cmd/project/index.ts
CHANGED
package/src/cmd/project/list.ts
CHANGED
package/src/cmd/project/show.ts
CHANGED
|
@@ -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 '
|
|
7
|
-
import * as tui from '
|
|
8
|
-
import { playSound } from '
|
|
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
|
|
package/src/cmd/version/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createCommand } from '
|
|
2
|
-
import { getVersion } from '
|
|
3
|
-
import { logger } from '
|
|
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 '
|
|
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,
|