@wundam/orchex 1.0.0-rc.2 → 1.0.0-rc.4
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/index.js +7 -0
- package/dist/login-helpers.d.ts +25 -0
- package/dist/login-helpers.js +54 -0
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -285,6 +285,13 @@ async function main() {
|
|
|
285
285
|
await handleStatusCommand(args.slice(1));
|
|
286
286
|
return;
|
|
287
287
|
}
|
|
288
|
+
if (args[0] === '--version' || args[0] === '-v') {
|
|
289
|
+
const { createRequire } = await import('module');
|
|
290
|
+
const require = createRequire(import.meta.url);
|
|
291
|
+
const pkg = require('../package.json');
|
|
292
|
+
console.log(pkg.version);
|
|
293
|
+
process.exit(0);
|
|
294
|
+
}
|
|
288
295
|
if (args[0] === '--help' || args[0] === '-h' || args[0] === 'help') {
|
|
289
296
|
printHelp();
|
|
290
297
|
process.exit(0);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helper functions for orchex login/logout/status commands.
|
|
3
|
+
* No I/O, no side effects — fully unit-testable.
|
|
4
|
+
*/
|
|
5
|
+
export interface DeviceAuthStartResponse {
|
|
6
|
+
device_code: string;
|
|
7
|
+
user_code: string;
|
|
8
|
+
verification_uri: string;
|
|
9
|
+
expires_in: number;
|
|
10
|
+
interval: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ParsedApiResponse<T> {
|
|
13
|
+
ok: boolean;
|
|
14
|
+
data?: T;
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface UserInfo {
|
|
18
|
+
email: string;
|
|
19
|
+
tier: string;
|
|
20
|
+
trialRunsRemaining: number;
|
|
21
|
+
subscriptionStatus: string | null;
|
|
22
|
+
}
|
|
23
|
+
export declare function buildVerificationMessage(data: Pick<DeviceAuthStartResponse, 'user_code' | 'verification_uri'>): string;
|
|
24
|
+
export declare function parseLoginApiResponse(status: number, body: unknown): ParsedApiResponse<DeviceAuthStartResponse>;
|
|
25
|
+
export declare function buildStatusMessage(user: UserInfo | null): string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helper functions for orchex login/logout/status commands.
|
|
3
|
+
* No I/O, no side effects — fully unit-testable.
|
|
4
|
+
*/
|
|
5
|
+
export function buildVerificationMessage(data) {
|
|
6
|
+
return [
|
|
7
|
+
'',
|
|
8
|
+
` Open this URL in your browser to authorize the orchex CLI:`,
|
|
9
|
+
``,
|
|
10
|
+
` ${data.verification_uri}`,
|
|
11
|
+
``,
|
|
12
|
+
` Confirm the code in your browser matches:`,
|
|
13
|
+
``,
|
|
14
|
+
` ${data.user_code}`,
|
|
15
|
+
``,
|
|
16
|
+
` Waiting for authorization... (Ctrl+C to cancel)`,
|
|
17
|
+
'',
|
|
18
|
+
].join('\n');
|
|
19
|
+
}
|
|
20
|
+
export function parseLoginApiResponse(status, body) {
|
|
21
|
+
if (status !== 200 || !body || typeof body !== 'object') {
|
|
22
|
+
return { ok: false, error: `Server returned ${status}` };
|
|
23
|
+
}
|
|
24
|
+
const b = body;
|
|
25
|
+
if (!b.device_code || !b.user_code || !b.verification_uri) {
|
|
26
|
+
return { ok: false, error: 'Unexpected server response shape' };
|
|
27
|
+
}
|
|
28
|
+
return { ok: true, data: b };
|
|
29
|
+
}
|
|
30
|
+
export function buildStatusMessage(user) {
|
|
31
|
+
if (!user) {
|
|
32
|
+
return [
|
|
33
|
+
'',
|
|
34
|
+
' Not logged in.',
|
|
35
|
+
' Run `orchex login` to connect to orchex cloud.',
|
|
36
|
+
'',
|
|
37
|
+
].join('\n');
|
|
38
|
+
}
|
|
39
|
+
const tierDisplay = user.tier.charAt(0).toUpperCase() + user.tier.slice(1);
|
|
40
|
+
const lines = [
|
|
41
|
+
'',
|
|
42
|
+
` Email: ${user.email}`,
|
|
43
|
+
` Tier: ${tierDisplay}`,
|
|
44
|
+
];
|
|
45
|
+
if (user.tier === 'free' && typeof user.trialRunsRemaining === 'number') {
|
|
46
|
+
lines.push(` trial: ${user.trialRunsRemaining} cloud run${user.trialRunsRemaining !== 1 ? 's' : ''} remaining`);
|
|
47
|
+
}
|
|
48
|
+
if (user.subscriptionStatus && user.subscriptionStatus !== 'active') {
|
|
49
|
+
lines.push(` ⚠ Subscription: ${user.subscriptionStatus} — visit /dashboard/billing`);
|
|
50
|
+
}
|
|
51
|
+
lines.push(` Mode: cloud`);
|
|
52
|
+
lines.push('');
|
|
53
|
+
return lines.join('\n');
|
|
54
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wundam/orchex",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.4",
|
|
4
4
|
"description": "Parallel agent orchestration via MCP",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -76,6 +76,8 @@
|
|
|
76
76
|
"dist/logger.d.ts",
|
|
77
77
|
"dist/logging.js",
|
|
78
78
|
"dist/logging.d.ts",
|
|
79
|
+
"dist/login-helpers.js",
|
|
80
|
+
"dist/login-helpers.d.ts",
|
|
79
81
|
"dist/manifest.js",
|
|
80
82
|
"dist/manifest.d.ts",
|
|
81
83
|
"dist/metrics.js",
|