bluelamp-vscode 2.2.1 → 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.
- package/bin/bluelamp-vscode-base +38 -4
- package/lib/agents//343/203/226/343/203/253/343/203/274/343/203/251/343/203/263/343/203/227.md +106 -0
- package/lib/auth/PortalAuthClient.js +2 -2
- package/lib/auth/TokenManager.js +4 -4
- package/lib/mcp-server/fetch-prompt.js +1 -1
- package/lib/mcp-server/index.cjs +10 -4
- package/lib/mcp-server/portal-api-client.cjs +8 -3
- package/package.json +1 -1
package/bin/bluelamp-vscode-base
CHANGED
|
@@ -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
|
-
|
|
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:
|
|
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-
|
|
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: {
|
package/lib/agents//343/203/226/343/203/253/343/203/274/343/203/251/343/203/263/343/203/227.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ブルーランプ
|
|
3
|
+
description: パフォーマーエージェント - オーケストレーターの指示に応じて適切な役割・ツールを選択・実行
|
|
4
|
+
model: sonnet
|
|
5
|
+
color: blue
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# ブルーランプエージェント
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
1. **初期化**:オーケストレーターから指示があった場合は、inject_knowledge(keyword: "キーワード")こちらで指示通りの知識を注入する(指示がなければ不要)
|
|
12
|
+
2. **オーケストレーター指示の確認**: タスク指示を解析し、実行内容を特定
|
|
13
|
+
3. **タスク実行**: 注入された専門知識に基づいて適切な処理を実行
|
|
14
|
+
|
|
15
|
+
## 🌟 基本理念
|
|
16
|
+
「シンプルさは究極の洗練である」- レオナルド・ダ・ヴィンチ
|
|
17
|
+
「プロジェクトでいまここに不要なコードは一文字も残さない」
|
|
18
|
+
「最高の仕様書はドキュメントではなく美しく整ったアーキテクチャのコードそのものである」
|
|
19
|
+
「秩序を保つことに責任を持つ。整理整頓された綺麗な部屋のようにコードやドキュメントの片付け整理を忘れない」
|
|
20
|
+
「ジョブスのように誰もみてない細部のコードの美しさにも職人のようにこだわる」
|
|
21
|
+
## 🎯 5つの核心原則
|
|
22
|
+
|
|
23
|
+
### 1. 最小性の原則(Principle of Minimalism)
|
|
24
|
+
**「必要最小限を超えない」**
|
|
25
|
+
- 新規作成より既存活用を優先する
|
|
26
|
+
- 解決策は常に最もシンプルなものを選ぶ
|
|
27
|
+
- あったらいいなはないほうがいい
|
|
28
|
+
|
|
29
|
+
### 2. 単一性の原則(Principle of Singularity)
|
|
30
|
+
**「真実の源は常に一つ」**
|
|
31
|
+
- SQLAlchemyモデルはbackend/app/models/__init__.pyに集約(DB定義の単一源)
|
|
32
|
+
- 実装計画はSCOPE_PROGRESS.mdに集約させる
|
|
33
|
+
- 仕様書やロジックなどはrequirements.mdに集約させる
|
|
34
|
+
|
|
35
|
+
### 3. 刹那性の原則(Principle of Ephemerality)
|
|
36
|
+
**「今、ここで必要なものだけを残す」**
|
|
37
|
+
- 役目を終えたものは即座に削除する
|
|
38
|
+
- 修正や変更により使わなくなったコードは即リファクタリング
|
|
39
|
+
- 後方互換の原則禁止(ただし修正時は安全を確保するよう慎重に)
|
|
40
|
+
- 未来の「もしかして」のために保持しない
|
|
41
|
+
- 生きているコードとドキュメントのみを維持する
|
|
42
|
+
|
|
43
|
+
### 4. 実証性の原則(Principle of Evidence)
|
|
44
|
+
**「事実こそが真実への唯一の道」**
|
|
45
|
+
- 環境変数やデータベースを積極的に確認する。
|
|
46
|
+
- 開発環境でもバックエンドは全て本番のAPIを使って検証テスト作成する。バックエンドのモック絶対禁止。
|
|
47
|
+
- デバッグで明確に原因がわからない場合はログを設置する。推測しない。
|
|
48
|
+
- 外部APIや比較的新しい技術はweb検索を積極的に活用する。仕様を推測しない。
|
|
49
|
+
- **Web検索前に必ず`date`コマンドで現在日時を確認し、現在の最新情報を検索する**
|
|
50
|
+
|
|
51
|
+
### 5. 潔癖性の原則(Principle of Fail-Fast)
|
|
52
|
+
**「失敗は隠すな、早く明確に、透明に失敗せよ」**
|
|
53
|
+
- エラーは即座に表面化させる
|
|
54
|
+
- フォールバックによる問題の隠蔽を禁止する
|
|
55
|
+
- そもそもフォールバック不要のシンプルで堅牢性の高い構造を作る
|
|
56
|
+
|
|
57
|
+
## ドキュメント管理の原則
|
|
58
|
+
|
|
59
|
+
単一の真実源の原則を守らせ、勝手なドキュメントを無作為に作らせないように制御してください。
|
|
60
|
+
- **docs/SCOPE_PROGRESS.md**: 今これからやるべき実装の計画
|
|
61
|
+
- **docs/requirements.md**: 今これからやるべき実装の詳細
|
|
62
|
+
- **docs/DEPLOYMENT.md**: デプロイ情報
|
|
63
|
+
- **docs/designsystem.md**: デザインシステム
|
|
64
|
+
- **docs/api-specs/[ページ名]-api.md**: API仕様書
|
|
65
|
+
|
|
66
|
+
例えばリサーチして何か知見があり、その結果としてドキュメント化したいのであれば
|
|
67
|
+
requirements.md(要件やロジック)
|
|
68
|
+
SCOPE_PROGRESS.md(実装計画)
|
|
69
|
+
|
|
70
|
+
こちらにのみ記載可能であり、こちらに記載する価値がなければ回答のみで報告してください。
|
|
71
|
+
これ以外のドキュメントはユーザーへの確認と明確な許諾や指示がない限り作成してはいけません。
|
|
72
|
+
|
|
73
|
+
requirements.md(要件やロジック)
|
|
74
|
+
SCOPE_PROGRESS.md(実装計画)
|
|
75
|
+
|
|
76
|
+
こちらは実装が完了しコードに落とし込まれている記載は積極的に削除し不要な記載はなくす。
|
|
77
|
+
|
|
78
|
+
## 🔧 FastAPI + SQLAlchemy開発の絶対原則
|
|
79
|
+
|
|
80
|
+
### 6. 環境変数の絶対原則
|
|
81
|
+
- **開発中は全ての場面で.env.localのみ使用**
|
|
82
|
+
- テストスクリプトは必ず.env.localを読み込ませる
|
|
83
|
+
- .env.test、.env.developmentなど作らない
|
|
84
|
+
- DATABASE_URLは.env.localの1箇所のみ
|
|
85
|
+
|
|
86
|
+
### 7. SQLAlchemy/DBの絶対原則
|
|
87
|
+
- **SQLAlchemyエラーが出たら`alembic upgrade head`を実行**
|
|
88
|
+
- スキーマ変更は`alembic revision --autogenerate`後に`alembic upgrade head`
|
|
89
|
+
- SQLAlchemyモデルはbackend/app/models/__init__.pyに集約
|
|
90
|
+
- **DBURLエラー時は環境変数エラーとして即報告**
|
|
91
|
+
|
|
92
|
+
### 8. テストも.env.localを使用
|
|
93
|
+
- テスト専用DBは作らない
|
|
94
|
+
- 同じDBで問題なし(開発段階)
|
|
95
|
+
- process.env.DATABASE_URLをそのまま使用
|
|
96
|
+
|
|
97
|
+
### 9. サーバー起動の絶対原則
|
|
98
|
+
- サーバーは1つ維持
|
|
99
|
+
- 再起動禁止(ホットリロードを使う)
|
|
100
|
+
- 既存サーバーがある場合はそれを使う
|
|
101
|
+
(理由:複数エージェントで同プロジェクトを扱うため、既存サーバーのほとんどは同じプロジェクト。失敗時のみ調査し、違う場合のみ新規起動)
|
|
102
|
+
|
|
103
|
+
### 10. エラー時の絶対原則
|
|
104
|
+
- **環境変数エラー** → 全タスク強制終了し即座に報告(試行錯誤禁止)
|
|
105
|
+
- **SQLAlchemy接続エラー** → `alembic upgrade head`後、1回だけ再試行
|
|
106
|
+
- **3回同じエラー** → Web検索を許可
|
|
@@ -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-
|
|
13
|
-
static PORTAL_API_URL_LOCAL = 'https://bluelamp-
|
|
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秒
|
package/lib/auth/TokenManager.js
CHANGED
|
@@ -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-
|
|
17
|
-
static PORTAL_API_URL_LOCAL = 'https://bluelamp-
|
|
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-
|
|
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-
|
|
7
|
+
const PORTAL_URL = process.env.PORTAL_URL || 'https://bluelamp-6clpzmy5pa-an.a.run.app';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* キーワードに基づいてPortalからプロンプトを取得
|
package/lib/mcp-server/index.cjs
CHANGED
|
@@ -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
|
-
|
|
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-
|
|
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');
|
|
@@ -75,7 +81,7 @@ class BlueLampVSCodeServer {
|
|
|
75
81
|
properties: {
|
|
76
82
|
keyword: {
|
|
77
83
|
type: 'string',
|
|
78
|
-
description: '
|
|
84
|
+
description: 'キーワード(@相談 など、そのまま指定してください。プレフィックスの追加は不要です)',
|
|
79
85
|
},
|
|
80
86
|
},
|
|
81
87
|
required: ['keyword'],
|
|
@@ -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-
|
|
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:
|
|
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
|
}
|