nubase_cli 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -13,7 +13,7 @@ npx nubase_cli
13
13
  Installing skills starts a one-time browser authorization session and prints an authorization URL:
14
14
 
15
15
  ```bash
16
- npx nubase_cli install-skills --target both --project-dir .
16
+ npx -y nubase_cli install-skills
17
17
  ```
18
18
 
19
19
  Open the printed URL, sign in to Studio, choose a project, and approve. The URL includes a per-session UUID and points back to the temporary localhost callback started by the install command. After approval, the CLI writes `~/.nubase/config.json` and closes the localhost callback server.
@@ -21,13 +21,13 @@ Open the printed URL, sign in to Studio, choose a project, and approve. The URL
21
21
  For automation, skip the prompt:
22
22
 
23
23
  ```bash
24
- npx nubase_cli install-skills --target both --project-dir . --no-authorize
24
+ npx -y nubase_cli install-skills --no-authorize
25
25
  ```
26
26
 
27
27
  You can also start a standalone authorization session:
28
28
 
29
29
  ```bash
30
- npx nubase_cli authorize
30
+ npx -y nubase_cli authorize
31
31
  ```
32
32
 
33
33
  Future `nubase_cli` runs read this file when `NUBASE_PROJECT_KEY` is not set.
@@ -72,7 +72,7 @@ You may still set `NUBASE_URL` and `NUBASE_PROJECT_KEY` explicitly. Environment
72
72
  Install the bundled Nubase skills into a repository:
73
73
 
74
74
  ```bash
75
- npx nubase_cli install-skills --target both --project-dir .
75
+ npx -y nubase_cli install-skills
76
76
  ```
77
77
 
78
78
  Targets:
@@ -97,7 +97,7 @@ The top-level skill tells the agent when to use Nubase. The `references/` files
97
97
  The bridge injects user and session context from environment variables:
98
98
 
99
99
  ```bash
100
- NUBASE_URL=http://localhost:9999
100
+ NUBASE_URL=https://nubase.ai
101
101
  NUBASE_PROJECT_KEY=YOUR_NUBASE_PROJECT_KEY
102
102
  NUBASE_USER_JWT=USER_ACCESS_TOKEN
103
103
  NUBASE_USER_ID=USER_UUID
@@ -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;
@@ -2,10 +2,12 @@ import { spawn } from 'node:child_process';
2
2
  import crypto from 'node:crypto';
3
3
  import http from 'node:http';
4
4
  import { saveStoredAuthConfig } from './auth-config.js';
5
+ import { DEFAULT_NUBASE_URL } from './config.js';
6
+ const DEFAULT_STUDIO_URL = 'https://nubase.ai/studio';
5
7
  export function parseAuthorizeArgs(argv, env = process.env) {
6
8
  const options = {
7
- nubaseUrl: stripTrailingSlash(env.NUBASE_URL || 'http://localhost:9999'),
8
- studioUrl: stripTrailingSlash(env.NUBASE_STUDIO_URL || 'http://localhost:3000'),
9
+ nubaseUrl: stripTrailingSlash(env.NUBASE_URL || DEFAULT_NUBASE_URL),
10
+ studioUrl: stripTrailingSlash(env.NUBASE_STUDIO_URL || DEFAULT_STUDIO_URL),
9
11
  agentId: blankToUndefined(env.NUBASE_AGENT_ID),
10
12
  openBrowser: true,
11
13
  timeoutMs: 5 * 60 * 1000,
@@ -45,6 +47,16 @@ export function parseAuthorizeArgs(argv, env = process.env) {
45
47
  export async function authorize(options) {
46
48
  return startAuthorization(options);
47
49
  }
50
+ export function buildAuthorizeUrl({ studioUrl, nubaseUrl, callbackUrl, sessionId, state, agentId, }) {
51
+ const authorizeUrl = new URL(`${stripTrailingSlash(studioUrl)}/cli/authorize`);
52
+ authorizeUrl.searchParams.set('callback', callbackUrl);
53
+ authorizeUrl.searchParams.set('session_id', sessionId);
54
+ authorizeUrl.searchParams.set('state', state);
55
+ authorizeUrl.searchParams.set('nubase_url', stripTrailingSlash(nubaseUrl));
56
+ if (agentId)
57
+ authorizeUrl.searchParams.set('agent_id', agentId);
58
+ return authorizeUrl;
59
+ }
48
60
  async function startAuthorization(options) {
49
61
  const sessionId = crypto.randomUUID();
50
62
  const state = crypto.randomBytes(24).toString('base64url');
@@ -95,13 +107,14 @@ async function startAuthorization(options) {
95
107
  });
96
108
  server.listen(0, '127.0.0.1', () => {
97
109
  const callbackUrl = `${callbackOrigin(server)}/callback`;
98
- const authorizeUrl = new URL('/cli/authorize', options.studioUrl);
99
- authorizeUrl.searchParams.set('callback', callbackUrl);
100
- authorizeUrl.searchParams.set('session_id', sessionId);
101
- authorizeUrl.searchParams.set('state', state);
102
- authorizeUrl.searchParams.set('nubase_url', options.nubaseUrl);
103
- if (options.agentId)
104
- authorizeUrl.searchParams.set('agent_id', options.agentId);
110
+ const authorizeUrl = buildAuthorizeUrl({
111
+ studioUrl: options.studioUrl,
112
+ nubaseUrl: options.nubaseUrl,
113
+ callbackUrl,
114
+ sessionId,
115
+ state,
116
+ agentId: options.agentId,
117
+ });
105
118
  console.error('Authorize Nubase CLI for this workspace:');
106
119
  console.error(authorizeUrl.toString());
107
120
  console.error('');
@@ -1,3 +1,4 @@
1
+ export declare const DEFAULT_NUBASE_URL = "https://nubase.ai";
1
2
  export interface BridgeConfig {
2
3
  nubaseUrl: string;
3
4
  projectKey: string;
@@ -1,6 +1,7 @@
1
1
  import { defaultConfigPath, loadStoredAuthConfig } from './auth-config.js';
2
+ export const DEFAULT_NUBASE_URL = 'https://nubase.ai';
2
3
  export function loadConfig(env = process.env) {
3
- const nubaseUrl = stripTrailingSlash(env.NUBASE_URL || 'http://localhost:9999');
4
+ const nubaseUrl = stripTrailingSlash(env.NUBASE_URL || DEFAULT_NUBASE_URL);
4
5
  const projectKey = env.NUBASE_PROJECT_KEY || env.NUBASE_API_KEY || '';
5
6
  return {
6
7
  nubaseUrl,
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.3';
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: '0.1.0' },
42
+ serverInfo: { name: 'nubase_cli', version: CLI_VERSION },
42
43
  };
43
44
  case 'notifications/initialized':
44
45
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nubase_cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {