flowbook 0.1.0

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/README.de.md ADDED
@@ -0,0 +1,170 @@
1
+ # Flowbook
2
+
3
+ > [English](./README.md) | [한국어](./README.ko.md) | [简体中文](./README.zh-CN.md) | [日本語](./README.ja.md) | [Español](./README.es.md) | [Português (BR)](./README.pt-BR.md) | [Français](./README.fr.md) | [Русский](./README.ru.md) | **Deutsch**
4
+
5
+ Storybook für Flussdiagramme. Erkennt automatisch Mermaid-Diagrammdateien in Ihrer Codebasis, organisiert sie nach Kategorien und rendert sie in einem browserbaren Viewer.
6
+
7
+ ![Vite](https://img.shields.io/badge/vite-6.x-646CFF?logo=vite&logoColor=white)
8
+ ![React](https://img.shields.io/badge/react-19.x-61DAFB?logo=react&logoColor=white)
9
+ ![Mermaid](https://img.shields.io/badge/mermaid-11.x-FF3670?logo=mermaid&logoColor=white)
10
+ ![TypeScript](https://img.shields.io/badge/typescript-5.x-3178C6?logo=typescript&logoColor=white)
11
+
12
+ ## Schnellstart
13
+
14
+ ```bash
15
+ # Installieren
16
+ npm install -D flowbook
17
+
18
+ # Initialisieren — fügt Skripte + Beispieldatei hinzu
19
+ npx flowbook init
20
+
21
+ # Entwicklungsserver starten
22
+ npm run flowbook
23
+ # → http://localhost:6200
24
+
25
+ # Statische Seite erstellen
26
+ npm run build-flowbook
27
+ # → flowbook-static/
28
+ ```
29
+
30
+ ## CLI
31
+
32
+ ```
33
+ flowbook init Flowbook im Projekt einrichten
34
+ flowbook dev [--port 6200] Entwicklungsserver starten
35
+ flowbook build [--out-dir d] Statische Seite erstellen
36
+ ```
37
+
38
+ ### `flowbook init`
39
+
40
+ - Fügt die Skripte `"flowbook"` und `"build-flowbook"` zu Ihrer `package.json` hinzu
41
+ - Erstellt `flows/example.flow.md` als Startvorlage
42
+
43
+ ### `flowbook dev`
44
+
45
+ Startet einen Vite-Entwicklungsserver unter `http://localhost:6200` mit HMR. Änderungen an `.flow.md`- oder `.flowchart.md`-Dateien werden sofort übernommen.
46
+
47
+ ### `flowbook build`
48
+
49
+ Erstellt eine statische Seite in `flowbook-static/` (konfigurierbar über `--out-dir`). Überall deploybar.
50
+
51
+ ## Flow-Dateien Erstellen
52
+
53
+ Erstellen Sie eine `.flow.md`- (oder `.flowchart.md`-) Datei an beliebiger Stelle in Ihrem Projekt:
54
+
55
+ ````markdown
56
+ ---
57
+ title: Login-Ablauf
58
+ category: Authentifizierung
59
+ tags: [auth, login, oauth]
60
+ order: 1
61
+ description: Benutzer-Authentifizierungsablauf mit OAuth2
62
+ ---
63
+
64
+ ```mermaid
65
+ flowchart TD
66
+ A[Benutzer] --> B{Authentifiziert?}
67
+ B -->|Ja| C[Dashboard]
68
+ B -->|Nein| D[Login-Seite]
69
+ ```
70
+ ````
71
+
72
+ Flowbook erkennt die Datei automatisch und fügt sie dem Viewer hinzu.
73
+
74
+ ## Frontmatter-Schema
75
+
76
+ | Feld | Typ | Erforderlich | Beschreibung |
77
+ |---------------|------------|--------------|---------------------------------------|
78
+ | `title` | `string` | Nein | Angezeigter Titel (Standard: Dateiname) |
79
+ | `category` | `string` | Nein | Kategorie in der Seitenleiste (Standard: "Uncategorized") |
80
+ | `tags` | `string[]` | Nein | Filterbare Tags |
81
+ | `order` | `number` | Nein | Sortierreihenfolge innerhalb der Kategorie (Standard: 999) |
82
+ | `description` | `string` | Nein | Beschreibung in der Detailansicht |
83
+
84
+ ## Datei-Erkennung
85
+
86
+ Flowbook durchsucht standardmäßig folgende Muster:
87
+
88
+ ```
89
+ **/*.flow.md
90
+ **/*.flowchart.md
91
+ ```
92
+
93
+ Ignoriert `node_modules/`, `.git/` und `dist/`.
94
+
95
+ ## Funktionsweise
96
+
97
+ ```
98
+ .flow.md-Dateien ──→ Vite-Plugin ──→ Virtuelles Modul ──→ React-Viewer
99
+ │ │
100
+ ├─ fast-glob-Scan ├─ export default { flows: [...] }
101
+ ├─ gray-matter │
102
+ │ Parsing └─ HMR bei Dateiänderung
103
+ └─ Mermaid-Block
104
+ Extraktion
105
+ ```
106
+
107
+ 1. **Erkennung** — `fast-glob` durchsucht das Projekt nach `*.flow.md` / `*.flowchart.md`
108
+ 2. **Parsing** — `gray-matter` extrahiert YAML-Frontmatter; Regex extrahiert `` ```mermaid ``-Blöcke
109
+ 3. **Virtuelles Modul** — Vite-Plugin stellt geparste Daten als `virtual:flowbook-data` bereit
110
+ 4. **Rendering** — React-App rendert Mermaid-Diagramme über `mermaid.render()`
111
+ 5. **HMR** — Dateiänderungen invalidieren das virtuelle Modul und lösen ein Neuladen aus
112
+
113
+ ## Projektstruktur
114
+
115
+ ```
116
+ src/
117
+ ├── types.ts # Gemeinsame Typen (FlowEntry, FlowbookData)
118
+ ├── node/
119
+ │ ├── cli.ts # CLI-Einstiegspunkt (init, dev, build)
120
+ │ ├── server.ts # Programmatischer Vite-Server & Build
121
+ │ ├── init.ts # Projekt-Initialisierungslogik
122
+ │ ├── discovery.ts # Datei-Scanner (fast-glob)
123
+ │ ├── parser.ts # Frontmatter + Mermaid-Extraktion
124
+ │ └── plugin.ts # Vite-Plugin für virtuelles Modul
125
+ └── client/
126
+ ├── index.html # Einstiegs-HTML
127
+ ├── main.tsx # React-Einstiegspunkt
128
+ ├── App.tsx # Layout mit Suche + Seitenleiste + Viewer
129
+ ├── vite-env.d.ts # Typdeklarationen für virtuelles Modul
130
+ ├── styles/globals.css # Tailwind v4 + benutzerdefinierte Stile
131
+ └── components/
132
+ ├── Header.tsx # Logo, Suchleiste, Flow-Anzahl
133
+ ├── Sidebar.tsx # Einklappbarer Kategoriebaum
134
+ ├── MermaidRenderer.tsx # Mermaid-Diagramm-Rendering
135
+ ├── FlowView.tsx # Einzelne Flow-Detailansicht
136
+ └── EmptyState.tsx # Leerzustand mit Anleitung
137
+ ```
138
+
139
+ ## Entwicklung (Beitragen)
140
+
141
+ ```bash
142
+ git clone https://github.com/Epsilondelta-ai/flowbook.git
143
+ cd flowbook
144
+ npm install
145
+
146
+ # Lokale Entwicklung (verwendet die Root-vite.config.ts)
147
+ npm run dev
148
+
149
+ # CLI erstellen
150
+ npm run build
151
+
152
+ # CLI lokal testen
153
+ node dist/cli.js dev
154
+ node dist/cli.js build
155
+ ```
156
+
157
+ ## Technologie-Stack
158
+
159
+ - **Vite** — Entwicklungsserver mit HMR
160
+ - **React 19** — Benutzeroberfläche
161
+ - **Mermaid 11** — Diagramm-Rendering
162
+ - **Tailwind CSS v4** — Styling
163
+ - **gray-matter** — YAML-Frontmatter-Parsing
164
+ - **fast-glob** — Datei-Erkennung
165
+ - **tsup** — CLI-Bundler
166
+ - **TypeScript** — Typsicherheit
167
+
168
+ ## Lizenz
169
+
170
+ MIT
package/README.es.md ADDED
@@ -0,0 +1,170 @@
1
+ # Flowbook
2
+
3
+ > [English](./README.md) | [한국어](./README.ko.md) | [简体中文](./README.zh-CN.md) | [日本語](./README.ja.md) | **Español** | [Português (BR)](./README.pt-BR.md) | [Français](./README.fr.md) | [Русский](./README.ru.md) | [Deutsch](./README.de.md)
4
+
5
+ Storybook para diagramas de flujo. Descubre automáticamente archivos de diagramas Mermaid en tu código, los organiza por categoría y los renderiza en un visor navegable.
6
+
7
+ ![Vite](https://img.shields.io/badge/vite-6.x-646CFF?logo=vite&logoColor=white)
8
+ ![React](https://img.shields.io/badge/react-19.x-61DAFB?logo=react&logoColor=white)
9
+ ![Mermaid](https://img.shields.io/badge/mermaid-11.x-FF3670?logo=mermaid&logoColor=white)
10
+ ![TypeScript](https://img.shields.io/badge/typescript-5.x-3178C6?logo=typescript&logoColor=white)
11
+
12
+ ## Inicio Rápido
13
+
14
+ ```bash
15
+ # Instalar
16
+ npm install -D flowbook
17
+
18
+ # Inicializar — agrega scripts + archivo de ejemplo
19
+ npx flowbook init
20
+
21
+ # Iniciar servidor de desarrollo
22
+ npm run flowbook
23
+ # → http://localhost:6200
24
+
25
+ # Construir sitio estático
26
+ npm run build-flowbook
27
+ # → flowbook-static/
28
+ ```
29
+
30
+ ## CLI
31
+
32
+ ```
33
+ flowbook init Configurar Flowbook en tu proyecto
34
+ flowbook dev [--port 6200] Iniciar el servidor de desarrollo
35
+ flowbook build [--out-dir d] Construir un sitio estático
36
+ ```
37
+
38
+ ### `flowbook init`
39
+
40
+ - Agrega los scripts `"flowbook"` y `"build-flowbook"` a tu `package.json`
41
+ - Crea `flows/example.flow.md` como plantilla inicial
42
+
43
+ ### `flowbook dev`
44
+
45
+ Inicia un servidor de desarrollo Vite en `http://localhost:6200` con HMR. Cualquier cambio en archivos `.flow.md` o `.flowchart.md` se refleja instantáneamente.
46
+
47
+ ### `flowbook build`
48
+
49
+ Construye un sitio estático en `flowbook-static/` (configurable con `--out-dir`). Despliégalo en cualquier lugar.
50
+
51
+ ## Escribir Archivos de Flujo
52
+
53
+ Crea un archivo `.flow.md` (o `.flowchart.md`) en cualquier lugar de tu proyecto:
54
+
55
+ ````markdown
56
+ ---
57
+ title: Flujo de Login
58
+ category: Autenticación
59
+ tags: [auth, login, oauth]
60
+ order: 1
61
+ description: Flujo de autenticación de usuario con OAuth2
62
+ ---
63
+
64
+ ```mermaid
65
+ flowchart TD
66
+ A[Usuario] --> B{¿Autenticado?}
67
+ B -->|Sí| C[Dashboard]
68
+ B -->|No| D[Página de Login]
69
+ ```
70
+ ````
71
+
72
+ Flowbook descubre automáticamente el archivo y lo agrega al visor.
73
+
74
+ ## Esquema de Frontmatter
75
+
76
+ | Campo | Tipo | Requerido | Descripción |
77
+ |---------------|------------|-----------|---------------------------------------|
78
+ | `title` | `string` | No | Título a mostrar (por defecto: nombre del archivo) |
79
+ | `category` | `string` | No | Categoría en la barra lateral (por defecto: "Uncategorized") |
80
+ | `tags` | `string[]` | No | Etiquetas filtrables |
81
+ | `order` | `number` | No | Orden dentro de la categoría (por defecto: 999) |
82
+ | `description` | `string` | No | Descripción en la vista detallada |
83
+
84
+ ## Descubrimiento de Archivos
85
+
86
+ Flowbook escanea estos patrones por defecto:
87
+
88
+ ```
89
+ **/*.flow.md
90
+ **/*.flowchart.md
91
+ ```
92
+
93
+ Ignora `node_modules/`, `.git/` y `dist/`.
94
+
95
+ ## Cómo Funciona
96
+
97
+ ```
98
+ archivos .flow.md ──→ Plugin Vite ──→ Módulo Virtual ──→ Visor React
99
+ │ │
100
+ ├─ escaneo fast-glob ├─ export default { flows: [...] }
101
+ ├─ gray-matter │
102
+ │ parseo └─ HMR en cambio de archivo
103
+ └─ bloque mermaid
104
+ extracción
105
+ ```
106
+
107
+ 1. **Descubrimiento** — `fast-glob` escanea el proyecto buscando `*.flow.md` / `*.flowchart.md`
108
+ 2. **Parseo** — `gray-matter` extrae el frontmatter YAML; regex extrae bloques `` ```mermaid ``
109
+ 3. **Módulo Virtual** — El plugin de Vite sirve los datos parseados como `virtual:flowbook-data`
110
+ 4. **Renderizado** — La app React renderiza diagramas Mermaid via `mermaid.render()`
111
+ 5. **HMR** — Los cambios en archivos invalidan el módulo virtual, disparando una recarga
112
+
113
+ ## Estructura del Proyecto
114
+
115
+ ```
116
+ src/
117
+ ├── types.ts # Tipos compartidos (FlowEntry, FlowbookData)
118
+ ├── node/
119
+ │ ├── cli.ts # Punto de entrada CLI (init, dev, build)
120
+ │ ├── server.ts # Servidor Vite programático y build
121
+ │ ├── init.ts # Lógica de inicialización del proyecto
122
+ │ ├── discovery.ts # Escáner de archivos (fast-glob)
123
+ │ ├── parser.ts # Extracción de frontmatter + mermaid
124
+ │ └── plugin.ts # Plugin de módulo virtual de Vite
125
+ └── client/
126
+ ├── index.html # HTML de entrada
127
+ ├── main.tsx # Entrada React
128
+ ├── App.tsx # Layout con búsqueda + barra lateral + visor
129
+ ├── vite-env.d.ts # Declaraciones de tipo del módulo virtual
130
+ ├── styles/globals.css # Tailwind v4 + estilos personalizados
131
+ └── components/
132
+ ├── Header.tsx # Logo, barra de búsqueda, conteo de flujos
133
+ ├── Sidebar.tsx # Árbol de categorías colapsable
134
+ ├── MermaidRenderer.tsx # Renderizado de diagramas Mermaid
135
+ ├── FlowView.tsx # Vista detallada de flujo individual
136
+ └── EmptyState.tsx # Estado vacío con guía
137
+ ```
138
+
139
+ ## Desarrollo (Contribución)
140
+
141
+ ```bash
142
+ git clone https://github.com/Epsilondelta-ai/flowbook.git
143
+ cd flowbook
144
+ npm install
145
+
146
+ # Desarrollo local (usa el vite.config.ts raíz)
147
+ npm run dev
148
+
149
+ # Construir CLI
150
+ npm run build
151
+
152
+ # Probar CLI localmente
153
+ node dist/cli.js dev
154
+ node dist/cli.js build
155
+ ```
156
+
157
+ ## Stack Tecnológico
158
+
159
+ - **Vite** — Servidor de desarrollo con HMR
160
+ - **React 19** — UI
161
+ - **Mermaid 11** — Renderizado de diagramas
162
+ - **Tailwind CSS v4** — Estilos
163
+ - **gray-matter** — Parseo de frontmatter YAML
164
+ - **fast-glob** — Descubrimiento de archivos
165
+ - **tsup** — Bundler de CLI
166
+ - **TypeScript** — Seguridad de tipos
167
+
168
+ ## Licencia
169
+
170
+ MIT
package/README.fr.md ADDED
@@ -0,0 +1,170 @@
1
+ # Flowbook
2
+
3
+ > [English](./README.md) | [한국어](./README.ko.md) | [简体中文](./README.zh-CN.md) | [日本語](./README.ja.md) | [Español](./README.es.md) | [Português (BR)](./README.pt-BR.md) | **Français** | [Русский](./README.ru.md) | [Deutsch](./README.de.md)
4
+
5
+ Storybook pour les diagrammes de flux. Découvre automatiquement les fichiers de diagrammes Mermaid dans votre code, les organise par catégorie et les affiche dans un visualiseur navigable.
6
+
7
+ ![Vite](https://img.shields.io/badge/vite-6.x-646CFF?logo=vite&logoColor=white)
8
+ ![React](https://img.shields.io/badge/react-19.x-61DAFB?logo=react&logoColor=white)
9
+ ![Mermaid](https://img.shields.io/badge/mermaid-11.x-FF3670?logo=mermaid&logoColor=white)
10
+ ![TypeScript](https://img.shields.io/badge/typescript-5.x-3178C6?logo=typescript&logoColor=white)
11
+
12
+ ## Démarrage Rapide
13
+
14
+ ```bash
15
+ # Installer
16
+ npm install -D flowbook
17
+
18
+ # Initialiser — ajoute les scripts + fichier d'exemple
19
+ npx flowbook init
20
+
21
+ # Démarrer le serveur de développement
22
+ npm run flowbook
23
+ # → http://localhost:6200
24
+
25
+ # Construire le site statique
26
+ npm run build-flowbook
27
+ # → flowbook-static/
28
+ ```
29
+
30
+ ## CLI
31
+
32
+ ```
33
+ flowbook init Configurer Flowbook dans votre projet
34
+ flowbook dev [--port 6200] Démarrer le serveur de développement
35
+ flowbook build [--out-dir d] Construire un site statique
36
+ ```
37
+
38
+ ### `flowbook init`
39
+
40
+ - Ajoute les scripts `"flowbook"` et `"build-flowbook"` à votre `package.json`
41
+ - Crée `flows/example.flow.md` comme modèle de départ
42
+
43
+ ### `flowbook dev`
44
+
45
+ Démarre un serveur de développement Vite sur `http://localhost:6200` avec HMR. Toute modification de fichiers `.flow.md` ou `.flowchart.md` est prise en compte instantanément.
46
+
47
+ ### `flowbook build`
48
+
49
+ Construit un site statique dans `flowbook-static/` (configurable via `--out-dir`). Déployez-le n'importe où.
50
+
51
+ ## Écrire des Fichiers de Flux
52
+
53
+ Créez un fichier `.flow.md` (ou `.flowchart.md`) n'importe où dans votre projet :
54
+
55
+ ````markdown
56
+ ---
57
+ title: Flux de Connexion
58
+ category: Authentification
59
+ tags: [auth, login, oauth]
60
+ order: 1
61
+ description: Flux d'authentification utilisateur avec OAuth2
62
+ ---
63
+
64
+ ```mermaid
65
+ flowchart TD
66
+ A[Utilisateur] --> B{Authentifié ?}
67
+ B -->|Oui| C[Tableau de bord]
68
+ B -->|Non| D[Page de connexion]
69
+ ```
70
+ ````
71
+
72
+ Flowbook découvre automatiquement le fichier et l'ajoute au visualiseur.
73
+
74
+ ## Schéma du Frontmatter
75
+
76
+ | Champ | Type | Requis | Description |
77
+ |---------------|------------|--------|----------------------------------------|
78
+ | `title` | `string` | Non | Titre affiché (par défaut : nom du fichier) |
79
+ | `category` | `string` | Non | Catégorie dans la barre latérale (par défaut : "Uncategorized") |
80
+ | `tags` | `string[]` | Non | Tags filtrables |
81
+ | `order` | `number` | Non | Ordre de tri dans la catégorie (par défaut : 999) |
82
+ | `description` | `string` | Non | Description affichée dans la vue détaillée |
83
+
84
+ ## Découverte des Fichiers
85
+
86
+ Flowbook analyse ces motifs par défaut :
87
+
88
+ ```
89
+ **/*.flow.md
90
+ **/*.flowchart.md
91
+ ```
92
+
93
+ Ignore `node_modules/`, `.git/` et `dist/`.
94
+
95
+ ## Fonctionnement
96
+
97
+ ```
98
+ fichiers .flow.md ──→ Plugin Vite ──→ Module Virtuel ──→ Visualiseur React
99
+ │ │
100
+ ├─ scan fast-glob ├─ export default { flows: [...] }
101
+ ├─ gray-matter │
102
+ │ parsing └─ HMR sur modification de fichier
103
+ └─ bloc mermaid
104
+ extraction
105
+ ```
106
+
107
+ 1. **Découverte** — `fast-glob` analyse le projet à la recherche de `*.flow.md` / `*.flowchart.md`
108
+ 2. **Parsing** — `gray-matter` extrait le frontmatter YAML ; regex extrait les blocs `` ```mermaid ``
109
+ 3. **Module Virtuel** — Le plugin Vite sert les données parsées comme `virtual:flowbook-data`
110
+ 4. **Rendu** — L'application React rend les diagrammes Mermaid via `mermaid.render()`
111
+ 5. **HMR** — Les modifications de fichiers invalident le module virtuel, déclenchant un rechargement
112
+
113
+ ## Structure du Projet
114
+
115
+ ```
116
+ src/
117
+ ├── types.ts # Types partagés (FlowEntry, FlowbookData)
118
+ ├── node/
119
+ │ ├── cli.ts # Point d'entrée CLI (init, dev, build)
120
+ │ ├── server.ts # Serveur Vite programmatique et build
121
+ │ ├── init.ts # Logique d'initialisation du projet
122
+ │ ├── discovery.ts # Scanner de fichiers (fast-glob)
123
+ │ ├── parser.ts # Extraction frontmatter + mermaid
124
+ │ └── plugin.ts # Plugin de module virtuel Vite
125
+ └── client/
126
+ ├── index.html # HTML d'entrée
127
+ ├── main.tsx # Entrée React
128
+ ├── App.tsx # Layout avec recherche + barre latérale + visualiseur
129
+ ├── vite-env.d.ts # Déclarations de type du module virtuel
130
+ ├── styles/globals.css # Tailwind v4 + styles personnalisés
131
+ └── components/
132
+ ├── Header.tsx # Logo, barre de recherche, nombre de flux
133
+ ├── Sidebar.tsx # Arbre de catégories repliable
134
+ ├── MermaidRenderer.tsx # Rendu des diagrammes Mermaid
135
+ ├── FlowView.tsx # Vue détaillée d'un flux individuel
136
+ └── EmptyState.tsx # État vide avec guide
137
+ ```
138
+
139
+ ## Développement (Contribution)
140
+
141
+ ```bash
142
+ git clone https://github.com/Epsilondelta-ai/flowbook.git
143
+ cd flowbook
144
+ npm install
145
+
146
+ # Développement local (utilise le vite.config.ts racine)
147
+ npm run dev
148
+
149
+ # Construire le CLI
150
+ npm run build
151
+
152
+ # Tester le CLI localement
153
+ node dist/cli.js dev
154
+ node dist/cli.js build
155
+ ```
156
+
157
+ ## Stack Technique
158
+
159
+ - **Vite** — Serveur de développement avec HMR
160
+ - **React 19** — Interface utilisateur
161
+ - **Mermaid 11** — Rendu de diagrammes
162
+ - **Tailwind CSS v4** — Stylisation
163
+ - **gray-matter** — Parsing de frontmatter YAML
164
+ - **fast-glob** — Découverte de fichiers
165
+ - **tsup** — Bundler CLI
166
+ - **TypeScript** — Sûreté de type
167
+
168
+ ## Licence
169
+
170
+ MIT
package/README.ja.md ADDED
@@ -0,0 +1,170 @@
1
+ # Flowbook
2
+
3
+ > [English](./README.md) | [한국어](./README.ko.md) | [简体中文](./README.zh-CN.md) | **日本語** | [Español](./README.es.md) | [Português (BR)](./README.pt-BR.md) | [Français](./README.fr.md) | [Русский](./README.ru.md) | [Deutsch](./README.de.md)
4
+
5
+ フローチャートのための Storybook。コードベースから Mermaid ダイアグラムファイルを自動検出し、カテゴリ別に整理して、ブラウザで閲覧可能なビューアでレンダリングします。
6
+
7
+ ![Vite](https://img.shields.io/badge/vite-6.x-646CFF?logo=vite&logoColor=white)
8
+ ![React](https://img.shields.io/badge/react-19.x-61DAFB?logo=react&logoColor=white)
9
+ ![Mermaid](https://img.shields.io/badge/mermaid-11.x-FF3670?logo=mermaid&logoColor=white)
10
+ ![TypeScript](https://img.shields.io/badge/typescript-5.x-3178C6?logo=typescript&logoColor=white)
11
+
12
+ ## クイックスタート
13
+
14
+ ```bash
15
+ # インストール
16
+ npm install -D flowbook
17
+
18
+ # 初期化 — スクリプト + サンプルファイルを追加
19
+ npx flowbook init
20
+
21
+ # 開発サーバーを起動
22
+ npm run flowbook
23
+ # → http://localhost:6200
24
+
25
+ # 静的サイトをビルド
26
+ npm run build-flowbook
27
+ # → flowbook-static/
28
+ ```
29
+
30
+ ## CLI
31
+
32
+ ```
33
+ flowbook init プロジェクトに Flowbook をセットアップ
34
+ flowbook dev [--port 6200] 開発サーバーを起動
35
+ flowbook build [--out-dir d] 静的サイトをビルド
36
+ ```
37
+
38
+ ### `flowbook init`
39
+
40
+ - `package.json` に `"flowbook"` と `"build-flowbook"` スクリプトを追加します
41
+ - `flows/example.flow.md` をスターターテンプレートとして作成します
42
+
43
+ ### `flowbook dev`
44
+
45
+ `http://localhost:6200` で HMR 対応の Vite 開発サーバーを起動します。`.flow.md` や `.flowchart.md` ファイルの変更が即座に反映されます。
46
+
47
+ ### `flowbook build`
48
+
49
+ `flowbook-static/` ディレクトリに静的サイトをビルドします(`--out-dir` で変更可能)。どこにでもデプロイできます。
50
+
51
+ ## フローファイルの作成
52
+
53
+ プロジェクト内の任意の場所に `.flow.md`(または `.flowchart.md`)ファイルを作成してください:
54
+
55
+ ````markdown
56
+ ---
57
+ title: ログインフロー
58
+ category: 認証
59
+ tags: [auth, login, oauth]
60
+ order: 1
61
+ description: OAuth2 を使用したユーザー認証フロー
62
+ ---
63
+
64
+ ```mermaid
65
+ flowchart TD
66
+ A[ユーザー] --> B{認証済み?}
67
+ B -->|はい| C[ダッシュボード]
68
+ B -->|いいえ| D[ログインページ]
69
+ ```
70
+ ````
71
+
72
+ Flowbook がファイルを自動検出し、ビューアに追加します。
73
+
74
+ ## フロントマタースキーマ
75
+
76
+ | フィールド | 型 | 必須 | 説明 |
77
+ |---------------|------------|--------|-------------------------------------|
78
+ | `title` | `string` | いいえ | 表示タイトル(デフォルト: ファイル名)|
79
+ | `category` | `string` | いいえ | サイドバーのカテゴリ(デフォルト: "Uncategorized")|
80
+ | `tags` | `string[]` | いいえ | フィルタリング可能なタグ |
81
+ | `order` | `number` | いいえ | カテゴリ内の並び順(デフォルト: 999)|
82
+ | `description` | `string` | いいえ | 詳細ビューに表示される説明 |
83
+
84
+ ## ファイル検出
85
+
86
+ Flowbook はデフォルトで以下のパターンをスキャンします:
87
+
88
+ ```
89
+ **/*.flow.md
90
+ **/*.flowchart.md
91
+ ```
92
+
93
+ `node_modules/`、`.git/`、`dist/` は無視します。
94
+
95
+ ## 仕組み
96
+
97
+ ```
98
+ .flow.md ファイル ──→ Vite プラグイン ──→ 仮想モジュール ──→ React ビューア
99
+ │ │
100
+ ├─ fast-glob スキャン ├─ export default { flows: [...] }
101
+ ├─ gray-matter │
102
+ │ パース └─ ファイル変更時に HMR
103
+ └─ mermaid ブロック
104
+ 抽出
105
+ ```
106
+
107
+ 1. **検出** — `fast-glob` がプロジェクト内の `*.flow.md` / `*.flowchart.md` をスキャン
108
+ 2. **パース** — `gray-matter` が YAML フロントマターを抽出;正規表現で `` ```mermaid `` ブロックを抽出
109
+ 3. **仮想モジュール** — Vite プラグインがパースしたデータを `virtual:flowbook-data` として提供
110
+ 4. **レンダリング** — React アプリが `mermaid.render()` で Mermaid ダイアグラムをレンダリング
111
+ 5. **HMR** — ファイル変更時に仮想モジュールを無効化し、リロードをトリガー
112
+
113
+ ## プロジェクト構成
114
+
115
+ ```
116
+ src/
117
+ ├── types.ts # 共有型 (FlowEntry, FlowbookData)
118
+ ├── node/
119
+ │ ├── cli.ts # CLI エントリポイント (init, dev, build)
120
+ │ ├── server.ts # プログラマティック Vite サーバー & ビルド
121
+ │ ├── init.ts # プロジェクト初期化ロジック
122
+ │ ├── discovery.ts # ファイルスキャナー (fast-glob)
123
+ │ ├── parser.ts # フロントマター + mermaid 抽出
124
+ │ └── plugin.ts # Vite 仮想モジュールプラグイン
125
+ └── client/
126
+ ├── index.html # エントリ HTML
127
+ ├── main.tsx # React エントリ
128
+ ├── App.tsx # 検索 + サイドバー + ビューアレイアウト
129
+ ├── vite-env.d.ts # 仮想モジュール型宣言
130
+ ├── styles/globals.css # Tailwind v4 + カスタムスタイル
131
+ └── components/
132
+ ├── Header.tsx # ロゴ、検索バー、フロー数
133
+ ├── Sidebar.tsx # 折りたたみ可能なカテゴリツリー
134
+ ├── MermaidRenderer.tsx # Mermaid ダイアグラムレンダリング
135
+ ├── FlowView.tsx # 単一フロー詳細ビュー
136
+ └── EmptyState.tsx # 空状態ガイド
137
+ ```
138
+
139
+ ## 開発(コントリビューション)
140
+
141
+ ```bash
142
+ git clone https://github.com/Epsilondelta-ai/flowbook.git
143
+ cd flowbook
144
+ npm install
145
+
146
+ # ローカル開発(ルートの vite.config.ts を使用)
147
+ npm run dev
148
+
149
+ # CLI をビルド
150
+ npm run build
151
+
152
+ # ローカルで CLI をテスト
153
+ node dist/cli.js dev
154
+ node dist/cli.js build
155
+ ```
156
+
157
+ ## 技術スタック
158
+
159
+ - **Vite** — HMR 対応開発サーバー
160
+ - **React 19** — UI
161
+ - **Mermaid 11** — ダイアグラムレンダリング
162
+ - **Tailwind CSS v4** — スタイリング
163
+ - **gray-matter** — YAML フロントマターパーサー
164
+ - **fast-glob** — ファイル検出
165
+ - **tsup** — CLI バンドラー
166
+ - **TypeScript** — 型安全性
167
+
168
+ ## ライセンス
169
+
170
+ MIT