@nahisaho/katashiro 0.1.3 → 0.1.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.
Files changed (3) hide show
  1. package/AGENTS.md +303 -145
  2. package/CLAUDE.md +212 -155
  3. package/package.json +1 -1
package/AGENTS.md CHANGED
@@ -1,198 +1,356 @@
1
1
  # KATASHIRO - AI Coding Agent Guide
2
2
 
3
- > **AI Coding Agent向け**: このファイルはAIエージェント(GitHub Copilot、Claude等)がKATASHIROサービスを自然言語で利用するためのガイドです。
3
+ > **AI Coding Agent向け**: このファイルを読み込んだAIエージェントは、ユーザーの課題を解決するためにKATASHIROライブラリの機能を自動的に活用できます。
4
4
 
5
- ## 🎯 KATASHIROでできること
5
+ ## 🎯 このガイドの目的
6
6
 
7
- KATASHIROは以下のタスクを自然言語で実行できます:
8
-
9
- | やりたいこと | 自然言語での依頼例 |
10
- |-------------|-------------------|
11
- | **Web調査** | 「〜について調べて」「〜の最新情報を検索して」 |
12
- | **Webページ取得** | 「このURLの内容を取得して」「〜のサイトをスクレイピングして」 |
13
- | **テキスト分析** | 「この文章を分析して」「キーワードを抽出して」 |
14
- | **エンティティ抽出** | 「人名・組織名を抽出して」「固有表現を見つけて」 |
15
- | **レポート生成** | 「調査レポートを作成して」「分析結果をまとめて」 |
16
- | **要約作成** | 「この文章を要約して」「3行でまとめて」 |
17
- | **知識グラフ操作** | 「知識グラフに追加して」「関連情報を検索して」 |
7
+ ユーザーが自然言語で入力した課題に対して、KATASHIROの機能を適切に組み合わせて解決策を提供します。
18
8
 
19
9
  ---
20
10
 
21
- ## 🔧 MCPツール(自然言語で呼び出し可能)
22
-
23
- ### 情報収集ツール
24
-
25
- | ツール | 自然言語での呼び出し例 |
26
- |--------|----------------------|
27
- | `katashiro_scrape` | 「https://example.com の内容を取得して」 |
28
- | `katashiro_search` | 「TypeScript best practices について検索して」 |
29
- | `katashiro_feed` | 「このRSSフィードを読み込んで」 |
11
+ ## 📋 課題タイプ別の解決アプローチ
30
12
 
31
- ### 分析ツール
13
+ ### 課題タイプの判定
32
14
 
33
- | ツール | 自然言語での呼び出し例 |
34
- |--------|----------------------|
35
- | `katashiro_analyze` | 「この文章のキーワードと複雑度を分析して」 |
36
- | `katashiro_extract_entities` | 「このテキストから人名と組織名を抽出して」 |
37
- | `katashiro_topics` | 「これらの文書のトピックを分析して」 |
15
+ ユーザーの入力から以下のタイプを判定してください:
38
16
 
39
- ### 生成ツール
17
+ | 課題タイプ | キーワード例 | 使用する機能 |
18
+ |-----------|-------------|-------------|
19
+ | **調査・リサーチ** | 調べて、検索、情報収集、〜について | Collector → Analyzer → Generator |
20
+ | **分析・解析** | 分析して、解析、キーワード、傾向 | Analyzer |
21
+ | **要約・まとめ** | 要約、まとめて、短くして | Generator (SummaryGenerator) |
22
+ | **レポート作成** | レポート、報告書、文書化 | Generator (ReportGenerator) |
23
+ | **データ抽出** | 抽出、取り出して、リストアップ | Analyzer (EntityExtractor) |
24
+ | **知識管理** | 保存、記録、覚えておいて | Knowledge |
25
+ | **比較・評価** | 比較、評価、どちらが | Collector → Analyzer → Generator |
40
26
 
41
- | ツール | 自然言語での呼び出し例 |
42
- |--------|----------------------|
43
- | `katashiro_generate_report` | 「調査結果からレポートを生成して」 |
44
- | `katashiro_summarize` | 「この長文を300文字で要約して」 |
45
- | `katashiro_citation` | 「APA形式で引用を生成して」 |
27
+ ---
46
28
 
47
- ### 知識グラフツール
29
+ ## 🔄 課題解決ワークフロー
30
+
31
+ ### ステップ1: 課題の分析
32
+
33
+ ```typescript
34
+ // ユーザー入力から課題タイプを判定
35
+ function analyzeProblem(userInput: string): ProblemType {
36
+ const keywords = {
37
+ research: ['調べ', '検索', '情報', 'について', '知りたい'],
38
+ analyze: ['分析', '解析', 'キーワード', '傾向', '特徴'],
39
+ summarize: ['要約', 'まとめ', '短く', '簡潔'],
40
+ report: ['レポート', '報告', '文書', 'ドキュメント'],
41
+ extract: ['抽出', '取り出', 'リスト', '一覧'],
42
+ knowledge: ['保存', '記録', '覚え', '登録'],
43
+ compare: ['比較', '評価', 'どちら', '違い'],
44
+ };
45
+ // キーワードマッチングで判定
46
+ }
47
+ ```
48
48
 
49
- | ツール | 自然言語での呼び出し例 |
50
- |--------|----------------------|
51
- | `katashiro_knowledge_query` | 「知識グラフから〜に関連する情報を検索して」 |
52
- | `katashiro_knowledge_add` | 「この情報を知識グラフに追加して」 |
49
+ ### ステップ2: 必要な機能の選択
50
+
51
+ 課題タイプに応じて以下のクラスを使用:
52
+
53
+ ```typescript
54
+ import {
55
+ // 情報収集(URLや検索クエリがある場合)
56
+ WebScraper, // URL指定のページ取得
57
+ WebSearchClient, // キーワード検索
58
+ FeedReader, // RSSフィード
59
+ ApiClient, // API呼び出し
60
+
61
+ // テキスト分析(テキストデータがある場合)
62
+ TextAnalyzer, // キーワード・複雑度分析
63
+ EntityExtractor, // 人名・組織名抽出
64
+ TopicModeler, // トピック分類
65
+ StructureAnalyzer, // 文書構造解析
66
+ QualityScorer, // 品質スコアリング
67
+
68
+ // コンテンツ生成(出力が必要な場合)
69
+ ReportGenerator, // レポート生成
70
+ SummaryGenerator, // 要約生成
71
+ CitationGenerator, // 引用生成
72
+ TemplateEngine, // テンプレート処理
73
+
74
+ // 知識管理(情報を蓄積・検索する場合)
75
+ KnowledgeGraph, // グラフ管理
76
+ GraphQuery, // 検索
77
+ GraphPersistence, // 永続化
78
+
79
+ // ユーティリティ
80
+ ok, err, isOk, isErr,
81
+ } from '@nahisaho/katashiro';
82
+ ```
53
83
 
54
84
  ---
55
85
 
56
- ## 📝 ユースケース別ワークフロー
57
-
58
- ### 1. 競合調査レポート作成
86
+ ## 📝 課題タイプ別の実装パターン
59
87
 
60
- ```
61
- ユーザー: 「〇〇社について競合調査して、レポートにまとめて」
62
-
63
- AIエージェントの動作:
64
- 1. katashiro_search で「〇〇社」を検索
65
- 2. katashiro_scrape で上位結果のページを取得
66
- 3. katashiro_analyze でテキスト分析
67
- 4. katashiro_extract_entities で企業名・人名を抽出
68
- 5. katashiro_generate_report でレポート生成
69
- ```
88
+ ### パターンA: 調査・リサーチ課題
70
89
 
71
- ### 2. 技術トレンド分析
90
+ **ユーザー例**: 「〇〇について調べてまとめて」
72
91
 
92
+ ```typescript
93
+ async function solveResearchProblem(topic: string) {
94
+ // 1. 情報収集
95
+ const searchClient = new WebSearchClient();
96
+ const results = await searchClient.search(topic, { maxResults: 10 });
97
+
98
+ // 2. ページ取得
99
+ const scraper = new WebScraper();
100
+ const contents: string[] = [];
101
+ for (const result of results.slice(0, 5)) {
102
+ const page = await scraper.scrape(result.url);
103
+ if (isOk(page)) contents.push(page.value.content);
104
+ }
105
+
106
+ // 3. 分析
107
+ const analyzer = new TextAnalyzer();
108
+ const analyses = await Promise.all(contents.map(c => analyzer.analyze(c)));
109
+
110
+ // 4. エンティティ抽出
111
+ const extractor = new EntityExtractor();
112
+ const allEntities = [];
113
+ for (const content of contents) {
114
+ const entities = await extractor.extract(content);
115
+ allEntities.push(...entities);
116
+ }
117
+
118
+ // 5. 要約生成
119
+ const summarizer = new SummaryGenerator();
120
+ const summary = await summarizer.generate(contents.join('\n\n'), { maxLength: 500 });
121
+
122
+ // 6. レポート生成
123
+ const reportGen = new ReportGenerator();
124
+ const report = await reportGen.generate({
125
+ title: `${topic} 調査レポート`,
126
+ sections: [
127
+ { heading: '概要', content: summary },
128
+ { heading: 'キーワード', content: analyses.flatMap(a => a.keywords).join(', ') },
129
+ { heading: '関連エンティティ', content: [...new Set(allEntities.map(e => e.text))].join(', ') },
130
+ { heading: '参考URL', content: results.map(r => `- ${r.url}`).join('\n') },
131
+ ],
132
+ format: 'markdown',
133
+ });
134
+
135
+ return report;
136
+ }
73
137
  ```
74
- ユーザー: 「2026年のAI技術トレンドを調べて分析して」
75
138
 
