@nahisaho/katashiro 2.1.1 → 2.1.2

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 (2) hide show
  1. package/AGENTS.md +30 -1
  2. package/package.json +1 -1
package/AGENTS.md CHANGED
@@ -118,7 +118,22 @@ console.log(`${summary.length}文字の要約`);
118
118
 
119
119
  | API | 戻り値の型 | 使用例 |
120
120
  |-----|-----------|-------|
121
- | `WebScraper.scrape()` | `Promise<Result<ScrapedContent, Error>>` | `if (isOk(page)) { ... }` |
121
+ | `WebScraper.scrape()` | `Promise<Result<ScrapingResult, Error>>` | `if (isOk(page)) { page.value.content }` |
122
+ | `WebScraper.scrapeMultiple()` | `Promise<Result<ScrapingResult, Error>[]>` | 各要素を`isOk()`でチェック |
123
+ | `SummaryGenerator.summarize()` | `Promise<Result<string, Error>>` | `if (isOk(result)) { result.value }` |
124
+ | `SummaryGenerator.generateSummary()` | `Promise<Result<string, Error>>` | `if (isOk(result)) { result.value }` |
125
+ | `TextAnalyzer.summarize()` | `Promise<Result<Summary, Error>>` | `if (isOk(summary)) { summary.value }` |
126
+ | `FactChecker.checkWithSources()` | `Promise<Result<FactCheckResultDetail, Error>>` | `if (isOk(result)) { ... }` |
127
+ | `FactChecker.detectConflicts()` | `Promise<Result<ConflictDetectionResult, Error>>` | `if (isOk(result)) { ... }` |
128
+ | `DocumentParser.parse()` | `Promise<Result<ParsedDocument, Error>>` | `if (isOk(doc)) { doc.value }` |
129
+ | `PDFParser.parse()` | `Promise<Result<ParsedDocument, Error>>` | `if (isOk(doc)) { ... }` |
130
+ | `DOCXParser.parse()` | `Promise<Result<ParsedDocument, Error>>` | `if (isOk(doc)) { ... }` |
131
+ | `XLSXParser.parse()` | `Promise<Result<ParsedDocument, Error>>` | `if (isOk(doc)) { ... }` |
132
+ | `ApiClient.getSafe()` | `Promise<Result<T, Error>>` | `if (isOk(response)) { ... }` |
133
+ | `ApiClient.postSafe()` | `Promise<Result<T, Error>>` | `if (isOk(response)) { ... }` |
134
+ | `CodeInterpreter.execute()` | `Promise<Result<ExecutionResult, Error>>` | `if (isOk(result)) { ... }` |
135
+ | `TrendAnalyzer.analyze()` | `Promise<Result<TrendAnalysisResult, Error>>` | `if (isOk(result)) { ... }` |
136
+ | `DiagramGenerator.generate*()` | `Promise<Result<DiagramOutput, Error>>` | `if (isOk(diagram)) { ... }` |
122
137
 
123
138
  ```typescript
124
139
  // ✅ 正しい使い方(Result型のみ isOk() を使用)
@@ -129,11 +144,25 @@ if (isOk(page)) {
129
144
  console.error(page.error); // .error でエラー取得
130
145
  }
131
146
 
147
+ // SummaryGenerator.summarize() もResult型
148
+ const summaryResult = await summarizer.summarize(text);
149
+ if (isOk(summaryResult)) {
150
+ console.log(summaryResult.value); // string
151
+ }
152
+
132
153
  // ❌ 間違い(直接値を返すAPIに isOk() を使用)
133
154
  const results = await searchClient.search('AI');
134
155
  // if (isOk(results)) { ... } // エラー!results は配列
156
+
157
+ // ❌ 間違い(generate() と summarize() を混同)
158
+ const summary = await summarizer.generate(text); // これは直接string
159
+ // if (isOk(summary)) { ... } // エラー!summaryはstring
135
160
  ```
136
161
 
162
+ > **注意**: `SummaryGenerator` には2つのメソッドがあります:
163
+ > - `generate()` → 直接 `string` を返す(`isOk()` 不要)
164
+ > - `summarize()` → `Result<string, Error>` を返す(`isOk()` 必須)
165
+
137
166
  ---
138
167
 
139
168
  ## 📝 課題タイプ別の実装パターン
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nahisaho/katashiro",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "KATASHIRO - VS Code Agent Mode向け情報収集・分析・生成システム(オールインワンパッケージ)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",