@shuji-bonji/rxjs-mcp 0.3.0 → 0.4.1
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/CHANGELOG.md +30 -0
- package/README.ja.md +32 -0
- package/README.md +58 -0
- package/dist/data/lint-rules.d.ts +33 -0
- package/dist/data/lint-rules.d.ts.map +1 -0
- package/dist/data/lint-rules.js +1040 -0
- package/dist/data/lint-rules.js.map +1 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/shared/subscription-analysis.d.ts +82 -0
- package/dist/shared/subscription-analysis.d.ts.map +1 -0
- package/dist/shared/subscription-analysis.js +143 -0
- package/dist/shared/subscription-analysis.js.map +1 -0
- package/dist/tools/analyze-operators.d.ts.map +1 -1
- package/dist/tools/analyze-operators.js +1 -2
- package/dist/tools/analyze-operators.js.map +1 -1
- package/dist/tools/execute-stream.d.ts.map +1 -1
- package/dist/tools/execute-stream.js +10 -4
- package/dist/tools/execute-stream.js.map +1 -1
- package/dist/tools/lint-rxjs.d.ts +3 -0
- package/dist/tools/lint-rxjs.d.ts.map +1 -0
- package/dist/tools/lint-rxjs.js +141 -0
- package/dist/tools/lint-rxjs.js.map +1 -0
- package/dist/tools/marble-diagram.d.ts +5 -0
- package/dist/tools/marble-diagram.d.ts.map +1 -1
- package/dist/tools/marble-diagram.js +10 -4
- package/dist/tools/marble-diagram.js.map +1 -1
- package/dist/tools/memory-leak.d.ts.map +1 -1
- package/dist/tools/memory-leak.js +71 -65
- package/dist/tools/memory-leak.js.map +1 -1
- package/dist/types.d.ts +4 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -8
- package/dist/types.js.map +1 -1
- package/package.json +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,36 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.4.1] - 2026-05-17
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- **`detect_memory_leak`**: 単純な subscribe/unsubscribe カウント比較を廃止し、`takeUntilDestroyed()`(Angular 16+)/ `take(N)` / `first()` / `firstValueFrom` / `useEffect` cleanup / `onUnmounted` 等の **自動クリーンアップパターンを認識** するように改修。これにより、Angular 16+ の `takeUntilDestroyed()` 等を使った現代的なコードに対する false positive を解消。
|
|
12
|
+
- **`detect_memory_leak`** の description に "Recognizes modern auto-cleanup patterns" を明記。
|
|
13
|
+
- **memory-leak と lint_rxjs の検出ロジック共通化**: `src/shared/subscription-analysis.ts` を新設し、サブスクリプション解析のヒューリスティクスを一元化。
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- **`getWorkerPath()` の Windows 非互換**: `__dirname.includes('/src/')` というハードコードを `path.sep` 経由のセグメント走査に変更。Windows (`\src\`) でも src/dist 判定が正しく動作するように。
|
|
17
|
+
- **`marble-diagram.ts`**: 未使用変数 `index` 削除、case block の `const value` をブロック化、内部ヘルパー `parseMarbleSyntax` の名前を `_parseMarbleSyntax`(未使用許可・将来の marble syntax 入力対応用)に整理。
|
|
18
|
+
|
|
19
|
+
### Infrastructure
|
|
20
|
+
- **ESLint 自己適用**: `eslint.config.js`(flat config)を追加し、`@eslint/js` + `typescript-eslint` を全 `src/` に、`eslint-plugin-rxjs-x` を `execute-stream*.ts` のみに(type-aware)適用。`npm run lint` / `npm run lint:fix` を追加し、CI workflow にも `Lint` ステップを追加。
|
|
21
|
+
- **Dependabot**: `.github/dependabot.yml` を追加。npm 依存(dev/prod グループ分け、週次)と GitHub Actions(月次)を自動更新。
|
|
22
|
+
- **MCP integration test の vitest 化**: `src/tools/mcp-integration.test.ts` を新規追加。子プロセスとして `dist/index.js` を spawn し、JSON-RPC で全 6 ツールを実機テスト。`npm test` で一括実行可能(dist 未ビルド時は自動 skip)。既存の `test-mcp-server.mjs` は legacy 用に残存(`npm run test:mcp`)。
|
|
23
|
+
|
|
24
|
+
## [0.4.0] - 2026-05-17
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
- **`lint_rxjs` ツール**: eslint-plugin-rxjs-x の recommended/strict ルールを正規表現ベースで再実装。コードスニペットを渡すだけで即座にフィードバック(ESLint 不要)
|
|
28
|
+
- **20 recommended ルール**: no-async-subscribe, no-create, no-nested-subscribe, no-sharereplay, prefer-root-operators, no-topromise, no-unsafe-takeuntil, throw-error 等
|
|
29
|
+
- **8 strict ルール**: no-exposed-subjects, no-floating-observables, no-misused-observables, no-subclass, finnish 等
|
|
30
|
+
- **フレームワーク固有ルール**: Angular (takeUntilDestroyed 推奨), React (useEffect 内 subscribe), Vue (onUnmounted cleanup)
|
|
31
|
+
- `config` パラメータ: `recommended`(デフォルト)/ `strict`
|
|
32
|
+
- `framework` パラメータ: `angular` / `react` / `vue` / `none`
|
|
33
|
+
- `rules` パラメータ: 個別ルール指定可能
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
- `DOC_BASE_URL` エイリアスを削除 (v0.3.0 で deprecated 告知済み)
|
|
37
|
+
|
|
8
38
|
## [0.3.0] - 2026-05-16
|
|
9
39
|
|
|
10
40
|
### BREAKING
|
package/README.ja.md
CHANGED
|
@@ -62,6 +62,12 @@ ClaudeなどのAIアシスタントから直接RxJSストリームを実行、
|
|
|
62
62
|
- 状態管理
|
|
63
63
|
- その他多数...
|
|
64
64
|
|
|
65
|
+
### 🔍 RxJS Lint(v0.4.0〜)
|
|
66
|
+
- eslint-plugin-rxjs-x ルールの正規表現ベース再実装
|
|
67
|
+
- ESLint / TypeScript パーサー不要で即チェック
|
|
68
|
+
- recommended(20ルール)/ strict(28ルール)の2段階
|
|
69
|
+
- Angular / React / Vue 固有のフレームワークルール対応
|
|
70
|
+
|
|
65
71
|
## インストール
|
|
66
72
|
|
|
67
73
|
```bash
|
|
@@ -197,6 +203,31 @@ source$.pipe(
|
|
|
197
203
|
- `cache-refresh` - リフレッシュ戦略付きキャッシュ
|
|
198
204
|
- その他多数...
|
|
199
205
|
|
|
206
|
+
### lint_rxjs
|
|
207
|
+
|
|
208
|
+
RxJSコードスニペットを静的解析し、一般的な問題とベストプラクティスを検出します。[eslint-plugin-rxjs-x](https://github.com/JasonWeinzierl/eslint-plugin-rxjs-x) のルールを正規表現ベースで再実装しています(ESLint不要)。
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
// パラメータ:
|
|
212
|
+
{
|
|
213
|
+
code: string; // 解析対象の RxJS コード
|
|
214
|
+
config?: 'recommended' | 'strict'; // ルールセット(デフォルト: recommended)
|
|
215
|
+
framework?: 'angular' | 'react' | 'vue' | 'none'; // フレームワークコンテキスト
|
|
216
|
+
rules?: string[]; // 個別ルール指定(config を上書き)
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Config レベル:**
|
|
221
|
+
|
|
222
|
+
- `recommended` — 最も一般的な問題をカバーする20ルール
|
|
223
|
+
- `strict` — スタイルチェック含む全ルール(finnish, no-exposed-subjects 等)
|
|
224
|
+
|
|
225
|
+
**フレームワーク固有チェック:**
|
|
226
|
+
|
|
227
|
+
- **Angular** — コンポーネント内の `takeUntilDestroyed()` / `takeUntil(destroy$)` 欠落を検出
|
|
228
|
+
- **React** — `useEffect` なしの `subscribe()` を検出
|
|
229
|
+
- **Vue** — `onUnmounted` なしの `subscribe()` を検出
|
|
230
|
+
|
|
200
231
|
## 使用例
|
|
201
232
|
|
|
202
233
|
### Claudeでの使用
|
|
@@ -300,6 +331,7 @@ RxJS MCP Serverは以下と組み合わせて使用できます:
|
|
|
300
331
|
│ • analyze_operators│
|
|
301
332
|
│ • detect_memory_leak│
|
|
302
333
|
│ • suggest_pattern│
|
|
334
|
+
│ • lint_rxjs │
|
|
303
335
|
└─────────────────┘
|
|
304
336
|
```
|
|
305
337
|
|
package/README.md
CHANGED
|
@@ -212,6 +212,31 @@ Available patterns:
|
|
|
212
212
|
- `cache-refresh` - Cache with refresh strategy
|
|
213
213
|
- And more...
|
|
214
214
|
|
|
215
|
+
### lint_rxjs
|
|
216
|
+
|
|
217
|
+
Lint RxJS code snippets for common issues and best practices. Based on [eslint-plugin-rxjs-x](https://github.com/JasonWeinzierl/eslint-plugin-rxjs-x) rules.
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
// Parameters:
|
|
221
|
+
{
|
|
222
|
+
code: string; // RxJS code to lint
|
|
223
|
+
config?: 'recommended' | 'strict'; // Rule set (default: recommended)
|
|
224
|
+
framework?: 'angular' | 'react' | 'vue' | 'none'; // Framework context
|
|
225
|
+
rules?: string[]; // Specific rules to check (overrides config)
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Config levels:**
|
|
230
|
+
|
|
231
|
+
- `recommended` — 20 rules covering the most common issues
|
|
232
|
+
- `strict` — All rules including style checks (finnish, no-exposed-subjects, etc.)
|
|
233
|
+
|
|
234
|
+
**Framework-specific checks:**
|
|
235
|
+
|
|
236
|
+
- **Angular** — Detects missing `takeUntilDestroyed()` or `takeUntil(destroy$)` in components
|
|
237
|
+
- **React** — Detects `subscribe()` without `useEffect` cleanup
|
|
238
|
+
- **Vue** — Detects `subscribe()` without `onUnmounted` cleanup
|
|
239
|
+
|
|
215
240
|
## Usage Examples
|
|
216
241
|
|
|
217
242
|
### With Claude
|
|
@@ -329,9 +354,42 @@ Future Meta-MCP integration will allow seamless coordination between these tools
|
|
|
329
354
|
│ • analyze_operators│
|
|
330
355
|
│ • detect_memory_leak│
|
|
331
356
|
│ • suggest_pattern│
|
|
357
|
+
│ • lint_rxjs │
|
|
332
358
|
└─────────────────┘
|
|
333
359
|
```
|
|
334
360
|
|
|
361
|
+
## Documentation Reference System
|
|
362
|
+
|
|
363
|
+
Since v0.3.0, `analyze_operators` outputs three-tier documentation links for each operator and creation function:
|
|
364
|
+
|
|
365
|
+
| Tier | Source | Purpose | AI-readable? |
|
|
366
|
+
|------|--------|---------|:---:|
|
|
367
|
+
| **Official** | [rxjs.dev](https://rxjs.dev) | Authoritative API reference for humans | ❌ (SPA) |
|
|
368
|
+
| **Source** | [GitHub (tag 7.8.2)](https://github.com/ReactiveX/rxjs/tree/7.8.2/src/internal) | JSDoc + implementation — the richest context for AI | ✅ |
|
|
369
|
+
| **Guide** | [RxJS-with-TypeScript](https://github.com/shuji-bonji/RxJS-with-TypeScript) | Bilingual JP/EN explanations with practical examples | ✅ |
|
|
370
|
+
|
|
371
|
+
### Why include the community guide alongside official docs?
|
|
372
|
+
|
|
373
|
+
1. **rxjs.dev is a client-rendered SPA.** AI assistants cannot fetch its content — HTTP requests return an empty shell with JavaScript loaders. The official site is therefore a "link to hand to humans," not a source AI can read.
|
|
374
|
+
|
|
375
|
+
2. **GitHub source provides raw truth.** The RxJS source code (pinned at tag `7.8.2`) contains JSDoc, type signatures, and implementation details. This is the primary reference for AI assistants.
|
|
376
|
+
|
|
377
|
+
3. **The bilingual guide adds learning context.** It organizes operators by use-case (not just alphabetically), provides runnable examples, and offers Japanese translations. For Japanese-speaking users or learners, this fills a gap that neither rxjs.dev nor raw source addresses.
|
|
378
|
+
|
|
379
|
+
### Priority order
|
|
380
|
+
|
|
381
|
+
When the MCP server outputs references, it follows this priority:
|
|
382
|
+
|
|
383
|
+
1. `officialUrl` — always shown (authority, human-readable)
|
|
384
|
+
2. `sourceUrl` — shown when available (AI should read this)
|
|
385
|
+
3. `guideUrl` — shown when the page exists (supplementary)
|
|
386
|
+
|
|
387
|
+
If a guide page does not yet exist for an operator, the field is simply omitted (no broken link). Coverage is tracked by the [URL validation CI](.github/workflows/url-validation.yml).
|
|
388
|
+
|
|
389
|
+
### Can I disable the guide references?
|
|
390
|
+
|
|
391
|
+
Currently there is no runtime option to exclude `guideUrl` from output. If you prefer official-only references, you can fork this server or open a feature request. A future version may support a `--references=official,source` flag.
|
|
392
|
+
|
|
335
393
|
## Contributing
|
|
336
394
|
|
|
337
395
|
Contributions are welcome! Please feel free to submit a PR.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RxJS Lint Rules Database
|
|
3
|
+
*
|
|
4
|
+
* Regex-based reimplementation of eslint-plugin-rxjs-x rules.
|
|
5
|
+
* These rules work on code snippets without requiring ESLint runtime or TypeScript parser.
|
|
6
|
+
*
|
|
7
|
+
* Reference: https://github.com/JasonWeinzierl/eslint-plugin-rxjs-x
|
|
8
|
+
*/
|
|
9
|
+
export type LintSeverity = 'error' | 'warning' | 'info';
|
|
10
|
+
export type LintConfig = 'recommended' | 'strict';
|
|
11
|
+
export type FrameworkContext = 'angular' | 'react' | 'vue' | 'none';
|
|
12
|
+
export interface LintDiagnostic {
|
|
13
|
+
rule: string;
|
|
14
|
+
severity: LintSeverity;
|
|
15
|
+
message: string;
|
|
16
|
+
line?: number;
|
|
17
|
+
suggestion?: string;
|
|
18
|
+
docUrl: string;
|
|
19
|
+
}
|
|
20
|
+
export interface LintRule {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
severity: LintSeverity;
|
|
24
|
+
config: LintConfig;
|
|
25
|
+
/** Whether this rule requires type information (cannot be fully checked with regex) */
|
|
26
|
+
requiresTypeInfo: boolean;
|
|
27
|
+
docUrl: string;
|
|
28
|
+
check: (code: string, framework: FrameworkContext) => LintDiagnostic[];
|
|
29
|
+
}
|
|
30
|
+
export declare const allLintRules: LintRule[];
|
|
31
|
+
/** Get rules for a given config level */
|
|
32
|
+
export declare function getRulesForConfig(config: LintConfig): LintRule[];
|
|
33
|
+
//# sourceMappingURL=lint-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-rules.d.ts","sourceRoot":"","sources":["../../src/data/lint-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAC;AAClD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAEpE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,UAAU,CAAC;IACnB,uFAAuF;IACvF,gBAAgB,EAAE,OAAO,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,KAAK,cAAc,EAAE,CAAC;CACxE;AA+/BD,eAAO,MAAM,YAAY,EAAE,QAAQ,EAiClC,CAAC;AAEF,yCAAyC;AACzC,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,EAAE,CAMhE"}
|