Skip to content

Commit 1ed6855

Browse files
authored
Merge pull request #274 from ysk8hori/docs-0.26.0
docs: 構成の見直し
2 parents f81fe4d + 34bd575 commit 1ed6855

File tree

3 files changed

+134
-137
lines changed

3 files changed

+134
-137
lines changed

README.md

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -181,49 +181,6 @@ Also, for large repositories, Mermaid may exceed the maximum amount of data that
181181

182182
In that case, you need to narrow down the directories to include in the graph.
183183

184-
### For AI Agents
185-
186-
When using TypeScript Graph with AI agents, the `--stdout` option provides structured output that's easy to parse and analyze:
187-
188-
```bash
189-
# Analyze codebase architecture and get both dependency graph and metrics
190-
tsg --stdout
191-
192-
# Get only code metrics for quality assessment
193-
tsg --stdout metrics
194-
195-
# Get only dependency relationships for architecture analysis
196-
tsg --stdout deps
197-
```
198-
199-
**Example prompts for AI agents:**
200-
201-
```
202-
Analyze this TypeScript codebase architecture:
203-
$(tsg --stdout deps)
204-
205-
Identify circular dependencies and suggest refactoring strategies.
206-
```
207-
208-
```
209-
Review code quality metrics:
210-
$(tsg --stdout metrics)
211-
212-
Identify files with low maintainability index and high complexity that need refactoring.
213-
```
214-
215-
```
216-
Full codebase analysis:
217-
$(tsg --stdout)
218-
219-
Provide architectural insights and code quality recommendations.
220-
```
221-
222-
```
223-
Review code quality for changes in the current branch:
224-
$(tsg --stdout --include $(git diff --name-only main | tr '\n' ' '))
225-
```
226-
227184
### Arguments or `--include`
228185

229186
To narrow down the directories or files included in the graph, specify the paths or parts of the paths using either the argument or the `--include` option.
@@ -434,6 +391,49 @@ flowchart LR
434391

435392
It makes it easier to share problems within the team. 👍
436393

394+
### For AI Agents
395+
396+
When using TypeScript Graph with AI agents, the `--stdout` option provides structured output that's easy to parse and analyze:
397+
398+
```bash
399+
# Analyze codebase architecture and get both dependency graph and metrics
400+
tsg --stdout
401+
402+
# Get only code metrics for quality assessment
403+
tsg --stdout metrics
404+
405+
# Get only dependency relationships for architecture analysis
406+
tsg --stdout deps
407+
```
408+
409+
**Example prompts for AI agents:**
410+
411+
```
412+
Analyze this TypeScript codebase architecture:
413+
$(tsg --stdout deps)
414+
415+
Identify circular dependencies and suggest refactoring strategies.
416+
```
417+
418+
```
419+
Review code quality metrics:
420+
$(tsg --stdout metrics)
421+
422+
Identify files with low maintainability index and high complexity that need refactoring.
423+
```
424+
425+
```
426+
Full codebase analysis:
427+
$(tsg --stdout)
428+
429+
Provide architectural insights and code quality recommendations.
430+
```
431+
432+
```
433+
Review code quality for changes in the current branch:
434+
$(tsg --stdout --include $(git diff --name-only main | tr '\n' ' '))
435+
```
436+
437437
## Code Metrics Measurement
438438

439439
This is a beta feature for measuring code metrics such as the Maintainability Index, Cyclomatic Complexity, and Cognitive Complexity. While these metrics are widely recognized, their reliability in TypeScript-specific contexts is not guaranteed. Nonetheless, they can serve as helpful indicators for evaluating code quality.
@@ -560,7 +560,7 @@ tsg --stdout
560560
# Output only metrics
561561
tsg --stdout metrics
562562

563-
# Output only dependency graph
563+
# Output only dependency graph
564564
tsg --stdout deps
565565

566566
# Output both (explicit)
@@ -629,4 +629,3 @@ flowchart
629629
- Maintainability Index
630630
- Cyclomatic Complexity
631631
- Cognitive Complexity
632-

docs/README_en.md

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -181,49 +181,6 @@ Also, for large repositories, Mermaid may exceed the maximum amount of data that
181181

182182
In that case, you need to narrow down the directories to include in the graph.
183183