76
- AIエージェントの動作:
77
- 1. katashiro_search で「AI trends 2026」を検索
78
- 2. katashiro_scrape で技術ブログを取得
79
- 3. katashiro_topics でトピック分析
80
- 4. katashiro_summarize で要点をまとめ
139
+ ### パターンB: 分析課題
140
+
141
+ **ユーザー例**: 「このテキストを分析して特徴を教えて」
142
+
143
+ ```typescript
144
+ async function solveAnalysisProblem(text: string) {
145
+ // 1. テキスト分析
146
+ const analyzer = new TextAnalyzer();
147
+ const analysis = await analyzer.analyze(text);
148
+
149
+ // 2. 構造分析
150
+ const structAnalyzer = new StructureAnalyzer();
151
+ const structure = await structAnalyzer.analyze(text);
152
+
153
+ // 3. エンティティ抽出
154
+ const extractor = new EntityExtractor();
155
+ const entities = await extractor.extract(text);
156
+
157
+ // 4. 品質スコアリング
158
+ const scorer = new QualityScorer();
159
+ const quality = await scorer.score(text);
160
+
161
+ return {
162
+ keywords: analysis.keywords,
163
+ complexity: analysis.complexity,
164
+ sentiment: analysis.sentiment,
165
+ structure: structure,
166
+ entities: entities,
167
+ qualityScore: quality,
168
+ };
169
+ }
81
170
  ```
82
171
 
83
- ### 3. 論文・記事の要約
172
+ ### パターンC: 要約課題
84
173
 
85
- ```
86
- ユーザー: 「このURLの論文を要約して、重要なポイントを箇条書きにして」
174
+ **ユーザー例**: 「この長文を300文字でまとめて」
87
175
 
88
- AIエージェントの動作:
89
- 1. katashiro_scrape でページ内容を取得
90
- 2. katashiro_analyze で構造分析
91
- 3. katashiro_summarize で要約生成
92
- 4. katashiro_citation で引用情報を生成
176
+ ```typescript
177
+ async function solveSummaryProblem(text: string, maxLength: number = 300) {
178
+ const summarizer = new SummaryGenerator();
179
+ const summary = await summarizer.generate(text, {
180
+ maxLength,
181
+ style: 'paragraph' // または 'bullets', 'headline'
182
+ });
183
+ return summary;
184
+ }
93
185
  ```
94
186
 
95
- ### 4. 知識ベース構築
96
-
187
+ ### パターンD: レポート作成課題
188
+
189
+ **ユーザー例**: 「分析結果をレポートにまとめて」
190
+
191
+ ```typescript
192
+ async function solveReportProblem(data: any, title: string) {
193
+ const reportGen = new ReportGenerator();
194
+ const report = await reportGen.generate({
195
+ title,
196
+ sections: [
197
+ { heading: '概要', content: data.summary },
198
+ { heading: '詳細分析', content: data.details },
199
+ { heading: '結論', content: data.conclusion },
200
+ ],
201
+ format: 'markdown',
202
+ metadata: { author: 'KATASHIRO', date: new Date().toISOString() },
203
+ });
204
+ return report;
205
+ }
97
206
  ```
98
- ユーザー: 「このプロジェクトの情報を知識グラフに登録して」
99
207
 
100
- AIエージェントの動作:
101
- 1. katashiro_extract_entities でエンティティ抽出
102
- 2. katashiro_knowledge_add でノード追加
103
- 3. katashiro_knowledge_query で関連性確認
208
+ ### パターンE: データ抽出課題
209
+
210
+ **ユーザー例**: 「この文章から人名と組織名を抽出して」
211
+
212
+ ```typescript
213
+ async function solveExtractionProblem(text: string, types: string[] = ['PERSON', 'ORGANIZATION']) {
214
+ const extractor = new EntityExtractor();
215
+ const entities = await extractor.extract(text);
216
+
217
+ const filtered = entities.filter(e => types.includes(e.type));
218
+ const grouped = types.reduce((acc, type) => {
219
+ acc[type] = filtered.filter(e => e.type === type).map(e => e.text);
220
+ return acc;
221
+ }, {} as Record<string, string[]>);
222
+
223
+ return grouped;
224
+ }
104
225
  ```
105
226
 
106
- ---
107
-
108
- ## 💡 自然言語プロンプト例
109
-
110
- ### 調査系
111
- - 「〜について調べて」
112
- - 「〜の最新ニュースを検索して」
113
- - 「〜に関する情報を集めて」
114
- - 「このURLの内容を取得して分析して」
115
-
116
- ### 分析系
117
- - 「この文章を分析して」
118
- - 「キーワードを抽出して」
119
- - 「人名・組織名をリストアップして」
120
- - 「トピックを分類して」
121
- - 「感情分析して」
122
-
123
- ### 生成系
124
- - 「レポートにまとめて」
125
- - 「要約して」
126
- - 「〜文字でまとめて」
127
- - 「プレゼン資料を作って」
128
- - 「引用を生成して」
129
-
130
- ### 知識グラフ系
131
- - 「知識グラフに追加して」
132
- - 「関連情報を検索して」
133
- - 「この情報を保存して」
134
-
135
- ---
136
-
137
- ## 📦 npmパッケージ
138
-
139
- ```bash
140
- # オールインワン(推奨)
141
- npm install @nahisaho/katashiro
227
+ ### パターンF: 知識管理課題
228
+
229
+ **ユーザー例**: 「この情報を保存しておいて」「〇〇に関連する情報を探して」
230
+
231
+ ```typescript
232
+ async function solveKnowledgeProblem(action: 'save' | 'search', data: any) {
233
+ const kg = new KnowledgeGraph();
234
+ const persistence = new GraphPersistence();
235
+
236
+ // 既存のグラフを読み込み
237
+ try {
238
+ const loaded = await persistence.load('./knowledge-graph.json');
239
+ Object.assign(kg, loaded);
240
+ } catch { /* 新規作成 */ }
241
+
242
+ if (action === 'save') {
243
+ // エンティティを抽出してノード追加
244
+ const extractor = new EntityExtractor();
245
+ const entities = await extractor.extract(data.text);
246
+
247
+ for (const entity of entities) {
248
+ kg.addNode({
249
+ id: `entity-${Date.now()}-${Math.random().toString(36).slice(2)}`,
250
+ type: entity.type,
251
+ properties: { name: entity.text, source: data.source },
252
+ });
253
+ }
254
+
255
+ await persistence.save(kg, './knowledge-graph.json');
256
+ return { saved: entities.length };
257
+ } else {
258
+ // 検索
259
+ const query = new GraphQuery(kg);
260
+ const results = query.search(data.query);
261
+ return results;
262
+ }
263
+ }
264
+ ```
142
265
 
