bluelamp-vscode 2.2.2 → 2.2.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.
@@ -13,10 +13,16 @@ const os = require('os');
13
13
  // パッケージのルートディレクトリを取得
14
14
  const packageRoot = path.dirname(__dirname);
15
15
 
16
- // .envファイルを読み込み(存在する場合)
16
+ // .envファイルを読み込み(.env.localを優先)
17
+ const dotenvLocalPath = path.join(packageRoot, '.env.local');
17
18
  const dotenvPath = path.join(packageRoot, '.env');
18
- if (fs.existsSync(dotenvPath)) {
19
+
20
+ if (fs.existsSync(dotenvLocalPath)) {
21
+ require('dotenv').config({ path: dotenvLocalPath });
22
+ console.log('📁 Loaded .env.local');
23
+ } else if (fs.existsSync(dotenvPath)) {
19
24
  require('dotenv').config({ path: dotenvPath });
25
+ console.log('📁 Loaded .env');
20
26
  }
21
27
 
22
28
  // コマンドマッピング(17個のプロンプト - 新BlueLamp 17エージェント体制)
@@ -62,6 +68,9 @@ function createMCPConfig(keyword, cliToken) {
62
68
  const mcpServerPath = path.join(packageRoot, 'lib/mcp-server/index.cjs');
63
69
  const tempConfigPath = path.join(os.tmpdir(), `bluelamp-vscode-${Date.now()}.json`);
64
70
 
71
+ // .env.localからPORTAL_URLを取得(デフォルトは本番)
72
+ const portalUrl = process.env.PORTAL_URL || "https://bluelamp-6clpzmy5pa-an.a.run.app";
73
+
65
74
  const config = {
66
75
  mcpServers: {
67
76
  "bluelamp-vscode": {
@@ -70,7 +79,7 @@ function createMCPConfig(keyword, cliToken) {
70
79
  env: {
71
80
  BLUELAMP_KEYWORD: keyword,
72
81
  BLUELAMP_TOKEN: cliToken,
73
- PORTAL_URL: "https://bluelamp-235426778039.asia-northeast1.run.app" // 本番Portalサーバー
82
+ PORTAL_URL: portalUrl
74
83
  }
75
84
  }
76
85
  }
@@ -100,7 +109,7 @@ async function performPortalAuth() {
100
109
  console.error('解決方法:');
101
110
  console.error('1. インターネット接続を確認してください');
102
111
  console.error('2. Portal認証情報が正しいか確認してください');
103
- console.error('3. https://bluelamp-235426778039.asia-northeast1.run.app にアクセスできるか確認してください');
112
+ console.error('3. https://bluelamp-6clpzmy5pa-an.a.run.app にアクセスできるか確認してください');
104
113
  process.exit(1);
105
114
  }
106
115
  }
@@ -111,8 +120,15 @@ async function performPortalAuth() {
111
120
  async function main() {
112
121
  const keyword = getKeywordFromCommand();
113
122
 
123
+ // --debugフラグの確認
124
+ const isDebugMode = process.argv.includes('--debug');
125
+
114
126
  console.log('🔵 BlueLamp VSCode MCP Integration');
115
127
  console.log(`📚 プロンプト: ${keyword}`);
128
+ if (isDebugMode) {
129
+ console.log('🐛 デバッグモード: 有効');
130
+ console.log(` ログファイル: ${path.join(os.tmpdir(), 'bluelamp-vscode-mcp-latest.log')}`);
131
+ }
116
132
  console.log('');
117
133
 
118
134
  // Portal認証の実行
@@ -172,6 +188,24 @@ inject_knowledge ツールで keyword: "${keyword}" を実行してから開始
172
188
  ];
173
189
  }
174
190
 
191
+ // デバッグモードの場合、詳細情報を表示
192
+ if (isDebugMode) {
193
+ console.log('🐛 デバッグ情報:');
194
+ console.log(` コマンド: ${claudeCommand}`);
195
+ console.log(` 引数: ${JSON.stringify(claudeArgs, null, 2)}`);
196
+ console.log(` MCP設定ファイル: ${configPath}`);
197
+ console.log(` 環境変数 BLUELAMP_KEYWORD: ${keyword}`);
198
+ console.log(` 環境変数 BLUELAMP_TOKEN: ${cliToken.substring(0, 20)}...`);
199
+ console.log(` 環境変数 PORTAL_URL: ${process.env.PORTAL_URL || 'https://bluelamp-6clpzmy5pa-an.a.run.app'}`);
200
+ console.log('');
201
+
202
+ // MCP設定ファイルの内容を表示
203
+ const configContent = fs.readFileSync(configPath, 'utf-8');
204
+ console.log('📄 MCP設定ファイル内容:');
205
+ console.log(configContent);
206
+ console.log('');
207
+ }
208
+
175
209
  const child = spawn(claudeCommand, claudeArgs, {
176
210
  stdio: 'inherit',
177
211
  env: {
@@ -9,8 +9,8 @@ const http = require('http');
9
9
  const { URL } = require('url');
10
10
 
11
11
  class PortalAuthClient {
12
- static PORTAL_API_URL_PROD = 'https://bluelamp-235426778039.asia-northeast1.run.app/api/cli/login';
13
- static PORTAL_API_URL_LOCAL = 'https://bluelamp-235426778039.asia-northeast1.run.app/api/cli/login';
12
+ static PORTAL_API_URL_PROD = 'https://bluelamp-6clpzmy5pa-an.a.run.app/api/cli/login';
13
+ static PORTAL_API_URL_LOCAL = 'https://bluelamp-6clpzmy5pa-an.a.run.app/api/cli/login';
14
14
  static MAX_RETRIES = 3;
15
15
  static RETRY_DELAY = 1000; // 1秒
16
16
  static REQUEST_TIMEOUT = 10000; // 10秒
@@ -13,8 +13,8 @@ const { URL } = require('url');
13
13
 
14
14
  class TokenManager {
15
15
  static TOKEN_FILE_PATH = path.join(os.homedir(), '.bluelamp-vscode', 'portal-token.enc');
16
- static PORTAL_API_URL_PROD = 'https://bluelamp-235426778039.asia-northeast1.run.app/api/cli/verify';
17
- static PORTAL_API_URL_LOCAL = 'https://bluelamp-235426778039.asia-northeast1.run.app/api/cli/verify';
16
+ static PORTAL_API_URL_PROD = 'https://bluelamp-6clpzmy5pa-an.a.run.app/api/cli/verify';
17
+ static PORTAL_API_URL_LOCAL = 'https://bluelamp-6clpzmy5pa-an.a.run.app/api/cli/verify';
18
18
  static ENCRYPTION_KEY = 'bluelamp-vscode-portal-token-key-2024';
19
19
  static REQUEST_TIMEOUT = 10000; // 10秒
20
20
 
@@ -29,8 +29,8 @@ class TokenManager {
29
29
  * APIエンドポイントを取得
30
30
  */
31
31
  static getApiUrl(endpoint) {
32
- // 環境変数から取得(デフォルトはローカル)
33
- const portalUrl = process.env.PORTAL_URL || 'https://bluelamp-235426778039.asia-northeast1.run.app';
32
+ // 環境変数から取得(デフォルトは本番)
33
+ const portalUrl = process.env.PORTAL_URL || 'https://bluelamp-6clpzmy5pa-an.a.run.app';
34
34
  return portalUrl + endpoint;
35
35
  }
36
36
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  import fetch from 'node-fetch';
6
6
 
7
- const PORTAL_URL = process.env.PORTAL_URL || 'https://bluelamp-235426778039.asia-northeast1.run.app';
7
+ const PORTAL_URL = process.env.PORTAL_URL || 'https://bluelamp-6clpzmy5pa-an.a.run.app';
8
8
 
9
9
  /**
10
10
  * キーワードに基づいてPortalからプロンプトを取得
@@ -16,16 +16,22 @@ const path = require('path');
16
16
  const fs = require('fs');
17
17
  const os = require('os');
18
18
 
19
- // .envファイルを読み込み(存在する場合)
19
+ // .envファイルを読み込み(.env.localを優先)
20
+ const dotenvLocalPath = path.join(__dirname, '../../.env.local');
20
21
  const dotenvPath = path.join(__dirname, '../../.env');
21
- if (fs.existsSync(dotenvPath)) {
22
+
23
+ if (fs.existsSync(dotenvLocalPath)) {
24
+ require('dotenv').config({ path: dotenvLocalPath });
25
+ console.error('[MCP Server] Loaded .env.local');
26
+ } else if (fs.existsSync(dotenvPath)) {
22
27
  require('dotenv').config({ path: dotenvPath });
28
+ console.error('[MCP Server] Loaded .env');
23
29
  }
24
30
 
25
31
  // 環境変数から取得
26
32
  const KEYWORD = process.env.BLUELAMP_KEYWORD || 'BL-要件定義';
27
33
  const TOKEN = process.env.BLUELAMP_TOKEN;
28
- const PORTAL_URL = process.env.PORTAL_URL || 'https://bluelamp-235426778039.asia-northeast1.run.app';
34
+ const PORTAL_URL = process.env.PORTAL_URL || 'https://bluelamp-6clpzmy5pa-an.a.run.app';
29
35
 
30
36
  // ログファイル設定(固定名にして見つけやすくする)
31
37
  const LOG_FILE = path.join(os.tmpdir(), 'bluelamp-vscode-mcp-latest.log');
@@ -14,7 +14,7 @@ const httpsAgent = new https.Agent({
14
14
  rejectUnauthorized: false
15
15
  });
16
16
 
17
- const PORTAL_URL = process.env.PORTAL_URL || 'https://bluelamp-235426778039.asia-northeast1.run.app';
17
+ const PORTAL_URL = process.env.PORTAL_URL || 'https://bluelamp-6clpzmy5pa-an.a.run.app';
18
18
 
19
19
  // ログファイル(index.cjsと同じファイルに書き込む)
20
20
  const LOG_FILE = path.join(os.tmpdir(), 'bluelamp-vscode-mcp-latest.log');
@@ -96,8 +96,9 @@ async function getPromptFromPortal(keyword, token) {
96
96
  const encodedKeyword = encodeURIComponent(keyword);
97
97
  const url = `${PORTAL_URL}/api/cli/prompts/knowledge-injection/${encodedKeyword}`;
98
98
  log(`[portal-api-client] Direct keyword search: ${url}`);
99
- log(`[portal-api-client] Token: [HIDDEN]`);
99
+ log(`[portal-api-client] Token (first 30 chars): ${token.substring(0, 30)}...`);
100
100
 
101
+ log(`[portal-api-client] About to call fetch...`);
101
102
  const response = await fetch(url, {
102
103
  method: 'GET',
103
104
  headers: {
@@ -105,10 +106,12 @@ async function getPromptFromPortal(keyword, token) {
105
106
  'Content-Type': 'application/json',
106
107
  'User-Agent': 'BlueLamp-VSCode-MCP/1.0'
107
108
  },
108
- agent: httpsAgent
109
+ agent: url.startsWith('https') ? httpsAgent : undefined
109
110
  });
111
+ log(`[portal-api-client] Fetch completed`);
110
112
 
111
113
  log(`[portal-api-client] Response status: ${response.status}`);
114
+ log(`[portal-api-client] Response headers: ${JSON.stringify(Object.fromEntries(response.headers.entries()))}`);
112
115
 
113
116
  if (!response.ok) {
114
117
  log(`[portal-api-client] Portal API error: ${response.status}`);
@@ -197,6 +200,8 @@ async function getPromptFromPortal(keyword, token) {
197
200
  };
198
201
 
199
202
  } catch (error) {
203
+ log(`[portal-api-client] FATAL ERROR in getPromptFromPortal: ${error.message}`);
204
+ log(`[portal-api-client] Error stack: ${error.stack}`);
200
205
  console.error('Failed to get prompt from Portal:', error);
201
206
  return null;
202
207
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bluelamp-vscode",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "BlueLamp VSCode Extension MCP Integration - 17 Development Prompts",
5
5
  "main": "lib/mcp-server/index.cjs",
6
6
  "bin": {