184-
### For AI Agents
185-
186-
When using TypeScript Graph with AI agents, the `--stdout` option provides structured output that's easy to parse and analyze:
187-
188-
```bash
189-
# Analyze codebase architecture and get both dependency graph and metrics
190-
tsg --stdout
191-
192-
# Get only code metrics for quality assessment
193-
tsg --stdout metrics
194-
195-
# Get only dependency relationships for architecture analysis
196-
tsg --stdout deps
197-
```
198-
199-
**Example prompts for AI agents:**
200-
201-
```
202-
Analyze this TypeScript codebase architecture:
203-
$(tsg --stdout deps)
204-
205-
Identify circular dependencies and suggest refactoring strategies.
206-
```
207-
208-
```
209-
Review code quality metrics:
210-
$(tsg --stdout metrics)
211-
212-
Identify files with low maintainability index and high complexity that need refactoring.
213-
```
214-
215-
```
216-
Full codebase analysis:
217-
$(tsg --stdout)
218-
219-
Provide architectural insights and code quality recommendations.
220-
```
221-
222-
```
223-
Review code quality for changes in the current branch:
224-
$(tsg --stdout --include $(git diff --name-only main | tr '\n' ' '))
225-
```
226-
227184
### Arguments or `--include`
228185

229186
To narrow down the directories or files included in the graph, specify the paths or parts of the paths using either the argument or the `--include` option.
@@ -434,6 +391,49 @@ flowchart LR
434391

435392
It makes it easier to share problems within the team. 👍
436393

394+
### For AI Agents
395+
396+
When using TypeScript Graph with AI agents, the `--stdout` option provides structured output that's easy to parse and analyze:
397+
398+
```bash
399+
# Analyze codebase architecture and get both dependency graph and metrics
400+
tsg --stdout
401+
402+
# Get only code metrics for quality assessment
403+
tsg --stdout metrics
404+
405+
# Get only dependency relationships for architecture analysis
406+
tsg --stdout deps
407+
```
408+
409+
**Example prompts for AI agents:**
410+
411+
```
412+
Analyze this TypeScript codebase architecture:
413+
$(tsg --stdout deps)
414+
415+
Identify circular dependencies and suggest refactoring strategies.
416+
```
417+
418+
```
419+
Review code quality metrics:
420+
$(tsg --stdout metrics)
421+
422+
Identify files with low maintainability index and high complexity that need refactoring.
423+
```
424+
425+
```
426+
Full codebase analysis:
427+
$(tsg --stdout)
428+
429+
Provide architectural insights and code quality recommendations.
430+
```
431+
432+
```
433+
Review code quality for changes in the current branch:
434+
$(tsg --stdout --include $(git diff --name-only main | tr '\n' ' '))
435+
```
436+
437437
## Code Metrics Measurement
438438