143
- # MCPサーバー
144
- npm install @nahisaho/katashiro-mcp-server
266
+ ### パターンG: 比較・評価課題
267
+
268
+ **ユーザー例**: 「AとBを比較して」
269
+
270
+ ```typescript
271
+ async function solveComparisonProblem(itemA: string, itemB: string) {
272
+ const searchClient = new WebSearchClient();
273
+ const scraper = new WebScraper();
274
+ const analyzer = new TextAnalyzer();
275
+
276
+ // 両方の情報を収集
277
+ const [resultsA, resultsB] = await Promise.all([
278
+ searchClient.search(itemA, { maxResults: 5 }),
279
+ searchClient.search(itemB, { maxResults: 5 }),
280
+ ]);
281
+
282
+ // 分析
283
+ const analysisA = await analyzeResults(resultsA, scraper, analyzer);
284
+ const analysisB = await analyzeResults(resultsB, scraper, analyzer);
285
+
286
+ // 比較レポート生成
287
+ const reportGen = new ReportGenerator();
288
+ return reportGen.generate({
289
+ title: `${itemA} vs ${itemB} 比較レポート`,
290
+ sections: [
291
+ { heading: itemA, content: formatAnalysis(analysisA) },
292
+ { heading: itemB, content: formatAnalysis(analysisB) },
293
+ { heading: '比較まとめ', content: generateComparison(analysisA, analysisB) },
294
+ ],
295
+ format: 'markdown',
296
+ });
297
+ }
145
298
  ```
146
299
 
147
- ### VS Code MCP設定
300
+ ---
148
301
 
149
- ```json
150
- {
151
- "mcp.servers": {
152
- "katashiro": {
153
- "command": "npx",
154
- "args": ["@nahisaho/katashiro-mcp-server"]
155
- }
302
+ ## 🚀 統合ソルバー
303
+
304
+ ユーザーの課題を自動判定して解決:
305
+
306
+ ```typescript
307
+ import * as katashiro from '@nahisaho/katashiro';
308
+
309
+ async function solveProblem(userInput: string, context?: any) {
310
+ // 課題タイプを判定
311
+ const problemType = detectProblemType(userInput);
312
+
313
+ switch (problemType) {
314
+ case 'research':
315
+ return solveResearchProblem(extractTopic(userInput));
316
+ case 'analyze':
317
+ return solveAnalysisProblem(context?.text || userInput);
318
+ case 'summarize':
319
+ return solveSummaryProblem(context?.text || userInput, extractMaxLength(userInput));
320
+ case 'report':
321
+ return solveReportProblem(context?.data, extractTitle(userInput));
322
+ case 'extract':
323
+ return solveExtractionProblem(context?.text || userInput, extractEntityTypes(userInput));
324
+ case 'knowledge':
325
+ return solveKnowledgeProblem(detectKnowledgeAction(userInput), context);
326
+ case 'compare':
327
+ const [itemA, itemB] = extractComparisonItems(userInput);
328
+ return solveComparisonProblem(itemA, itemB);
329
+ default:
330
+ // 汎用的なリサーチとして処理
331
+ return solveResearchProblem(userInput);
156
332
  }
157
333
  }
