flowbook 0.2.10 → 0.2.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowbook",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "flowbook": "dist/cli.js"
@@ -318,35 +318,66 @@ flowchart TD
318
318
  G -->|Invalid| I[Show Errors]
319
319
  ```
320
320
 
321
- #### Styling
321
+ #### Styling — Flow-Group Coloring
322
322
 
323
- Apply consistent colors to node types:
323
+ Color nodes by **logical flow group**, not by shape. Nodes on the same path or serving the same purpose share a color.
324
+
325
+ **Step 1: Identify flow groups** — Analyze the diagram and group nodes by semantic role:
326
+ - Happy path / success flow
327
+ - Error / failure / rejection path
328
+ - Validation / guard checks
329
+ - External service calls (API, third-party)
330
+ - Data storage operations (DB read/write, cache)
331
+ - User interaction points (input, redirect)
332
+ - Each distinct branch from a decision point
333
+
334
+ **Step 2: Assign colors using `classDef` + `class`** — One `classDef` per group, then apply with `class`:
324
335
 
325
336
  ```mermaid
326
337
  flowchart TD
327
- A([Start]) --> B[Process]
328
- B --> C{Decision}
329
- C -->|Yes| D[(Save to DB)]
330
- C -->|No| E[Handle Error]
331
- D --> F([End])
332
- E --> F
333
-
334
- style A fill:#6366f1,color:#fff
335
- style F fill:#6366f1,color:#fff
336
- style C fill:#f59e0b,color:#000
337
- style D fill:#10b981,color:#fff
338
- style E fill:#ef4444,color:#fff
338
+ A([POST /api/login]) --> B{{"Validate Input"}}
339
+ B -->|Invalid| C[\400 Bad Request/]
340
+ B -->|Valid| D[(Find User)]
341
+ D -->|Not Found| E[\401 Unauthorized/]
342
+ D -->|Found| F{{Compare Password}}
343
+ F -->|Mismatch| E
344
+ F -->|Match| G[Generate Token]
345
+ G --> H[(Save Token)]
346
+ H --> I[\200 OK + Token/]
347
+
348
+ classDef entry fill:#6366f1,stroke:#818cf8,color:#fff
349
+ classDef validation fill:#f59e0b,stroke:#fbbf24,color:#000
350
+ classDef success fill:#10b981,stroke:#34d399,color:#fff
351
+ classDef error fill:#ef4444,stroke:#f87171,color:#fff
352
+ classDef data fill:#3b82f6,stroke:#60a5fa,color:#fff
353
+
354
+ class A entry
355
+ class B,F validation
356
+ class G,I success
357
+ class C,E error
358
+ class D,H data
339
359
  ```
340
360
 
341
- **Color convention:**
342
- - `#6366f1` (indigo) — Start/End points
343
- - `#10b981` (green) Success paths, DB operations
344
- - `#f59e0b` (amber) — Decision points
345
- - `#ef4444` (red) Error paths, failures
346
- - `#8b5cf6` (purple) External service calls
347
- - `#3b82f6` (blue) Processing steps
348
- - Default (no style) Regular steps
349
-
361
+ **Color palette (assign by flow group, not by shape):**
362
+
363
+ | Group | Color | Hex | Use When |
364
+ |-------|-------|-----|----------|
365
+ | Entry/Exit | Indigo | `#6366f1` | Start/end points of the flow |
366
+ | Success path | Green | `#10b981` | Happy path, successful operations |
367
+ | Error path | Red | `#ef4444` | Failures, rejections, error responses |
368
+ | Validation | Amber | `#f59e0b` | Guards, checks, decision points that validate |
369
+ | Data ops | Blue | `#3b82f6` | DB reads/writes, cache, storage |
370
+ | External | Purple | `#8b5cf6` | Third-party API calls, external services |
371
+ | User action | Cyan | `#06b6d4` | User-facing interactions, redirects |
372
+ | Processing | Slate | `#64748b` | Internal processing, transformation |
373
+
374
+ **Rules:**
375
+ - Nodes on the **same logical path** MUST share the same `classDef`
376
+ - A decision node (diamond) gets the color of the **flow group it guards** (e.g., validation diamond → `validation` class)
377
+ - If a node belongs to multiple paths, color it by its **primary purpose**
378
+ - Use `classDef` + `class` (NOT individual `style` per node) — it's cleaner and groups are explicit
379
+ - Keep to 3–5 color groups per diagram. Too many colors defeats the purpose
380
+ - Uncolored nodes use the theme default — only color nodes that benefit from grouping
350
381
  #### Subgraphs for Complex Flows
351
382
 
352
383
  Use subgraphs to group related steps:
@@ -411,14 +442,17 @@ flowchart TD
411
442
  I --> J[(Save Refresh Token)]
412
443
  J --> K[\200 OK + Tokens/]
413
444
 
414
- style A fill:#6366f1,color:#fff
415
- style C fill:#f59e0b,color:#000
416
- style G fill:#f59e0b,color:#000
417
- style E fill:#10b981,color:#fff
418
- style J fill:#10b981,color:#fff
419
- style D fill:#ef4444,color:#fff
420
- style F fill:#ef4444,color:#fff
421
- style K fill:#10b981,color:#fff
445
+ classDef entry fill:#6366f1,stroke:#818cf8,color:#fff
446
+ classDef validation fill:#f59e0b,stroke:#fbbf24,color:#000
447
+ classDef success fill:#10b981,stroke:#34d399,color:#fff
448
+ classDef error fill:#ef4444,stroke:#f87171,color:#fff
449
+ classDef data fill:#3b82f6,stroke:#60a5fa,color:#fff
450
+
451
+ class A entry
452
+ class B,C,G validation
453
+ class H,I,K success
454
+ class D,F error
455
+ class E,J data
422
456
  ```
423
457
  ````
424
458