nubase_cli 0.1.2 → 0.1.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/README.md CHANGED
@@ -5,7 +5,7 @@ stdio MCP bridge for Nubase. Use it when Codex, Claude Code, Cursor, IDEA, or an
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npx nubase_cli
8
+ npx -y nubase_cli@latest
9
9
  ```
10
10
 
11
11
  ## Browser Authorization
@@ -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@latest 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@latest 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@latest authorize
31
31
  ```
32
32
 
33
33
  Future `nubase_cli` runs read this file when `NUBASE_PROJECT_KEY` is not set.
@@ -35,7 +35,7 @@ Future `nubase_cli` runs read this file when `NUBASE_PROJECT_KEY` is not set.
35
35
  Options:
36
36
 
37
37
  ```bash
38
- npx nubase_cli authorize \
38
+ npx -y nubase_cli@latest authorize \
39
39
  --studio-url http://localhost:3000 \
40
40
  --nubase-url http://localhost:9999 \
41
41
  --agent-id codex
@@ -56,7 +56,7 @@ node packages/mcp-bridge/dist/src/index.js
56
56
  "mcpServers": {
57
57
  "nubase": {
58
58
  "command": "npx",
59
- "args": ["nubase_cli"],
59
+ "args": ["-y", "nubase_cli@latest"],
60
60
  "env": {
61
61
  "NUBASE_AGENT_ID": "claude-code"
62
62
  }
@@ -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@latest 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
@@ -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,
@@ -75,6 +77,10 @@ async function startAuthorization(options) {
75
77
  return;
76
78
  }
77
79
  try {
80
+ if (req.method === 'OPTIONS' && req.url === '/callback') {
81
+ sendCorsNoContent(res);
82
+ return;
83
+ }
78
84
  if (req.method === 'GET' && req.url?.startsWith('/callback')) {
79
85
  const url = new URL(req.url, origin);
80
86
  if (url.searchParams.get('state') !== state) {
@@ -156,12 +162,24 @@ async function readJson(req) {
156
162
  function sendJson(res, status, body) {
157
163
  res.writeHead(status, {
158
164
  'Content-Type': 'application/json',
159
- 'Access-Control-Allow-Origin': '*',
165
+ ...corsHeaders(),
160
166
  });
161
167
  res.end(JSON.stringify(body));
162
168
  }
169
+ function sendCorsNoContent(res) {
170
+ res.writeHead(204, corsHeaders());
171
+ res.end();
172
+ }
173
+ function corsHeaders() {
174
+ return {
175
+ 'Access-Control-Allow-Origin': '*',
176
+ 'Access-Control-Allow-Methods': 'GET,POST,OPTIONS',
177
+ 'Access-Control-Allow-Headers': 'Content-Type',
178
+ 'Access-Control-Max-Age': '600',
179
+ };
180
+ }
163
181
  function sendHtml(res, status, title, message) {
164
- res.writeHead(status, { 'Content-Type': 'text/html; charset=utf-8' });
182
+ res.writeHead(status, { 'Content-Type': 'text/html; charset=utf-8', ...corsHeaders() });
165
183
  res.end(`<!doctype html><meta charset="utf-8"><title>${escapeHtml(title)}</title><body style="font-family: system-ui, sans-serif; padding: 32px;"><h1>${escapeHtml(title)}</h1><p>${escapeHtml(message)}</p></body>`);
166
184
  }
167
185
  function openBrowser(url) {
@@ -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,7 +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
+ const CLI_VERSION = '0.1.4';
10
10
  if (process.argv[2] === 'install-skills') {
11
11
  const options = parseInstallArgs(process.argv.slice(3));
12
12
  const installed = await installSkills(options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nubase_cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {