flowbook 0.1.4 → 0.2.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.md +63 -24
- package/dist/cli.js +237 -52
- package/package.json +1 -1
- package/src/commands/flowbook.md +13 -0
- package/src/commands/flowbook.plain.md +13 -0
- package/src/node/cli.ts +15 -0
- package/src/node/init.ts +8 -32
- package/src/node/skill.ts +230 -0
- package/README.de.md +0 -219
- package/README.es.md +0 -219
- package/README.fr.md +0 -219
- package/README.ja.md +0 -219
- package/README.ko.md +0 -219
- package/README.pt-BR.md +0 -219
- package/README.ru.md +0 -220
- package/README.zh-CN.md +0 -219
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Flowbook
|
|
2
2
|
|
|
3
|
-
> **English** | [한국어](./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](./README.de.md)
|
|
3
|
+
> **English** | [한국어](./docs/README.ko.md) | [简体中文](./docs/README.zh-CN.md) | [日本語](./docs/README.ja.md) | [Español](./docs/README.es.md) | [Português (BR)](./docs/README.pt-BR.md) | [Français](./docs/README.fr.md) | [Русский](./docs/README.ru.md) | [Deutsch](./docs/README.de.md)
|
|
4
4
|
|
|
5
5
|
Storybook for flowcharts. Auto-discovers Mermaid diagram files from your codebase, organizes them by category, and renders them in a browsable viewer.
|
|
6
6
|
|
|
@@ -30,12 +30,14 @@ npm run build-flowbook
|
|
|
30
30
|
flowbook init Set up Flowbook in your project
|
|
31
31
|
flowbook dev [--port 6200] Start the dev server
|
|
32
32
|
flowbook build [--out-dir d] Build a static site
|
|
33
|
+
flowbook skill <agent> [-g] Install AI agent skill & /flowbook command
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
### `flowbook init`
|
|
36
37
|
|
|
37
38
|
- Adds `"flowbook"` and `"build-flowbook"` scripts to your `package.json`
|
|
38
39
|
- Creates `flows/example.flow.md` as a starter template
|
|
40
|
+
- Installs AI agent skills to all supported agent directories
|
|
39
41
|
|
|
40
42
|
### `flowbook dev`
|
|
41
43
|
|
|
@@ -99,46 +101,77 @@ When a coding agent (Claude Code, OpenAI Codex, VS Code Copilot, Cursor, Gemini
|
|
|
99
101
|
3. Generate `.flow.md` files with Mermaid diagrams for every significant flow
|
|
100
102
|
4. Verify the build
|
|
101
103
|
|
|
102
|
-
###
|
|
104
|
+
### `flowbook skill`
|
|
105
|
+
|
|
106
|
+
Install skills and `/flowbook` slash commands for specific agents:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Install for a specific agent (project-level)
|
|
110
|
+
flowbook skill opencode
|
|
111
|
+
flowbook skill claude
|
|
112
|
+
flowbook skill cursor
|
|
113
|
+
|
|
114
|
+
# Install for all agents
|
|
115
|
+
flowbook skill all
|
|
116
|
+
|
|
117
|
+
# Install globally (available across all projects)
|
|
118
|
+
flowbook skill opencode -g
|
|
119
|
+
flowbook skill all --global
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**What gets installed:**
|
|
123
|
+
|
|
124
|
+
| Component | Description |
|
|
125
|
+
|-----------|-------------|
|
|
126
|
+
| **Skill** (`SKILL.md`) | Auto-triggers when you mention "flowbook" in prompts |
|
|
127
|
+
| **Slash command** (`/flowbook`) | Explicit trigger — type `/flowbook` to generate flowcharts |
|
|
128
|
+
|
|
129
|
+
Slash commands are installed for agents that support them: **Claude Code**, **Cursor**, **Windsurf**, **OpenCode**.
|
|
130
|
+
|
|
131
|
+
### Install via skills.sh
|
|
103
132
|
|
|
104
133
|
You can also install the skill standalone using [skills.sh](https://skills.sh):
|
|
105
134
|
|
|
106
135
|
```bash
|
|
136
|
+
# Project-level
|
|
107
137
|
npx skills add Epsilondelta-ai/flowbook
|
|
138
|
+
|
|
139
|
+
# Global
|
|
140
|
+
npx skills add -g Epsilondelta-ai/flowbook
|
|
108
141
|
```
|
|
109
142
|
|
|
110
|
-
|
|
143
|
+
> **Note:** `npx skills add` installs skills only (SKILL.md). Use `flowbook skill` to also install `/flowbook` slash commands.
|
|
111
144
|
|
|
112
|
-
###
|
|
145
|
+
### Supported Agents
|
|
113
146
|
|
|
114
|
-
| Agent | Skill
|
|
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` |
|
|
147
|
+
| Agent | Skill | Slash Command |
|
|
148
|
+
|-------|-------|---------------|
|
|
149
|
+
| Claude Code | `.claude/skills/flowbook/SKILL.md` | `.claude/commands/flowbook.md` |
|
|
150
|
+
| OpenAI Codex | `.agents/skills/flowbook/SKILL.md` | — |
|
|
151
|
+
| VS Code / GitHub Copilot | `.github/skills/flowbook/SKILL.md` | — |
|
|
152
|
+
| Google Antigravity | `.agent/skills/flowbook/SKILL.md` | — |
|
|
153
|
+
| Gemini CLI | `.gemini/skills/flowbook/SKILL.md` | — |
|
|
154
|
+
| Cursor | `.cursor/skills/flowbook/SKILL.md` | `.cursor/commands/flowbook.md` |
|
|
155
|
+
| Windsurf (Codeium) | `.windsurf/skills/flowbook/SKILL.md` | `.windsurf/workflows/flowbook.md` |
|
|
156
|
+
| AmpCode | `.amp/skills/flowbook/SKILL.md` | — |
|
|
157
|
+
| OpenCode / oh-my-opencode | `.opencode/skills/flowbook/SKILL.md` | `.opencode/command/flowbook.md` |
|
|
125
158
|
|
|
126
159
|
<details>
|
|
127
|
-
<summary>Manual
|
|
160
|
+
<summary>Manual Installation</summary>
|
|
128
161
|
|
|
129
|
-
If you didn't use `flowbook
|
|
162
|
+
If you didn't use `flowbook skill` or `npx skills add`, copy files manually:
|
|
130
163
|
|
|
131
164
|
```bash
|
|
132
|
-
#
|
|
165
|
+
# Skill
|
|
133
166
|
mkdir -p .claude/skills/flowbook
|
|
134
167
|
cp node_modules/flowbook/src/skills/flowbook/SKILL.md .claude/skills/flowbook/
|
|
135
168
|
|
|
136
|
-
#
|
|
137
|
-
mkdir -p .
|
|
138
|
-
cp node_modules/flowbook/src/
|
|
169
|
+
# Slash command (Claude Code)
|
|
170
|
+
mkdir -p .claude/commands
|
|
171
|
+
cp node_modules/flowbook/src/commands/flowbook.md .claude/commands/
|
|
139
172
|
```
|
|
140
173
|
|
|
141
|
-
Replace
|
|
174
|
+
Replace directories with the appropriate paths from the table above.
|
|
142
175
|
|
|
143
176
|
</details>
|
|
144
177
|
## How It Works
|
|
@@ -165,12 +198,19 @@ Replace the directory with the appropriate path from the Compatible Agents table
|
|
|
165
198
|
src/
|
|
166
199
|
├── types.ts # Shared types (FlowEntry, FlowbookData)
|
|
167
200
|
├── node/
|
|
168
|
-
│ ├── cli.ts # CLI entry point (init, dev, build)
|
|
201
|
+
│ ├── cli.ts # CLI entry point (init, dev, build, skill)
|
|
169
202
|
│ ├── server.ts # Programmatic Vite server & build
|
|
170
203
|
│ ├── init.ts # Project initialization logic
|
|
204
|
+
│ ├── skill.ts # AI agent skill & command installer
|
|
171
205
|
│ ├── discovery.ts # File scanner (fast-glob)
|
|
172
206
|
│ ├── parser.ts # Frontmatter + mermaid extraction
|
|
173
207
|
│ └── plugin.ts # Vite virtual module plugin
|
|
208
|
+
├── skills/
|
|
209
|
+
│ └── flowbook/
|
|
210
|
+
│ └── SKILL.md # AI agent skill definition
|
|
211
|
+
├── commands/
|
|
212
|
+
│ ├── flowbook.md # Slash command (frontmatter format)
|
|
213
|
+
│ └── flowbook.plain.md # Slash command (plain markdown format)
|
|
174
214
|
└── client/
|
|
175
215
|
├── index.html # Entry HTML
|
|
176
216
|
├── main.tsx # React entry
|
|
@@ -183,7 +223,6 @@ src/
|
|
|
183
223
|
├── MermaidRenderer.tsx # Mermaid diagram rendering
|
|
184
224
|
├── FlowView.tsx # Single flow detail view
|
|
185
225
|
└── EmptyState.tsx # Empty state with guide
|
|
186
|
-
```
|
|
187
226
|
|
|
188
227
|
## Development (Contributing)
|
|
189
228
|
|
package/dist/cli.js
CHANGED
|
@@ -1,11 +1,214 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/node/init.ts
|
|
4
|
-
import { readFileSync, writeFileSync, existsSync, mkdirSync
|
|
5
|
-
import { resolve
|
|
4
|
+
import { readFileSync, writeFileSync, existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
|
|
5
|
+
import { resolve as resolve2 } from "path";
|
|
6
6
|
import { execSync } from "child_process";
|
|
7
|
+
|
|
8
|
+
// src/node/skill.ts
|
|
9
|
+
import { existsSync, mkdirSync, copyFileSync } from "fs";
|
|
10
|
+
import { resolve, dirname } from "path";
|
|
7
11
|
import { fileURLToPath } from "url";
|
|
12
|
+
import { homedir } from "os";
|
|
8
13
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
var AGENTS = [
|
|
15
|
+
{
|
|
16
|
+
name: "Claude Code",
|
|
17
|
+
aliases: ["claude"],
|
|
18
|
+
skill: {
|
|
19
|
+
project: ".claude/skills/flowbook",
|
|
20
|
+
global: ".claude/skills/flowbook"
|
|
21
|
+
},
|
|
22
|
+
command: {
|
|
23
|
+
project: ".claude/commands",
|
|
24
|
+
global: ".claude/commands",
|
|
25
|
+
format: "frontmatter"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "OpenAI Codex",
|
|
30
|
+
aliases: ["codex"],
|
|
31
|
+
skill: {
|
|
32
|
+
project: ".agents/skills/flowbook",
|
|
33
|
+
global: ".codex/skills/flowbook"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "VS Code / GitHub Copilot",
|
|
38
|
+
aliases: ["copilot", "vscode"],
|
|
39
|
+
skill: {
|
|
40
|
+
project: ".github/skills/flowbook",
|
|
41
|
+
global: ".copilot/skills/flowbook"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "Google Antigravity",
|
|
46
|
+
aliases: ["antigravity"],
|
|
47
|
+
skill: {
|
|
48
|
+
project: ".agent/skills/flowbook",
|
|
49
|
+
global: ".gemini/antigravity/skills/flowbook"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "Gemini CLI",
|
|
54
|
+
aliases: ["gemini"],
|
|
55
|
+
skill: {
|
|
56
|
+
project: ".gemini/skills/flowbook",
|
|
57
|
+
global: ".gemini/skills/flowbook"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "Cursor",
|
|
62
|
+
aliases: ["cursor"],
|
|
63
|
+
skill: {
|
|
64
|
+
project: ".cursor/skills/flowbook",
|
|
65
|
+
global: ".cursor/skills/flowbook"
|
|
66
|
+
},
|
|
67
|
+
command: {
|
|
68
|
+
project: ".cursor/commands",
|
|
69
|
+
global: ".cursor/commands",
|
|
70
|
+
format: "plain"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "Windsurf",
|
|
75
|
+
aliases: ["windsurf"],
|
|
76
|
+
skill: {
|
|
77
|
+
project: ".windsurf/skills/flowbook",
|
|
78
|
+
global: ".codeium/windsurf/skills/flowbook"
|
|
79
|
+
},
|
|
80
|
+
command: {
|
|
81
|
+
project: ".windsurf/workflows",
|
|
82
|
+
global: ".codeium/windsurf/workflows",
|
|
83
|
+
format: "plain"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "AmpCode",
|
|
88
|
+
aliases: ["amp"],
|
|
89
|
+
skill: {
|
|
90
|
+
project: ".amp/skills/flowbook",
|
|
91
|
+
global: ".config/agents/skills/flowbook"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "OpenCode",
|
|
96
|
+
aliases: ["opencode"],
|
|
97
|
+
skill: {
|
|
98
|
+
project: ".opencode/skills/flowbook",
|
|
99
|
+
global: ".config/opencode/skills/flowbook"
|
|
100
|
+
},
|
|
101
|
+
command: {
|
|
102
|
+
project: ".opencode/command",
|
|
103
|
+
global: ".config/opencode/command",
|
|
104
|
+
format: "frontmatter"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
];
|
|
108
|
+
function getSkillSrc() {
|
|
109
|
+
return resolve(__dirname, "..", "src", "skills", "flowbook", "SKILL.md");
|
|
110
|
+
}
|
|
111
|
+
function getCommandSrc(format) {
|
|
112
|
+
const file = format === "frontmatter" ? "flowbook.md" : "flowbook.plain.md";
|
|
113
|
+
return resolve(__dirname, "..", "src", "commands", file);
|
|
114
|
+
}
|
|
115
|
+
function resolveAgents(agentArg) {
|
|
116
|
+
if (agentArg === "all") return AGENTS;
|
|
117
|
+
const lower = agentArg.toLowerCase();
|
|
118
|
+
const found = AGENTS.filter(
|
|
119
|
+
(a) => a.aliases.includes(lower) || a.name.toLowerCase().includes(lower)
|
|
120
|
+
);
|
|
121
|
+
if (found.length === 0) {
|
|
122
|
+
console.error(` Unknown agent: "${agentArg}"`);
|
|
123
|
+
console.error(` Available: all, ${AGENTS.flatMap((a) => a.aliases).join(", ")}`);
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
return found;
|
|
127
|
+
}
|
|
128
|
+
function installFile(src, destDir, destFilename) {
|
|
129
|
+
const dest = resolve(destDir, destFilename);
|
|
130
|
+
if (existsSync(dest)) return false;
|
|
131
|
+
mkdirSync(destDir, { recursive: true });
|
|
132
|
+
copyFileSync(src, dest);
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
function installSkills(agentArg, global) {
|
|
136
|
+
const agents = resolveAgents(agentArg);
|
|
137
|
+
const base = global ? homedir() : process.cwd();
|
|
138
|
+
const skillSrc = getSkillSrc();
|
|
139
|
+
if (!existsSync(skillSrc)) {
|
|
140
|
+
console.error(" \u2717 Skill source file not found. Reinstall flowbook.");
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
let skillCount = 0;
|
|
144
|
+
let cmdCount = 0;
|
|
145
|
+
for (const agent of agents) {
|
|
146
|
+
const skillDir = resolve(base, global ? agent.skill.global : agent.skill.project);
|
|
147
|
+
if (installFile(skillSrc, skillDir, "SKILL.md")) {
|
|
148
|
+
skillCount++;
|
|
149
|
+
}
|
|
150
|
+
if (agent.command) {
|
|
151
|
+
const cmdSrc = getCommandSrc(agent.command.format);
|
|
152
|
+
if (existsSync(cmdSrc)) {
|
|
153
|
+
const cmdDir = resolve(base, global ? agent.command.global : agent.command.project);
|
|
154
|
+
if (installFile(cmdSrc, cmdDir, "flowbook.md")) {
|
|
155
|
+
cmdCount++;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const scope = global ? "global" : "project";
|
|
161
|
+
const agentNames = agents.map((a) => a.name).join(", ");
|
|
162
|
+
if (skillCount > 0 || cmdCount > 0) {
|
|
163
|
+
if (skillCount > 0) console.log(` \u2713 Installed skill to ${skillCount} ${scope} director${skillCount > 1 ? "ies" : "y"}`);
|
|
164
|
+
if (cmdCount > 0) console.log(` \u2713 Installed /flowbook command to ${cmdCount} ${scope} director${cmdCount > 1 ? "ies" : "y"}`);
|
|
165
|
+
console.log(` Agents: ${agentNames}`);
|
|
166
|
+
} else {
|
|
167
|
+
console.log(` \u2713 Already installed for: ${agentNames}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function installAllProjectSkills() {
|
|
171
|
+
const cwd = process.cwd();
|
|
172
|
+
const skillSrc = getSkillSrc();
|
|
173
|
+
if (!existsSync(skillSrc)) return 0;
|
|
174
|
+
let installed = 0;
|
|
175
|
+
for (const agent of AGENTS) {
|
|
176
|
+
const dir = resolve(cwd, agent.skill.project);
|
|
177
|
+
if (installFile(skillSrc, dir, "SKILL.md")) {
|
|
178
|
+
installed++;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return installed;
|
|
182
|
+
}
|
|
183
|
+
function printSkillUsage() {
|
|
184
|
+
console.log(`
|
|
185
|
+
flowbook skill \u2014 Install AI agent skill & /flowbook command
|
|
186
|
+
|
|
187
|
+
Usage:
|
|
188
|
+
flowbook skill <agent> Install to project
|
|
189
|
+
flowbook skill <agent> --global Install globally
|
|
190
|
+
flowbook skill <agent> -g Install globally (short)
|
|
191
|
+
|
|
192
|
+
Agents:
|
|
193
|
+
all All supported agents
|
|
194
|
+
claude Claude Code
|
|
195
|
+
codex OpenAI Codex
|
|
196
|
+
copilot VS Code / GitHub Copilot
|
|
197
|
+
antigravity Google Antigravity
|
|
198
|
+
gemini Gemini CLI
|
|
199
|
+
cursor Cursor
|
|
200
|
+
windsurf Windsurf (Codeium)
|
|
201
|
+
amp AmpCode
|
|
202
|
+
opencode OpenCode / oh-my-opencode
|
|
203
|
+
|
|
204
|
+
Examples:
|
|
205
|
+
flowbook skill all Install to all agents (project)
|
|
206
|
+
flowbook skill opencode -g Install globally for OpenCode
|
|
207
|
+
flowbook skill claude --global Install globally for Claude Code
|
|
208
|
+
`);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// src/node/init.ts
|
|
9
212
|
var EXAMPLE_FLOW = `---
|
|
10
213
|
title: Example Flow
|
|
11
214
|
category: Getting Started
|
|
@@ -25,8 +228,8 @@ flowchart TD
|
|
|
25
228
|
`;
|
|
26
229
|
async function initFlowbook() {
|
|
27
230
|
const cwd = process.cwd();
|
|
28
|
-
const pkgPath =
|
|
29
|
-
if (!
|
|
231
|
+
const pkgPath = resolve2(cwd, "package.json");
|
|
232
|
+
if (!existsSync2(pkgPath)) {
|
|
30
233
|
console.error(" No package.json found. Run 'npm init' first.");
|
|
31
234
|
process.exit(1);
|
|
32
235
|
}
|
|
@@ -57,59 +260,28 @@ async function initFlowbook() {
|
|
|
57
260
|
} else {
|
|
58
261
|
console.log(" \u2713 Scripts already exist in package.json");
|
|
59
262
|
}
|
|
60
|
-
const flowsDir =
|
|
61
|
-
const examplePath =
|
|
62
|
-
if (!
|
|
63
|
-
|
|
263
|
+
const flowsDir = resolve2(cwd, "flows");
|
|
264
|
+
const examplePath = resolve2(flowsDir, "example.flow.md");
|
|
265
|
+
if (!existsSync2(examplePath)) {
|
|
266
|
+
mkdirSync2(flowsDir, { recursive: true });
|
|
64
267
|
writeFileSync(examplePath, EXAMPLE_FLOW);
|
|
65
268
|
console.log(" \u2713 Created flows/example.flow.md");
|
|
66
269
|
} else {
|
|
67
270
|
console.log(" \u2713 Example flow already exists");
|
|
68
271
|
}
|
|
69
|
-
const gitignorePath =
|
|
70
|
-
if (
|
|
272
|
+
const gitignorePath = resolve2(cwd, ".gitignore");
|
|
273
|
+
if (existsSync2(gitignorePath)) {
|
|
71
274
|
const gitignore = readFileSync(gitignorePath, "utf-8");
|
|
72
275
|
if (!gitignore.includes("flowbook-static")) {
|
|
73
276
|
writeFileSync(gitignorePath, gitignore.trimEnd() + "\nflowbook-static\n");
|
|
74
277
|
console.log(" \u2713 Added flowbook-static to .gitignore");
|
|
75
278
|
}
|
|
76
279
|
}
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
}
|
|
280
|
+
const installed = installAllProjectSkills();
|
|
281
|
+
if (installed > 0) {
|
|
282
|
+
console.log(` \u2713 Installed AI agent skill to ${installed} agent directories`);
|
|
283
|
+
} else {
|
|
284
|
+
console.log(" \u2713 AI agent skills already installed");
|
|
113
285
|
}
|
|
114
286
|
const run = pm === "yarn" ? "yarn" : `${pm} run`;
|
|
115
287
|
console.log("");
|
|
@@ -119,9 +291,9 @@ async function initFlowbook() {
|
|
|
119
291
|
console.log("");
|
|
120
292
|
}
|
|
121
293
|
function detectPackageManager(cwd) {
|
|
122
|
-
if (
|
|
123
|
-
if (
|
|
124
|
-
if (
|
|
294
|
+
if (existsSync2(resolve2(cwd, "bun.lockb")) || existsSync2(resolve2(cwd, "bun.lock"))) return "bun";
|
|
295
|
+
if (existsSync2(resolve2(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
296
|
+
if (existsSync2(resolve2(cwd, "yarn.lock"))) return "yarn";
|
|
125
297
|
return "npm";
|
|
126
298
|
}
|
|
127
299
|
function getInstallCommand(pm) {
|
|
@@ -228,11 +400,11 @@ function flowbookPlugin(options = {}) {
|
|
|
228
400
|
}
|
|
229
401
|
|
|
230
402
|
// src/node/server.ts
|
|
231
|
-
import { resolve as
|
|
403
|
+
import { resolve as resolve3, dirname as dirname2 } from "path";
|
|
232
404
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
233
405
|
var __dirname2 = dirname2(fileURLToPath2(import.meta.url));
|
|
234
406
|
function getClientDir() {
|
|
235
|
-
return
|
|
407
|
+
return resolve3(__dirname2, "..", "src", "client");
|
|
236
408
|
}
|
|
237
409
|
function createConfig(options) {
|
|
238
410
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -253,7 +425,7 @@ function createConfig(options) {
|
|
|
253
425
|
port: options.port ?? 6200
|
|
254
426
|
},
|
|
255
427
|
build: {
|
|
256
|
-
outDir:
|
|
428
|
+
outDir: resolve3(cwd, options.outDir ?? "flowbook-static"),
|
|
257
429
|
emptyOutDir: true
|
|
258
430
|
}
|
|
259
431
|
};
|
|
@@ -290,6 +462,16 @@ async function main() {
|
|
|
290
462
|
await buildStatic({ outDir });
|
|
291
463
|
break;
|
|
292
464
|
}
|
|
465
|
+
case "skill": {
|
|
466
|
+
const agent = args[1];
|
|
467
|
+
if (!agent) {
|
|
468
|
+
printSkillUsage();
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
const isGlobal = args.includes("--global") || args.includes("-g");
|
|
472
|
+
installSkills(agent, isGlobal);
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
293
475
|
default:
|
|
294
476
|
printUsage();
|
|
295
477
|
break;
|
|
@@ -308,10 +490,13 @@ function printUsage() {
|
|
|
308
490
|
flowbook init Set up Flowbook in your project
|
|
309
491
|
flowbook dev [--port 6200] Start the dev server
|
|
310
492
|
flowbook build [--out-dir d] Build a static site
|
|
493
|
+
flowbook skill <agent> [-g] Install AI agent skill & command
|
|
311
494
|
|
|
312
495
|
Options:
|
|
313
496
|
--port <number> Dev server port (default: 6200)
|
|
314
497
|
--out-dir <path> Build output directory (default: flowbook-static)
|
|
498
|
+
|
|
499
|
+
Run 'flowbook skill' for agent-specific options.
|
|
315
500
|
`);
|
|
316
501
|
}
|
|
317
502
|
main().catch((err) => {
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Analyze codebase and generate Mermaid flowchart documentation using Flowbook
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Load the **flowbook** skill and execute the full flowchart generation workflow.
|
|
6
|
+
|
|
7
|
+
When prompted with `/flowbook`, you MUST:
|
|
8
|
+
|
|
9
|
+
1. Load the `flowbook` skill (SKILL.md) for detailed instructions
|
|
10
|
+
2. Analyze the codebase for logical flows (API routes, auth, state management, business logic)
|
|
11
|
+
3. Set up Flowbook if not already initialized (`npx flowbook@latest init`)
|
|
12
|
+
4. Generate `.flow.md` files with Mermaid diagrams for every significant flow
|
|
13
|
+
5. Run `npm run flowbook` to verify the build
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# /flowbook — Flowchart Documentation Generator
|
|
2
|
+
|
|
3
|
+
Analyze codebase and generate Mermaid flowchart documentation using Flowbook.
|
|
4
|
+
|
|
5
|
+
Load the **flowbook** skill and execute the full flowchart generation workflow.
|
|
6
|
+
|
|
7
|
+
When prompted with `/flowbook`, you MUST:
|
|
8
|
+
|
|
9
|
+
1. Load the `flowbook` skill (SKILL.md) for detailed instructions
|
|
10
|
+
2. Analyze the codebase for logical flows (API routes, auth, state management, business logic)
|
|
11
|
+
3. Set up Flowbook if not already initialized (`npx flowbook@latest init`)
|
|
12
|
+
4. Generate `.flow.md` files with Mermaid diagrams for every significant flow
|
|
13
|
+
5. Run `npm run flowbook` to verify the build
|
package/src/node/cli.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { initFlowbook } from "./init";
|
|
2
2
|
import { startDevServer, buildStatic } from "./server";
|
|
3
|
+
import { installSkills, printSkillUsage } from "./skill";
|
|
3
4
|
|
|
4
5
|
async function main() {
|
|
5
6
|
const args = process.argv.slice(2);
|
|
@@ -22,6 +23,17 @@ async function main() {
|
|
|
22
23
|
break;
|
|
23
24
|
}
|
|
24
25
|
|
|
26
|
+
case "skill": {
|
|
27
|
+
const agent = args[1];
|
|
28
|
+
if (!agent) {
|
|
29
|
+
printSkillUsage();
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
const isGlobal = args.includes("--global") || args.includes("-g");
|
|
33
|
+
installSkills(agent, isGlobal);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
|
|
25
37
|
default:
|
|
26
38
|
printUsage();
|
|
27
39
|
break;
|
|
@@ -46,10 +58,13 @@ function printUsage() {
|
|
|
46
58
|
flowbook init Set up Flowbook in your project
|
|
47
59
|
flowbook dev [--port 6200] Start the dev server
|
|
48
60
|
flowbook build [--out-dir d] Build a static site
|
|
61
|
+
flowbook skill <agent> [-g] Install AI agent skill & command
|
|
49
62
|
|
|
50
63
|
Options:
|
|
51
64
|
--port <number> Dev server port (default: 6200)
|
|
52
65
|
--out-dir <path> Build output directory (default: flowbook-static)
|
|
66
|
+
|
|
67
|
+
Run 'flowbook skill' for agent-specific options.
|
|
53
68
|
`);
|
|
54
69
|
}
|
|
55
70
|
|
package/src/node/init.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync, existsSync, mkdirSync
|
|
2
|
-
import { resolve
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
3
|
import { execSync } from "node:child_process";
|
|
4
|
-
import {
|
|
4
|
+
import { installAllProjectSkills } from "./skill";
|
|
5
5
|
|
|
6
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
6
|
|
|
8
7
|
const EXAMPLE_FLOW = `---
|
|
9
8
|
title: Example Flow
|
|
@@ -89,34 +88,11 @@ export async function initFlowbook() {
|
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
// 5. Install AI agent skill to all supported agent directories
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
}
|
|
91
|
+
const installed = installAllProjectSkills();
|
|
92
|
+
if (installed > 0) {
|
|
93
|
+
console.log(` ✓ Installed AI agent skill to ${installed} agent directories`);
|
|
94
|
+
} else {
|
|
95
|
+
console.log(" ✓ AI agent skills already installed");
|
|
120
96
|
}
|
|
121
97
|
|
|
122
98
|
const run = pm === "yarn" ? "yarn" : `${pm} run`;
|