bluelamp 4.0.4 → 4.0.6
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 +258 -0
- package/bin/bluelamp-vscode1 +2 -0
- package/bin/bluelamp-vscode10 +2 -0
- package/bin/bluelamp-vscode11 +2 -0
- package/bin/bluelamp-vscode12 +2 -0
- package/bin/bluelamp-vscode13 +2 -0
- package/bin/bluelamp-vscode14 +2 -0
- package/bin/bluelamp-vscode15 +2 -0
- package/bin/bluelamp-vscode16 +2 -0
- package/bin/bluelamp-vscode17 +2 -0
- package/bin/bluelamp-vscode18 +2 -0
- package/bin/bluelamp-vscode2 +2 -0
- package/bin/bluelamp-vscode3 +2 -0
- package/bin/bluelamp-vscode4 +2 -0
- package/bin/bluelamp-vscode5 +2 -0
- package/bin/bluelamp-vscode6 +2 -0
- package/bin/bluelamp-vscode7 +2 -0
- package/bin/bluelamp-vscode8 +2 -0
- package/bin/bluelamp-vscode9 +2 -0
- package/lib/auth/PortalAuthClient.js +1 -1
- package/lib/mcp-server/index.cjs +57 -25
- package/lib/mcp-server/portal-api-client.cjs +37 -10
- package/lib/utils/logger.js +83 -0
- package/package.json +34 -27
- package/scripts/generate-commands.js +10 -15
- package/bin/bluelamp-base +0 -280
- package/bin/bluelamp-hook +0 -49
- package/bin/bluelamp1 +0 -2
- package/bin/bluelamp10 +0 -2
- package/bin/bluelamp11 +0 -2
- package/bin/bluelamp12 +0 -2
- package/bin/bluelamp13 +0 -2
- package/bin/bluelamp14 +0 -2
- package/bin/bluelamp15 +0 -2
- package/bin/bluelamp16 +0 -2
- package/bin/bluelamp17 +0 -2
- package/bin/bluelamp18 +0 -2
- package/bin/bluelamp2 +0 -2
- package/bin/bluelamp3 +0 -2
- package/bin/bluelamp4 +0 -2
- package/bin/bluelamp5 +0 -2
- package/bin/bluelamp6 +0 -2
- package/bin/bluelamp7 +0 -2
- package/bin/bluelamp8 +0 -2
- package/bin/bluelamp9 +0 -2
- package/lib/mcp-server/fetch-prompt.js +0 -61
- package/scripts/setup-hook.js +0 -98
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BlueLamp VSCode Logger
|
|
3
|
+
* 環境変数ベースのログレベル制御
|
|
4
|
+
*
|
|
5
|
+
* @module logger
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const LOG_LEVELS = {
|
|
9
|
+
debug: 0,
|
|
10
|
+
info: 1,
|
|
11
|
+
warn: 2,
|
|
12
|
+
error: 3,
|
|
13
|
+
silent: 4
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const LOG_LEVEL = process.env.BLUELAMP_LOG_LEVEL || 'info';
|
|
17
|
+
const currentLevel = LOG_LEVELS[LOG_LEVEL] ?? LOG_LEVELS.info;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* タイムスタンプ付きログメッセージを生成
|
|
21
|
+
* @param {string} level - ログレベル
|
|
22
|
+
* @param {string} message - メッセージ
|
|
23
|
+
* @returns {string} フォーマット済みメッセージ
|
|
24
|
+
*/
|
|
25
|
+
function formatMessage(level, message) {
|
|
26
|
+
const timestamp = new Date().toISOString();
|
|
27
|
+
return `[${timestamp}] [${level.toUpperCase()}] ${message}`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* ログ出力関数
|
|
32
|
+
*/
|
|
33
|
+
const logger = {
|
|
34
|
+
/**
|
|
35
|
+
* デバッグログ
|
|
36
|
+
* @param {string} message - メッセージ
|
|
37
|
+
*/
|
|
38
|
+
debug(message) {
|
|
39
|
+
if (currentLevel <= LOG_LEVELS.debug) {
|
|
40
|
+
console.error(formatMessage('debug', message));
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 情報ログ
|
|
46
|
+
* @param {string} message - メッセージ
|
|
47
|
+
*/
|
|
48
|
+
info(message) {
|
|
49
|
+
if (currentLevel <= LOG_LEVELS.info) {
|
|
50
|
+
console.error(formatMessage('info', message));
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* 警告ログ
|
|
56
|
+
* @param {string} message - メッセージ
|
|
57
|
+
*/
|
|
58
|
+
warn(message) {
|
|
59
|
+
if (currentLevel <= LOG_LEVELS.warn) {
|
|
60
|
+
console.warn(formatMessage('warn', message));
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* エラーログ
|
|
66
|
+
* @param {string} message - メッセージ
|
|
67
|
+
*/
|
|
68
|
+
error(message) {
|
|
69
|
+
if (currentLevel <= LOG_LEVELS.error) {
|
|
70
|
+
console.error(formatMessage('error', message));
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* ログレベルを取得
|
|
76
|
+
* @returns {string} 現在のログレベル
|
|
77
|
+
*/
|
|
78
|
+
getLevel() {
|
|
79
|
+
return LOG_LEVEL;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
module.exports = { logger, LOG_LEVELS };
|
package/package.json
CHANGED
|
@@ -1,39 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bluelamp",
|
|
3
|
-
"version": "4.0.
|
|
4
|
-
"description": "BlueLamp MCP Integration -
|
|
3
|
+
"version": "4.0.6",
|
|
4
|
+
"description": "BlueLamp VSCode Extension MCP Integration - 18 Development Prompts",
|
|
5
5
|
"main": "lib/mcp-server/index.cjs",
|
|
6
6
|
"bin": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"bluelamp-hook": "./bin/bluelamp-hook"
|
|
7
|
+
"bluelamp-vscode1": "./bin/bluelamp-vscode1",
|
|
8
|
+
"bluelamp-vscode2": "./bin/bluelamp-vscode2",
|
|
9
|
+
"bluelamp-vscode3": "./bin/bluelamp-vscode3",
|
|
10
|
+
"bluelamp-vscode4": "./bin/bluelamp-vscode4",
|
|
11
|
+
"bluelamp-vscode5": "./bin/bluelamp-vscode5",
|
|
12
|
+
"bluelamp-vscode6": "./bin/bluelamp-vscode6",
|
|
13
|
+
"bluelamp-vscode7": "./bin/bluelamp-vscode7",
|
|
14
|
+
"bluelamp-vscode8": "./bin/bluelamp-vscode8",
|
|
15
|
+
"bluelamp-vscode9": "./bin/bluelamp-vscode9",
|
|
16
|
+
"bluelamp-vscode10": "./bin/bluelamp-vscode10",
|
|
17
|
+
"bluelamp-vscode11": "./bin/bluelamp-vscode11",
|
|
18
|
+
"bluelamp-vscode12": "./bin/bluelamp-vscode12",
|
|
19
|
+
"bluelamp-vscode13": "./bin/bluelamp-vscode13",
|
|
20
|
+
"bluelamp-vscode14": "./bin/bluelamp-vscode14",
|
|
21
|
+
"bluelamp-vscode15": "./bin/bluelamp-vscode15",
|
|
22
|
+
"bluelamp-vscode16": "./bin/bluelamp-vscode16",
|
|
23
|
+
"bluelamp-vscode17": "./bin/bluelamp-vscode17",
|
|
24
|
+
"bluelamp-vscode18": "./bin/bluelamp-vscode18"
|
|
26
25
|
},
|
|
27
26
|
"scripts": {
|
|
28
|
-
"postinstall": "node scripts/generate-commands.js
|
|
29
|
-
"test": "
|
|
27
|
+
"postinstall": "node scripts/generate-commands.js",
|
|
28
|
+
"test": "jest",
|
|
29
|
+
"test:coverage": "jest --coverage",
|
|
30
|
+
"test:mcp": "node test-mcp.js",
|
|
31
|
+
"build:release": "node scripts/build-release.js"
|
|
30
32
|
},
|
|
31
33
|
"keywords": [
|
|
34
|
+
"vscode",
|
|
32
35
|
"bluelamp",
|
|
33
36
|
"mcp",
|
|
34
37
|
"claude",
|
|
35
38
|
"knowledge-injection",
|
|
36
|
-
"
|
|
39
|
+
"development-prompts"
|
|
37
40
|
],
|
|
38
41
|
"author": "BlueLamp Team",
|
|
39
42
|
"license": "MIT",
|
|
@@ -41,8 +44,7 @@
|
|
|
41
44
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
42
45
|
"dotenv": "^16.6.1",
|
|
43
46
|
"jsonwebtoken": "^9.0.2",
|
|
44
|
-
"node-fetch": "^3.3.2"
|
|
45
|
-
"node-pty": "^1.1.0"
|
|
47
|
+
"node-fetch": "^3.3.2"
|
|
46
48
|
},
|
|
47
49
|
"engines": {
|
|
48
50
|
"node": ">=18"
|
|
@@ -56,6 +58,11 @@
|
|
|
56
58
|
"preferGlobal": true,
|
|
57
59
|
"repository": {
|
|
58
60
|
"type": "git",
|
|
59
|
-
"url": "https://github.com/bluelamp/bluelamp.git"
|
|
61
|
+
"url": "https://github.com/bluelamp/bluelamp-vscode.git"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"javascript-obfuscator": "^4.1.1",
|
|
65
|
+
"jest": "^30.2.0",
|
|
66
|
+
"terser": "^5.44.0"
|
|
60
67
|
}
|
|
61
68
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* BlueLamp コマンド生成スクリプト
|
|
5
|
-
*
|
|
4
|
+
* BlueLamp VSCode コマンド生成スクリプト
|
|
5
|
+
* 16個のコマンドファイルを自動生成
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const fs = require('fs');
|
|
9
9
|
const path = require('path');
|
|
10
10
|
|
|
11
11
|
const binDir = path.join(__dirname, '..', 'bin');
|
|
12
|
-
const baseScript = path.join(binDir, 'bluelamp-base');
|
|
13
|
-
const hookScript = path.join(binDir, 'bluelamp-hook');
|
|
12
|
+
const baseScript = path.join(binDir, 'bluelamp-vscode-base');
|
|
14
13
|
|
|
15
|
-
//
|
|
16
|
-
for (let i = 1; i <=
|
|
17
|
-
const commandName = `bluelamp${i}`;
|
|
14
|
+
// 16個のコマンドを生成
|
|
15
|
+
for (let i = 1; i <= 16; i++) {
|
|
16
|
+
const commandName = `bluelamp-vscode${i}`;
|
|
18
17
|
const commandPath = path.join(binDir, commandName);
|
|
19
18
|
|
|
19
|
+
// シンボリックリンクまたはラッパースクリプトを作成
|
|
20
20
|
const content = `#!/usr/bin/env node
|
|
21
|
-
require('./bluelamp-base');
|
|
21
|
+
require('./bluelamp-vscode-base');
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
24
|
fs.writeFileSync(commandPath, content);
|
|
@@ -27,14 +27,9 @@ require('./bluelamp-base');
|
|
|
27
27
|
console.log(`✅ Created: ${commandName}`);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
//
|
|
30
|
+
// ベーススクリプトにも実行権限を付与
|
|
31
31
|
if (fs.existsSync(baseScript)) {
|
|
32
32
|
fs.chmodSync(baseScript, '755');
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
if (fs.existsSync(hookScript)) {
|
|
37
|
-
fs.chmodSync(hookScript, '755');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
console.log('\n✨ 18個のコマンドファイルを生成しました');
|
|
35
|
+
console.log('\n✨ 16個のコマンドファイルを生成しました');
|
package/bin/bluelamp-base
DELETED
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* BlueLamp MCP Integration
|
|
5
|
-
* Fast startup with auto-trigger using node-pty
|
|
6
|
-
* Fallback to spawn if pty fails
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const { spawn } = require('child_process');
|
|
10
|
-
const path = require('path');
|
|
11
|
-
const fs = require('fs');
|
|
12
|
-
const os = require('os');
|
|
13
|
-
|
|
14
|
-
// パッケージのルートディレクトリを取得
|
|
15
|
-
const packageRoot = path.dirname(__dirname);
|
|
16
|
-
|
|
17
|
-
// .envファイルを読み込み(.env.localを優先)
|
|
18
|
-
const dotenvLocalPath = path.join(packageRoot, '.env.local');
|
|
19
|
-
const dotenvPath = path.join(packageRoot, '.env');
|
|
20
|
-
|
|
21
|
-
if (fs.existsSync(dotenvLocalPath)) {
|
|
22
|
-
require('dotenv').config({ path: dotenvLocalPath });
|
|
23
|
-
} else if (fs.existsSync(dotenvPath)) {
|
|
24
|
-
require('dotenv').config({ path: dotenvPath });
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// コマンドマッピング(18個のプロンプト - BlueLamp 18エージェント体制)
|
|
28
|
-
const PROMPT_MAPPING = {
|
|
29
|
-
'bluelamp1': '@要件定義',
|
|
30
|
-
'bluelamp2': '@Git管理',
|
|
31
|
-
'bluelamp3': '@フロントエンド基盤',
|
|
32
|
-
'bluelamp4': '@ページ実装オーケストレーター',
|
|
33
|
-
'bluelamp5': '@環境構築オーケストレーター',
|
|
34
|
-
'bluelamp6': '@バックエンド計画オーケストレーター',
|
|
35
|
-
'bluelamp7': '@バックエンド実装オーケストレーター',
|
|
36
|
-
'bluelamp8': '@フロントエンド実装オーケストレーター',
|
|
37
|
-
'bluelamp9': '@E2Eテストオーケストレーター',
|
|
38
|
-
'bluelamp10': '@本番運用診断オーケストレーター',
|
|
39
|
-
'bluelamp11': '@デプロイオーケストレーター',
|
|
40
|
-
'bluelamp12': '@拡張要件定義',
|
|
41
|
-
'bluelamp13': '@拡張機能実装',
|
|
42
|
-
'bluelamp14': '@デバッグ技術',
|
|
43
|
-
'bluelamp15': '@リファクタリング',
|
|
44
|
-
'bluelamp16': '@ドキュメント生成',
|
|
45
|
-
'bluelamp17': '@相談',
|
|
46
|
-
'bluelamp18': '@MCP追加'
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* コマンド名から対応するキーワードを取得
|
|
51
|
-
*/
|
|
52
|
-
function getKeywordFromCommand() {
|
|
53
|
-
const commandPath = process.argv[1];
|
|
54
|
-
const commandName = path.basename(commandPath);
|
|
55
|
-
|
|
56
|
-
if (!PROMPT_MAPPING[commandName]) {
|
|
57
|
-
console.error(`❌ 未定義のコマンド: ${commandName}`);
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return PROMPT_MAPPING[commandName];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* MCPサーバー設定を作成
|
|
66
|
-
*/
|
|
67
|
-
function createMCPConfig(keyword, cliToken) {
|
|
68
|
-
const mcpServerPath = path.join(packageRoot, 'lib/mcp-server/index.cjs');
|
|
69
|
-
const tempConfigPath = path.join(os.tmpdir(), `bluelamp-${Date.now()}.json`);
|
|
70
|
-
|
|
71
|
-
const portalUrl = process.env.PORTAL_URL || "https://bluelamp-6clpzmy5pa-an.a.run.app";
|
|
72
|
-
|
|
73
|
-
const config = {
|
|
74
|
-
mcpServers: {
|
|
75
|
-
"bluelamp": {
|
|
76
|
-
command: "node",
|
|
77
|
-
args: [mcpServerPath],
|
|
78
|
-
env: {
|
|
79
|
-
BLUELAMP_KEYWORD: keyword,
|
|
80
|
-
BLUELAMP_TOKEN: cliToken,
|
|
81
|
-
PORTAL_URL: portalUrl
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
fs.writeFileSync(tempConfigPath, JSON.stringify(config, null, 2));
|
|
88
|
-
return tempConfigPath;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Portal認証の実行
|
|
93
|
-
*/
|
|
94
|
-
async function performPortalAuth() {
|
|
95
|
-
try {
|
|
96
|
-
const { InteractiveLogin } = require('../lib/auth/InteractiveLogin');
|
|
97
|
-
const authResult = await InteractiveLogin.performLogin();
|
|
98
|
-
InteractiveLogin.displayLoginSuccess(authResult);
|
|
99
|
-
return authResult.token;
|
|
100
|
-
} catch (error) {
|
|
101
|
-
console.error('❌ Portal認証エラー:', error.message);
|
|
102
|
-
console.error('');
|
|
103
|
-
console.error('解決方法:');
|
|
104
|
-
console.error('1. インターネット接続を確認してください');
|
|
105
|
-
console.error('2. Portal認証情報が正しいか確認してください');
|
|
106
|
-
process.exit(1);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* node-ptyを使用してClaudeを起動(自動トリガー付き)
|
|
112
|
-
*/
|
|
113
|
-
function startWithPty(claudeCommand, claudeArgs, configPath, keyword) {
|
|
114
|
-
const pty = require('node-pty');
|
|
115
|
-
|
|
116
|
-
// 疑似端末を作成
|
|
117
|
-
const ptyProcess = pty.spawn(claudeCommand, claudeArgs, {
|
|
118
|
-
name: 'xterm-256color',
|
|
119
|
-
cols: process.stdout.columns || 80,
|
|
120
|
-
rows: process.stdout.rows || 24,
|
|
121
|
-
cwd: process.cwd(),
|
|
122
|
-
env: {
|
|
123
|
-
...process.env,
|
|
124
|
-
BLUELAMP_KEYWORD: keyword
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
// Claudeが起動完了したら自動で「開始」を送信
|
|
129
|
-
let triggered = false;
|
|
130
|
-
let buffer = '';
|
|
131
|
-
|
|
132
|
-
// 出力をそのまま標準出力に転送 + 起動完了検知
|
|
133
|
-
ptyProcess.onData((data) => {
|
|
134
|
-
process.stdout.write(data);
|
|
135
|
-
buffer += data;
|
|
136
|
-
|
|
137
|
-
// Claudeの起動完了を検知(プロンプトが表示されたら)
|
|
138
|
-
if (!triggered && (buffer.includes('> ') || buffer.includes('╰─'))) {
|
|
139
|
-
triggered = true;
|
|
140
|
-
// 少し待ってから「開始」を送信
|
|
141
|
-
setTimeout(() => {
|
|
142
|
-
ptyProcess.write('開始\r');
|
|
143
|
-
}, 500);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
// 標準入力をptyに転送
|
|
148
|
-
if (process.stdin.isTTY) {
|
|
149
|
-
process.stdin.setRawMode(true);
|
|
150
|
-
}
|
|
151
|
-
process.stdin.resume();
|
|
152
|
-
process.stdin.on('data', (data) => {
|
|
153
|
-
ptyProcess.write(data.toString());
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// ターミナルサイズの変更を検知
|
|
157
|
-
process.stdout.on('resize', () => {
|
|
158
|
-
ptyProcess.resize(process.stdout.columns, process.stdout.rows);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// プロセス終了時の処理
|
|
162
|
-
ptyProcess.onExit(({ exitCode }) => {
|
|
163
|
-
console.log('');
|
|
164
|
-
console.log('🔵 BlueLamp セッション終了');
|
|
165
|
-
try { fs.unlinkSync(configPath); } catch (e) {}
|
|
166
|
-
process.exit(exitCode || 0);
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
// Ctrl+C などのシグナル処理
|
|
170
|
-
process.on('SIGINT', () => {
|
|
171
|
-
ptyProcess.write('\x03');
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* 通常のspawnでClaudeを起動(フォールバック)
|
|
177
|
-
*/
|
|
178
|
-
function startWithSpawn(claudeCommand, claudeArgs, configPath, keyword) {
|
|
179
|
-
const child = spawn(claudeCommand, claudeArgs, {
|
|
180
|
-
stdio: 'inherit',
|
|
181
|
-
env: {
|
|
182
|
-
...process.env,
|
|
183
|
-
BLUELAMP_KEYWORD: keyword
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
child.on('error', (error) => {
|
|
188
|
-
console.error('❌ Claude 起動エラー:', error.message);
|
|
189
|
-
try { fs.unlinkSync(configPath); } catch (e) {}
|
|
190
|
-
process.exit(1);
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
child.on('exit', (code) => {
|
|
194
|
-
console.log('');
|
|
195
|
-
console.log('🔵 BlueLamp セッション終了');
|
|
196
|
-
try { fs.unlinkSync(configPath); } catch (e) {}
|
|
197
|
-
process.exit(code || 0);
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
process.on('SIGINT', () => {
|
|
201
|
-
console.log('\n🔵 BlueLamp を終了しています...');
|
|
202
|
-
child.kill('SIGINT');
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* メイン処理
|
|
208
|
-
*/
|
|
209
|
-
async function main() {
|
|
210
|
-
const keyword = getKeywordFromCommand();
|
|
211
|
-
const isDebugMode = process.argv.includes('--debug');
|
|
212
|
-
const useSpawn = process.argv.includes('--no-auto');
|
|
213
|
-
|
|
214
|
-
console.log('🔵 BlueLamp MCP Integration (Auto Mode)');
|
|
215
|
-
console.log(`📚 プロンプト: ${keyword}`);
|
|
216
|
-
console.log('');
|
|
217
|
-
|
|
218
|
-
// Portal認証の実行
|
|
219
|
-
const cliToken = await performPortalAuth();
|
|
220
|
-
|
|
221
|
-
// MCP設定ファイルを作成
|
|
222
|
-
const configPath = createMCPConfig(keyword, cliToken);
|
|
223
|
-
|
|
224
|
-
console.log('🚀 Claude 起動中...');
|
|
225
|
-
console.log('');
|
|
226
|
-
|
|
227
|
-
// システムプロンプトに追加する指示
|
|
228
|
-
const systemPromptAddition = `【重要】セッション開始時に必ず inject_knowledge ツールを実行してください。
|
|
229
|
-
keyword: "${keyword}" を指定して、専門知識を注入してから作業を開始してください。
|
|
230
|
-
ユーザーが何か質問や指示をした場合でも、まず inject_knowledge を実行してから回答してください。`;
|
|
231
|
-
|
|
232
|
-
// Windows対応
|
|
233
|
-
const isWindows = process.platform === 'win32';
|
|
234
|
-
let claudeCommand, claudeArgs;
|
|
235
|
-
|
|
236
|
-
if (isWindows) {
|
|
237
|
-
claudeCommand = 'powershell.exe';
|
|
238
|
-
claudeArgs = [
|
|
239
|
-
'-NoProfile',
|
|
240
|
-
'-Command',
|
|
241
|
-
'claude',
|
|
242
|
-
'--dangerously-skip-permissions',
|
|
243
|
-
'--mcp-config', configPath,
|
|
244
|
-
'--append-system-prompt', systemPromptAddition
|
|
245
|
-
];
|
|
246
|
-
} else {
|
|
247
|
-
claudeCommand = 'claude';
|
|
248
|
-
claudeArgs = [
|
|
249
|
-
'--dangerously-skip-permissions',
|
|
250
|
-
'--mcp-config', configPath,
|
|
251
|
-
'--append-system-prompt', systemPromptAddition
|
|
252
|
-
];
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (isDebugMode) {
|
|
256
|
-
console.log('🐛 デバッグ情報:');
|
|
257
|
-
console.log(` コマンド: ${claudeCommand}`);
|
|
258
|
-
console.log(` 引数: ${JSON.stringify(claudeArgs)}`);
|
|
259
|
-
console.log(` MCP設定: ${configPath}`);
|
|
260
|
-
console.log('');
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// node-ptyを試行、失敗したらspawnにフォールバック
|
|
264
|
-
if (useSpawn) {
|
|
265
|
-
// --no-autoオプションが指定された場合は通常のspawnを使用
|
|
266
|
-
startWithSpawn(claudeCommand, claudeArgs, configPath, keyword);
|
|
267
|
-
} else {
|
|
268
|
-
try {
|
|
269
|
-
startWithPty(claudeCommand, claudeArgs, configPath, keyword);
|
|
270
|
-
} catch (e) {
|
|
271
|
-
console.log('⚠️ 自動モード利用不可、通常モードで起動します...');
|
|
272
|
-
startWithSpawn(claudeCommand, claudeArgs, configPath, keyword);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
main().catch((error) => {
|
|
278
|
-
console.error('❌ 予期しないエラー:', error.message);
|
|
279
|
-
process.exit(1);
|
|
280
|
-
});
|
package/bin/bluelamp-hook
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* BlueLamp SessionStart Hook
|
|
5
|
-
* Claude Code の SessionStart Hook として実行され、
|
|
6
|
-
* 一時ファイルからキーワードを読み取ってプロンプトを出力する
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const fs = require('fs');
|
|
10
|
-
const path = require('path');
|
|
11
|
-
const os = require('os');
|
|
12
|
-
|
|
13
|
-
// 一時ファイルからキーワードを読み取り
|
|
14
|
-
const keywordFilePath = path.join(os.tmpdir(), 'bluelamp-keyword');
|
|
15
|
-
|
|
16
|
-
let keyword = null;
|
|
17
|
-
|
|
18
|
-
// 環境変数を優先、なければ一時ファイルから読み取り
|
|
19
|
-
if (process.env.BLUELAMP_KEYWORD) {
|
|
20
|
-
keyword = process.env.BLUELAMP_KEYWORD;
|
|
21
|
-
} else if (fs.existsSync(keywordFilePath)) {
|
|
22
|
-
keyword = fs.readFileSync(keywordFilePath, 'utf-8').trim();
|
|
23
|
-
// 読み取り後に削除(一度だけ使用)
|
|
24
|
-
try { fs.unlinkSync(keywordFilePath); } catch (e) {}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// キーワードがあればプロンプトを出力
|
|
28
|
-
if (keyword) {
|
|
29
|
-
const prompt = `> 拡張モードで起動
|
|
30
|
-
|
|
31
|
-
🔵 BlueLamp 統合認証システム が有効化されました
|
|
32
|
-
|
|
33
|
-
╭─────────────────────────────────────────────────────────────────╮
|
|
34
|
-
│ │
|
|
35
|
-
│ B l u e L a m p │
|
|
36
|
-
│ ───────────────── │
|
|
37
|
-
│ さあ始めましょう │
|
|
38
|
-
│ │
|
|
39
|
-
╰─────────────────────────────────────────────────────────────────╯
|
|
40
|
-
|
|
41
|
-
**最初に必ず専門知識を注入してください**
|
|
42
|
-
inject_knowledge ツールで keyword: "${keyword}" を実行してから開始してください。(初回必須)
|
|
43
|
-
|
|
44
|
-
重要:キーワードは "${keyword}" をそのまま使用してください。変換や推測は不要です。
|
|
45
|
-
|
|
46
|
-
準備完了です。まず知識注入を実行してから、タスクを開始してください。`;
|
|
47
|
-
|
|
48
|
-
console.log(prompt);
|
|
49
|
-
}
|
package/bin/bluelamp1
DELETED
package/bin/bluelamp10
DELETED
package/bin/bluelamp11
DELETED
package/bin/bluelamp12
DELETED
package/bin/bluelamp13
DELETED
package/bin/bluelamp14
DELETED
package/bin/bluelamp15
DELETED
package/bin/bluelamp16
DELETED
package/bin/bluelamp17
DELETED
package/bin/bluelamp18
DELETED
package/bin/bluelamp2
DELETED
package/bin/bluelamp3
DELETED
package/bin/bluelamp4
DELETED
package/bin/bluelamp5
DELETED
package/bin/bluelamp6
DELETED
package/bin/bluelamp7
DELETED
package/bin/bluelamp8
DELETED
package/bin/bluelamp9
DELETED