@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/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,CAAC,IAAI,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;iBAm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AC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,OAAO,CAAC,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACpC,GACD;IACA,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,OAAO,CAAC,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACpC,CAAC"}
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -68,6 +68,17 @@ export class UpgradeRequiredError extends Error {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
export class APIError extends Error {
|
|
72
|
+
constructor(
|
|
73
|
+
message: string,
|
|
74
|
+
public status: number,
|
|
75
|
+
public code?: string
|
|
76
|
+
) {
|
|
77
|
+
super(message);
|
|
78
|
+
this.name = 'APIError';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
71
82
|
export class APIClient {
|
|
72
83
|
constructor(
|
|
73
84
|
private baseUrl: string,
|
|
@@ -141,10 +152,13 @@ export class APIClient {
|
|
|
141
152
|
|
|
142
153
|
// Throw with message from API if available
|
|
143
154
|
if (errorData?.message) {
|
|
144
|
-
throw new
|
|
155
|
+
throw new APIError(errorData.message, response.status, errorData.code);
|
|
145
156
|
}
|
|
146
157
|
|
|
147
|
-
throw new
|
|
158
|
+
throw new APIError(
|
|
159
|
+
`API error: ${response.status} ${response.statusText}`,
|
|
160
|
+
response.status
|
|
161
|
+
);
|
|
148
162
|
}
|
|
149
163
|
|
|
150
164
|
// Successful response; handle empty bodies (e.g., 204 No Content)
|
package/src/auth.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { getDefaultConfigDir, getAuth } from './config';
|
|
|
3
3
|
import { getCommand } from './command-prefix';
|
|
4
4
|
import type { CommandContext, AuthData } from './types';
|
|
5
5
|
import * as tui from './tui';
|
|
6
|
+
import enquirer from 'enquirer';
|
|
6
7
|
|
|
7
8
|
export function isTTY(): boolean {
|
|
8
9
|
return process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
@@ -45,8 +46,10 @@ export async function requireAuth(ctx: CommandContext<false>): Promise<AuthData>
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
//
|
|
49
|
-
tui.
|
|
49
|
+
// Show signup benefits box
|
|
50
|
+
tui.showSignupBenefits();
|
|
51
|
+
|
|
52
|
+
// Interactive mode - show warning and confirm
|
|
50
53
|
tui.warning(
|
|
51
54
|
hasConfig
|
|
52
55
|
? 'You are not currently logged in or your session has expired.'
|
|
@@ -60,9 +63,65 @@ export async function requireAuth(ctx: CommandContext<false>): Promise<AuthData>
|
|
|
60
63
|
);
|
|
61
64
|
|
|
62
65
|
if (!shouldLogin) {
|
|
63
|
-
|
|
66
|
+
return tui.fatal(`Authentication required. Run "${loginCmd}" when you're ready to continue.`);
|
|
67
|
+
}
|
|
68
|
+
tui.newline();
|
|
69
|
+
|
|
70
|
+
// Import and run login flow
|
|
71
|
+
const { loginCommand } = await import('./cmd/auth/login');
|
|
72
|
+
await loginCommand.handler(ctx);
|
|
73
|
+
|
|
74
|
+
// After login completes, verify we have auth
|
|
75
|
+
const newAuth = await getAuth();
|
|
76
|
+
if (!newAuth || newAuth.expires <= new Date()) {
|
|
77
|
+
return tui.fatal('Login was not completed successfully.');
|
|
78
|
+
}
|
|
79
|
+
tui.newline();
|
|
80
|
+
|
|
81
|
+
return newAuth;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export async function optionalAuth(
|
|
85
|
+
ctx: CommandContext<false>,
|
|
86
|
+
continueText?: string
|
|
87
|
+
): Promise<AuthData | null> {
|
|
88
|
+
const auth = await getAuth();
|
|
89
|
+
|
|
90
|
+
if (auth && auth.expires > new Date()) {
|
|
91
|
+
return auth;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (!isTTY()) {
|
|
95
|
+
// In non-TTY mode, just return null
|
|
96
|
+
return null;
|
|
64
97
|
}
|
|
65
98
|
|
|
99
|
+
// Show signup benefits box
|
|
100
|
+
tui.showSignupBenefits();
|
|
101
|
+
|
|
102
|
+
// Show select menu with custom or default text
|
|
103
|
+
const defaultContinueText = 'Start without an account (run locally)';
|
|
104
|
+
const response = await enquirer.prompt<{ action: string }>({
|
|
105
|
+
type: 'select',
|
|
106
|
+
name: 'action',
|
|
107
|
+
message: 'How would you like to continue?',
|
|
108
|
+
choices: [
|
|
109
|
+
{
|
|
110
|
+
name: 'login',
|
|
111
|
+
message: 'Create an account or login',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'local',
|
|
115
|
+
message: continueText || defaultContinueText,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
if (response.action === 'local') {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
tui.newline();
|
|
124
|
+
|
|
66
125
|
// Import and run login flow
|
|
67
126
|
const { loginCommand } = await import('./cmd/auth/login');
|
|
68
127
|
await loginCommand.handler(ctx);
|
|
@@ -70,8 +129,9 @@ export async function requireAuth(ctx: CommandContext<false>): Promise<AuthData>
|
|
|
70
129
|
// After login completes, verify we have auth
|
|
71
130
|
const newAuth = await getAuth();
|
|
72
131
|
if (!newAuth || newAuth.expires <= new Date()) {
|
|
73
|
-
return
|
|
132
|
+
return null;
|
|
74
133
|
}
|
|
134
|
+
tui.newline();
|
|
75
135
|
|
|
76
136
|
return newAuth;
|
|
77
137
|
}
|
|
@@ -89,3 +149,18 @@ export function withAuth<TArgs extends unknown[]>(
|
|
|
89
149
|
return handler(authenticatedCtx, ...args);
|
|
90
150
|
};
|
|
91
151
|
}
|
|
152
|
+
|
|
153
|
+
export function withOptionalAuth<TArgs extends unknown[]>(
|
|
154
|
+
ctx: CommandContext<false>,
|
|
155
|
+
handler: (
|
|
156
|
+
ctx: CommandContext<false>,
|
|
157
|
+
auth: AuthData | null,
|
|
158
|
+
...args: TArgs
|
|
159
|
+
) => Promise<void> | void,
|
|
160
|
+
continueText?: string
|
|
161
|
+
): (...args: TArgs) => Promise<void> {
|
|
162
|
+
return async (...args: TArgs) => {
|
|
163
|
+
const auth = await optionalAuth(ctx, continueText);
|
|
164
|
+
return handler(ctx, auth, ...args);
|
|
165
|
+
};
|
|
166
|
+
}
|
package/src/cli.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import type { CommandDefinition, SubcommandDefinition, CommandContext } from './types';
|
|
3
3
|
import { showBanner } from './banner';
|
|
4
|
-
import { requireAuth } from './auth';
|
|
4
|
+
import { requireAuth, optionalAuth } from './auth';
|
|
5
5
|
import { parseArgsSchema, parseOptionsSchema, buildValidationInput } from './schema-parser';
|
|
6
6
|
|
|
7
7
|
export async function createCLI(version: string): Promise<Command> {
|
|
@@ -121,6 +121,46 @@ async function registerSubcommand(
|
|
|
121
121
|
};
|
|
122
122
|
await subcommand.handler(ctx);
|
|
123
123
|
}
|
|
124
|
+
} else if (subcommand.optionalAuth) {
|
|
125
|
+
const continueText =
|
|
126
|
+
typeof subcommand.optionalAuth === 'string' ? subcommand.optionalAuth : undefined;
|
|
127
|
+
const auth = await optionalAuth(baseCtx as CommandContext<false>, continueText);
|
|
128
|
+
|
|
129
|
+
if (subcommand.schema) {
|
|
130
|
+
try {
|
|
131
|
+
const input = buildValidationInput(subcommand.schema, args, options);
|
|
132
|
+
const ctx: Record<string, unknown> = {
|
|
133
|
+
...baseCtx,
|
|
134
|
+
...(auth ? { auth } : {}),
|
|
135
|
+
};
|
|
136
|
+
if (subcommand.schema.args) {
|
|
137
|
+
ctx.args = subcommand.schema.args.parse(input.args);
|
|
138
|
+
}
|
|
139
|
+
if (subcommand.schema.options) {
|
|
140
|
+
ctx.opts = subcommand.schema.options.parse(input.options);
|
|
141
|
+
}
|
|
142
|
+
await subcommand.handler(ctx as CommandContext);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
if (error && typeof error === 'object' && 'issues' in error) {
|
|
145
|
+
baseCtx.logger.error('Validation error:');
|
|
146
|
+
const issues = (error as { issues: Array<{ path: string[]; message: string }> })
|
|
147
|
+
.issues;
|
|
148
|
+
for (const issue of issues) {
|
|
149
|
+
baseCtx.logger.error(` ${issue.path.join('.')}: ${issue.message}`);
|
|
150
|
+
}
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
} else if (auth) {
|
|
156
|
+
const ctx: CommandContext<true> = {
|
|
157
|
+
...baseCtx,
|
|
158
|
+
auth,
|
|
159
|
+
};
|
|
160
|
+
await subcommand.handler(ctx);
|
|
161
|
+
} else {
|
|
162
|
+
await subcommand.handler(baseCtx as CommandContext<false>);
|
|
163
|
+
}
|
|
124
164
|
} else {
|
|
125
165
|
if (subcommand.schema) {
|
|
126
166
|
try {
|
|
@@ -175,6 +215,16 @@ export async function registerCommands(
|
|
|
175
215
|
const auth = await requireAuth(baseCtx as CommandContext<false>);
|
|
176
216
|
const ctx: CommandContext<true> = { ...baseCtx, auth };
|
|
177
217
|
await cmdDef.handler!(ctx);
|
|
218
|
+
} else if (cmdDef.optionalAuth) {
|
|
219
|
+
const continueText =
|
|
220
|
+
typeof cmdDef.optionalAuth === 'string' ? cmdDef.optionalAuth : undefined;
|
|
221
|
+
const auth = await optionalAuth(baseCtx as CommandContext<false>, continueText);
|
|
222
|
+
if (auth) {
|
|
223
|
+
const ctx: CommandContext<true> = { ...baseCtx, auth };
|
|
224
|
+
await cmdDef.handler!(ctx);
|
|
225
|
+
} else {
|
|
226
|
+
await cmdDef.handler!(baseCtx as CommandContext<false>);
|
|
227
|
+
}
|
|
178
228
|
} else {
|
|
179
229
|
await cmdDef.handler!(baseCtx as CommandContext<false>);
|
|
180
230
|
}
|
package/src/cmd/auth/README.md
CHANGED
|
@@ -33,6 +33,34 @@ preferences:
|
|
|
33
33
|
orgId: ''
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
### `auth signup`
|
|
37
|
+
|
|
38
|
+
Create a new Agentuity Cloud Platform account.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
agentuity auth signup
|
|
42
|
+
# or
|
|
43
|
+
agentuity signup
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**How it works:**
|
|
47
|
+
|
|
48
|
+
1. Generates a random 5-character OTP locally (client-side)
|
|
49
|
+
2. Displays a signup URL with the OTP code: `/sign-up?code=<otp>`
|
|
50
|
+
3. User opens the URL in their browser and completes the signup process
|
|
51
|
+
4. Polls `GET /cli/auth/signup/<otp>` every 2 seconds for up to 5 minutes
|
|
52
|
+
5. Server returns 404 until signup is complete, then returns credentials
|
|
53
|
+
6. Once complete, saves the API key, user ID, and expiration to config
|
|
54
|
+
|
|
55
|
+
**Stored data:**
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
auth:
|
|
59
|
+
api_key: 'your-api-key'
|
|
60
|
+
user_id: 'user-id'
|
|
61
|
+
expires: 1234567890
|
|
62
|
+
```
|
|
63
|
+
|
|
36
64
|
### `auth logout`
|
|
37
65
|
|
|
38
66
|
Logout of the Agentuity Cloud Platform by clearing authentication credentials.
|
|
@@ -55,6 +83,7 @@ The authentication flow uses the following API endpoints:
|
|
|
55
83
|
|
|
56
84
|
- `GET /cli/auth/start` - Generate OTP for login
|
|
57
85
|
- `POST /cli/auth/check` - Poll for login completion with OTP
|
|
86
|
+
- `GET /cli/auth/signup/<otp>` - Poll for signup completion with client-generated OTP (returns 404 until complete)
|
|
58
87
|
|
|
59
88
|
## URL Configuration
|
|
60
89
|
|
|
@@ -80,13 +109,18 @@ This allows different profiles (e.g., `local`, `production`) to point to differe
|
|
|
80
109
|
|
|
81
110
|
## Implementation Details
|
|
82
111
|
|
|
83
|
-
- **Generic API Client**: [../../api.ts](../../api.ts) provides the generic `APIClient` class for HTTP requests
|
|
84
|
-
- **Auth-specific APIs**: [api.ts](./api.ts) provides
|
|
112
|
+
- **Generic API Client**: [../../api.ts](../../api.ts) provides the generic `APIClient` class and `APIError` for HTTP requests
|
|
113
|
+
- **Auth-specific APIs**: [api.ts](./api.ts) provides:
|
|
114
|
+
- `generateLoginOTP()` and `pollForLoginCompletion()` for login flow
|
|
115
|
+
- `generateSignupOTP()` and `pollForSignupCompletion()` for signup flow
|
|
85
116
|
- **Config Management**: [../../config.ts](../../config.ts) provides `saveAuth()`, `clearAuth()`, and `getAuth()` helpers
|
|
86
117
|
- **Browser Opening**: Uses `Bun.spawn(['open', authURL])` on non-Windows platforms to auto-open browser
|
|
87
|
-
- **Polling**:
|
|
118
|
+
- **Polling**:
|
|
119
|
+
- Login: Polls every 2 seconds with 60-second timeout
|
|
120
|
+
- Signup: Polls every 2 seconds with 5-minute timeout, retries on 404 errors
|
|
88
121
|
- **Error Handling**: All errors are caught and displayed to user with appropriate exit codes
|
|
89
122
|
- `UpgradeRequiredError`: Shows upgrade instructions when CLI version is outdated
|
|
123
|
+
- `APIError`: Preserves HTTP status codes for proper retry logic (e.g., 404 during signup polling)
|
|
90
124
|
- Generic API errors: Display the error message from the server
|
|
91
125
|
- See [../../api-errors.md](../../api-errors.md) for details
|
|
92
126
|
|
package/src/cmd/auth/api.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { APIClient } from '
|
|
2
|
-
import type { Config } from '
|
|
1
|
+
import { APIClient, APIError } from '../../api';
|
|
2
|
+
import type { Config } from '../../types';
|
|
3
3
|
|
|
4
4
|
interface APIResponse<T> {
|
|
5
5
|
success: boolean;
|
|
@@ -23,6 +23,18 @@ export interface LoginResult {
|
|
|
23
23
|
expires: Date;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
interface SignupCompleteData {
|
|
27
|
+
userId: string;
|
|
28
|
+
apiKey: string;
|
|
29
|
+
expiresAt: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SignupResult {
|
|
33
|
+
apiKey: string;
|
|
34
|
+
userId: string;
|
|
35
|
+
expires: Date;
|
|
36
|
+
}
|
|
37
|
+
|
|
26
38
|
export async function generateLoginOTP(apiUrl: string, config?: Config | null): Promise<string> {
|
|
27
39
|
const client = new APIClient(apiUrl, undefined, config);
|
|
28
40
|
const resp = await client.request<APIResponse<OTPStartData>>('GET', '/cli/auth/start');
|
|
@@ -64,8 +76,60 @@ export async function pollForLoginCompletion(
|
|
|
64
76
|
};
|
|
65
77
|
}
|
|
66
78
|
|
|
67
|
-
await
|
|
79
|
+
await Bun.sleep(2000);
|
|
68
80
|
}
|
|
69
81
|
|
|
70
82
|
throw new Error('Login timed out');
|
|
71
83
|
}
|
|
84
|
+
|
|
85
|
+
export function generateSignupOTP(): string {
|
|
86
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
|
87
|
+
let result = '';
|
|
88
|
+
const array = new Uint8Array(5);
|
|
89
|
+
crypto.getRandomValues(array);
|
|
90
|
+
for (let i = 0; i < 5; i++) {
|
|
91
|
+
result += chars[array[i] % chars.length];
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export async function pollForSignupCompletion(
|
|
97
|
+
apiUrl: string,
|
|
98
|
+
otp: string,
|
|
99
|
+
config?: Config | null,
|
|
100
|
+
timeoutMs = 300000
|
|
101
|
+
): Promise<SignupResult> {
|
|
102
|
+
const client = new APIClient(apiUrl, undefined, config);
|
|
103
|
+
const started = Date.now();
|
|
104
|
+
|
|
105
|
+
while (Date.now() - started < timeoutMs) {
|
|
106
|
+
try {
|
|
107
|
+
const resp = await client.request<APIResponse<SignupCompleteData>>(
|
|
108
|
+
'GET',
|
|
109
|
+
`/cli/auth/signup/${otp}`
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
if (!resp.success) {
|
|
113
|
+
throw new Error(resp.message);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (resp.data) {
|
|
117
|
+
return {
|
|
118
|
+
apiKey: resp.data.apiKey,
|
|
119
|
+
userId: resp.data.userId,
|
|
120
|
+
expires: new Date(resp.data.expiresAt),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
} catch (error) {
|
|
124
|
+
if (error instanceof APIError && error.status === 404) {
|
|
125
|
+
await Bun.sleep(2000);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
await Bun.sleep(2000);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
throw new Error('Signup timed out');
|
|
135
|
+
}
|
package/src/cmd/auth/index.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { createCommand } from '
|
|
1
|
+
import { createCommand } from '../../types';
|
|
2
2
|
import { loginCommand } from './login';
|
|
3
3
|
import { logoutCommand } from './logout';
|
|
4
|
+
import { signupCommand } from './signup';
|
|
4
5
|
|
|
5
6
|
export const command = createCommand({
|
|
6
7
|
name: 'auth',
|
|
7
8
|
description: 'Authentication and authorization related commands',
|
|
8
|
-
subcommands: [loginCommand, logoutCommand],
|
|
9
|
+
subcommands: [loginCommand, logoutCommand, signupCommand],
|
|
9
10
|
});
|
package/src/cmd/auth/login.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { SubcommandDefinition } from '
|
|
2
|
-
import { getAPIBaseURL, getAppBaseURL, UpgradeRequiredError } from '
|
|
3
|
-
import { saveAuth } from '
|
|
1
|
+
import type { SubcommandDefinition } from '../../types';
|
|
2
|
+
import { getAPIBaseURL, getAppBaseURL, UpgradeRequiredError } from '../../api';
|
|
3
|
+
import { saveAuth } from '../../config';
|
|
4
4
|
import { generateLoginOTP, pollForLoginCompletion } from './api';
|
|
5
|
-
import * as tui from '
|
|
5
|
+
import * as tui from '../../tui';
|
|
6
6
|
|
|
7
7
|
export const loginCommand: SubcommandDefinition = {
|
|
8
8
|
name: 'login',
|
|
@@ -15,9 +15,16 @@ export const loginCommand: SubcommandDefinition = {
|
|
|
15
15
|
const appUrl = getAppBaseURL(config);
|
|
16
16
|
|
|
17
17
|
try {
|
|
18
|
-
|
|
18
|
+
let otp: string | undefined;
|
|
19
|
+
|
|
20
|
+
await tui.spinner('Generating login one time code...', async () => {
|
|
21
|
+
otp = await generateLoginOTP(apiUrl, config);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
if (!otp) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
19
27
|
|
|
20
|
-
const otp = await generateLoginOTP(apiUrl, config);
|
|
21
28
|
const authURL = `${appUrl}/auth/cli`;
|
|
22
29
|
|
|
23
30
|
const copied = await tui.copyToClipboard(otp);
|
|
@@ -39,7 +46,8 @@ export const loginCommand: SubcommandDefinition = {
|
|
|
39
46
|
tui.newline();
|
|
40
47
|
|
|
41
48
|
if (process.platform === 'darwin') {
|
|
42
|
-
await tui.waitForAnyKey('Press
|
|
49
|
+
await tui.waitForAnyKey('Press any key to open the URL in your browser...');
|
|
50
|
+
tui.newline();
|
|
43
51
|
try {
|
|
44
52
|
Bun.spawn(['open', authURL], {
|
|
45
53
|
stdio: ['ignore', 'ignore', 'ignore'],
|
package/src/cmd/auth/logout.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { SubcommandDefinition } from '
|
|
2
|
-
import { clearAuth } from '
|
|
3
|
-
import * as tui from '
|
|
1
|
+
import type { SubcommandDefinition } from '../../types';
|
|
2
|
+
import { clearAuth } from '../../config';
|
|
3
|
+
import * as tui from '../../tui';
|
|
4
4
|
|
|
5
5
|
export const logoutCommand: SubcommandDefinition = {
|
|
6
6
|
name: 'logout',
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { SubcommandDefinition } from '../../types';
|
|
2
|
+
import { getAPIBaseURL, getAppBaseURL, UpgradeRequiredError } from '../../api';
|
|
3
|
+
import { saveAuth } from '../../config';
|
|
4
|
+
import { generateSignupOTP, pollForSignupCompletion } from './api';
|
|
5
|
+
import * as tui from '../../tui';
|
|
6
|
+
|
|
7
|
+
export const signupCommand: SubcommandDefinition = {
|
|
8
|
+
name: 'signup',
|
|
9
|
+
description: 'Create a new Agentuity Cloud Platform account',
|
|
10
|
+
toplevel: true,
|
|
11
|
+
|
|
12
|
+
async handler(ctx) {
|
|
13
|
+
const { logger, config } = ctx;
|
|
14
|
+
const apiUrl = getAPIBaseURL(config);
|
|
15
|
+
const appUrl = getAppBaseURL(config);
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
const otp = generateSignupOTP();
|
|
19
|
+
|
|
20
|
+
const signupURL = `${appUrl}/sign-up?code=${otp}`;
|
|
21
|
+
|
|
22
|
+
const bannerBody = `Please open the URL in your browser:\n\n${tui.link(signupURL)}\n\n${tui.muted('Once you have completed the signup process, you will be given a one-time password to complete the signup process.')}`;
|
|
23
|
+
|
|
24
|
+
tui.banner('Signup for Agentuity', bannerBody);
|
|
25
|
+
tui.newline();
|
|
26
|
+
|
|
27
|
+
await tui.spinner('Waiting for signup to complete...', async () => {
|
|
28
|
+
const result = await pollForSignupCompletion(apiUrl, otp, config);
|
|
29
|
+
|
|
30
|
+
await saveAuth({
|
|
31
|
+
apiKey: result.apiKey,
|
|
32
|
+
userId: result.userId,
|
|
33
|
+
expires: result.expires,
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
tui.newline();
|
|
38
|
+
tui.success('Welcome to Agentuity! You are now logged in');
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (error instanceof UpgradeRequiredError) {
|
|
41
|
+
const bannerBody = `${error.message}\n\nVisit: ${tui.link('https://agentuity.dev/CLI/installation')}`;
|
|
42
|
+
tui.banner('CLI Upgrade Required', bannerBody);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
} else if (error instanceof Error) {
|
|
45
|
+
logger.fatal(`Signup failed: ${error.message}`);
|
|
46
|
+
} else {
|
|
47
|
+
logger.fatal('Signup failed');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
};
|
package/src/cmd/bundle/index.ts
CHANGED