nubase_cli 0.1.1 → 0.1.2
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/src/authorize.d.ts +8 -0
- package/dist/src/authorize.js +18 -7
- package/dist/src/index.js +2 -1
- package/package.json +1 -1
package/dist/src/authorize.d.ts
CHANGED
|
@@ -9,3 +9,11 @@ export interface AuthorizeOptions {
|
|
|
9
9
|
}
|
|
10
10
|
export declare function parseAuthorizeArgs(argv: string[], env?: NodeJS.ProcessEnv): AuthorizeOptions;
|
|
11
11
|
export declare function authorize(options: AuthorizeOptions): Promise<StoredAuthConfig>;
|
|
12
|
+
export declare function buildAuthorizeUrl({ studioUrl, nubaseUrl, callbackUrl, sessionId, state, agentId, }: {
|
|
13
|
+
studioUrl: string;
|
|
14
|
+
nubaseUrl: string;
|
|
15
|
+
callbackUrl: string;
|
|
16
|
+
sessionId: string;
|
|
17
|
+
state: string;
|
|
18
|
+
agentId?: string;
|
|
19
|
+
}): import("url").URL;
|
package/dist/src/authorize.js
CHANGED
|
@@ -45,6 +45,16 @@ export function parseAuthorizeArgs(argv, env = process.env) {
|
|
|
45
45
|
export async function authorize(options) {
|
|
46
46
|
return startAuthorization(options);
|
|
47
47
|
}
|
|
48
|
+
export function buildAuthorizeUrl({ studioUrl, nubaseUrl, callbackUrl, sessionId, state, agentId, }) {
|
|
49
|
+
const authorizeUrl = new URL(`${stripTrailingSlash(studioUrl)}/cli/authorize`);
|
|
50
|
+
authorizeUrl.searchParams.set('callback', callbackUrl);
|
|
51
|
+
authorizeUrl.searchParams.set('session_id', sessionId);
|
|
52
|
+
authorizeUrl.searchParams.set('state', state);
|
|
53
|
+
authorizeUrl.searchParams.set('nubase_url', stripTrailingSlash(nubaseUrl));
|
|
54
|
+
if (agentId)
|
|
55
|
+
authorizeUrl.searchParams.set('agent_id', agentId);
|
|
56
|
+
return authorizeUrl;
|
|
57
|
+
}
|
|
48
58
|
async function startAuthorization(options) {
|
|
49
59
|
const sessionId = crypto.randomUUID();
|
|
50
60
|
const state = crypto.randomBytes(24).toString('base64url');
|
|
@@ -95,13 +105,14 @@ async function startAuthorization(options) {
|
|
|
95
105
|
});
|
|
96
106
|
server.listen(0, '127.0.0.1', () => {
|
|
97
107
|
const callbackUrl = `${callbackOrigin(server)}/callback`;
|
|
98
|
-
const authorizeUrl =
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
const authorizeUrl = buildAuthorizeUrl({
|
|
109
|
+
studioUrl: options.studioUrl,
|
|
110
|
+
nubaseUrl: options.nubaseUrl,
|
|
111
|
+
callbackUrl,
|
|
112
|
+
sessionId,
|
|
113
|
+
state,
|
|
114
|
+
agentId: options.agentId,
|
|
115
|
+
});
|
|
105
116
|
console.error('Authorize Nubase CLI for this workspace:');
|
|
106
117
|
console.error(authorizeUrl.toString());
|
|
107
118
|
console.error('');
|
package/dist/src/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { installSkills, parseInstallArgs } from './install-skills.js';
|
|
|
6
6
|
import { McpStdioServer } from './mcp-stdio.js';
|
|
7
7
|
import { NubaseClient } from './nubase-client.js';
|
|
8
8
|
import { callTool, TOOLS } from './tools.js';
|
|
9
|
+
const CLI_VERSION = '0.1.2';
|
|
9
10
|
if (process.argv[2] === 'install-skills') {
|
|
10
11
|
const options = parseInstallArgs(process.argv.slice(3));
|
|
11
12
|
const installed = await installSkills(options);
|
|
@@ -38,7 +39,7 @@ const server = new McpStdioServer(async (request) => {
|
|
|
38
39
|
return {
|
|
39
40
|
protocolVersion: request.params?.protocolVersion ?? '2024-11-05',
|
|
40
41
|
capabilities: { tools: {} },
|
|
41
|
-
serverInfo: { name: 'nubase_cli', version:
|
|
42
|
+
serverInfo: { name: 'nubase_cli', version: CLI_VERSION },
|
|
42
43
|
};
|
|
43
44
|
case 'notifications/initialized':
|
|
44
45
|
return null;
|