bluelamp 4.0.8 → 4.0.11

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.
Files changed (46) hide show
  1. package/README.md +53 -56
  2. package/bin/bluelamp-vscode-base +1 -257
  3. package/bin/bluelamp-vscode1 +2 -0
  4. package/bin/bluelamp-vscode10 +2 -0
  5. package/bin/bluelamp-vscode11 +2 -0
  6. package/bin/bluelamp-vscode12 +2 -0
  7. package/bin/bluelamp-vscode13 +2 -0
  8. package/bin/bluelamp-vscode14 +2 -0
  9. package/bin/bluelamp-vscode15 +2 -0
  10. package/bin/bluelamp-vscode16 +2 -0
  11. package/bin/bluelamp-vscode2 +2 -0
  12. package/bin/bluelamp-vscode3 +2 -0
  13. package/bin/bluelamp-vscode4 +2 -0
  14. package/bin/bluelamp-vscode5 +2 -0
  15. package/bin/bluelamp-vscode6 +2 -0
  16. package/bin/bluelamp-vscode7 +2 -0
  17. package/bin/bluelamp-vscode8 +2 -0
  18. package/bin/bluelamp-vscode9 +2 -0
  19. package/bin/bluelamp1 +0 -0
  20. package/bin/bluelamp10 +0 -0
  21. package/bin/bluelamp11 +0 -0
  22. package/bin/bluelamp12 +0 -0
  23. package/bin/bluelamp13 +0 -0
  24. package/bin/bluelamp14 +0 -0
  25. package/bin/bluelamp15 +0 -0
  26. package/bin/bluelamp16 +0 -0
  27. package/bin/bluelamp17 +0 -0
  28. package/bin/bluelamp18 +0 -0
  29. package/bin/bluelamp2 +0 -0
  30. package/bin/bluelamp3 +0 -0
  31. package/bin/bluelamp4 +0 -0
  32. package/bin/bluelamp5 +0 -0
  33. package/bin/bluelamp6 +0 -0
  34. package/bin/bluelamp7 +0 -0
  35. package/bin/bluelamp8 +0 -0
  36. package/bin/bluelamp9 +0 -0
  37. package/lib/auth/InteractiveLogin.js +1 -243
  38. package/lib/auth/PortalAuthClient.js +1 -187
  39. package/lib/auth/TokenManager.js +1 -258
  40. package/lib/mcp-server/index.cjs +1 -195
  41. package/lib/mcp-server/portal-api-client.cjs +1 -237
  42. package/lib/utils/logger.js +1 -83
  43. package/package.json +5 -17
  44. package/bin/docs/SCOPE_PROGRESS.md +0 -222
  45. package/scripts/build-release.js +0 -426
  46. package/scripts/generate-commands.js +0 -35
