bluelamp-vscode 2.0.2 → 2.0.5
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/bin/bluelamp-vscode-base +202 -1
- package/lib/auth/InteractiveLogin.js +243 -1
- package/lib/auth/PortalAuthClient.js +187 -1
- package/lib/auth/TokenManager.js +258 -1
- package/lib/mcp-server/fetch-prompt.js +61 -1
- package/lib/mcp-server/index.cjs +157 -1
- package/lib/mcp-server/portal-api-client.cjs +205 -1
- package/package.json +12 -3
- package/scripts/build-release.js +426 -0
- package/scripts/generate-commands.js +35 -0
package/bin/bluelamp-vscode-base
CHANGED
|
@@ -1,2 +1,203 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* BlueLamp VSCode MCP Integration
|
|
5
|
+
* Base script for VSCode extension prompt injection
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { spawn } = require('child_process');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const os = require('os');
|
|
12
|
+
|
|
13
|
+
// パッケージのルートディレクトリを取得
|
|
14
|
+
const packageRoot = path.dirname(__dirname);
|
|
15
|
+
|
|
16
|
+
// .envファイルを読み込み(存在する場合)
|
|
17
|
+
const dotenvPath = path.join(packageRoot, '.env');
|
|
18
|
+
if (fs.existsSync(dotenvPath)) {
|
|
19
|
+
require('dotenv').config({ path: dotenvPath });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// コマンドマッピング(15個のプロンプト - 新BlueLamp 15エージェント体制)
|
|
23
|
+
const PROMPT_MAPPING = {
|
|
24
|
+
'bluelamp-vscode1': '@要件定義', // Phase @1: 要件定義エンジニア
|
|
25
|
+
'bluelamp-vscode2': '@Git管理', // Phase @2: Git/GitHub管理
|
|
26
|
+
'bluelamp-vscode3': '@フロントエンド基盤', // Phase @3: フロントエンド基盤オーケストレーター
|
|
27
|
+
'bluelamp-vscode4': '@ページ実装オーケストレーター', // Phase @4: ページ実装統括
|
|
28
|
+
'bluelamp-vscode5': '@環境構築オーケストレーター', // Phase @5: 環境構築
|
|
29
|
+
'bluelamp-vscode6': '@バックエンド計画オーケストレーター', // Phase @6: バックエンド実装計画
|
|
30
|
+
'bluelamp-vscode7': '@バックエンド実装オーケストレーター', // Phase @7: バックエンド実装統括
|
|
31
|
+
'bluelamp-vscode8': '@フロントエンド実装オーケストレーター', // Phase @8: API統合統括
|
|
32
|
+
'bluelamp-vscode9': '@E2Eテストオーケストレーター', // Phase @9: E2Eテスト統括
|
|
33
|
+
'bluelamp-vscode10': '@デプロイオーケストレーター', // Phase @10: デプロイメント統括
|
|
34
|
+
'bluelamp-vscode11': '@機能拡張', // Phase @11: 機能拡張オーケストレーター
|
|
35
|
+
'bluelamp-vscode12': '@デバッグ技術', // Tools @12: 自己完結型デバッグマスター
|
|
36
|
+
'bluelamp-vscode13': '@TypeScript型システム', // Tools @13: 並列TypeScript型エラー解消
|
|
37
|
+
'bluelamp-vscode14': '@リファクタリング', // Tools @14: 超並列リファクタリング
|
|
38
|
+
'bluelamp-vscode15': '@ドキュメント生成', // Tools @15: ドキュメント生成統括
|
|
39
|
+
'bluelamp-vscode16': '@相談' // Tools @16: 相談対応
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* コマンド名から対応するキーワードを取得
|
|
44
|
+
*/
|
|
45
|
+
function getKeywordFromCommand() {
|
|
46
|
+
const commandPath = process.argv[1];
|
|
47
|
+
const commandName = path.basename(commandPath);
|
|
48
|
+
|
|
49
|
+
if (!PROMPT_MAPPING[commandName]) {
|
|
50
|
+
console.error(`❌ 未定義のコマンド: ${commandName}`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return PROMPT_MAPPING[commandName];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* MCPサーバー設定を作成
|
|
59
|
+
*/
|
|
60
|
+
function createMCPConfig(keyword, cliToken) {
|
|
61
|
+
const mcpServerPath = path.join(packageRoot, 'lib/mcp-server/index.cjs');
|
|
62
|
+
const tempConfigPath = path.join(os.tmpdir(), `bluelamp-vscode-${Date.now()}.json`);
|
|
63
|
+
|
|
64
|
+
const config = {
|
|
65
|
+
mcpServers: {
|
|
66
|
+
"bluelamp-vscode": {
|
|
67
|
+
command: "node",
|
|
68
|
+
args: [mcpServerPath],
|
|
69
|
+
env: {
|
|
70
|
+
BLUELAMP_KEYWORD: keyword,
|
|
71
|
+
BLUELAMP_TOKEN: cliToken,
|
|
72
|
+
PORTAL_URL: "https://bluelamp-235426778039.asia-northeast1.run.app" // 本番Portalサーバー
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
fs.writeFileSync(tempConfigPath, JSON.stringify(config, null, 2));
|
|
79
|
+
return tempConfigPath;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Portal認証の実行(BlueLamp VSCode独自の認証システム)
|
|
84
|
+
*/
|
|
85
|
+
async function performPortalAuth() {
|
|
86
|
+
try {
|
|
87
|
+
// BlueLamp VSCode用の認証モジュールを使用
|
|
88
|
+
const { InteractiveLogin } = require('../lib/auth/InteractiveLogin');
|
|
89
|
+
|
|
90
|
+
const authResult = await InteractiveLogin.performLogin();
|
|
91
|
+
|
|
92
|
+
InteractiveLogin.displayLoginSuccess(authResult);
|
|
93
|
+
|
|
94
|
+
return authResult.token;
|
|
95
|
+
|
|
96
|
+
} catch (error) {
|
|
97
|
+
console.error('❌ Portal認証エラー:', error.message);
|
|
98
|
+
console.error('');
|
|
99
|
+
console.error('解決方法:');
|
|
100
|
+
console.error('1. インターネット接続を確認してください');
|
|
101
|
+
console.error('2. Portal認証情報が正しいか確認してください');
|
|
102
|
+
console.error('3. https://bluelamp-235426778039.asia-northeast1.run.app にアクセスできるか確認してください');
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* メイン処理
|
|
109
|
+
*/
|
|
110
|
+
async function main() {
|
|
111
|
+
const keyword = getKeywordFromCommand();
|
|
112
|
+
|
|
113
|
+
console.log('🔵 BlueLamp VSCode MCP Integration');
|
|
114
|
+
console.log(`📚 プロンプト: ${keyword}`);
|
|
115
|
+
console.log('');
|
|
116
|
+
|
|
117
|
+
// Portal認証の実行
|
|
118
|
+
const cliToken = await performPortalAuth();
|
|
119
|
+
|
|
120
|
+
// MCP設定ファイルを作成(認証トークンを含む)
|
|
121
|
+
const configPath = createMCPConfig(keyword, cliToken);
|
|
122
|
+
|
|
123
|
+
// 初期プロンプトメッセージ
|
|
124
|
+
const initialPrompt = `> 拡張モードで起動
|
|
125
|
+
|
|
126
|
+
🔵 BlueLamp 統合認証システム が有効化されました
|
|
127
|
+
|
|
128
|
+
\x1b[34m╭─────────────────────────────────────────────────────────────────╮\x1b[0m
|
|
129
|
+
\x1b[34m│ │\x1b[0m
|
|
130
|
+
\x1b[34m│ B l u e L a m p │\x1b[0m
|
|
131
|
+
\x1b[34m│ ───────────────── │\x1b[0m
|
|
132
|
+
\x1b[34m│ さあ始めましょう │\x1b[0m
|
|
133
|
+
\x1b[34m│ │\x1b[0m
|
|
134
|
+
\x1b[34m╰─────────────────────────────────────────────────────────────────╯\x1b[0m
|
|
135
|
+
|
|
136
|
+
**最初に必ず専門知識を注入してください**
|
|
137
|
+
inject_knowledge ツールで keyword: "${keyword}" を実行してから開始してください。(初回必須)
|
|
138
|
+
|
|
139
|
+
重要:キーワードは "${keyword}" をそのまま使用してください。変換や推測は不要です。
|
|
140
|
+
|
|
141
|
+
準備完了です。まず知識注入を実行してから、タスクを開始してください。`;
|
|
142
|
+
|
|
143
|
+
// Claude を起動
|
|
144
|
+
console.log('🚀 Claude 起動中...');
|
|
145
|
+
console.log(' - MCP Server: BlueLamp VSCode');
|
|
146
|
+
console.log(` - Knowledge: ${keyword}`);
|
|
147
|
+
console.log('');
|
|
148
|
+
|
|
149
|
+
const claudeArgs = [
|
|
150
|
+
initialPrompt,
|
|
151
|
+
'--dangerously-skip-permissions', // bypassPermissionを有効化
|
|
152
|
+
'--mcp-config', configPath
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
const child = spawn('claude', claudeArgs, {
|
|
156
|
+
stdio: 'inherit',
|
|
157
|
+
env: {
|
|
158
|
+
...process.env,
|
|
159
|
+
BLUELAMP_VSCODE_KEYWORD: keyword
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// エラーハンドリング
|
|
164
|
+
child.on('error', (error) => {
|
|
165
|
+
console.error('❌ Claude 起動エラー:', error.message);
|
|
166
|
+
|
|
167
|
+
// 一時ファイルをクリーンアップ
|
|
168
|
+
try {
|
|
169
|
+
fs.unlinkSync(configPath);
|
|
170
|
+
} catch (e) {
|
|
171
|
+
// ignore
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
process.exit(1);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// 終了時のクリーンアップ
|
|
178
|
+
child.on('exit', (code) => {
|
|
179
|
+
console.log('');
|
|
180
|
+
console.log('🔵 BlueLamp VSCode セッション終了');
|
|
181
|
+
|
|
182
|
+
// 一時ファイルをクリーンアップ
|
|
183
|
+
try {
|
|
184
|
+
fs.unlinkSync(configPath);
|
|
185
|
+
} catch (e) {
|
|
186
|
+
// ignore
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
process.exit(code || 0);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// SIGINT (Ctrl+C) ハンドリング
|
|
193
|
+
process.on('SIGINT', () => {
|
|
194
|
+
console.log('\n🔵 BlueLamp VSCode を終了しています...');
|
|
195
|
+
child.kill('SIGINT');
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// メイン処理の実行
|
|
200
|
+
main().catch((error) => {
|
|
201
|
+
console.error('❌ 予期しないエラー:', error.message);
|
|
202
|
+
process.exit(1);
|
|
203
|
+
});
|