158
334
  ```
159
335
 
160
336
  ---
161
337
 
162
- ## 🏗️ プロジェクト構造
338
+ ## 📦 インストール
163
339
 
164
- ```
165
- katashiro/
166
- ├── packages/
167
- │ ├── katashiro/ # @nahisaho/katashiro(オールインワン)
168
- │ ├── core/ # @nahisaho/katashiro-core
169
- │ ├── collector/ # @nahisaho/katashiro-collector
170
- │ ├── analyzer/ # @nahisaho/katashiro-analyzer
171
- │ ├── generator/ # @nahisaho/katashiro-generator
172
- │ ├── knowledge/ # @nahisaho/katashiro-knowledge
173
- │ ├── feedback/ # @nahisaho/katashiro-feedback
174
- │ ├── mcp-server/ # @nahisaho/katashiro-mcp-server
175
- │ └── vscode-extension/ # katashiro VS Code拡張
176
- └── docs/
177
- ├── USER-GUIDE.md
178
- └── USER-GUIDE.ja.md
340
+ ```bash
341
+ npm install @nahisaho/katashiro
179
342
  ```
180
343
 
181
344
  ---
182
345
 
183
- ## 🛠️ 開発コマンド
346
+ ## 🔗 関連リンク
184
347
 
185
- ```bash
186
- npm install # 依存関係インストール
187
- npm run build # 全パッケージビルド
188
- npm run test # テスト実行(448テスト)
189
- npm run lint # ESLint
190
- npm run typecheck # TypeScript型チェック
191
- ```
348
+ - **npm**: https://www.npmjs.com/package/@nahisaho/katashiro
349
+ - **GitHub**: https://github.com/nahisaho/katashiro
192
350
 
193
351
  ---
194
352
 
195
353
  **Project**: KATASHIRO
196
354
  **npm**: @nahisaho/katashiro
197
355
  **Last Updated**: 2026-01-10
198
- **Version**: 0.1.0
356
+ **Version**: 0.1.5
package/CLAUDE.md CHANGED
@@ -1,221 +1,278 @@
1
- # KATASHIRO - Claude Code専用ガイド
1
+ # KATASHIRO - Claude向け課題解決ガイド
2
2
 
3
- > このファイルはClaude CodeがKATASHIROサービスを自然言語で利用するためのガイドです。
3
+ > このファイルを読み込んだClaudeは、ユーザーの課題を解決するためにKATASHIROライブラリの機能を自動的に活用できます。
4
4
 
5
- ## 🎯 KATASHIROとは
5
+ ## 🎯 基本動作
6
6
 
7
- KATASHIROは情報収集・分析・コンテンツ生成を行うMCPサーバーです。ユーザーから以下のような依頼があった場合、KATASHIROのツールを使用してください。
7
+ **ユーザーが課題を入力したら、以下の手順で解決してください:**
8
8
 
9
- ---
9
+ 1. 課題タイプを判定
10
+ 2. 適切なKATASHIRO機能を選択
11
+ 3. コードを生成して実行
12
+ 4. 結果をユーザーに提示
10
13
 
11
- ## 📝 自然言語 → ツール対応表
14
+ ---
12
15
 
13
- ### 「〜について調べて」「検索して」
16
+ ## 📋 課題タイプ判定表
17
+
18
+ | ユーザーの言葉 | 課題タイプ | 使用機能 |
19
+ |---------------|-----------|----------|
20
+ | 「〜について調べて」「検索して」「情報を集めて」 | 調査 | WebSearchClient → WebScraper → TextAnalyzer → ReportGenerator |
21
+ | 「このテキストを分析して」「特徴を教えて」 | 分析 | TextAnalyzer + EntityExtractor + StructureAnalyzer |
22
+ | 「要約して」「まとめて」「短くして」 | 要約 | SummaryGenerator |
23
+ | 「レポートを作成して」「報告書にして」 | レポート | ReportGenerator |
24
+ | 「人名を抽出して」「組織名を取り出して」 | 抽出 | EntityExtractor |
25
+ | 「保存して」「覚えておいて」「記録して」 | 保存 | KnowledgeGraph + GraphPersistence |
26
+ | 「〜を探して」「検索して」(保存済みデータ) | 検索 | GraphQuery |
27
+ | 「AとBを比較して」「違いを教えて」 | 比較 | 複合(調査×2 → 分析 → レポート) |
28
+ | 「このURLの内容を取得して」 | 取得 | WebScraper |
29
+ | 「RSSフィードを読んで」 | フィード | FeedReader |
14
30
 
15
- ```
16
- katashiro_search を使用
17
- ```
31
+ ---
18
32
 
19
- 例:
20
- - 「TypeScriptのベストプラクティスについて調べて」
21
- - 「2026年のAIトレンドを検索して」
22
- - 「〇〇社の最新ニュースを調べて」
33
+ ## 🔧 機能別クイックリファレンス
23
34
 
24
- ### 「このURLの内容を取得して」「スクレイピングして」
35
+ ### 情報収集
25
36
 
