@rigstate/cli 0.7.22 → 0.7.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rigstate/cli",
3
- "version": "0.7.22",
3
+ "version": "0.7.23",
4
4
  "description": "Rigstate CLI - Code audit, sync and supervision tool",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -30,12 +30,17 @@ export function createLinkCommand() {
30
30
 
31
31
  const manifestPath = path.join(process.cwd(), '.rigstate');
32
32
 
33
- const content = {
33
+ const content: any = {
34
34
  project_id: projectId,
35
- api_url: getApiUrl(),
36
35
  linked_at: new Date().toISOString()
37
36
  };
38
37
 
38
+ // Only store api_url locally if it's NOT the production default
39
+ const currentUrl = getApiUrl();
40
+ if (currentUrl !== 'https://app.rigstate.com') {
41
+ content.api_url = currentUrl;
42
+ }
43
+
39
44
  try {
40
45
  await fs.writeFile(manifestPath, JSON.stringify(content, null, 2), 'utf-8');
41
46
  console.log(chalk.green(`✔ Linked to project ID: ${projectId}`));
@@ -105,10 +110,6 @@ async function installHooks(cwd: string) {
105
110
  // Actually, let's just use the `hooks` command logic if possible, or a lightweight version
106
111
 
107
112
  try {
108
- const { installHooks: runInstall } = await import('./hooks.js');
109
- // We need to mock the command context or extract logic.
110
- // For simplicity/robustness in this iteration, let's just suggest it or verify
111
-
112
113
  // Simpler approach: Check if pre-commit exists
113
114
  const preCommitPath = path.join(cwd, '.git/hooks/pre-commit');
114
115
  try {
@@ -4,6 +4,7 @@ import { spawn } from 'child_process';
4
4
  import path from 'path';
5
5
  import fs from 'fs';
6
6
  import { fileURLToPath } from 'url';
7
+ import { getApiKey, getApiUrl } from '../utils/config.js';
7
8
 
8
9
  // ESM compatibility for __dirname
9
10
  const __filename = fileURLToPath(import.meta.url);
@@ -45,15 +46,29 @@ export function createMcpCommand() {
45
46
 
46
47
  console.log(chalk.dim(`Starting MCP server from: ${serverPath}`));
47
48
 
48
- // Map VIBE_API_KEY to RIGSTATE_API_KEY if needed (backwards compatibility)
49
- if (process.env.VIBE_API_KEY && !process.env.RIGSTATE_API_KEY) {
50
- process.env.RIGSTATE_API_KEY = process.env.VIBE_API_KEY;
49
+ // SMART INJECTION: Inject global config into MCP environment
50
+ const env = { ...process.env };
51
+
52
+ try {
53
+ const apiKey = getApiKey();
54
+ if (apiKey) {
55
+ env.RIGSTATE_API_KEY = apiKey;
56
+ // Also inject the URL for consistency
57
+ env.RIGSTATE_APP_URL = getApiUrl();
58
+ env.RIGSTATE_API_URL = getApiUrl();
59
+ }
60
+ } catch (e) {
61
+ // If not logged in, we carry on and let the MCP server show the final error
62
+ }
63
+
64
+ // Map VIBE_API_KEY if needed
65
+ if (env.VIBE_API_KEY && !env.RIGSTATE_API_KEY) {
66
+ env.RIGSTATE_API_KEY = env.VIBE_API_KEY;
51
67
  }
52
68
 
53
69
  // Spawn the MCP server as a child process
54
- // MCP uses stdio for communication, so we inherit it
55
70
  const worker = spawn('node', [serverPath], {
56
- env: process.env,
71
+ env,
57
72
  stdio: ['inherit', 'inherit', 'inherit']
58
73
  });
59
74
 
@@ -1 +0,0 @@
1
- 32037