@@ -1,222 +0,0 @@
1
- # bin 開発進捗状況
2
-
3
- ## 1. 基本情報
4
-
5
- - **ステータス**: 開始段階
6
- - **完了タスク数**: 0/10
7
- - **進捗率**: 0%
8
- - **次のマイルストーン**: 要件定義完了
9
- - **最終更新日**: YYYY-MM-DD
10
-
11
- ## 2. 実装計画
12
-
13
- BlueLampでの開発は以下のフローに沿って進行します:
14
-
15
- ### 開発フェーズ
16
- | フェーズ | 状態 | 担当エージェント | 解説 |
17
- |---------|------|----------------|------|
18
- | **Phase 1: 要件定義** | [ ] | 要件定義エンジニア | あなたのアイデアを実現可能な要件に落とし込みます |
19
- | **Phase 2: Git/GitHub管理** | [ ] | Git管理エージェント | プロジェクトリポジトリを準備し開発環境を整えます |
20
- | **Phase 3: フロントエンド基盤** | [ ] | フロントエンド基盤オーケストレーター | React+TypeScript+Viteの最新基盤が即座に立ち上がります |
21
- | **Phase 4: ページ実装** | [ ] | ページ実装オーケストレーター | 画面が一つずつ形になっていきます |
22
- | **Phase 5: 環境構築** | [ ] | 環境構築オーケストレーター | 本番環境で動作するための秘密鍵を取得し設定します |
23
- | **Phase 6: バックエンド計画** | [ ] | バックエンド計画オーケストレーター | 実装の順番を計画し効果的にプロジェクトを組み上げます |
24
- | **Phase 7: バックエンド実装** | [ ] | バックエンド実装オーケストレーター | いよいよバックエンドの実装に入ります |
25
- | **Phase 8: API統合** | [ ] | フロントエンド実装オーケストレーター | プロトタイプが動くシステムへと変わります |
26
- | **Phase 9: E2Eテスト** | [ ] | E2Eテストオーケストレーター | ユーザー操作をシミュレートして品質を担保します |
27
- | **Phase 10: 本番運用診断** | [ ] | 本番運用診断オーケストレーター | CVSS 3.1準拠の包括的診断で納品レベルを保証します |
28
- | **Phase 11: デプロイメント** | [ ] | デプロイオーケストレーター | いよいよデプロイ!インターネットに公開します |
29
-
30
- ### サポートツール(必要に応じて使用)
31
- | ツール | 担当エージェント | 解説 |
32
- |---------|----------------|------|
33
- | **機能拡張** | 機能拡張オーケストレーター | リリース後も新機能を追加できます |
34
- | **デバッグ** | デバッグマスター | エラーが発生したら完全自動で解決します |
35
- | **TypeScript型解消** | TypeScript型解消オーケストレーター | 型エラーを徹底的に分析し一掃します |
36
- | **リファクタリング** | リファクタリングオーケストレーター | コード品質を大規模に改善します |
37
- | **ドキュメント生成** | ドキュメント生成オーケストレーター | 日本標準の納品ドキュメントを自動生成します |
38
- | **相談** | 相談エージェント | プロジェクトに関する汎用的な相談やサポートを提供します |
39
-
40
-
41
- ## 4. 付録
42
-
43
- ### 開発フロー
44
- ```
45
- Phase 1: 要件定義 → Phase 2: Git管理 → Phase 3: フロントエンド基盤 → Phase 4: ページ実装
46
- → Phase 5: 環境構築 → Phase 6: バックエンド計画 → Phase 7: バックエンド実装
47
- → Phase 8: API統合 → Phase 9: E2Eテスト → Phase 10: 本番運用診断 → Phase 11: デプロイメント
48
-
49
- ※ サポートツールは必要に応じて適宜使用
50
- ```
51
-
52
- ### 開始手順
53
-
54
- 開発プロンプトをクリックして「Phase 1: 要件定義」を選択し、要件定義エンジニアを活用するところから始めてください。各フェーズが完了したら、次のPhaseへ進みます。
55
-
56
- サポートツールは開発中の任意のタイミングで、問題解決や品質向上のために使用できます。
57
-
58
- ---
59
-
60
- ## 🔒 本番運用診断に基づく改善計画
61
-
62
- **診断日**: 2025-11-22
63
- **総合スコア**: 52/100点 (D評価)
64
- **本番運用可否**: ⚠️ 軽微な改善後に運用可能
65
-
66
- ### 📊 診断結果サマリー
67
- | カテゴリ | スコア | 評価 | ステータス |
68
- |---------|--------|------|-----------|
69
- | セキュリティ | 26/30 | A | ✅ 優秀 |
70
- | パフォーマンス | 16/20 | B | ✅ 良好 |
71
- | 信頼性 | 11/20 | D | 🟡 要改善 |
72
- | 運用性 | 10/20 | D | 🟡 要改善 |
73
- | コード品質 | 3/10 | F | 🔴 Critical |
74
-
75
- ### ✅ 優れている点
76
- - **Portal統合認証**: AES-256-CBC暗号化、scryptベース
77
- - **CVSS脆弱性**: 0件(validator@13.15.20に自動更新済み)
78
- - **MCPサーバー起動時間**: 80-120ms(非常に効率的)
79
- - **メモリ使用量**: ~30MB(ピーク時)
80
- - **ライセンス**: 全28パッケージが商用利用可能
81
-
82
- ### Phase 1: 緊急対応(1-3日)🟡
83
-
84
- **予想スコア**: 58/100点(D評価)
85
-
86
- - [ ] **HTTPS検証の環境別切り替え**
87
- - 場所: `lib/mcp-server/portal-api-client.cjs:14`
88
- ```javascript
89
- // ❌ 現在
90
- const httpsAgent = new https.Agent({
91
- rejectUnauthorized: false
92
- });
93
-
94
- // ✅ 修正後
95
- const httpsAgent = new https.Agent({
96
- rejectUnauthorized: process.env.NODE_ENV !== 'development'
97
- });
98
- ```
99
-
100
- - [ ] **エラーハンドリングの改善**(5箇所)
101
- - `index.cjs` L95-141(CallToolRequestSchema)
102
- - `portal-api-client.cjs` L202-207(catch節)
103
- - エラー詳細の伝播
104
- - isErrorフラグの追加
105
-
106
- - [ ] **console.log → logger置換**(65箇所)
107
- - `bin/bluelamp-vscode-base`: 25箇所
108
- - `lib/auth/InteractiveLogin.js`: 26箇所
109
- - `lib/auth/PortalAuthClient.js`: 4箇所
110
- ```javascript
111
- const LOG_LEVEL = process.env.BLUELAMP_LOG_LEVEL || 'info';
112
- const logger = {
113
- debug: (msg) => LOG_LEVEL === 'debug' && console.log(`[DEBUG] ${msg}`),
114
- info: (msg) => ['debug', 'info'].includes(LOG_LEVEL) && console.log(`[INFO] ${msg}`),
115
- warn: (msg) => console.warn(`[WARN] ${msg}`),
116
- error: (msg) => console.error(`[ERROR] ${msg}`)
117
- };
118
- ```
119
-
120
- ### Phase 2: 重要対応(1-2週間)🟡
121
-
122
- **予想スコア**: 72/100点(C評価)
123
-
124
- - [ ] **テストカバレッジ50%達成**
125
- ```bash
126
- npm install --save-dev jest
127
- npm test
128
- ```
129
- - MCPサーバー機能のユニットテスト
130
- - Portal API統合テスト
131
-
132
- - [ ] **JSDoc型アノテーション追加**
133
- ```javascript
134
- /**
135
- * Portal APIからプロンプトを取得
136
- * @param {string} keyword - 検索キーワード
137
- * @param {string} token - CLI認証トークン
138
- * @returns {Promise<{success: boolean, knowledge?: string, error?: string}>}
139
- */
140
- async function getPromptFromPortal(keyword, token) {
141
- // ...
142
- }
143
- ```
144
-
145
- - [ ] **同時アクセス制御実装**
146
- - クライアントごとのキャッシュ管理
147
- ```javascript
148
- class PortalAPIClient {
149
- constructor() {
150
- this.cache = new Map();
151
- }
152
- }
153
- ```
154
-
155
- - [ ] **ログファイル保存場所変更**
156
- ```javascript
157
- // ❌ 現在
158
- const LOG_FILE = '/tmp/bluelamp-vscode-mcp-latest.log';
159
-
160
- // ✅ 修正後
161
- const path = require('path');
162
- const os = require('os');
163
- const LOG_FILE = path.join(os.homedir(), '.bluelamp-vscode', 'logs', 'mcp.log');
164
- ```
165
-
166
- ### Phase 3: 改善対応(1ヶ月)🟢
167
-
168
- **予想スコア**: 90/100点(A評価 - npm公開可)
169
-
170
- - [ ] **テストカバレッジ70%達成**
171
- - エッジケースのテスト
172
- - エラーハンドリングのテスト
173
-
174
- - [ ] **TypeScriptへの移行検討**
175
- - 段階的な型安全性の導入
176
- - ビルドプロセスの最適化
177
-
178
- - [ ] **ヘルスチェック機能実装**
179
- - MCPサーバー稼働状態確認
180
- - トークン有効性チェック
181
- - エラー発生時のトラッキング
182
-
183
- - [ ] **メトリクス収集機能追加**
184
- - API呼び出し回数
185
- - レスポンス時間
186
- - エラー率
187
-
188
- ### 📅 タイムライン
189
-
190
- ```
191
- Day 1-3: Phase 1(緊急対応)
192
- - HTTPS検証の環境別切り替え
193
- - エラーハンドリングの改善
194
- - console.log → logger置換
195
-
196
- Week 2-3: Phase 2(重要対応)
197
- - テストカバレッジ50%達成
198
- - JSDoc型アノテーション追加
199
- - 同時アクセス制御実装
200
- - ログファイル保存場所変更
201
-
202
- Month 2: Phase 3(改善対応)
203
- - テストカバレッジ70%達成
204
- - TypeScriptへの移行検討
205
- - ヘルスチェック機能実装
206
- - メトリクス収集機能追加
207
- ```
208
-
209
- ### 💰 予想工数
210
-
211
- | Phase | 期間 | 工数(人日) | 優先度 |
212
- |-------|------|------------|--------|
213
- | Phase 1 | 1-3日 | 1-2日 | 🟡 High |
214
- | Phase 2 | 1-2週間 | 5-10日 | 🟡 High |
215
- | Phase 3 | 1ヶ月 | 10-15日 | 🟢 Medium |
216
-
217
- ### 📞 参照ドキュメント
218
- - 詳細診断レポート: `/bluelamp-vscode/本番運用診断レポート_bluelamp-vscode.md`
219
- - 統合レポート: `/本番運用診断_統合レポート.md`
220
-
221
- ---
222
- *最終更新: 2025-11-22*
@@ -1,426 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * BlueLamp VSCode Extension - Release Build Script with Advanced Obfuscation
4
- *
5
- * 高度難読化を適用したリリースビルドを生成
6
- *
7
- * 主要機能:
8
- * - JavaScript Obfuscatorによる高度難読化
9
- * - クリーンな出力ディレクトリ構造の維持
10
- * - 配布用package.jsonの最適化
11
- * - エラーハンドリングと進行状況表示
12
- */
13
-
14
- const fs = require('fs').promises;
15
- const path = require('path');
16
-
17
- // 設定定数
18
- const PROJECT_ROOT = path.dirname(__dirname);
19
- const VERSION = '2.2.5';
20
- const RELEASE_DIR = path.join(PROJECT_ROOT, 'release');
21
- const OUTPUT_DIR = path.join(RELEASE_DIR, `bluelamp-vscode-v${VERSION}`);
22
-
23
- // 高度難読化設定(全ファイル用 - ログ出力保護)
24
- const HIGH_OBFUSCATION_OPTIONS = {
25
- compact: true,
26
- controlFlowFlattening: true,
27
- controlFlowFlatteningThreshold: 0.75,
28
- deadCodeInjection: true,
29
- deadCodeInjectionThreshold: 0.4,
30
- debugProtection: true,
31
- debugProtectionInterval: 4000,
32
- disableConsoleOutput: false, // ログ出力を保護
33
- identifierNamesGenerator: 'hexadecimal',
34
- log: false,
35
- numbersToExpressions: true,
36
- renameGlobals: true,
37
- selfDefending: true,
38
- simplify: true,
39
- splitStrings: true,
40
- splitStringsChunkLength: 5,
41
- stringArray: true,
42
- stringArrayCallsTransform: true,
43
- stringArrayCallsTransformThreshold: 0.8,
44
- stringArrayEncoding: ['base64'],
45
- stringArrayIndexShift: true,
46
- stringArrayRotate: true,
47
- stringArrayShuffle: true,
48
- stringArrayWrappersCount: 2,
49
- stringArrayWrappersChainedCalls: true,
50
- stringArrayWrappersParametersMaxCount: 4,
51
- stringArrayWrappersType: 'function',
52
- stringArrayThreshold: 0.8,
53
- transformObjectKeys: true,
54
- unicodeEscapeSequence: false
55
- };
56
-
57
- // 軽度難読化設定(現在未使用 - 全て高度難読化に変更済み)
58
- const LIGHT_OBFUSCATION_OPTIONS = {
59
- compact: true,
60
- controlFlowFlattening: false,
61
- deadCodeInjection: false,
62
- debugProtection: false,
63
- disableConsoleOutput: false, // console.logを保護
64
- identifierNamesGenerator: 'mangled',
65
- log: false,
66
- renameGlobals: false,
67
- selfDefending: false,
68
- simplify: true,
69
- stringArray: false, // 文字列配列を無効化(日本語保護)
70
- stringArrayEncoding: [],
71
- stringArrayThreshold: 0, // 文字列変換を完全に無効化
72
- transformObjectKeys: false,
73
- unicodeEscapeSequence: false
74
- };
75
-
76
- // 対象ファイルパターン
77
- const TARGET_PATTERNS = {
78
- lib: {
79
- auth: ['*.js'],
80
- 'mcp-server': ['*.cjs', '*.js']
81
- },
82
- bin: ['bluelamp-vscode-base'],
83
- scripts: ['*.js']
84
- };
85
-
86
- /**
87
- * コンソール出力ユーティリティ
88
- */
89
- class Logger {
90
- static info(message) {
91
- console.log(`\x1b[36m[INFO]\x1b[0m ${message}`);
92
- }
93
-
94
- static success(message) {
95
- console.log(`\x1b[32m[SUCCESS]\x1b[0m ${message}`);
96
- }
97
-
98
- static warn(message) {
99
- console.log(`\x1b[33m[WARN]\x1b[0m ${message}`);
100
- }
101
-
102
- static error(message) {
103
- console.log(`\x1b[31m[ERROR]\x1b[0m ${message}`);
104
- }
105
-
106
- static step(step, total, message) {
107
- console.log(`\x1b[34m[${step}/${total}]\x1b[0m ${message}`);
108
- }
109
- }
110
-
111
- /**
112
- * ディレクトリの作成
113
- */
114
- async function ensureDirectory(dirPath) {
115
- try {
116
- await fs.access(dirPath);
117
- } catch {
118
- await fs.mkdir(dirPath, { recursive: true });
119
- }
120
- }
121
-
122
- /**
123
- * ディレクトリの完全削除
124
- */
125
- async function removeDirectory(dirPath) {
126
- try {
127
- await fs.access(dirPath);
128
- await fs.rm(dirPath, { recursive: true, force: true });
129
- } catch {
130
- // ディレクトリが存在しない場合は無視
131
- }
132
- }
133
-
134
- /**
135
- * JavaScript Obfuscatorのロード
136
- */
137
- function loadObfuscator() {
138
- try {
139
- return require('javascript-obfuscator');
140
- } catch (error) {
141
- Logger.error('javascript-obfuscator package not found. Installing...');
142
- console.log('Run: npm install javascript-obfuscator --save-dev');
143
- process.exit(1);
144
- }
145
- }
146
-
147
- /**
148
- * ファイルの難読化
149
- */
150
- async function obfuscateFile(inputPath, outputPath, obfuscationType = 'high') {
151
- const JavaScriptObfuscator = loadObfuscator();
152
- try {
153
- const sourceCode = await fs.readFile(inputPath, 'utf8');
154
-
155
- // shebang行を保持
156
- let shebang = '';
157
- let codeToObfuscate = sourceCode;
158
-
159
- if (sourceCode.startsWith('#!')) {
160
- const firstNewline = sourceCode.indexOf('\n');
161
- shebang = sourceCode.substring(0, firstNewline + 1);
162
- codeToObfuscate = sourceCode.substring(firstNewline + 1);
163
- }
164
-
165
- // 難読化オプションを選択
166
- const obfuscationOptions = obfuscationType === 'light'
167
- ? LIGHT_OBFUSCATION_OPTIONS
168
- : HIGH_OBFUSCATION_OPTIONS;
169
-
170
- // 難読化実行
171
- const obfuscatedCode = JavaScriptObfuscator.obfuscate(codeToObfuscate, obfuscationOptions);
172
-
173
- // shebang + 難読化コードを結合
174
- const finalCode = shebang + obfuscatedCode.getObfuscatedCode();
175
-
176
- // 出力ディレクトリを確保
177
- await ensureDirectory(path.dirname(outputPath));
178
-
179
- // ファイル書き込み
180
- await fs.writeFile(outputPath, finalCode, 'utf8');
181
-
182
- // 実行権限の復元(binファイルの場合)
183
- if (outputPath.includes('/bin/')) {
184
- await fs.chmod(outputPath, 0o755);
185
- }
186
-
187
- return true;
188
- } catch (error) {
189
- Logger.error(`Failed to obfuscate ${inputPath}: ${error.message}`);
190
- return false;
191
- }
192
- }
193
-
194
- /**
195
- * ファイルの単純コピー
196
- */
197
- async function copyFile(inputPath, outputPath) {
198
- try {
199
- await ensureDirectory(path.dirname(outputPath));
200
- await fs.copyFile(inputPath, outputPath);
201
- return true;
202
- } catch (error) {
203
- Logger.error(`Failed to copy ${inputPath}: ${error.message}`);
204
- return false;
205
- }
206
- }
207
-
208
- /**
209
- * 対象ファイルの収集
210
- */
211
- async function collectTargetFiles() {
212
- const files = [];
213
-
214
- // lib/auth/*.js
215
- const authDir = path.join(PROJECT_ROOT, 'lib', 'auth');
216
- try {
217
- const authFiles = await fs.readdir(authDir);
218
- for (const file of authFiles) {
219
- if (file.endsWith('.js')) {
220
- files.push({
221
- input: path.join(authDir, file),
222
- output: path.join(OUTPUT_DIR, 'lib', 'auth', file),
223
- type: 'obfuscate',
224
- obfuscationType: 'high' // 認証モジュールも高度難読化
225
- });
226
- }
227
- }
228
- } catch (error) {
229
- Logger.warn(`lib/auth directory not found: ${error.message}`);
230
- }
231
-
232
- // lib/mcp-server/*.{cjs,js}
233
- const mcpDir = path.join(PROJECT_ROOT, 'lib', 'mcp-server');
234
- try {
235
- const mcpFiles = await fs.readdir(mcpDir);
236
- for (const file of mcpFiles) {
237
- if (file.endsWith('.cjs') || file.endsWith('.js')) {
238
- files.push({
239
- input: path.join(mcpDir, file),
240
- output: path.join(OUTPUT_DIR, 'lib', 'mcp-server', file),
241
- type: 'obfuscate',
242
- obfuscationType: 'high'
243
- });
244
- }
245
- }
246
- } catch (error) {
247
- Logger.warn(`lib/mcp-server directory not found: ${error.message}`);
248
- }
249
-
250
- // bin/bluelamp-vscode-base
251
- const baseScript = path.join(PROJECT_ROOT, 'bin', 'bluelamp-vscode-base');
252
- try {
253
- await fs.access(baseScript);
254
- files.push({
255
- input: baseScript,
256
- output: path.join(OUTPUT_DIR, 'bin', 'bluelamp-vscode-base'),
257
- type: 'obfuscate', // 高度難読化を適用
258
- obfuscationType: 'high'
259
- });
260
- } catch (error) {
261
- Logger.warn(`bin/bluelamp-vscode-base not found: ${error.message}`);
262
- }
263
-
264
- // 他のbinファイル(高度難読化)
265
- const binDir = path.join(PROJECT_ROOT, 'bin');
266
- try {
267
- const binFiles = await fs.readdir(binDir);
268
- for (const file of binFiles) {
269
- if (file !== 'bluelamp-vscode-base' && file.startsWith('bluelamp-vscode')) {
270
- files.push({
271
- input: path.join(binDir, file),
272
- output: path.join(OUTPUT_DIR, 'bin', file),
273
- type: 'obfuscate',
274
- obfuscationType: 'high'
275
- });
276
- }
277
- }
278
- } catch (error) {
279
- Logger.warn(`bin directory not found: ${error.message}`);
280
- }
281
-
282
- return files;
283
- }
284
-
285
- /**
286
- * 配布用package.jsonの生成
287
- */
288
- async function generateReleasePackageJson() {
289
- try {
290
- const packageJsonPath = path.join(PROJECT_ROOT, 'package.json');
291
- const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
292
-
293
- // 配布用に最適化
294
- const releasePackageJson = {
295
- name: packageJson.name,
296
- version: VERSION,
297
- description: packageJson.description + ' (Obfuscated Release)',
298
- main: packageJson.main,
299
- bin: packageJson.bin,
300
- keywords: packageJson.keywords,
301
- author: packageJson.author,
302
- license: packageJson.license,
303
- dependencies: packageJson.dependencies,
304
- engines: packageJson.engines,
305
- files: packageJson.files,
306
- preferGlobal: packageJson.preferGlobal,
307
- repository: packageJson.repository
308
- };
309
-
310
- const outputPath = path.join(OUTPUT_DIR, 'package.json');
311
- await fs.writeFile(outputPath, JSON.stringify(releasePackageJson, null, 2), 'utf8');
312
-
313
- Logger.success('Generated release package.json');
314
- return true;
315
- } catch (error) {
316
- Logger.error(`Failed to generate package.json: ${error.message}`);
317
- return false;
318
- }
319
- }
320
-
321
- /**
322
- * READMEのコピー
323
- */
324
- async function copyReadme() {
325
- try {
326
- const readmePath = path.join(PROJECT_ROOT, 'README.md');
327
- const outputPath = path.join(OUTPUT_DIR, 'README.md');
328
- await copyFile(readmePath, outputPath);
329
- Logger.success('Copied README.md');
330
- return true;
331
- } catch (error) {
332
- Logger.error(`Failed to copy README.md: ${error.message}`);
333
- return false;
334
- }
335
- }
336
-
337
- /**
338
- * メイン処理
339
- */
340
- async function main() {
341
- const startTime = Date.now();
342
-
343
- Logger.info('🚀 Starting BlueLamp VSCode Release Build with Advanced Obfuscation');
344
- Logger.info(`📂 Output directory: ${OUTPUT_DIR}`);
345
-
346
- try {
347
- // Step 1: クリーンアップ
348
- Logger.step(1, 6, 'Cleaning release directory...');
349
- await removeDirectory(RELEASE_DIR);
350
- await ensureDirectory(OUTPUT_DIR);
351
-
352
- // Step 2: 対象ファイルの収集
353
- Logger.step(2, 6, 'Collecting target files...');
354
- const targetFiles = await collectTargetFiles();
355
- Logger.info(`📄 Found ${targetFiles.length} files to process`);
356
-
357
- // Step 3: ファイル処理
358
- Logger.step(3, 6, 'Processing files with obfuscation...');
359
- let processedCount = 0;
360
- let errorCount = 0;
361
-
362
- for (const file of targetFiles) {
363
- const fileName = path.basename(file.input);
364
-
365
- if (file.type === 'obfuscate') {
366
- const obfType = file.obfuscationType || 'high';
367
- Logger.info(`🔒 Obfuscating (${obfType}): ${fileName}`);
368
- const success = await obfuscateFile(file.input, file.output, obfType);
369
- if (success) {
370
- processedCount++;
371
- } else {
372
- errorCount++;
373
- }
374
- } else {
375
- Logger.info(`📋 Copying: ${fileName}`);
376
- const success = await copyFile(file.input, file.output);
377
- if (success) {
378
- processedCount++;
379
- } else {
380
- errorCount++;
381
- }
382
- }
383
- }
384
-
385
- // Step 4: package.json生成
386
- Logger.step(4, 6, 'Generating release package.json...');
387
- await generateReleasePackageJson();
388
-
389
- // Step 5: README.mdコピー
390
- Logger.step(5, 6, 'Copying documentation...');
391
- await copyReadme();
392
-
393
- // Step 6: 完了報告
394
- Logger.step(6, 6, 'Build completed!');
395
-
396
- const endTime = Date.now();
397
- const duration = ((endTime - startTime) / 1000).toFixed(2);
398
-
399
- Logger.success('✅ Release build completed successfully!');
400
- Logger.info(`📊 Processed: ${processedCount} files, Errors: ${errorCount}`);
401
- Logger.info(`⏱️ Build time: ${duration} seconds`);
402
- Logger.info(`📦 Release package: ${OUTPUT_DIR}`);
403
-
404
- if (errorCount > 0) {
405
- Logger.warn('⚠️ Some files could not be processed. Check the logs above.');
406
- process.exit(1);
407
- }
408
-
409
- } catch (error) {
410
- Logger.error(`❌ Build failed: ${error.message}`);
411
- Logger.error(error.stack);
412
- process.exit(1);
413
- }
414
- }
415
-
416
- // スクリプトを実行
417
- if (require.main === module) {
418
- main();
419
- }
420
-
421
- module.exports = {
422
- main,
423
- HIGH_OBFUSCATION_OPTIONS,
424
- LIGHT_OBFUSCATION_OPTIONS,
425
- obfuscateFile
426
- };
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * BlueLamp VSCode コマンド生成スクリプト
5
- * 16個のコマンドファイルを自動生成
6
- */
7
-
8
- const fs = require('fs');
9
- const path = require('path');
10
-
11
- const binDir = path.join(__dirname, '..', 'bin');
12
- const baseScript = path.join(binDir, 'bluelamp-vscode-base');
13
-
14
- // 16個のコマンドを生成
15
- for (let i = 1; i <= 16; i++) {
16
- const commandName = `bluelamp-vscode${i}`;
17
- const commandPath = path.join(binDir, commandName);
18
-
19
- // シンボリックリンクまたはラッパースクリプトを作成
20
- const content = `#!/usr/bin/env node
21
- require('./bluelamp-vscode-base');
22
- `;
23
-
24
- fs.writeFileSync(commandPath, content);
25
- fs.chmodSync(commandPath, '755');
26
-
27
- console.log(`✅ Created: ${commandName}`);
28
- }
29
-
30
- // ベーススクリプトにも実行権限を付与
31
- if (fs.existsSync(baseScript)) {
32
- fs.chmodSync(baseScript, '755');
33
- }
34
-
35
- console.log('\n✨ 16個のコマンドファイルを生成しました');