26
- ```
27
- katashiro_scrape を使用
28
- ```
37
+ ```typescript
38
+ import { WebScraper, WebSearchClient, FeedReader } from '@nahisaho/katashiro';
29
39
 
30
- 例:
31
- - 「https://example.com の内容を取得して」
32
- - 「このページの本文を抽出して」
40
+ // URL取得
41
+ const scraper = new WebScraper();
42
+ const page = await scraper.scrape('https://example.com');
33
43
 
34
- ### 「分析して」「キーワードを抽出して」
44
+ // Web検索
45
+ const search = new WebSearchClient();
46
+ const results = await search.search('キーワード', { maxResults: 10 });
35
47
 
36
- ```
37
- katashiro_analyze を使用
48
+ // RSSフィード
49
+ const reader = new FeedReader();
50
+ const feed = await reader.read('https://example.com/rss.xml');
38
51
  ```
39
52
 
40
- 例:
41
- - 「この文章を分析して」
42
- - 「テキストの複雑度を調べて」
43
- - 「重要なキーワードを抽出して」
53
+ ### テキスト分析
44
54
 
45
- ### 「人名・組織名を抽出して」「固有表現を見つけて」
55
+ ```typescript
56
+ import { TextAnalyzer, EntityExtractor, TopicModeler, StructureAnalyzer, QualityScorer } from '@nahisaho/katashiro';
46
57
 
47
- ```
48
- katashiro_extract_entities を使用
49
- ```
58
+ // 基本分析
59
+ const analyzer = new TextAnalyzer();
60
+ const { keywords, complexity, sentiment } = await analyzer.analyze(text);
50
61
 
51
- 例:
52
- - 「この記事に出てくる人名をリストアップして」
53
- - 「組織名と地名を抽出して」
62
+ // エンティティ抽出
63
+ const extractor = new EntityExtractor();
64
+ const entities = await extractor.extract(text);
65
+ // entities: [{ type: 'PERSON', text: '山田太郎' }, { type: 'ORGANIZATION', text: '〇〇株式会社' }]
54
66
 
55
- ### 「レポートを作成して」「まとめて」
67
+ // トピック分析
68
+ const modeler = new TopicModeler();
69
+ const topics = await modeler.model(documents, { numTopics: 5 });
56
70
 
57
- ```
58
- katashiro_generate_report を使用
59
- ```
71
+ // 構造分析
72
+ const structAnalyzer = new StructureAnalyzer();
73
+ const structure = await structAnalyzer.analyze(text);
60
74
 
61
- 例:
62
- - 「調査結果をレポートにまとめて」
63
- - 「分析結果からレポートを生成して」
75
+ // 品質スコア
76
+ const scorer = new QualityScorer();
77
+ const score = await scorer.score(text);
78
+ ```
64
79
 
65
- ### 「要約して」「〜文字でまとめて」
80
+ ### コンテンツ生成
66
81
 
67
- ```
68
- katashiro_summarize を使用
82
+ ```typescript
83
+ import { ReportGenerator, SummaryGenerator, CitationGenerator } from '@nahisaho/katashiro';
84
+
85
+ // 要約
86
+ const summarizer = new SummaryGenerator();
87
+ const summary = await summarizer.generate(longText, { maxLength: 300, style: 'paragraph' });
88
+
89
+ // レポート
90
+ const reportGen = new ReportGenerator();
91
+ const report = await reportGen.generate({
92
+ title: 'タイトル',
93
+ sections: [
94
+ { heading: 'セクション1', content: '内容1' },
95
+ { heading: 'セクション2', content: '内容2' },
96
+ ],
97
+ format: 'markdown',
98
+ });
99
+
100
+ // 引用
101
+ const citationGen = new CitationGenerator();
102
+ const citation = citationGen.generate(source, { style: 'APA' });
69
103
  ```
70
104
 
71
- 例:
72
- - 「この長文を要約して」
73
- - 「300文字以内でまとめて」
74
- - 「3行で要点をまとめて」
105
+ ### 知識グラフ
75
106
 
