flowbook 0.1.2 → 0.1.4

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 CHANGED
@@ -89,6 +89,58 @@ Flowbook durchsucht standardmäßig folgende Muster:
89
89
 
90
90
  Ignoriert `node_modules/`, `.git/` und `dist/`.
91
91
 
92
+ ## KI-Agent-Fähigkeit
93
+
94
+ `flowbook init` installiert automatisch KI-Agent-Fähigkeiten in alle unterstützten Codierungs-Agent-Verzeichnisse.
95
+ Wenn ein Codierungs-Agent (Claude Code, OpenAI Codex, VS Code Copilot, Cursor, Gemini CLI usw.) das Schlüsselwort **"flowbook"** in Ihrer Eingabeaufforderung erkennt, wird er:
96
+
97
+ 1. Ihre Codebasis auf logische Abläufe analysieren (API-Routen, Authentifizierung, Zustandsverwaltung, Geschäftslogik usw.)
98
+ 2. Flowbook einrichten, falls noch nicht initialisiert
99
+ 3. `.flow.md`-Dateien mit Mermaid-Diagrammen für jeden bedeutenden Ablauf generieren
100
+ 4. Den Build überprüfen
101
+
102
+ ### Fähigkeit über CLI installieren
103
+
104
+ Sie können die Fähigkeit auch eigenständig über [skills.sh](https://skills.sh) installieren:
105
+
106
+ ```bash
107
+ npx skills add Epsilondelta-ai/flowbook
108
+ ```
109
+
110
+ Erkennt automatisch Ihre installierten Codierungs-Agenten und installiert die Fähigkeit in die richtigen Verzeichnisse.
111
+
112
+ ### Kompatible Agenten
113
+
114
+ | Agent | Fähigkeitsort |
115
+ |-------|---------------|
116
+ | Claude Code | `.claude/skills/flowbook/SKILL.md` |
117
+ | OpenAI Codex | `.agents/skills/flowbook/SKILL.md` |
118
+ | VS Code / GitHub Copilot | `.github/skills/flowbook/SKILL.md` |
119
+ | Google Antigravity | `.agent/skills/flowbook/SKILL.md` |
120
+ | Gemini CLI | `.gemini/skills/flowbook/SKILL.md` |
121
+ | Cursor | `.cursor/skills/flowbook/SKILL.md` |
122
+ | Windsurf (Codeium) | `.windsurf/skills/flowbook/SKILL.md` |
123
+ | AmpCode | `.amp/skills/flowbook/SKILL.md` |
124
+ | OpenCode / oh-my-opencode | `.opencode/skills/flowbook/SKILL.md` |
125
+
126
+ <details>
127
+ <summary>Manuelle Fähigkeitsinstallation</summary>
128
+
129
+ Wenn Sie `flowbook init` oder `npx skills add` nicht verwendet haben, kopieren Sie die Fähigkeit manuell:
130
+
131
+ ```bash
132
+ # Beispiel: Claude Code
133
+ mkdir -p .claude/skills/flowbook
134
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .claude/skills/flowbook/
135
+
136
+ # Beispiel: Cursor
137
+ mkdir -p .cursor/skills/flowbook
138
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .cursor/skills/flowbook/
139
+ ```
140
+
141
+ Ersetzen Sie das Verzeichnis durch den entsprechenden Pfad aus der Tabelle der kompatiblen Agenten.
142
+
143
+ </details>
92
144
  ## Funktionsweise
93
145
 
94
146
  ```
package/README.es.md CHANGED
@@ -89,6 +89,58 @@ Flowbook escanea estos patrones por defecto:
89
89
 
90
90
  Ignora `node_modules/`, `.git/` y `dist/`.
91
91
 
92
+ ## Habilidad de Agente IA
93
+
94
+ `flowbook init` instala automáticamente habilidades de agente IA en todos los directorios de agentes de codificación soportados.
95
+ Cuando un agente de codificación (Claude Code, OpenAI Codex, VS Code Copilot, Cursor, Gemini CLI, etc.) detecta la palabra clave **"flowbook"** en tu indicación, hará:
96
+
97
+ 1. Analizar tu base de código en busca de flujos lógicos (rutas API, autenticación, gestión de estado, lógica empresarial, etc.)
98
+ 2. Configurar Flowbook si aún no está inicializado
99
+ 3. Generar archivos `.flow.md` con diagramas Mermaid para cada flujo significativo
100
+ 4. Verificar la compilación
101
+
102
+ ### Instalar Habilidad via CLI
103
+
104
+ También puedes instalar la habilidad de forma independiente usando [skills.sh](https://skills.sh):
105
+
106
+ ```bash
107
+ npx skills add Epsilondelta-ai/flowbook
108
+ ```
109
+
110
+ Detecta automáticamente tus agentes de codificación instalados e instala la habilidad en los directorios correctos.
111
+
112
+ ### Agentes Compatibles
113
+
114
+ | Agente | Ubicación de Habilidad |
115
+ |-------|---------------|
116
+ | Claude Code | `.claude/skills/flowbook/SKILL.md` |
117
+ | OpenAI Codex | `.agents/skills/flowbook/SKILL.md` |
118
+ | VS Code / GitHub Copilot | `.github/skills/flowbook/SKILL.md` |
119
+ | Google Antigravity | `.agent/skills/flowbook/SKILL.md` |
120
+ | Gemini CLI | `.gemini/skills/flowbook/SKILL.md` |
121
+ | Cursor | `.cursor/skills/flowbook/SKILL.md` |
122
+ | Windsurf (Codeium) | `.windsurf/skills/flowbook/SKILL.md` |
123
+ | AmpCode | `.amp/skills/flowbook/SKILL.md` |
124
+ | OpenCode / oh-my-opencode | `.opencode/skills/flowbook/SKILL.md` |
125
+
126
+ <details>
127
+ <summary>Instalación Manual de Habilidad</summary>
128
+
129
+ Si no usaste `flowbook init` ni `npx skills add`, copia la habilidad manualmente:
130
+
131
+ ```bash
132
+ # Ejemplo: Claude Code
133
+ mkdir -p .claude/skills/flowbook
134
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .claude/skills/flowbook/
135
+
136
+ # Ejemplo: Cursor
137
+ mkdir -p .cursor/skills/flowbook
138
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .cursor/skills/flowbook/
139
+ ```
140
+
141
+ Reemplaza el directorio con la ruta apropiada de la tabla de Agentes Compatibles.
142
+
143
+ </details>
92
144
  ## Cómo Funciona
93
145
 
94
146
  ```
package/README.fr.md CHANGED
@@ -89,6 +89,58 @@ Flowbook analyse ces motifs par défaut :
89
89
 
90
90
  Ignore `node_modules/`, `.git/` et `dist/`.
91
91
 
92
+ ## Compétence Agent IA
93
+
94
+ `flowbook init` installe automatiquement les compétences d'agent IA dans tous les répertoires d'agents de codage supportés.
95
+ Lorsqu'un agent de codage (Claude Code, OpenAI Codex, VS Code Copilot, Cursor, Gemini CLI, etc.) détecte le mot-clé **"flowbook"** dans votre invite, il :
96
+
97
+ 1. Analyse votre base de code pour les flux logiques (routes API, authentification, gestion d'état, logique métier, etc.)
98
+ 2. Configure Flowbook s'il n'est pas déjà initialisé
99
+ 3. Génère des fichiers `.flow.md` avec des diagrammes Mermaid pour chaque flux significatif
100
+ 4. Vérifie la compilation
101
+
102
+ ### Installer la Compétence via CLI
103
+
104
+ Vous pouvez aussi installer la compétence indépendamment avec [skills.sh](https://skills.sh) :
105
+
106
+ ```bash
107
+ npx skills add Epsilondelta-ai/flowbook
108
+ ```
109
+
110
+ Détecte automatiquement vos agents de codage installés et installe la compétence dans les bons répertoires.
111
+
112
+ ### Agents Compatibles
113
+
114
+ | Agent | Emplacement de Compétence |
115
+ |-------|---------------|
116
+ | Claude Code | `.claude/skills/flowbook/SKILL.md` |
117
+ | OpenAI Codex | `.agents/skills/flowbook/SKILL.md` |
118
+ | VS Code / GitHub Copilot | `.github/skills/flowbook/SKILL.md` |
119
+ | Google Antigravity | `.agent/skills/flowbook/SKILL.md` |
120
+ | Gemini CLI | `.gemini/skills/flowbook/SKILL.md` |
121
+ | Cursor | `.cursor/skills/flowbook/SKILL.md` |
122
+ | Windsurf (Codeium) | `.windsurf/skills/flowbook/SKILL.md` |
123
+ | AmpCode | `.amp/skills/flowbook/SKILL.md` |
124
+ | OpenCode / oh-my-opencode | `.opencode/skills/flowbook/SKILL.md` |
125
+
126
+ <details>
127
+ <summary>Installation Manuelle de Compétence</summary>
128
+
129
+ Si vous n'avez pas utilisé `flowbook init` ni `npx skills add`, copiez la compétence manuellement :
130
+
131
+ ```bash
132
+ # Exemple : Claude Code
133
+ mkdir -p .claude/skills/flowbook
134
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .claude/skills/flowbook/
135
+
136
+ # Exemple : Cursor
137
+ mkdir -p .cursor/skills/flowbook
138
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .cursor/skills/flowbook/
139
+ ```
140
+
141
+ Remplacez le répertoire par le chemin approprié du tableau des Agents Compatibles.
142
+
143
+ </details>
92
144
  ## Fonctionnement
93
145
 
94
146
  ```
package/README.ja.md CHANGED
@@ -89,6 +89,58 @@ Flowbook はデフォルトで以下のパターンをスキャンします:
89
89
 
90
90
  `node_modules/`、`.git/`、`dist/` は無視します。
91
91
 
92
+ ## AI Agent Skill
93
+
94
+ `flowbook init` はサポートされているすべてのコーディングエージェントディレクトリに AI エージェントスキルを自動的にインストールします。
95
+ コーディングエージェント(Claude Code、OpenAI Codex、VS Code Copilot、Cursor、Gemini CLI など)がプロンプト内の **"flowbook"** キーワードを検出した場合、以下を実行します:
96
+
97
+ 1. コードベース内の論理的なフローを分析(API ルート、認証、状態管理、ビジネスロジックなど)
98
+ 2. まだ初期化されていない場合、Flowbook を設定
99
+ 3. すべての重要なフローに対して Mermaid ダイアグラム付き `.flow.md` ファイルを生成
100
+ 4. ビルドを検証
101
+
102
+ ### CLI でスキルをインストール
103
+
104
+ [skills.sh](https://skills.sh) を使用してスキルを単独でインストールすることもできます:
105
+
106
+ ```bash
107
+ npx skills add Epsilondelta-ai/flowbook
108
+ ```
109
+
110
+ インストール済みのコーディングエージェントを自動検出し、適切なディレクトリにスキルをインストールします。
111
+
112
+ ### 互換性のあるエージェント
113
+
114
+ | エージェント | スキル位置 |
115
+ |-------|---------------|
116
+ | Claude Code | `.claude/skills/flowbook/SKILL.md` |
117
+ | OpenAI Codex | `.agents/skills/flowbook/SKILL.md` |
118
+ | VS Code / GitHub Copilot | `.github/skills/flowbook/SKILL.md` |
119
+ | Google Antigravity | `.agent/skills/flowbook/SKILL.md` |
120
+ | Gemini CLI | `.gemini/skills/flowbook/SKILL.md` |
121
+ | Cursor | `.cursor/skills/flowbook/SKILL.md` |
122
+ | Windsurf (Codeium) | `.windsurf/skills/flowbook/SKILL.md` |
123
+ | AmpCode | `.amp/skills/flowbook/SKILL.md` |
124
+ | OpenCode / oh-my-opencode | `.opencode/skills/flowbook/SKILL.md` |
125
+
126
+ <details>
127
+ <summary>手動スキルインストール</summary>
128
+
129
+ `flowbook init` や `npx skills add` を使用しなかった場合、スキルを手動でコピーしてください:
130
+
131
+ ```bash
132
+ # 例:Claude Code
133
+ mkdir -p .claude/skills/flowbook
134
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .claude/skills/flowbook/
135
+
136
+ # 例:Cursor
137
+ mkdir -p .cursor/skills/flowbook
138
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .cursor/skills/flowbook/
139
+ ```
140
+
141
+ 上の互換性テーブルのパスを参考に、適切なディレクトリに置き換えてください。
142
+
143
+ </details>
92
144
  ## 仕組み
93
145
 
94
146
  ```
package/README.ko.md CHANGED
@@ -89,6 +89,58 @@ Flowbook은 기본적으로 다음 패턴을 스캔합니다:
89
89
 
90
90
  `node_modules/`, `.git/`, `dist/`는 무시합니다.
91
91
 
92
+ ## AI Agent Skill
93
+
94
+ `flowbook init`은 지원하는 모든 코딩 에이전트 디렉토리에 AI 에이전트 스킬을 자동으로 설치합니다.
95
+ 코딩 에이전트(Claude Code, OpenAI Codex, VS Code Copilot, Cursor, Gemini CLI 등)가 프롬프트에서 **"flowbook"** 키워드를 감지하면 다음을 수행합니다:
96
+
97
+ 1. 코드베이스에서 논리적 흐름 분석 (API 라우트, 인증, 상태 관리, 비즈니스 로직 등)
98
+ 2. 아직 초기화되지 않았으면 Flowbook 설정
99
+ 3. 모든 중요한 흐름에 대해 Mermaid 다이어그램이 포함된 `.flow.md` 파일 생성
100
+ 4. 빌드 검증
101
+
102
+ ### CLI로 스킬 설치
103
+
104
+ [skills.sh](https://skills.sh)를 사용하여 스킬을 독립적으로 설치할 수도 있습니다:
105
+
106
+ ```bash
107
+ npx skills add Epsilondelta-ai/flowbook
108
+ ```
109
+
110
+ 설치된 코딩 에이전트를 자동 감지하여 올바른 디렉토리에 스킬을 설치합니다.
111
+
112
+ ### 호환 에이전트
113
+
114
+ | 에이전트 | 스킬 위치 |
115
+ |-------|---------------|
116
+ | Claude Code | `.claude/skills/flowbook/SKILL.md` |
117
+ | OpenAI Codex | `.agents/skills/flowbook/SKILL.md` |
118
+ | VS Code / GitHub Copilot | `.github/skills/flowbook/SKILL.md` |
119
+ | Google Antigravity | `.agent/skills/flowbook/SKILL.md` |
120
+ | Gemini CLI | `.gemini/skills/flowbook/SKILL.md` |
121
+ | Cursor | `.cursor/skills/flowbook/SKILL.md` |
122
+ | Windsurf (Codeium) | `.windsurf/skills/flowbook/SKILL.md` |
123
+ | AmpCode | `.amp/skills/flowbook/SKILL.md` |
124
+ | OpenCode / oh-my-opencode | `.opencode/skills/flowbook/SKILL.md` |
125
+
126
+ <details>
127
+ <summary>수동 스킬 설치</summary>
128
+
129
+ `flowbook init`이나 `npx skills add`를 사용하지 않았다면 스킬을 수동으로 복사하세요:
130
+
131
+ ```bash
132
+ # 예시: Claude Code
133
+ mkdir -p .claude/skills/flowbook
134
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .claude/skills/flowbook/
135
+
136
+ # 예시: Cursor
137
+ mkdir -p .cursor/skills/flowbook
138
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .cursor/skills/flowbook/
139
+ ```
140
+
141
+ 위 호환 에이전트 테이블의 경로를 참고하여 적절한 디렉토리로 교체하세요.
142
+
143
+ </details>
92
144
  ## 동작 원리
93
145
 
94
146
  ```
package/README.md CHANGED
@@ -89,6 +89,58 @@ Flowbook scans for these patterns by default:
89
89
 
90
90
  Ignores `node_modules/`, `.git/`, and `dist/`.
91
91
 
92
+ ## AI Agent Skill
93
+
94
+ `flowbook init` automatically installs AI agent skills to all supported coding agent directories.
95
+ When a coding agent (Claude Code, OpenAI Codex, VS Code Copilot, Cursor, Gemini CLI, etc.) detects the keyword **"flowbook"** in your prompt, it will:
96
+
97
+ 1. Analyze your codebase for logical flows (API routes, auth, state management, business logic, etc.)
98
+ 2. Set up Flowbook if not already initialized
99
+ 3. Generate `.flow.md` files with Mermaid diagrams for every significant flow
100
+ 4. Verify the build
101
+
102
+ ### Install Skill via CLI
103
+
104
+ You can also install the skill standalone using [skills.sh](https://skills.sh):
105
+
106
+ ```bash
107
+ npx skills add Epsilondelta-ai/flowbook
108
+ ```
109
+
110
+ This auto-detects your installed coding agents and installs the skill to the correct directories.
111
+
112
+ ### Compatible Agents
113
+
114
+ | Agent | Skill Location |
115
+ |-------|---------------|
116
+ | Claude Code | `.claude/skills/flowbook/SKILL.md` |
117
+ | OpenAI Codex | `.agents/skills/flowbook/SKILL.md` |
118
+ | VS Code / GitHub Copilot | `.github/skills/flowbook/SKILL.md` |
119
+ | Google Antigravity | `.agent/skills/flowbook/SKILL.md` |
120
+ | Gemini CLI | `.gemini/skills/flowbook/SKILL.md` |
121
+ | Cursor | `.cursor/skills/flowbook/SKILL.md` |
122
+ | Windsurf (Codeium) | `.windsurf/skills/flowbook/SKILL.md` |
123
+ | AmpCode | `.amp/skills/flowbook/SKILL.md` |
124
+ | OpenCode / oh-my-opencode | `.opencode/skills/flowbook/SKILL.md` |
125
+
126
+ <details>
127
+ <summary>Manual Skill Installation</summary>
128
+
129
+ If you didn't use `flowbook init` or `npx skills add`, copy the skill manually:
130
+
131
+ ```bash
132
+ # Example: Claude Code
133
+ mkdir -p .claude/skills/flowbook
134
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .claude/skills/flowbook/
135
+
136
+ # Example: Cursor
137
+ mkdir -p .cursor/skills/flowbook
138
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .cursor/skills/flowbook/
139
+ ```
140
+
141
+ Replace the directory with the appropriate path from the Compatible Agents table above.
142
+
143
+ </details>
92
144
  ## How It Works
93
145
 
94
146
  ```
package/README.pt-BR.md CHANGED
@@ -89,6 +89,58 @@ O Flowbook escaneia estes padrões por padrão:
89
89
 
90
90
  Ignora `node_modules/`, `.git/` e `dist/`.
91
91
 
92
+ ## Habilidade de Agente IA
93
+
94
+ `flowbook init` instala automaticamente habilidades de agente IA em todos os diretórios de agentes de codificação suportados.
95
+ Quando um agente de codificação (Claude Code, OpenAI Codex, VS Code Copilot, Cursor, Gemini CLI, etc.) detecta a palavra-chave **"flowbook"** no seu prompt, ele irá:
96
+
97
+ 1. Analisar sua base de código em busca de fluxos lógicos (rotas de API, autenticação, gerenciamento de estado, lógica de negócios, etc.)
98
+ 2. Configurar Flowbook se ainda não estiver inicializado
99
+ 3. Gerar arquivos `.flow.md` com diagramas Mermaid para cada fluxo significativo
100
+ 4. Verificar a compilação
101
+
102
+ ### Instalar Habilidade via CLI
103
+
104
+ Você também pode instalar a habilidade de forma independente usando [skills.sh](https://skills.sh):
105
+
106
+ ```bash
107
+ npx skills add Epsilondelta-ai/flowbook
108
+ ```
109
+
110
+ Detecta automaticamente seus agentes de codificação instalados e instala a habilidade nos diretórios corretos.
111
+
112
+ ### Agentes Compatíveis
113
+
114
+ | Agente | Local da Habilidade |
115
+ |-------|---------------|
116
+ | Claude Code | `.claude/skills/flowbook/SKILL.md` |
117
+ | OpenAI Codex | `.agents/skills/flowbook/SKILL.md` |
118
+ | VS Code / GitHub Copilot | `.github/skills/flowbook/SKILL.md` |
119
+ | Google Antigravity | `.agent/skills/flowbook/SKILL.md` |
120
+ | Gemini CLI | `.gemini/skills/flowbook/SKILL.md` |
121
+ | Cursor | `.cursor/skills/flowbook/SKILL.md` |
122
+ | Windsurf (Codeium) | `.windsurf/skills/flowbook/SKILL.md` |
123
+ | AmpCode | `.amp/skills/flowbook/SKILL.md` |
124
+ | OpenCode / oh-my-opencode | `.opencode/skills/flowbook/SKILL.md` |
125
+
126
+ <details>
127
+ <summary>Instalação Manual de Habilidade</summary>
128
+
129
+ Se você não usou `flowbook init` nem `npx skills add`, copie a habilidade manualmente:
130
+
131
+ ```bash
132
+ # Exemplo: Claude Code
133
+ mkdir -p .claude/skills/flowbook
134
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .claude/skills/flowbook/
135
+
136
+ # Exemplo: Cursor
137
+ mkdir -p .cursor/skills/flowbook
138
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .cursor/skills/flowbook/
139
+ ```
140
+
141
+ Substitua o diretório pelo caminho apropriado da tabela de Agentes Compatíveis.
142
+
143
+ </details>
92
144
  ## Como Funciona
93
145
 
94
146
  ```
package/README.ru.md CHANGED
@@ -89,6 +89,58 @@ Flowbook по умолчанию сканирует следующие шабл
89
89
 
90
90
  Игнорирует `node_modules/`, `.git/` и `dist/`.
91
91
 
92
+ ## Навык AI-агента
93
+
94
+ `flowbook init` автоматически устанавливает навыки AI-агента во все поддерживаемые директории агентов кодирования.
95
+ Когда агент кодирования (Claude Code, OpenAI Codex, VS Code Copilot, Cursor, Gemini CLI и т.д.) обнаружит ключевое слово **"flowbook"** в вашем промпте, он:
96
+
97
+ 1. Анализирует вашу базу кода на предмет логических потоков (API маршруты, аутентификация, управление состоянием, бизнес-логика и т.д.)
98
+ 2. Настраивает Flowbook, если он еще не инициализирован
99
+ 3. Генерирует файлы `.flow.md` с диаграммами Mermaid для каждого значимого потока
100
+ 4. Проверяет сборку
101
+
102
+ ### Установка навыка через CLI
103
+
104
+ Вы также можете установить навык отдельно с помощью [skills.sh](https://skills.sh):
105
+
106
+ ```bash
107
+ npx skills add Epsilondelta-ai/flowbook
108
+ ```
109
+
110
+ Автоматически определяет установленные агенты кодирования и устанавливает навык в нужные директории.
111
+
112
+ ### Совместимые агенты
113
+
114
+ | Агент | Местонахождение навыка |
115
+ |-------|---------------|
116
+ | Claude Code | `.claude/skills/flowbook/SKILL.md` |
117
+ | OpenAI Codex | `.agents/skills/flowbook/SKILL.md` |
118
+ | VS Code / GitHub Copilot | `.github/skills/flowbook/SKILL.md` |
119
+ | Google Antigravity | `.agent/skills/flowbook/SKILL.md` |
120
+ | Gemini CLI | `.gemini/skills/flowbook/SKILL.md` |
121
+ | Cursor | `.cursor/skills/flowbook/SKILL.md` |
122
+ | Windsurf (Codeium) | `.windsurf/skills/flowbook/SKILL.md` |
123
+ | AmpCode | `.amp/skills/flowbook/SKILL.md` |
124
+ | OpenCode / oh-my-opencode | `.opencode/skills/flowbook/SKILL.md` |
125
+
126
+ <details>
127
+ <summary>Ручная установка навыка</summary>
128
+
129
+ Если вы не использовали `flowbook init` или `npx skills add`, скопируйте навык вручную:
130
+
131
+ ```bash
132
+ # Пример: Claude Code
133
+ mkdir -p .claude/skills/flowbook
134
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .claude/skills/flowbook/
135
+
136
+ # Пример: Cursor
137
+ mkdir -p .cursor/skills/flowbook
138
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .cursor/skills/flowbook/
139
+ ```
140
+
141
+ Замените директорию на подходящий путь из таблицы совместимых агентов.
142
+
143
+ </details>
92
144
  ## Как Это Работает
93
145
 
94
146
  ```
package/README.zh-CN.md CHANGED
@@ -89,6 +89,58 @@ Flowbook 默认扫描以下模式:
89
89
 
90
90
  忽略 `node_modules/`、`.git/` 和 `dist/`。
91
91
 
92
+ ## AI Agent Skill
93
+
94
+ `flowbook init` 自动将 AI 代理技能安装到所有支持的编码代理目录中。
95
+ 当编码代理(Claude Code、OpenAI Codex、VS Code Copilot、Cursor、Gemini CLI 等)检测到你的提示中有 **"flowbook"** 关键字时,它会:
96
+
97
+ 1. 分析你的代码库中的逻辑流(API 路由、认证、状态管理、业务逻辑等)
98
+ 2. 如果尚未初始化,设置 Flowbook
99
+ 3. 为每个重要流程生成包含 Mermaid 图表的 `.flow.md` 文件
100
+ 4. 验证构建
101
+
102
+ ### 通过 CLI 安装技能
103
+
104
+ 你也可以使用 [skills.sh](https://skills.sh) 独立安装技能:
105
+
106
+ ```bash
107
+ npx skills add Epsilondelta-ai/flowbook
108
+ ```
109
+
110
+ 自动检测已安装的编码代理并将技能安装到正确的目录。
111
+
112
+ ### 兼容代理
113
+
114
+ | 代理 | 技能位置 |
115
+ |-------|---------------|
116
+ | Claude Code | `.claude/skills/flowbook/SKILL.md` |
117
+ | OpenAI Codex | `.agents/skills/flowbook/SKILL.md` |
118
+ | VS Code / GitHub Copilot | `.github/skills/flowbook/SKILL.md` |
119
+ | Google Antigravity | `.agent/skills/flowbook/SKILL.md` |
120
+ | Gemini CLI | `.gemini/skills/flowbook/SKILL.md` |
121
+ | Cursor | `.cursor/skills/flowbook/SKILL.md` |
122
+ | Windsurf (Codeium) | `.windsurf/skills/flowbook/SKILL.md` |
123
+ | AmpCode | `.amp/skills/flowbook/SKILL.md` |
124
+ | OpenCode / oh-my-opencode | `.opencode/skills/flowbook/SKILL.md` |
125
+
126
+ <details>
127
+ <summary>手动技能安装</summary>
128
+
129
+ 如果你没有使用 `flowbook init` 或 `npx skills add`,请手动复制技能:
130
+
131
+ ```bash
132
+ # 示例:Claude Code
133
+ mkdir -p .claude/skills/flowbook
134
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .claude/skills/flowbook/
135
+
136
+ # 示例:Cursor
137
+ mkdir -p .cursor/skills/flowbook
138
+ cp node_modules/flowbook/src/skills/flowbook/SKILL.md .cursor/skills/flowbook/
139
+ ```
140
+
141
+ 请参考上方兼容代理表格中的路径替换为适当的目录。
142
+
143
+ </details>
92
144
  ## 工作原理
93
145
 
94
146
  ```
package/dist/cli.js CHANGED
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/node/init.ts
4
- import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
5
- import { resolve } from "path";
4
+ import { readFileSync, writeFileSync, existsSync, mkdirSync, copyFileSync } from "fs";
5
+ import { resolve, dirname } from "path";
6
6
  import { execSync } from "child_process";
7
+ import { fileURLToPath } from "url";
8
+ var __dirname = dirname(fileURLToPath(import.meta.url));
7
9
  var EXAMPLE_FLOW = `---
8
10
  title: Example Flow
9
11
  category: Getting Started
@@ -72,6 +74,43 @@ async function initFlowbook() {
72
74
  console.log(" \u2713 Added flowbook-static to .gitignore");
73
75
  }
74
76
  }
77
+ const skillSrc = resolve(__dirname, "..", "src", "skills", "flowbook", "SKILL.md");
78
+ const skillDirs = [
79
+ resolve(cwd, ".claude", "skills", "flowbook"),
80
+ // Claude Code
81
+ resolve(cwd, ".agents", "skills", "flowbook"),
82
+ // OpenAI Codex / cross-tool alias
83
+ resolve(cwd, ".github", "skills", "flowbook"),
84
+ // VS Code / GitHub Copilot
85
+ resolve(cwd, ".agent", "skills", "flowbook"),
86
+ // Google Antigravity
87
+ resolve(cwd, ".gemini", "skills", "flowbook"),
88
+ // Gemini CLI
89
+ resolve(cwd, ".cursor", "skills", "flowbook"),
90
+ // Cursor
91
+ resolve(cwd, ".windsurf", "skills", "flowbook"),
92
+ // Windsurf (Codeium)
93
+ resolve(cwd, ".amp", "skills", "flowbook"),
94
+ // AmpCode
95
+ resolve(cwd, ".opencode", "skills", "flowbook")
96
+ // OpenCode / oh-my-opencode
97
+ ];
98
+ if (existsSync(skillSrc)) {
99
+ let installed = 0;
100
+ for (const dir of skillDirs) {
101
+ const dest = resolve(dir, "SKILL.md");
102
+ if (!existsSync(dest)) {
103
+ mkdirSync(dir, { recursive: true });
104
+ copyFileSync(skillSrc, dest);
105
+ installed++;
106
+ }
107
+ }
108
+ if (installed > 0) {
109
+ console.log(` \u2713 Installed AI agent skill to ${installed} agent directories`);
110
+ } else {
111
+ console.log(" \u2713 AI agent skills already installed");
112
+ }
113
+ }
75
114
  const run = pm === "yarn" ? "yarn" : `${pm} run`;
76
115
  console.log("");
77
116
  console.log(" Next steps:");
@@ -189,11 +228,11 @@ function flowbookPlugin(options = {}) {
189
228
  }
190
229
 
191
230
  // src/node/server.ts
192
- import { resolve as resolve2, dirname } from "path";
193
- import { fileURLToPath } from "url";
194
- var __dirname = dirname(fileURLToPath(import.meta.url));
231
+ import { resolve as resolve2, dirname as dirname2 } from "path";
232
+ import { fileURLToPath as fileURLToPath2 } from "url";
233
+ var __dirname2 = dirname2(fileURLToPath2(import.meta.url));
195
234
  function getClientDir() {
196
- return resolve2(__dirname, "..", "src", "client");
235
+ return resolve2(__dirname2, "..", "src", "client");
197
236
  }
198
237
  function createConfig(options) {
199
238
  const cwd = options.cwd ?? process.cwd();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbook",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "flowbook": "./dist/cli.js"
@@ -12,7 +12,9 @@
12
12
  "scripts": {
13
13
  "dev": "vite",
14
14
  "build": "tsup",
15
- "preview": "vite preview"
15
+ "preview": "vite preview",
16
+ "flowbook": "flowbook dev",
17
+ "build-flowbook": "flowbook build"
16
18
  },
17
19
  "dependencies": {
18
20
  "@tailwindcss/vite": "^4.0.0",
@@ -29,6 +31,7 @@
29
31
  "@types/node": "^25.3.3",
30
32
  "@types/react": "^19.0.0",
31
33
  "@types/react-dom": "^19.0.0",
34
+ "flowbook": "^0.1.2",
32
35
  "tsup": "^8.0.0",
33
36
  "typescript": "^5.7.0"
34
37
  }
package/src/node/init.ts CHANGED
@@ -1,6 +1,9 @@
1
- import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
2
- import { resolve } from "node:path";
1
+ import { readFileSync, writeFileSync, existsSync, mkdirSync, copyFileSync } from "node:fs";
2
+ import { resolve, dirname } from "node:path";
3
3
  import { execSync } from "node:child_process";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
4
7
 
5
8
  const EXAMPLE_FLOW = `---
6
9
  title: Example Flow
@@ -85,6 +88,37 @@ export async function initFlowbook() {
85
88
  }
86
89
  }
87
90
 
91
+ // 5. Install AI agent skill to all supported agent directories
92
+ const skillSrc = resolve(__dirname, "..", "src", "skills", "flowbook", "SKILL.md");
93
+ const skillDirs = [
94
+ resolve(cwd, ".claude", "skills", "flowbook"), // Claude Code
95
+ resolve(cwd, ".agents", "skills", "flowbook"), // OpenAI Codex / cross-tool alias
96
+ resolve(cwd, ".github", "skills", "flowbook"), // VS Code / GitHub Copilot
97
+ resolve(cwd, ".agent", "skills", "flowbook"), // Google Antigravity
98
+ resolve(cwd, ".gemini", "skills", "flowbook"), // Gemini CLI
99
+ resolve(cwd, ".cursor", "skills", "flowbook"), // Cursor
100
+ resolve(cwd, ".windsurf", "skills", "flowbook"), // Windsurf (Codeium)
101
+ resolve(cwd, ".amp", "skills", "flowbook"), // AmpCode
102
+ resolve(cwd, ".opencode", "skills", "flowbook"), // OpenCode / oh-my-opencode
103
+ ];
104
+
105
+ if (existsSync(skillSrc)) {
106
+ let installed = 0;
107
+ for (const dir of skillDirs) {
108
+ const dest = resolve(dir, "SKILL.md");
109
+ if (!existsSync(dest)) {
110
+ mkdirSync(dir, { recursive: true });
111
+ copyFileSync(skillSrc, dest);
112
+ installed++;
113
+ }
114
+ }
115
+ if (installed > 0) {
116
+ console.log(` \u2713 Installed AI agent skill to ${installed} agent directories`);
117
+ } else {
118
+ console.log(" \u2713 AI agent skills already installed");
119
+ }
120
+ }
121
+
88
122
  const run = pm === "yarn" ? "yarn" : `${pm} run`;
89
123
  console.log("");
90
124
  console.log(" Next steps:");
@@ -0,0 +1,499 @@
1
+ ---
2
+ name: flowbook
3
+ description: "Flowbook generator — analyzes codebase logic and generates Mermaid flowchart documentation (.flow.md). Auto-discovers functions, API routes, state machines, auth flows, data pipelines, and business logic, then produces browsable flowchart documentation. Triggers: 'flowbook', 'flow diagram', 'flowchart', 'generate flows', 'document flows', 'logic diagram'."
4
+ license: MIT
5
+ compatibility:
6
+ - Claude Code
7
+ - OpenAI Codex
8
+ - VS Code / GitHub Copilot
9
+ - Google Antigravity
10
+ - Gemini CLI
11
+ - Cursor
12
+ - Windsurf (Codeium)
13
+ - AmpCode
14
+ - OpenCode / oh-my-opencode
15
+ metadata:
16
+ author: Epsilondelta
17
+ version: "1.0.0"
18
+ tags: flowbook, flowchart, mermaid, documentation, architecture, diagram, visualization
19
+ ---
20
+
21
+ # flowbook — Flowchart Documentation Generator
22
+
23
+ Analyze codebase logic → setup flowbook → generate `.flow.md` files → verify → build.
24
+
25
+ **Execute ALL phases in order. Do NOT skip phases. Generate flows for ALL significant logic — not just a few.**
26
+
27
+ ---
28
+
29
+ ## Phase 1: Project Analysis
30
+
31
+ ### 1.1 Check Flowbook Existence
32
+
33
+ Check if flowbook is already set up:
34
+
35
+ - `package.json` has `"flowbook"` script → Already initialized, skip Phase 2
36
+ - Otherwise → Proceed to Phase 2
37
+
38
+ ### 1.2 Detect Package Manager
39
+
40
+ | Lockfile | PM |
41
+ |----------|----|
42
+ | `bun.lock` or `bun.lockb` | bun |
43
+ | `pnpm-lock.yaml` | pnpm |
44
+ | `yarn.lock` | yarn |
45
+ | `package-lock.json` | npm |
46
+
47
+ ### 1.3 Detect Framework & Language
48
+
49
+ Read `package.json` dependencies:
50
+
51
+ | Dependency | Framework |
52
+ |------------|-----------|
53
+ | `next` | Next.js |
54
+ | `nuxt` | Nuxt |
55
+ | `@sveltejs/kit` | SvelteKit |
56
+ | `svelte` (no kit) | Svelte |
57
+ | `vue` (no nuxt) | Vue |
58
+ | `@angular/core` | Angular |
59
+ | `express` / `fastify` / `hono` / `koa` | Node.js Backend |
60
+ | `@nestjs/core` | NestJS |
61
+ | `react` (no next) | React |
62
+ | `django` / `flask` / `fastapi` | Python Backend |
63
+ | `spring` | Java/Kotlin Backend |
64
+ | `gin` / `echo` / `fiber` | Go Backend |
65
+
66
+ Language detection:
67
+ - `tsconfig.json` → TypeScript
68
+ - `*.go` files → Go
69
+ - `*.py` files → Python
70
+ - `*.java` / `*.kt` files → Java/Kotlin
71
+ - Otherwise → JavaScript
72
+
73
+ ### 1.4 Detect Source Structure
74
+
75
+ Scan for actual source directories:
76
+
77
+ **Frontend:**
78
+ - `src/components/`, `src/pages/`, `src/views/`, `src/routes/`
79
+ - `src/app/`, `app/`, `pages/`, `components/`
80
+ - `src/store/`, `src/hooks/`, `src/composables/`, `src/lib/`
81
+
82
+ **Backend:**
83
+ - `src/routes/`, `src/api/`, `src/controllers/`, `src/services/`
84
+ - `src/middleware/`, `src/handlers/`, `src/resolvers/`
85
+ - `routes/`, `api/`, `controllers/`, `services/`
86
+
87
+ **Shared:**
88
+ - `src/utils/`, `src/helpers/`, `src/lib/`
89
+ - `src/models/`, `src/schemas/`, `src/types/`
90
+
91
+ Only include directories that actually exist.
92
+
93
+ ---
94
+
95
+ ## Phase 2: Flowbook Setup
96
+
97
+ ### 2.1 Initialize Flowbook
98
+
99
+ ```bash
100
+ npx flowbook@latest init
101
+ ```
102
+
103
+ This will:
104
+ - Install `flowbook` as a devDependency
105
+ - Add `"flowbook"` and `"build-flowbook"` scripts to `package.json`
106
+ - Create `flows/example.flow.md` as a starter template
107
+ - Add `flowbook-static` to `.gitignore`
108
+
109
+ ### 2.2 Verify Setup
110
+
111
+ Check that:
112
+ - `package.json` contains `"flowbook": "flowbook dev"` script
113
+ - `flowbook` is in `devDependencies`
114
+ - `flows/` directory exists
115
+
116
+ ### 2.3 Remove Example Flow
117
+
118
+ After verification, delete the example to replace with real flows:
119
+
120
+ ```bash
121
+ rm flows/example.flow.md
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Phase 3: Codebase Analysis & Flow Discovery
127
+
128
+ This is the **most critical phase**. Deeply analyze the codebase to identify all significant logic flows.
129
+
130
+ ### 3.1 Flow Categories to Discover
131
+
132
+ Scan the codebase for these flow types. For EACH one found, plan a `.flow.md` file:
133
+
134
+ #### A. API / Route Flows
135
+ - HTTP request → middleware chain → handler → response
136
+ - REST endpoints (GET, POST, PUT, DELETE)
137
+ - GraphQL resolvers (Query, Mutation)
138
+ - WebSocket message flows
139
+ - RPC handlers
140
+
141
+ #### B. Authentication & Authorization
142
+ - Login / signup / logout flows
143
+ - Token refresh / session management
144
+ - OAuth flows (redirect → callback → token exchange)
145
+ - Role-based access control (RBAC) decision trees
146
+ - Password reset / email verification
147
+
148
+ #### C. Data Flows
149
+ - CRUD operations (Create → Validate → Save → Respond)
150
+ - Data pipeline / ETL (Extract → Transform → Load)
151
+ - Form submission → validation → API call → state update
152
+ - File upload → process → store → respond
153
+ - Cache strategies (read-through, write-through, invalidation)
154
+
155
+ #### D. State Management
156
+ - Global state flow (Redux, Zustand, Pinia, Vuex)
157
+ - Action → Reducer → State → UI update cycle
158
+ - Side effects (Sagas, Thunks, Effects)
159
+ - Optimistic updates → rollback on failure
160
+
161
+ #### E. Business Logic
162
+ - Order processing / checkout flow
163
+ - Payment flow (initiate → process → confirm / refund)
164
+ - Notification system (trigger → queue → send → track)
165
+ - Scheduling / cron job flows
166
+ - Approval workflows (submit → review → approve/reject)
167
+
168
+ #### F. Error Handling
169
+ - Global error boundary flow
170
+ - Retry strategies (exponential backoff)
171
+ - Fallback / circuit breaker patterns
172
+ - Error logging / monitoring pipeline
173
+
174
+ #### G. DevOps & Infrastructure
175
+ - CI/CD pipeline stages
176
+ - Deployment flow
177
+ - Health check / monitoring flow
178
+ - Database migration flow
179
+
180
+ #### H. Lifecycle & Initialization
181
+ - App bootstrap / initialization sequence
182
+ - Component lifecycle flows
183
+ - Server startup → middleware registration → route binding → listen
184
+ - Database connection → migration → seeding → ready
185
+
186
+ ### 3.2 How to Analyze
187
+
188
+ For each source file:
189
+
190
+ 1. **Read the file** — understand its purpose
191
+ 2. **Trace the flow** — follow function calls, conditionals, async operations
192
+ 3. **Identify decision points** — if/else, switch, try/catch, early returns
193
+ 4. **Map dependencies** — what other modules/services does it call?
194
+ 5. **Note error paths** — what happens when things fail?
195
+
196
+ ### 3.3 Flow Classification
197
+
198
+ For each discovered flow, determine:
199
+
200
+ | Field | How to Determine |
201
+ |-------|-----------------|
202
+ | `title` | Clear, descriptive name (e.g., "User Login Flow") |
203
+ | `category` | Group by domain: Authentication, API, Data, State, Business, DevOps, etc. |
204
+ | `tags` | Relevant keywords for filtering |
205
+ | `order` | Lower = more important. Core flows first. |
206
+ | `description` | One-line summary of what the flow does |
207
+
208
+ ### 3.4 Skip Rules
209
+
210
+ Do NOT create flows for:
211
+ - Trivial utility functions (formatDate, slugify, etc.)
212
+ - Simple getters/setters with no logic
213
+ - Type definitions / interfaces only
214
+ - Test files
215
+ - Config files (unless they represent a complex pipeline)
216
+ - Files that already have corresponding `.flow.md`
217
+
218
+ ---
219
+
220
+ ## Phase 4: Flow File Generation
221
+
222
+ ### 4.1 File Placement
223
+
224
+ Place ALL flow files in the `flows/` directory at project root:
225
+
226
+ ```
227
+ flows/
228
+ ├── auth-login.flow.md
229
+ ├── auth-oauth.flow.md
230
+ ├── api-user-crud.flow.md
231
+ ├── data-order-processing.flow.md
232
+ ├── state-cart-management.flow.md
233
+ └── devops-ci-pipeline.flow.md
234
+ ```
235
+
236
+ **Naming convention**: `{category}-{name}.flow.md` (kebab-case)
237
+
238
+ ### 4.2 Flow File Template
239
+
240
+ Every `.flow.md` file MUST follow this structure:
241
+
242
+ ````markdown
243
+ ---
244
+ title: {Descriptive Title}
245
+ category: {Category Name}
246
+ tags: [{tag1}, {tag2}, {tag3}]
247
+ order: {number}
248
+ description: {One-line description}
249
+ ---
250
+
251
+ ```mermaid
252
+ flowchart TD
253
+ A[Start] --> B{Decision}
254
+ B -->|Yes| C[Action]
255
+ B -->|No| D[Other Action]
256
+ C --> E[End]
257
+ D --> E
258
+ ```
259
+ ````
260
+
261
+ ### 4.3 Mermaid Diagram Guidelines
262
+
263
+ #### Node Types
264
+
265
+ ```mermaid
266
+ flowchart TD
267
+ A[Regular Step] %% Rectangle: action/process
268
+ B{Decision Point} %% Diamond: if/else, switch
269
+ C([Start / End]) %% Stadium: entry/exit points
270
+ D[(Database)] %% Cylinder: DB operations
271
+ E[[Sub-routine]] %% Subroutine: function call
272
+ F>Event / Signal] %% Flag: async event, webhook
273
+ G{{Validation}} %% Hexagon: validation step
274
+ H[/Input/] %% Parallelogram: user input
275
+ I[\Output\] %% Reverse parallelogram: response
276
+ ```
277
+
278
+ #### Edge Labels
279
+
280
+ ```mermaid
281
+ flowchart TD
282
+ A{Authenticated?} -->|Yes| B[Dashboard]
283
+ A -->|No| C[Login Page]
284
+ D[API Call] -->|200 OK| E[Process Data]
285
+ D -->|4xx/5xx| F[Handle Error]
286
+ G[Submit] -->|Valid| H[Save]
287
+ G -->|Invalid| I[Show Errors]
288
+ ```
289
+
290
+ #### Styling
291
+
292
+ Apply consistent colors to node types:
293
+
294
+ ```mermaid
295
+ flowchart TD
296
+ A([Start]) --> B[Process]
297
+ B --> C{Decision}
298
+ C -->|Yes| D[(Save to DB)]
299
+ C -->|No| E[Handle Error]
300
+ D --> F([End])
301
+ E --> F
302
+
303
+ style A fill:#6366f1,color:#fff
304
+ style F fill:#6366f1,color:#fff
305
+ style C fill:#f59e0b,color:#000
306
+ style D fill:#10b981,color:#fff
307
+ style E fill:#ef4444,color:#fff
308
+ ```
309
+
310
+ **Color convention:**
311
+ - `#6366f1` (indigo) — Start/End points
312
+ - `#10b981` (green) — Success paths, DB operations
313
+ - `#f59e0b` (amber) — Decision points
314
+ - `#ef4444` (red) — Error paths, failures
315
+ - `#8b5cf6` (purple) — External service calls
316
+ - `#3b82f6` (blue) — Processing steps
317
+ - Default (no style) — Regular steps
318
+
319
+ #### Subgraphs for Complex Flows
320
+
321
+ Use subgraphs to group related steps:
322
+
323
+ ```mermaid
324
+ flowchart TD
325
+ A([Request]) --> B
326
+
327
+ subgraph Middleware
328
+ B[Auth Check] --> C[Rate Limit] --> D[Parse Body]
329
+ end
330
+
331
+ D --> E
332
+
333
+ subgraph Handler
334
+ E[Validate Input] --> F{Valid?}
335
+ F -->|Yes| G[Process]
336
+ F -->|No| H[Return 400]
337
+ end
338
+
339
+ G --> I[(Save)]
340
+ I --> J[\200 OK/]
341
+ H --> K[\400 Error/]
342
+ ```
343
+
344
+ ### 4.4 Complexity Guidelines
345
+
346
+ - **Simple flows** (3-8 nodes): Single linear or branching flow
347
+ - **Medium flows** (8-15 nodes): Multiple branches, some subgraphs
348
+ - **Complex flows** (15-25 nodes): Multiple subgraphs, parallel paths
349
+ - **Do NOT exceed 25 nodes** per diagram — split into multiple flows instead
350
+
351
+ If a flow is too complex:
352
+ 1. Create a high-level overview flow
353
+ 2. Create detailed sub-flows for each section
354
+ 3. Reference sub-flows in the overview's description
355
+
356
+ ### 4.5 Real-World Example
357
+
358
+ For a Next.js API route `app/api/auth/login/route.ts`:
359
+
360
+ ````markdown
361
+ ---
362
+ title: User Login
363
+ category: Authentication
364
+ tags: [auth, login, jwt, api]
365
+ order: 1
366
+ description: POST /api/auth/login — validates credentials and returns JWT tokens
367
+ ---
368
+
369
+ ```mermaid
370
+ flowchart TD
371
+ A([POST /api/auth/login]) --> B[/Parse Request Body/]
372
+ B --> C{{Validate Email & Password}}
373
+ C -->|Invalid| D[\400 Bad Request/]
374
+ C -->|Valid| E[(Find User by Email)]
375
+ E -->|Not Found| F[\401 Unauthorized/]
376
+ E -->|Found| G{{Compare Password Hash}}
377
+ G -->|Mismatch| F
378
+ G -->|Match| H[Generate JWT Access Token]
379
+ H --> I[Generate Refresh Token]
380
+ I --> J[(Save Refresh Token)]
381
+ J --> K[\200 OK + Tokens/]
382
+
383
+ style A fill:#6366f1,color:#fff
384
+ style C fill:#f59e0b,color:#000
385
+ style G fill:#f59e0b,color:#000
386
+ style E fill:#10b981,color:#fff
387
+ style J fill:#10b981,color:#fff
388
+ style D fill:#ef4444,color:#fff
389
+ style F fill:#ef4444,color:#fff
390
+ style K fill:#10b981,color:#fff
391
+ ```
392
+ ````
393
+
394
+ ---
395
+
396
+ ## Phase 5: Verification
397
+
398
+ ### 5.1 Syntax Check
399
+
400
+ For each generated `.flow.md` file:
401
+
402
+ 1. Verify YAML frontmatter is valid (title, category present)
403
+ 2. Verify mermaid code block is properly fenced (``` mermaid ```)
404
+ 3. Verify mermaid syntax has no obvious errors (matched brackets, valid node IDs)
405
+
406
+ ### 5.2 Build Verification
407
+
408
+ ```bash
409
+ npx flowbook build 2>&1
410
+ ```
411
+
412
+ If build fails:
413
+ - Read error output
414
+ - Fix the issue (likely malformed mermaid syntax)
415
+ - Retry until build succeeds
416
+
417
+ ### 5.3 Visual Verification
418
+
419
+ Start dev server and verify rendering:
420
+
421
+ ```bash
422
+ npx flowbook dev &
423
+ FB_PID=$!
424
+ sleep 3
425
+ ```
426
+
427
+ If the `playwright` skill is available, load it and:
428
+
429
+ 1. Navigate to `http://localhost:6200`
430
+ 2. Wait for Flowbook UI to load
431
+ 3. Check sidebar — all flow categories should appear
432
+ 4. Click through each flow — verify diagrams render (no error messages)
433
+ 5. Screenshot any failures
434
+
435
+ ```bash
436
+ kill $FB_PID 2>/dev/null
437
+ ```
438
+
439
+ ### 5.4 Fix-and-Retry Loop
440
+
441
+ If mermaid diagrams fail to render:
442
+ 1. Common issue: special characters in labels — wrap in quotes: `A["Label with (parens)"]`
443
+ 2. Common issue: reserved keywords — prefix with text: `A[End Point]` not `A[End]` alone as node content after using `End` as ID
444
+ 3. Re-run build verification
445
+ 4. Repeat until all diagrams render
446
+
447
+ ---
448
+
449
+ ## Phase 6: Summary Report
450
+
451
+ Print a summary:
452
+
453
+ ```
454
+ === Flowbook Report ===
455
+ Framework: {detected framework}
456
+ Language: {detected language}
457
+
458
+ Flows generated: {N}
459
+ Categories:
460
+ - Authentication: {N} flows
461
+ - API: {N} flows
462
+ - Data: {N} flows
463
+ - State: {N} flows
464
+ - Business Logic: {N} flows
465
+ - DevOps: {N} flows
466
+
467
+ Files created:
468
+ - flows/{filename}.flow.md — {title}
469
+ - flows/{filename}.flow.md — {title}
470
+ ...
471
+
472
+ Build: ✅ / ❌
473
+ ```
474
+
475
+ ---
476
+
477
+ ## Troubleshooting
478
+
479
+ ### Flowbook init fails
480
+ - **No package.json**: Run `npm init -y` first
481
+ - **Permission error**: Check write permissions on project directory
482
+
483
+ ### Mermaid syntax errors
484
+ - **Brackets**: Every `[`, `{`, `(` must be closed
485
+ - **Special characters in labels**: Wrap in double quotes: `A["User's Input"]`
486
+ - **Arrow syntax**: Use `-->` for solid, `-.->` for dotted, `==>` for thick
487
+ - **Node ID reuse**: Each node ID must be unique per diagram. Reuse ID to reference same node.
488
+ - **Subgraph naming**: Subgraph labels cannot contain special characters
489
+
490
+ ### Diagrams too complex
491
+ - Split into overview + detail flows
492
+ - Use subgraphs to group related logic
493
+ - Keep each diagram under 25 nodes
494
+ - Link related flows via description references
495
+
496
+ ### Build fails
497
+ - Check mermaid version compatibility (flowbook uses Mermaid 11+)
498
+ - Validate YAML frontmatter (no tabs, proper indentation)
499
+ - Ensure code blocks use triple backticks with `mermaid` language tag