439439
This is a beta feature for measuring code metrics such as the Maintainability Index, Cyclomatic Complexity, and Cognitive Complexity. While these metrics are widely recognized, their reliability in TypeScript-specific contexts is not guaranteed. Nonetheless, they can serve as helpful indicators for evaluating code quality.
@@ -536,7 +536,7 @@ You can monitor file changes in real time and display metrics such as the Mainta
536536
tsg --watch-metrics
537537
```
538538

539-
![tsg --watch-metrics result](docs/img/watch-metrics.png)
539+
![tsg --watch-metrics result](/docs/img/watch-metrics.png)
540540

541541
The values in `()` represent the difference from when monitoring started. Improvements are displayed in green, while regressions are shown in red. Whether an increase or decrease is better depends on the metric. The following table outlines the preferred directions for each metric:
542542

@@ -560,7 +560,7 @@ tsg --stdout
560560
# Output only metrics
561561
tsg --stdout metrics
562562

563-
# Output only dependency graph
563+
# Output only dependency graph
564564
tsg --stdout deps
565565

566566
# Output both (explicit)
@@ -629,4 +629,3 @@ flowchart
629629
- Maintainability Index
630630
- Cyclomatic Complexity
631631
- Cognitive Complexity
632-

docs/README_ja.md

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ npm install --global @ysk8hori/typescript-graph
8787
| `-w, --watch-metrics` | ファイルの変更をリアルタイムで監視し、変更が発生するたびに Maintainability Index、Cyclomatic Complexity、Cognitive Complexity などのメトリクスを表示します。継続的な品質チェックに利用可能です。 |
8888
| `--config-file` | 設定ファイルへの相対パスを指定します(カレントディレクトリまたは -d, --dir で指定された場所から)。デフォルトは .tsgrc.json です。 |
8989
| `--vue` (experimental) | `.vue` ファイルも対象とします。Node.js の `fs.mkdtempSync` によって作業ディレクトリを作成し、そこへ tsc 対象となるファイルと `.vue` ファイルをコピーして解析します。`.vue` ファイルは `.vue.ts` へとリネームしますが、すでにそのファイルが存在する場合はリネームしません。 |
90-
| `--stdout [types...]` | 構造化データを標準出力に出力します。types: `metrics`, `deps`, または省略で全て(デフォルト: 全て)。例: `--stdout` (全て), `--stdout metrics` (メトリクスのみ), `--stdout deps` (依存グラフのみ), `--stdout metrics deps` (両方) |
90+
| `--stdout [types...]` | 構造化データを標準出力に出力します。types: `metrics`, `deps`, または省略で全て(デフォルト: 全て)。例: `--stdout` (全て), `--stdout metrics` (メトリクスのみ), `--stdout deps` (依存グラフのみ), `--stdout metrics deps` (両方) |
9191
| `-h, --help` | コマンドのヘルプを表示します。 |
9292

9393
## 使い方
@@ -181,49 +181,6 @@ flowchart
181181

182182
その場合、グラフに含めるディレクトリを絞り込む必要があります。
183183

184-
### AI エージェント向け
185-
186-
AI エージェントと TypeScript Graph を使用する場合、`--stdout` オプションで構造化された出力を提供し、解析しやすい形式でデータを得ることができます:
187-
188-
```bash
189-
# コードベースアーキテクチャを分析し、依存関係グラフとメトリクスの両方を取得
190-
tsg --stdout
191-
192-
# 品質評価のためのコードメトリクスのみを取得
193-
tsg --stdout metrics
194-
195-
# アーキテクチャ分析のための依存関係のみを取得
196-
tsg --stdout deps
197-
```
198-
199-
**AI エージェントのためのプロンプト例:**
200-
201-
```
202-
このTypeScriptコードベースのアーキテクチャを分析してください:
203-
$(tsg --stdout deps)
204-
205-
循環依存を特定し、リファクタリング戦略を提案してください。
206-
```
207-
208-
```
209-
コード品質メトリクスをレビューしてください:
210-
$(tsg --stdout metrics)
211-
212-
保守性指数が低く、複雑度が高いファイルを特定し、リファクタリングが必要なファイルを見つけてください。
213-
```
214-
215-
```
216-
完全なコードベース分析:
217-
$(tsg --stdout)
218-
219-
アーキテクチャの洞察とコード品質の推奨事項を提供してください。
220-
```
221-
222-
```
223-
現在のブランチでの変更のコード品質をレビューしてください:
224-
$(tsg --stdout --include $(git diff --name-only main | tr '\n' ' '))
225-
```
226-
227184
### 引数または `--include` オプション
228185

229186
グラフに含めるディレクトリやファイルを絞り込むには、引数または `--include` オプションでパスまたはその一部を指定します。
@@ -437,6 +394,49 @@ flowchart LR
437394

438395
さらにチームと問題の共有がしやすくなりました 👍
439396

397+
### AI エージェント向け
398+
399+
AI エージェントと TypeScript Graph を使用する場合、`--stdout` オプションで構造化された出力を提供し、解析しやすい形式でデータを得ることができます:
400+
401+
```bash
402+
# コードベースアーキテクチャを分析し、依存関係グラフとメトリクスの両方を取得
403+
tsg --stdout
404+
405+
# 品質評価のためのコードメトリクスのみを取得
406+
tsg --stdout metrics
407+
408+
# アーキテクチャ分析のための依存関係のみを取得
409+
tsg --stdout deps
410+
```
411+
412+
**AI エージェントのためのプロンプト例:**
413+
414+
```
415+
このTypeScriptコードベースのアーキテクチャを分析してください:
416+
$(tsg --stdout deps)
417+
418+
循環依存を特定し、リファクタリング戦略を提案してください。
419+
```
420+
421+
```
422+
コード品質メトリクスをレビューしてください:
423+
$(tsg --stdout metrics)
424+
425+
保守性指数が低く、複雑度が高いファイルを特定し、リファクタリングが必要なファイルを見つけてください。
426+
```
427+
428+
```
429+
完全なコードベース分析:
430+
$(tsg --stdout)
431+
432+
アーキテクチャの洞察とコード品質の推奨事項を提供してください。
433+
```
434+
435+
```
436+
現在のブランチでの変更のコード品質をレビューしてください:
437+
$(tsg --stdout --include $(git diff --name-only main | tr '\n' ' '))
438+
```
439+
440440
## コードメトリクスの測定
441441

442442
保守性指数(Maintainability Index)、サイクロマティック複雑度(Cyclomatic Complexity)、認知的複雑度(Cognitive Complexity)などのコード・メトリクスを測定するベータ機能です。これらのメトリクスは一般的に知られていますが、TypeScript に当てはめた場合には信頼性が高いものではありません。それでも、コードの品質について考える際の指標にはなりうると考えています。
@@ -539,7 +539,7 @@ function volume(): number {
539539
tsg --watch-metrics
540540
```
541541

542-
![tsg --watch-metrics result](img/watch-metrics.png)
542+
![tsg --watch-metrics result](/docs/img/watch-metrics.png)
543543

544544
`()` 内の値は、監視開始時からの差分です。より良い値へと変わった場合は緑で、より悪い値へ変わった場合は赤で表示します。値の増減の良し悪しはメトリクスによって異なります。以下に対応表を記載します。
545545

@@ -618,4 +618,3 @@ flowchart
618618
- 保守性指数
619619
- サイクロマティック複雑度
620620
- 認知的複雑度
621-

0 commit comments

Comments
 (0)