76
- ### 「知識グラフに追加して」「保存して」
107
+ ```typescript
108
+ import { KnowledgeGraph, GraphQuery, GraphPersistence } from '@nahisaho/katashiro';
77
109
 
78
- ```
79
- katashiro_knowledge_add を使用
80
- ```
110
+ const kg = new KnowledgeGraph();
111
+ const persistence = new GraphPersistence();
112
+ const query = new GraphQuery(kg);
81
113
 
82
- 例:
83
- - 「この情報を知識グラフに登録して」
84
- - 「エンティティを保存して」
114
+ // 保存
115
+ kg.addNode({ id: 'node-1', type: 'Person', properties: { name: '山田太郎' } });
116
+ await persistence.save(kg, './knowledge.json');
85
117
 
86
- ### 「知識グラフから検索して」「関連情報を探して」
118
+ // 読み込み
119
+ const loaded = await persistence.load('./knowledge.json');
87
120
 
88
- ```
89
- katashiro_knowledge_query を使用
121
+ // 検索
122
+ const results = query.findByType('Person');
90
123
  ```
91
124
 
92
- 例:
93
- - 「〇〇に関連する情報を知識グラフから検索して」
94
- - 「保存した情報を検索して」
95
-
96
125
  ---
97
126
 
98
- ## 🔄 複合タスクのワークフロー
99
-
100
- ### 競合調査レポート
101
-
102
- ユーザー: 「〇〇社について調査してレポートにまとめて」
103
-
104
- ```
105
- 1. katashiro_search("〇〇社 最新 ニュース")
106
- 2. katashiro_scrape(検索結果のURL)
107
- 3. katashiro_analyze(取得したテキスト)
108
- 4. katashiro_extract_entities(取得したテキスト)
109
- 5. katashiro_generate_report(分析結果)
110
- ```
111
-
112
- ### 論文要約
127
+ ## 📝 課題解決テンプレート
113
128
 
114
- ユーザー: 「このURLの論文を要約して」
129
+ ### テンプレート1: 調査タスク
115
130
 
131
+ ```typescript
132
+ // ユーザー: 「〇〇について調べてまとめて」
133
+ import { WebSearchClient, WebScraper, TextAnalyzer, EntityExtractor, SummaryGenerator, ReportGenerator, isOk } from '@nahisaho/katashiro';
134
+
135
+ async function research(topic: string) {
136
+ // 1. 検索
137
+ const search = new WebSearchClient();
138
+ const results = await search.search(topic, { maxResults: 10 });
139
+
140
+ // 2. ページ取得
141
+ const scraper = new WebScraper();
142
+ const contents: string[] = [];
143
+ for (const r of results.slice(0, 5)) {
144
+ const page = await scraper.scrape(r.url);
145
+ if (isOk(page)) contents.push(page.value.content);
146
+ }
147
+
148
+ // 3. 分析
149
+ const analyzer = new TextAnalyzer();
150
+ const keywords = new Set<string>();
151
+ for (const c of contents) {
152
+ const a = await analyzer.analyze(c);
153
+ a.keywords.forEach(k => keywords.add(k));
154
+ }
155
+
156
+ // 4. エンティティ抽出
157
+ const extractor = new EntityExtractor();
158
+ const entities = new Set<string>();
159
+ for (const c of contents) {
160
+ const e = await extractor.extract(c);
161
+ e.forEach(ent => entities.add(ent.text));
162
+ }
163
+
164
+ // 5. 要約
165
+ const summarizer = new SummaryGenerator();
166
+ const summary = await summarizer.generate(contents.join('\n\n'), { maxLength: 500 });
167
+
168
+ // 6. レポート生成
169
+ const reportGen = new ReportGenerator();
170
+ return reportGen.generate({
171
+ title: `${topic} 調査レポート`,
172
+ sections: [
173
+ { heading: '概要', content: summary },
174
+ { heading: 'キーワード', content: [...keywords].join(', ') },
175
+ { heading: '関連エンティティ', content: [...entities].join(', ') },
176
+ { heading: '参考URL', content: results.map(r => `- ${r.url}`).join('\n') },
177
+ ],
178
+ format: 'markdown',
179
+ });
180
+ }
116
181
  ```
117
- 1. katashiro_scrape(URL)
118
- 2. katashiro_analyze(取得したテキスト)
119
- 3. katashiro_summarize(取得したテキスト)
120
- ```
121
-
122
- ### 技術調査と知識ベース構築
123
182
 
124
- ユーザー: 「〜について調べて知識グラフに保存して」
183
+ ### テンプレート2: 分析タスク
125
184
 
185
+ ```typescript
186
+ // ユーザー: 「このテキストを分析して」
187
+ import { TextAnalyzer, EntityExtractor, StructureAnalyzer, QualityScorer } from '@nahisaho/katashiro';
188
+
189
+ async function analyze(text: string) {
190
+ const [analysis, entities, structure, quality] = await Promise.all([
191
+ new TextAnalyzer().analyze(text),
192
+ new EntityExtractor().extract(text),
193
+ new StructureAnalyzer().analyze(text),
194
+ new QualityScorer().score(text),
195
+ ]);
196
+
197
+ return {
198
+ keywords: analysis.keywords,
199
+ complexity: analysis.complexity,
200
+ sentiment: analysis.sentiment,
201
+ entities: entities.map(e => ({ type: e.type, text: e.text })),
202
+ structure,
203
+ qualityScore: quality,
204
+ };
205
+ }
126
206
  ```
127
- 1. katashiro_search(クエリ)
128
- 2. katashiro_scrape(検索結果)
129
- 3. katashiro_extract_entities(テキスト)
130
- 4. katashiro_knowledge_add(エンティティ)
131
- ```
132
-
133
- ---
134
207
 
135
- ## 💻 コード例(TypeScript)
208
+ ### テンプレート3: 比較タスク
136
209
 
137
210
  ```typescript
