durable-map 0.1.1 → 0.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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +68 -102
  3. package/package.json +29 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Taishi Yamashita
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,137 +1,103 @@
1
1
  # durable-map
2
2
 
3
- Azure Durable Functions の C# プロジェクトを解析し、関数の呼び出し関係を Markdown / JSON / HTML + Mermaid で可視化する CLI ツール。
3
+ [![npm version](https://img.shields.io/npm/v/durable-map.svg)](https://www.npmjs.com/package/durable-map)
4
+ [![npm downloads](https://img.shields.io/npm/dm/durable-map.svg)](https://www.npmjs.com/package/durable-map)
5
+ [![license](https://img.shields.io/npm/l/durable-map.svg)](https://github.com/taishiyamashita1114/durable-map/blob/main/LICENSE)
4
6
 
5
- ## インストール
7
+ > Analyze Azure Durable Functions projects and auto-generate documentation with Mermaid flow diagrams.
6
8
 
7
- ```bash
8
- npm install
9
- npm run build
10
- ```
11
-
12
- ## 基本的な使い方
13
-
14
- ```bash
15
- npx tsx src/index.ts <C#プロジェクトのパス> [options]
16
- ```
17
-
18
- 対象パスの `.cs` ファイルを再帰的にスキャンし、Durable Functions の定義(Client / Orchestrator / Activity / Entity)と呼び出し関係を解析します。
9
+ Azure Durable Functions の構成を静的解析し、トリガー → オーケストレーター → アクティビティ → インフラ層の呼び出し関係をドキュメントと Mermaid フローチャートで自動生成する CLI ツール。
19
10
 
20
- ### 出力形式
11
+ ## Features
21
12
 
22
- ```bash
23
- # Markdown 出力(デフォルト)— stdout に出力
24
- npx tsx src/index.ts ./MyFunctionsProject
25
-
26
- # ファイルに保存
27
- npx tsx src/index.ts ./MyFunctionsProject -o output.md
13
+ - C# isolated worker model の自動解析
14
+ - Mermaid フローチャートの自動生成
15
+ - Markdown / JSON / HTML ドキュメントの自動生成
16
+ - トリガー → オーケストレーター → アクティビティの呼び出し関係を可視化
17
+ - インフラ層(CosmosDB, Blob Storage, Queue, Service Bus 等)の検出
18
+ - `@durable-map:infra` アノテーションによる手動補完
28
19
 
29
- # HTML 出力(ブラウザで Mermaid 図をレンダリング)
30
- npx tsx src/index.ts ./MyFunctionsProject -f html -o output.html
20
+ ## Output Example
31
21
 
32
- # JSON 出力(他ツールとの連携用)
33
- npx tsx src/index.ts ./MyFunctionsProject -f json -o output.json
34
-
35
- # Mermaid 図なしの Markdown
36
- npx tsx src/index.ts ./MyFunctionsProject --no-mermaid
22
+ ```mermaid
23
+ graph LR
24
+ A[HTTP POST /api/order] --> B[Orchestrator: ProcessOrder]
25
+ B --> C[Activity: ValidateOrder]
26
+ C --> D[(CosmosDB: orders)]
27
+ B --> E[Activity: ChargePayment]
28
+ E --> F[/Stripe API/]
29
+ B --> G[Activity: SendConfirmation]
30
+ G --> H[/SendGrid/]
37
31
  ```
38
32
 
39
- ### 表示深度(`--depth`)
33
+ ## Quick Start
40
34
 
41
35
  ```bash
42
- # shallow(デフォルト): Client → Orchestrator の関係のみ
43
- npx tsx src/index.ts ./MyFunctionsProject
44
-
45
- # deep: Client → Orchestrator → Activity まで表示
46
- npx tsx src/index.ts ./MyFunctionsProject -d deep
36
+ npx durable-map ./path/to/azure-functions-project
47
37
 
48
- # deep + HTML で全体像をブラウザ確認
49
- npx tsx src/index.ts ./MyFunctionsProject -d deep -f html -o output.html
38
+ npm install -g durable-map
39
+ durable-map ./path/to/project
50
40
  ```
51
41
 
52
- | Mode | 表示内容 |
53
- |---|---|
54
- | `shallow` (デフォルト) | Client → Orchestrator の呼び出し関係のみ |
55
- | `deep` | Client → Orchestrator → Activity ノードまで表示。アノテーションで指定されたインフラ情報も含む |
56
-
57
- ### その他のオプション
42
+ ## Options
58
43
 
59
44
  ```bash
60
- # 特定ディレクトリを除外
61
- npx tsx src/index.ts ./MyFunctionsProject --exclude "**/Tests/**" "**/bin/**"
45
+ durable-map ./path/to/project --output ./docs/durable-map.md
62
46
 
63
- # 詳細ログ
64
- npx tsx src/index.ts ./MyFunctionsProject -v
65
- ```
47
+ durable-map ./path/to/project --format json
66
48
 
67
- ### オプション一覧
49
+ durable-map ./path/to/project --format html --output output.html
50
+
51
+ durable-map ./path/to/project --depth deep
52
+ ```
68
53
 
69
54
  | Option | Description |
70
55
  |---|---|
71
- | `-f, --format <format>` | 出力形式 (`markdown` \| `json` \| `html`) デフォルト: `markdown` |
72
- | `-o, --output <file>` | 出力先ファイル (デフォルト: stdout) |
73
- | `-d, --depth <mode>` | 表示深度 (`shallow` \| `deep`) デフォルト: `shallow` |
74
- | `--exclude <patterns...>` | 除外パターン |
75
- | `--no-mermaid` | Mermaid 図を生成しない |
76
- | `-v, --verbose` | 詳細ログ |
56
+ | `-f, --format <format>` | Output format (`markdown` \| `json` \| `html`) Default: `markdown` |
57
+ | `-o, --output <file>` | Output file (default: stdout) |
58
+ | `-d, --depth <mode>` | Display depth (`shallow` \| `deep`) Default: `shallow` |
59
+ | `--exclude <patterns...>` | Exclude patterns |
60
+ | `--no-mermaid` | Disable Mermaid diagram generation |
61
+ | `-v, --verbose` | Verbose logging |
77
62
 
78
- ## アノテーション
63
+ ## Supported Languages
79
64
 
80
- Activity 関数のコード内に `// @durable-map:infra` コメントを記述すると、`--depth deep` 使用時に Mermaid 図へインフラノード(DB・Queue 等)を表示できます。
81
-
82
- ```csharp
83
- [Function("SaveOrderActivity")]
84
- public async Task Run([ActivityTrigger] OrderData input)
85
- {
86
- // @durable-map:infra cosmosdb:orders "Order database"
87
- // @durable-map:infra blob:receipts
88
- await _container.CreateItemAsync(input);
89
- }
90
- ```
65
+ | Language | Model | Status |
66
+ |----------|-------|--------|
67
+ | C# | isolated worker | Supported |
68
+ | Python | V2 | Planned |
69
+ | TypeScript | V4 | Planned |
91
70
 
92
- **書式:** `// @durable-map:infra <kind>:<resource> "<description>"`
71
+ ## How It Works
93
72
 
94
- | パラメータ | 必須 | 説明 |
95
- |---|---|---|
96
- | `kind` | Yes | `cosmosdb` \| `blob` \| `queue` \| `table` \| `servicebus` \| `eventhub` \| `http` \| `sql` |
97
- | `resource` | No | リソース名(コンテナ名、キュー名など) |
98
- | `description` | No | 説明文(ダブルクォートで囲む) |
73
+ 1. Recursively scans `.cs` files in the target directory
74
+ 2. Detects `[Function]`, `[HttpTrigger]`, `[OrchestrationTrigger]`, `[ActivityTrigger]` attributes
75
+ 3. Analyzes `CallActivityAsync`, `CallSubOrchestratorAsync` call patterns
76
+ 4. Builds a call graph and outputs Markdown + Mermaid
99
77
 
100
- ## Mermaid 図の手動編集
78
+ ## Infrastructure Detection
101
79
 
102
- 生成された Mermaid 図にインフラ層を手動で追記することもできます。
80
+ Activities are scanned for Azure SDK client usage:
103
81
 
104
- ```mermaid
105
- graph LR
106
- HttpStart(["HttpStart"])
107
- Orchestrator[["Orchestrator"]]
108
- SaveOrder["SaveOrder"]
109
- HttpStart -->|scheduleOrchestration| Orchestrator
110
- Orchestrator -->|callActivity| SaveOrder
111
-
112
- %% インフラ層(手動追記)
113
- CosmosDB[("CosmosDB\norders")]
114
- BlobStorage[("Blob\nuploads")]
115
- SaveOrder -.->|cosmosdb| CosmosDB
116
- SaveOrder -.->|blob| BlobStorage
117
- ```
82
+ - CosmosDB (`CosmosClient`)
83
+ - Blob Storage (`BlobServiceClient`)
84
+ - Queue Storage / Service Bus (`QueueClient`, `ServiceBusClient`)
85
+ - Table Storage (`TableClient`)
86
+ - Event Hub (`EventHubProducerClient`)
87
+ - HTTP API (`HttpClient`)
118
88
 
119
- ノード形状の目安:
89
+ Use annotations for manual supplementation:
120
90
 
121
- | 種別 | Mermaid 記法 | 例 |
122
- |---|---|---|
123
- | DB 系 | `[("label")]` (シリンダー) | `CosmosDB[("CosmosDB")]` |
124
- | Queue / Stream | `[["label"]]` (二重四角) | `Queue[["Queue"]]` |
125
- | 外部 API | `>"label"]` (非対称) | `API>"External API"]` |
91
+ ```csharp
92
+ // @durable-map:infra cosmosdb:orders "Order database"
93
+ // @durable-map:infra blob:receipts
94
+ public class SaveOrder : TaskActivity<OrderData, bool> { ... }
95
+ ```
126
96
 
127
- ## Development
97
+ ## Feedback / Contact
128
98
 
129
- ```bash
130
- npm install
131
- npm test
132
- ```
99
+ [Contact Form](https://forms.gle/2VvCjT3EDesHJsBU8)
133
100
 
134
- ## Roadmap
101
+ ## License
135
102
 
136
- - Mermaid 図の整形・レイアウト改善
137
- - Azure Subscription 連携 (App Service Plan / App Service 名などのインフラ情報を出力に含める)
103
+ MIT
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "durable-map",
3
- "version": "0.1.1",
4
- "description": "Azure Durable Functions の構成を Markdown + Mermaid で可視化する CLI ツール",
3
+ "version": "0.1.2",
4
+ "description": "CLI tool to analyze Azure Durable Functions projects and auto-generate documentation with Mermaid flow diagrams. Visualize triggers, orchestrators, activities, and infrastructure dependencies.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "durable-map": "./dist/index.js"
@@ -18,9 +18,34 @@
18
18
  },
19
19
  "keywords": [
20
20
  "azure",
21
+ "azure-functions",
21
22
  "durable-functions",
22
- "visualization",
23
- "mermaid"
23
+ "durable-task",
24
+ "orchestration",
25
+ "orchestrator",
26
+ "serverless",
27
+ "mermaid",
28
+ "diagram",
29
+ "flowchart",
30
+ "documentation",
31
+ "documentation-generator",
32
+ "doc-generator",
33
+ "static-analysis",
34
+ "code-analysis",
35
+ "cli",
36
+ "csharp",
37
+ "dotnet",
38
+ "isolated-worker",
39
+ "architecture",
40
+ "architecture-diagram",
41
+ "function-chaining",
42
+ "fan-out-fan-in",
43
+ "workflow",
44
+ "flow-diagram",
45
+ "code-visualization",
46
+ "call-graph",
47
+ "dependency-graph",
48
+ "infrastructure"
24
49
  ],
25
50
  "license": "MIT",
26
51
  "dependencies": {