bluelamp-vscode 2.2.2 → 2.2.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.
@@ -13,13 +13,19 @@ 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
- // コマンドマッピング(17個のプロンプト - 新BlueLamp 17エージェント体制)
28
+ // コマンドマッピング(18個のプロンプト - 新BlueLamp 18エージェント体制)
23
29
  const PROMPT_MAPPING = {
24
30
  'bluelamp-vscode1': '@要件定義', // Phase @1: 要件定義エンジニア
25
31
  'bluelamp-vscode2': '@Git管理', // Phase @2: Git/GitHub管理
@@ -37,7 +43,8 @@ const PROMPT_MAPPING = {
37
43
  'bluelamp-vscode14': '@デバッグ技術', // Tools @14: 自己完結型デバッグマスター
38
44
  'bluelamp-vscode15': '@リファクタリング', // Tools @15: 超並列リファクタリング
39
45
  'bluelamp-vscode16': '@ドキュメント生成', // Tools @16: ドキュメント生成統括
40
- 'bluelamp-vscode17': '@相談' // Tools @17: 相談対応
46
+ 'bluelamp-vscode17': '@相談', // Tools @17: 相談対応
47
+ 'bluelamp-vscode18': '@MCP追加' // Tools @18: MCP追加エージェント
41
48
  };
42
49
 
43
50
  /**
@@ -62,6 +69,9 @@ function createMCPConfig(keyword, cliToken) {
62
69
  const mcpServerPath = path.join(packageRoot, 'lib/mcp-server/index.cjs');
63
70
  const tempConfigPath = path.join(os.tmpdir(), `bluelamp-vscode-${Date.now()}.json`);
64
71
 
72
+ // .env.localからPORTAL_URLを取得(デフォルトは本番)
73
+ const portalUrl = process.env.PORTAL_URL || "https://bluelamp-6clpzmy5pa-an.a.run.app";
74
+
65
75
  const config = {
66
76
  mcpServers: {
67
77
  "bluelamp-vscode": {
@@ -70,7 +80,7 @@ function createMCPConfig(keyword, cliToken) {
70
80
  env: {
71
81
  BLUELAMP_KEYWORD: keyword,
72
82
  BLUELAMP_TOKEN: cliToken,
73
- PORTAL_URL: "https://bluelamp-235426778039.asia-northeast1.run.app" // 本番Portalサーバー
83
+ PORTAL_URL: portalUrl
74
84
  }
75
85
  }
76
86
  }
@@ -100,7 +110,7 @@ async function performPortalAuth() {
100
110
  console.error('解決方法:');
101
111
  console.error('1. インターネット接続を確認してください');
102
112
  console.error('2. Portal認証情報が正しいか確認してください');
103
- console.error('3. https://bluelamp-235426778039.asia-northeast1.run.app にアクセスできるか確認してください');
113
+ console.error('3. https://bluelamp-6clpzmy5pa-an.a.run.app にアクセスできるか確認してください');
104
114
  process.exit(1);
105
115
  }
106
116
  }
@@ -111,8 +121,15 @@ async function performPortalAuth() {
111
121
  async function main() {
112
122
  const keyword = getKeywordFromCommand();
113
123
 
124
+ // --debugフラグの確認
125
+ const isDebugMode = process.argv.includes('--debug');
126
+
114
127
  console.log('🔵 BlueLamp VSCode MCP Integration');
115
128
  console.log(`📚 プロンプト: ${keyword}`);
129
+ if (isDebugMode) {
130
+ console.log('🐛 デバッグモード: 有効');
131
+ console.log(` ログファイル: ${path.join(os.tmpdir(), 'bluelamp-vscode-mcp-latest.log')}`);
132
+ }
116
133
  console.log('');
117
134
 
118
135
  // Portal認証の実行
@@ -172,6 +189,24 @@ inject_knowledge ツールで keyword: "${keyword}" を実行してから開始
172
189
  ];
173
190
  }
174
191
 
192
+ // デバッグモードの場合、詳細情報を表示
193
+ if (isDebugMode) {
194
+ console.log('🐛 デバッグ情報:');
195
+ console.log(` コマンド: ${claudeCommand}`);
196
+ console.log(` 引数: ${JSON.stringify(claudeArgs, null, 2)}`);
197
+ console.log(` MCP設定ファイル: ${configPath}`);
198
+ console.log(` 環境変数 BLUELAMP_KEYWORD: ${keyword}`);
199
+ console.log(` 環境変数 BLUELAMP_TOKEN: ${cliToken.substring(0, 20)}...`);
200
+ console.log(` 環境変数 PORTAL_URL: ${process.env.PORTAL_URL || 'https://bluelamp-6clpzmy5pa-an.a.run.app'}`);
201
+ console.log('');
202
+
203
+ // MCP設定ファイルの内容を表示
204
+ const configContent = fs.readFileSync(configPath, 'utf-8');
205
+ console.log('📄 MCP設定ファイル内容:');
206
+ console.log(configContent);
207
+ console.log('');
208
+ }
209
+
175
210
  const child = spawn(claudeCommand, claudeArgs, {
176
211
  stdio: 'inherit',
177
212
  env: {
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('./bluelamp-vscode-base');
@@ -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,7 +1,7 @@
1
1
  {
2
2
  "name": "bluelamp-vscode",
3
- "version": "2.2.2",
4
- "description": "BlueLamp VSCode Extension MCP Integration - 17 Development Prompts",
3
+ "version": "2.2.4",
4
+ "description": "BlueLamp VSCode Extension MCP Integration - 18 Development Prompts",
5
5
  "main": "lib/mcp-server/index.cjs",
6
6
  "bin": {
7
7
  "bluelamp-vscode1": "./bin/bluelamp-vscode1",
@@ -20,7 +20,8 @@
20
20
  "bluelamp-vscode14": "./bin/bluelamp-vscode14",
21
21
  "bluelamp-vscode15": "./bin/bluelamp-vscode15",
22
22
  "bluelamp-vscode16": "./bin/bluelamp-vscode16",
23
- "bluelamp-vscode17": "./bin/bluelamp-vscode17"
23
+ "bluelamp-vscode17": "./bin/bluelamp-vscode17",
24
+ "bluelamp-vscode18": "./bin/bluelamp-vscode18"
24
25
  },
25
26
  "scripts": {
26
27
  "postinstall": "node scripts/generate-commands.js",