138
- import {
139
- WebScraper,
140
- TextAnalyzer,
141
- ReportGenerator,
142
- KnowledgeGraph,
143
- isOk
144
- } from '@nahisaho/katashiro';
145
-
146
- // Web調査 → 分析 → レポート生成
147
- async function research(url: string) {
211
+ // ユーザー: 「AとBを比較して」
212
+ import { WebSearchClient, WebScraper, TextAnalyzer, ReportGenerator, isOk } from '@nahisaho/katashiro';
213
+
214
+ async function compare(itemA: string, itemB: string) {
215
+ const search = new WebSearchClient();
148
216
  const scraper = new WebScraper();
149
217
  const analyzer = new TextAnalyzer();
150
- const generator = new ReportGenerator();
151
-
152
- const page = await scraper.scrape(url);
153
- if (isOk(page)) {
154
- const analysis = await analyzer.analyze(page.value.text);
155
- const report = await generator.generate({
156
- title: '調査レポート',
157
- sections: [{ heading: '分析結果', content: analysis.value.summary }]
158
- });
159
- return report;
218
+
219
+ async function gatherInfo(item: string) {
220
+ const results = await search.search(item, { maxResults: 5 });
221
+ const contents: string[] = [];
222
+ for (const r of results) {
223
+ const page = await scraper.scrape(r.url);
224
+ if (isOk(page)) contents.push(page.value.content);
225
+ }
226
+ const analysis = await analyzer.analyze(contents.join('\n'));
227
+ return { item, analysis, sources: results };
160
228
  }
229
+
230
+ const [infoA, infoB] = await Promise.all([gatherInfo(itemA), gatherInfo(itemB)]);
231
+
232
+ const reportGen = new ReportGenerator();
233
+ return reportGen.generate({
234
+ title: `${itemA} vs ${itemB} 比較`,
235
+ sections: [
236
+ { heading: itemA, content: `キーワード: ${infoA.analysis.keywords.join(', ')}` },
237
+ { heading: itemB, content: `キーワード: ${infoB.analysis.keywords.join(', ')}` },
238
+ { heading: '比較まとめ', content: '(AIが分析結果を基に比較コメントを生成)' },
239
+ ],
240
+ format: 'markdown',
241
+ });
161
242
  }
162
243
  ```
163
244
 
164
245
  ---
165
246
 
166
- ## 📦 インストール
247
+ ## クイックスタート
167
248
 
168
249
  ```bash
169
- # オールインワン
170
250
  npm install @nahisaho/katashiro
171
-
172
- # MCPサーバー
173
- npm install @nahisaho/katashiro-mcp-server
174
251
  ```
175
252
 
176
- ## VS Code MCP設定
177
-
178
- ```json
179
- {
180
- "mcp.servers": {
181
- "katashiro": {
182
- "command": "npx",
183
- "args": ["@nahisaho/katashiro-mcp-server"]
184
- }
185
- }
186
- }
253
+ ```typescript
254
+ import * as katashiro from '@nahisaho/katashiro';
255
+
256
+ // すべての機能にアクセス可能
257
+ const {
258
+ WebScraper, WebSearchClient, FeedReader,
259
+ TextAnalyzer, EntityExtractor, TopicModeler,
260
+ ReportGenerator, SummaryGenerator, CitationGenerator,
261
+ KnowledgeGraph, GraphQuery, GraphPersistence,
262
+ isOk, isErr
263
+ } = katashiro;
187
264
  ```
188
265
 
189
266
  ---
190
267
 
191
- ## 🔧 開発時の注意
268
+ ## 🔗 関連リンク
192
269
 
193
- ### Result型パターン
194
- ```typescript
195
- import { Result, ok, err, isOk, isErr } from '@nahisaho/katashiro';
196
-
197
- const result = await scraper.scrape(url);
198
- if (isOk(result)) {
199
- // 成功時の処理
200
- console.log(result.value);
201
- } else {
202
- // エラー時の処理
203
- console.error(result.error);
204
- }
205
- ```
206
-
207
- ### パッケージ依存関係
208
- ```
209
- @nahisaho/katashiro-core (依存なし)
210
-
211
- collector, analyzer, generator, knowledge, feedback (coreに依存)
212
-
213
- @nahisaho/katashiro (オールインワン - 全てを含む)
214
- @nahisaho/katashiro-mcp-server (全パッケージを使用)
215
- ```
270
+ - **npm**: https://www.npmjs.com/package/@nahisaho/katashiro
271
+ - **GitHub**: https://github.com/nahisaho/katashiro
216
272
 
217
273
  ---
218
274
 
219
275
  **Project**: KATASHIRO
220
276
  **npm**: @nahisaho/katashiro
221
- **Updated**: 2026-01-10
277
+ **Last Updated**: 2026-01-10
278
+ **Version**: 0.1.5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nahisaho/katashiro",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "KATASHIRO - VS Code Agent Mode向け情報収集・分析・生成システム(オールインワンパッケージ)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",