@dv.nghiem/flowdeck 0.2.3 → 0.3.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 +24 -41
- package/dist/hooks/memory-hook.d.ts +21 -0
- package/dist/hooks/memory-hook.d.ts.map +1 -0
- package/dist/hooks/orchestrator-guard-hook.d.ts +2 -1
- package/dist/hooks/orchestrator-guard-hook.d.ts.map +1 -1
- package/dist/hooks/todo-hook.d.ts +1 -7
- package/dist/hooks/todo-hook.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +649 -310
- package/dist/services/memory-store.d.ts +40 -0
- package/dist/services/memory-store.d.ts.map +1 -0
- package/dist/services/telemetry.d.ts +1 -1
- package/dist/services/telemetry.d.ts.map +1 -1
- package/dist/tools/memory-search.d.ts +3 -0
- package/dist/tools/memory-search.d.ts.map +1 -0
- package/docs/commands/fd-doctor.md +21 -0
- package/docs/commands/fd-quick.md +33 -0
- package/docs/commands/fd-reflect.md +23 -0
- package/docs/commands/fd-status.md +31 -0
- package/docs/commands/fd-translate-intent.md +17 -0
- package/docs/commands.md +209 -271
- package/docs/configuration.md +2 -1
- package/docs/index.md +22 -28
- package/docs/memory.md +69 -0
- package/docs/quick-start.md +1 -1
- package/docs/workflows.md +72 -320
- package/package.json +1 -2
- package/src/commands/fd-deploy-check.md +189 -34
- package/src/commands/fd-discuss.md +44 -6
- package/src/commands/fd-fix-bug.md +47 -20
- package/src/commands/fd-map-codebase.md +66 -18
- package/src/commands/fd-multi-repo.md +130 -6
- package/src/commands/fd-new-feature.md +164 -21
- package/src/commands/fd-new-project.md +14 -1
- package/src/commands/fd-plan.md +66 -44
- package/src/commands/fd-quick.md +60 -0
- package/src/commands/fd-reflect.md +41 -2
- package/src/commands/fd-status.md +84 -0
- package/src/commands/fd-write-docs.md +55 -23
- package/src/rules/README.md +8 -7
- package/src/skills/agent-harness-construction/SKILL.md +227 -0
- package/src/skills/api-design/SKILL.md +5 -0
- package/src/skills/backend-patterns/SKILL.md +105 -0
- package/src/skills/clean-architecture/SKILL.md +85 -0
- package/src/skills/cqrs/SKILL.md +230 -0
- package/src/skills/ddd-architecture/SKILL.md +104 -0
- package/src/skills/django-patterns/SKILL.md +304 -0
- package/src/skills/django-tdd/SKILL.md +297 -0
- package/src/skills/event-driven-architecture/SKILL.md +152 -0
- package/src/skills/frontend-pattern/SKILL.md +159 -0
- package/src/skills/hexagonal-architecture/SKILL.md +80 -0
- package/src/skills/layered-architecture/SKILL.md +64 -0
- package/src/skills/postgres-patterns/SKILL.md +74 -0
- package/src/skills/python-patterns/SKILL.md +5 -0
- package/src/skills/saga-architecture/SKILL.md +113 -0
- package/dist/tools/run-parallel.d.ts +0 -4
- package/dist/tools/run-parallel.d.ts.map +0 -1
- package/docs/command-migration.md +0 -175
- package/docs/commands/fd-analyze-change.md +0 -107
- package/docs/commands/fd-dashboard.md +0 -11
- package/docs/commands/fd-evaluate-risk.md +0 -134
- package/docs/commands/fd-guarded-edit.md +0 -105
- package/docs/commands/fd-progress.md +0 -11
- package/docs/commands/fd-review-code.md +0 -29
- package/docs/commands/fd-roadmap.md +0 -10
- package/docs/commands/fd-settings.md +0 -10
- package/docs/parallel-execution.md +0 -227
- package/src/commands/fd-analyze-change.md +0 -57
- package/src/commands/fd-approve.md +0 -64
- package/src/commands/fd-blast-radius.md +0 -49
- package/src/commands/fd-dashboard.md +0 -57
- package/src/commands/fd-evaluate-risk.md +0 -62
- package/src/commands/fd-guarded-edit.md +0 -69
- package/src/commands/fd-impact-radar.md +0 -51
- package/src/commands/fd-learn.md +0 -36
- package/src/commands/fd-progress.md +0 -50
- package/src/commands/fd-regression-predict.md +0 -57
- package/src/commands/fd-review-code.md +0 -62
- package/src/commands/fd-review-route.md +0 -54
- package/src/commands/fd-roadmap.md +0 -46
- package/src/commands/fd-settings.md +0 -57
- package/src/commands/fd-test-gap.md +0 -54
- package/src/commands/fd-volatility-map.md +0 -64
- package/src/commands/fd-workspace-status.md +0 -34
- package/src/skills/parallel-execute/SKILL.md +0 -92
- package/src/workflows/debug-flow.md +0 -119
- package/src/workflows/deploy-check-flow.md +0 -98
- package/src/workflows/discuss-flow.md +0 -97
- package/src/workflows/execute-flow.md +0 -233
- package/src/workflows/execute-phase.md +0 -145
- package/src/workflows/fix-bug-flow.md +0 -210
- package/src/workflows/map-codebase-flow.md +0 -92
- package/src/workflows/multi-repo-flow.md +0 -226
- package/src/workflows/parallel-execution-flow.md +0 -236
- package/src/workflows/plan-flow.md +0 -126
- package/src/workflows/plan-phase.md +0 -101
- package/src/workflows/refactor-flow.md +0 -122
- package/src/workflows/review-code-flow.md +0 -105
- package/src/workflows/spec-driven-flow.md +0 -43
- package/src/workflows/write-docs-flow.md +0 -95
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# layered-architecture
|
|
2
|
+
|
|
3
|
+
## When to Activate
|
|
4
|
+
When building traditional monolithic or client-server applications where clear vertical separation of concerns improves maintainability (e.g., MVC applications, REST APIs, data-driven apps).
|
|
5
|
+
|
|
6
|
+
## Steps
|
|
7
|
+
1. **Identify natural layers** - Determine the distinct vertical tiers based on responsibility (e.g., presentation, business logic, data access).
|
|
8
|
+
2. **Define layer responsibilities** - Establish clear contracts for what each layer can and cannot depend on.
|
|
9
|
+
3. **Implement top-down dependencies** - Higher layers (presentation) depend on lower layers (data), but never vice versa.
|
|
10
|
+
4. **Create layer interfaces** - Use interfaces or abstract classes to define how adjacent layers communicate.
|
|
11
|
+
5. **Enforce layer access rules** - Use module visibility, package private, or architectural linting tools to prevent cross-layer pollution.
|
|
12
|
+
6. **Keep thin layers** - Avoid bloating any single layer; if the business logic layer grows large, consider extracting domain objects.
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
```typescript
|
|
16
|
+
// Presentation Layer - Controllers/Handlers
|
|
17
|
+
class OrderController {
|
|
18
|
+
constructor(private readonly orderService: OrderService) {}
|
|
19
|
+
|
|
20
|
+
async createOrder(req: Request, res: Response): Promise<void> {
|
|
21
|
+
const order = await this.orderService.createOrder(req.body)
|
|
22
|
+
res.status(201).json(order)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Business Logic Layer - Services
|
|
27
|
+
class OrderService {
|
|
28
|
+
constructor(
|
|
29
|
+
private readonly orderRepository: OrderRepository,
|
|
30
|
+
private readonly paymentGateway: PaymentGateway
|
|
31
|
+
) {}
|
|
32
|
+
|
|
33
|
+
async createOrder(data: CreateOrderDto): Promise<Order> {
|
|
34
|
+
const order = new Order(data.items)
|
|
35
|
+
|
|
36
|
+
if (data.paymentMethod === 'prepaid') {
|
|
37
|
+
await this.paymentGateway.charge(order.total, data.paymentToken)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return this.orderRepository.save(order)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Data Access Layer - Repositories
|
|
45
|
+
interface OrderRepository {
|
|
46
|
+
save(order: Order): Promise<void>
|
|
47
|
+
findById(id: string): Promise<Order | null>
|
|
48
|
+
findByCustomer(customerId: string): Promise<Order[]>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
class PostgresOrderRepository implements OrderRepository {
|
|
52
|
+
constructor(private readonly db: Database) {}
|
|
53
|
+
|
|
54
|
+
async save(order: Order): Promise<void> {
|
|
55
|
+
await this.db.query('INSERT INTO orders (...) VALUES (...)', order.toDbFormat())
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Related Skills
|
|
61
|
+
- clean-architecture
|
|
62
|
+
- hexagonal-architecture
|
|
63
|
+
- ddd-architecture
|
|
64
|
+
- backend-patterns
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# postgres-patterns
|
|
2
|
+
|
|
3
|
+
## When to Activate
|
|
4
|
+
When designing database schemas, writing complex queries, or optimizing database performance. Use before creating migrations or writing SQL queries.
|
|
5
|
+
|
|
6
|
+
## Steps
|
|
7
|
+
1. **Design indexes strategically** - Create individual btree indexes on each column for multi-column searches (allows BitmapAnd)
|
|
8
|
+
2. **Use EXPLAIN ANALYZE** - Always verify query plans before and after optimization
|
|
9
|
+
3. **Choose correct index type** - B-tree for equality/range, Bloom for multi-column filters with high selectivity
|
|
10
|
+
4. **Avoid multi-column btree on non-leading columns** - Queries on non-first columns of multi-column btree indexes will do sequential scans
|
|
11
|
+
5. **Use parameterized queries** - Let the planner cache and reuse query plans
|
|
12
|
+
6. **Run ANALYZE regularly** - Keep statistics fresh for optimal planner decisions
|
|
13
|
+
|
|
14
|
+
## Examples
|
|
15
|
+
|
|
16
|
+
```sql
|
|
17
|
+
-- AVOID: Multi-column btree for non-leading column queries
|
|
18
|
+
CREATE INDEX btreeidx ON tbloom (i1, i2, i3, i4, i5, i6);
|
|
19
|
+
-- Query on i2 and i5 will do sequential scan, not use the index
|
|
20
|
+
|
|
21
|
+
-- PREFER: Individual btree indexes for multi-column searches
|
|
22
|
+
CREATE INDEX btreeidx1 ON tbloom (i1);
|
|
23
|
+
CREATE INDEX btreeidx2 ON tbloom (i2);
|
|
24
|
+
CREATE INDEX btreeidx3 ON tbloom (i3);
|
|
25
|
+
CREATE INDEX btreeidx4 ON tbloom (i4);
|
|
26
|
+
CREATE INDEX btreeidx5 ON tbloom (i5);
|
|
27
|
+
CREATE INDEX btreeidx6 ON tbloom (i6);
|
|
28
|
+
-- Bitmap Index Scan with BitmapAnd is used for multi-column queries
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```sql
|
|
32
|
+
-- Bloom Index for multi-column filtering (good for low selectivity columns)
|
|
33
|
+
CREATE INDEX bloomidx ON tbloom USING bloom (i1, i2, i3, i4, i5, i6);
|
|
34
|
+
-- More efficient than btree for queries filtering on many columns
|
|
35
|
+
-- Smaller index size, faster Bitmap Index Scans
|
|
36
|
+
|
|
37
|
+
-- Always verify with EXPLAIN ANALYZE
|
|
38
|
+
EXPLAIN ANALYZE SELECT * FROM tbloom WHERE i2 = 898732 AND i5 = 123451;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```sql
|
|
42
|
+
-- Query Planner Configuration (temporary fix only)
|
|
43
|
+
SET enable_hashjoin = off; -- Force nested-loop or merge join
|
|
44
|
+
SET enable_seqscan = off; -- Prefer index scans
|
|
45
|
+
SET random_page_cost = 1.1; -- Make index scans cheaper (SSD)
|
|
46
|
+
SET effective_cache_size = '8GB'; -- Help planner estimate
|
|
47
|
+
|
|
48
|
+
-- Better approaches:
|
|
49
|
+
-- 1. Run ANALYZE to update statistics
|
|
50
|
+
ANALYZE;
|
|
51
|
+
-- 2. Increase statistics for specific columns
|
|
52
|
+
ALTER TABLE orders SET STATISTICS = 500;
|
|
53
|
+
ANALYZE orders;
|
|
54
|
+
-- 3. Adjust planner cost constants (postgresql.conf)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```sql
|
|
58
|
+
-- Repository Pattern in SQL
|
|
59
|
+
-- Define standard operations
|
|
60
|
+
interface OrderRepository {
|
|
61
|
+
findAll(filter: OrderFilter, pagination: Pagination): Promise<Order[]>;
|
|
62
|
+
findById(id: string): Promise<Order | null>;
|
|
63
|
+
create(order: CreateOrderDTO): Promise<Order>;
|
|
64
|
+
update(id: string, attributes: UpdateOrderDTO): Promise<Order>;
|
|
65
|
+
delete(id: string): Promise<void>;
|
|
66
|
+
count(filter?: OrderFilter): Promise<number>;
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Related Skills
|
|
71
|
+
- api-design
|
|
72
|
+
- backend-patterns
|
|
73
|
+
- database-migrations
|
|
74
|
+
- postgres-performance
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# saga-architecture
|
|
2
|
+
|
|
3
|
+
## When to Activate
|
|
4
|
+
When coordinating distributed operations across multiple services or data stores where ACID transactions are not available and compensating actions are needed to maintain eventual consistency.
|
|
5
|
+
|
|
6
|
+
## Steps
|
|
7
|
+
1. **Identify the saga participants** - Determine which services or components participate in the distributed operation.
|
|
8
|
+
2. **Define the saga choreography or orchestration** - Choose whether sagas will be choreographed (event-driven) or orchestrated (central coordinator).
|
|
9
|
+
3. **Define each step with corresponding compensation** - For every forward action, define what compensating action undoes it.
|
|
10
|
+
4. **Implement idempotent operations** - Ensure each step can be safely retried and compensation can be safely reapplied.
|
|
11
|
+
5. **Handle saga failures with compensation** - On failure, execute compensations in reverse order (for orchestrating sagas) or react to failure events (for choreographing sagas).
|
|
12
|
+
6. **Persist saga state** - Store saga state to survive process crashes and enable recovery.
|
|
13
|
+
7. **Add timeout and retry logic** - Detect stuck sagas and advance or compensate accordingly.
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
```typescript
|
|
17
|
+
// Saga State
|
|
18
|
+
interface SagaState<T> {
|
|
19
|
+
id: string
|
|
20
|
+
currentStep: number
|
|
21
|
+
data: T
|
|
22
|
+
status: 'pending' | 'in_progress' | 'completed' | 'compensating' | 'failed'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Orchestrating Saga - Central coordinator manages steps
|
|
26
|
+
class OrderProcessingSaga {
|
|
27
|
+
private readonly steps: SagaStep[]
|
|
28
|
+
|
|
29
|
+
constructor(
|
|
30
|
+
private readonly sagaOrchestrator: SagaOrchestrator,
|
|
31
|
+
private readonly inventoryService: InventoryService,
|
|
32
|
+
private readonly paymentService: PaymentService,
|
|
33
|
+
private readonly shippingService: ShippingService
|
|
34
|
+
) {
|
|
35
|
+
this.steps = [
|
|
36
|
+
{
|
|
37
|
+
name: 'reserve_inventory',
|
|
38
|
+
execute: (state) => this.inventoryService.reserve(state.orderId, state.items),
|
|
39
|
+
compensate: (state) => this.inventoryService.release(state.orderId, state.items)
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'process_payment',
|
|
43
|
+
execute: (state) => this.paymentService.charge(state.orderId, state.total),
|
|
44
|
+
compensate: (state) => this.paymentService.refund(state.orderId, state.total)
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'initiate_shipping',
|
|
48
|
+
execute: (state) => this.shippingService.createShipment(state.orderId),
|
|
49
|
+
compensate: (state) => this.shippingService.cancelShipment(state.shipmentId)
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async execute(orderId: string): Promise<void> {
|
|
55
|
+
const state: SagaState<OrderSagaData> = {
|
|
56
|
+
id: generateId(),
|
|
57
|
+
currentStep: 0,
|
|
58
|
+
data: { orderId, items: [], total: 0 },
|
|
59
|
+
status: 'in_progress'
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
await this.sagaOrchestrator.start(state, this.steps)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Choreography-based Saga - Events trigger reactions
|
|
67
|
+
class OrderCreatedHandler {
|
|
68
|
+
constructor(private readonly eventBus: EventBus) {}
|
|
69
|
+
|
|
70
|
+
async handle(event: OrderCreatedEvent): Promise<void> {
|
|
71
|
+
// Step 1: Reserve inventory
|
|
72
|
+
try {
|
|
73
|
+
await this.inventoryService.reserve(event.orderId, event.items)
|
|
74
|
+
this.eventBus.publish(new InventoryReservedEvent(event.orderId))
|
|
75
|
+
} catch (error) {
|
|
76
|
+
this.eventBus.publish(new InventoryReservationFailedEvent(event.orderId, error.message))
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
class InventoryReservedHandler {
|
|
82
|
+
async handle(event: InventoryReservedEvent): Promise<void> {
|
|
83
|
+
// Step 2: Process payment
|
|
84
|
+
try {
|
|
85
|
+
await this.paymentService.charge(event.orderId, event.total)
|
|
86
|
+
this.eventBus.publish(new PaymentProcessedEvent(event.orderId))
|
|
87
|
+
} catch (error) {
|
|
88
|
+
// Compensate by releasing inventory
|
|
89
|
+
this.eventBus.publish(new InventoryReleaseRequestedEvent(event.orderId))
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Idempotent Step Implementation
|
|
95
|
+
class PaymentService {
|
|
96
|
+
async charge(orderId: string, amount: Money): Promise<TransactionId> {
|
|
97
|
+
const existingTx = await this.transactionRepo.findByOrderId(orderId)
|
|
98
|
+
if (existingTx) {
|
|
99
|
+
return existingTx.id // Idempotent: return existing instead of charging again
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const transaction = await this.paymentGateway.charge(amount)
|
|
103
|
+
await this.transactionRepo.save({ orderId, transaction })
|
|
104
|
+
return transaction.id
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Related Skills
|
|
110
|
+
- clean-architecture
|
|
111
|
+
- hexagonal-architecture
|
|
112
|
+
- ddd-architecture
|
|
113
|
+
- backend-patterns
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-parallel.d.ts","sourceRoot":"","sources":["../../src/tools/run-parallel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAkBtD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CA8G5E"}
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
# Command Architecture & Migration Guide
|
|
2
|
-
|
|
3
|
-
FlowDeck v2 consolidates seven individual analysis commands into four umbrella commands, reducing the top-level command surface while keeping all capabilities. The 15 workflow commands remain as separate top-level slash commands.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Command Map
|
|
8
|
-
|
|
9
|
-
### Workflow commands (unchanged — 15 total)
|
|
10
|
-
|
|
11
|
-
These remain as separate top-level commands:
|
|
12
|
-
|
|
13
|
-
| Command | Purpose |
|
|
14
|
-
|---------|---------|
|
|
15
|
-
| `/fd-new-project` | Bootstrap a new project |
|
|
16
|
-
| `/fd-map-codebase` | Analyse and index the codebase |
|
|
17
|
-
| `/fd-settings` | Configure FlowDeck settings |
|
|
18
|
-
| `/fd-discuss` | Pre-planning discussion with impact radar |
|
|
19
|
-
| `/fd-plan` | Generate a phase plan |
|
|
20
|
-
| `/fd-roadmap` | View / update project roadmap |
|
|
21
|
-
| `/fd-dashboard` | Visual progress dashboard |
|
|
22
|
-
| `/fd-ask` | Smart agent dispatch |
|
|
23
|
-
| `/fd-new-feature` | Implement a new feature |
|
|
24
|
-
| `/fd-fix-bug` | Fix a bug with failure replay |
|
|
25
|
-
| `/fd-review-code` | Code review with impact radar |
|
|
26
|
-
| `/fd-write-docs` | Generate documentation |
|
|
27
|
-
| `/fd-deploy-check` | Pre-deploy safety check |
|
|
28
|
-
| `/fd-progress` | View project progress |
|
|
29
|
-
| `/fd-checkpoint` | Save a session checkpoint |
|
|
30
|
-
| `/fd-resume` | Resume from checkpoint |
|
|
31
|
-
| `/fd-multi-repo` | Multi-repo management |
|
|
32
|
-
|
|
33
|
-
### Analysis commands — old → new mapping
|
|
34
|
-
|
|
35
|
-
| Old command | New umbrella command | Flag |
|
|
36
|
-
|-------------|---------------------|------|
|
|
37
|
-
| `/fd-impact-radar` | `/fd-analyze-change` | `--impact` |
|
|
38
|
-
| `/fd-blast-radius` | `/fd-analyze-change` | `--blast-radius` |
|
|
39
|
-
| `/fd-regression-predict` | `/fd-analyze-change` | `--regression` |
|
|
40
|
-
| `/fd-test-gap` | `/fd-analyze-change` | `--test-gap` |
|
|
41
|
-
| `/fd-volatility-map` | `/fd-analyze-change` | `--volatility` |
|
|
42
|
-
| `/fd-review-route` | `/fd-analyze-change` | `--review-route` |
|
|
43
|
-
| `/fd-translate-intent` | `/fd-translate-intent` | *(enhanced, kept as-is)* |
|
|
44
|
-
| *(new)* | `/fd-guarded-edit` | — |
|
|
45
|
-
| *(new)* | `/fd-evaluate-risk` | — |
|
|
46
|
-
|
|
47
|
-
### New umbrella commands (4 total)
|
|
48
|
-
|
|
49
|
-
| Command | Replaces / Adds |
|
|
50
|
-
|---------|----------------|
|
|
51
|
-
| `/fd-analyze-change` | Combines 6 analysis commands; `--all` runs all modules |
|
|
52
|
-
| `/fd-guarded-edit` | New — edit gate decision (auto/confirm/review/block) |
|
|
53
|
-
| `/fd-evaluate-risk` | New — standalone risk + regression assessment |
|
|
54
|
-
| `/fd-translate-intent` | Enhanced — adds `assumptions`, `recommended_option`, `clarifying_questions` |
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Architecture
|
|
59
|
-
|
|
60
|
-
### Command layer
|
|
61
|
-
|
|
62
|
-
Commands are thin entry points that dispatch to agent pipelines or shared utilities. No analysis logic lives inside command files.
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
User runs: /fd-analyze-change --change "..." --impact --regression
|
|
66
|
-
↓
|
|
67
|
-
analyzeChangeCommand.execute()
|
|
68
|
-
↓
|
|
69
|
-
reads: VOLATILITY.json, FAILURES.json, MEMORY.json via shared libs
|
|
70
|
-
calls: runImpactRadar(), scorePatch()
|
|
71
|
-
↓
|
|
72
|
-
returns: unified config object with agent pipeline + aggregated data
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Agent layer
|
|
76
|
-
|
|
77
|
-
Agents are modular and reusable across commands:
|
|
78
|
-
|
|
79
|
-
| Agent | Used by |
|
|
80
|
-
|-------|---------|
|
|
81
|
-
| `architect` | `/fd-analyze-change`, `/fd-translate-intent`, `/fd-plan` |
|
|
82
|
-
| `researcher` | `/fd-analyze-change`, `/fd-evaluate-risk`, `/fd-discuss` |
|
|
83
|
-
| `tester` | `/fd-analyze-change` |
|
|
84
|
-
| `reviewer` | `/fd-analyze-change`, `/fd-evaluate-risk`, `/fd-review-code` |
|
|
85
|
-
| `security-auditor` | `/fd-evaluate-risk` (high/critical risk), `/fd-review-code` |
|
|
86
|
-
| `risk-analyst` | `/fd-evaluate-risk`, `/fd-guarded-edit` |
|
|
87
|
-
| `policy-enforcer` | `/fd-guarded-edit` |
|
|
88
|
-
|
|
89
|
-
### Plugin hooks
|
|
90
|
-
|
|
91
|
-
Hooks intercept tool execution and enforce safety policies at the infrastructure layer:
|
|
92
|
-
|
|
93
|
-
| Hook | Function |
|
|
94
|
-
|------|---------|
|
|
95
|
-
| `tool.execute.before` | `toolGuardHook` — blocks dangerous read/write/bash/edit |
|
|
96
|
-
| `tool.execute.before` | `guardRailsHook` — enforces execution mode (auto/guarded/review-only) |
|
|
97
|
-
| `tool.execute.before` | `patchTrustHook` — scores writes/edits; blocks high-risk without approval |
|
|
98
|
-
| `tool.execute.before` | `decisionTraceHook` — records every edit to DECISIONS.jsonl |
|
|
99
|
-
| `session.started` | `sessionStartHook` — announces FlowDeck, loads context |
|
|
100
|
-
| `command.execute.before` | Command routing — dispatches slash commands |
|
|
101
|
-
|
|
102
|
-
### Shared libraries
|
|
103
|
-
|
|
104
|
-
Reusable utilities consumed by multiple commands:
|
|
105
|
-
|
|
106
|
-
| Module | Exports |
|
|
107
|
-
|--------|---------|
|
|
108
|
-
| `src/lib/impact-radar.ts` | `runImpactRadar()`, `impactRadarSummaryLines()`, `lookupPriorFailures()` |
|
|
109
|
-
| `src/hooks/patch-trust.ts` | `scorePatch()` |
|
|
110
|
-
| `src/hooks/guard-rails.ts` | `resolveExecutionMode()` |
|
|
111
|
-
| `src/hooks/tool-guard.ts` | `checkArchConstraint()`, `isBlocked()` |
|
|
112
|
-
| `src/tools/planning-state-lib.ts` | `statePath()`, `codebaseDir()`, `readPlanningState()`, `timestamp()` |
|
|
113
|
-
|
|
114
|
-
### Data files (`.codebase/`)
|
|
115
|
-
|
|
116
|
-
| File | Purpose |
|
|
117
|
-
|------|---------|
|
|
118
|
-
| `MEMORY.json` | Architecture graph — modules, ownership, types |
|
|
119
|
-
| `FAILURES.json` | Failure history — root causes, tags, recurrence counts |
|
|
120
|
-
| `DECISIONS.jsonl` | Append-only edit audit log |
|
|
121
|
-
| `VOLATILITY.json` | Churn metrics — stability ratings per path |
|
|
122
|
-
| `POLICIES.json` | Self-healing policy rules |
|
|
123
|
-
| `CONSTRAINTS.md` | Forbidden paths and architectural boundaries |
|
|
124
|
-
| `ARCHITECTURE.md` | High-level architecture notes (written by `/fd-map-codebase`) |
|
|
125
|
-
| `STACK.md` | Technology stack reference |
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
## Migration Plan
|
|
130
|
-
|
|
131
|
-
### For existing users
|
|
132
|
-
|
|
133
|
-
**All old commands still work.** No action required. Old commands were not removed.
|
|
134
|
-
|
|
135
|
-
**When to migrate:**
|
|
136
|
-
|
|
137
|
-
| If you used to run | Now prefer |
|
|
138
|
-
|-------------------|-----------|
|
|
139
|
-
| `/fd-impact-radar --change "..."` | `/fd-analyze-change --change "..." --impact` |
|
|
140
|
-
| Multiple analysis commands in sequence | `/fd-analyze-change --change "..." --all` |
|
|
141
|
-
| Manual pre-edit risk assessment | `/fd-evaluate-risk --change "..." --file "..."` |
|
|
142
|
-
| Manually deciding whether to apply a change | `/fd-guarded-edit --file "..." --change "..."` |
|
|
143
|
-
| `/fd-translate-intent --intent "..."` | Same — now returns `assumptions` and `recommended_option` |
|
|
144
|
-
|
|
145
|
-
### Quick start for new workflows
|
|
146
|
-
|
|
147
|
-
**Before any significant edit:**
|
|
148
|
-
```bash
|
|
149
|
-
# 1. Translate vague intent to concrete options
|
|
150
|
-
/fd-translate-intent --intent "make checkout faster"
|
|
151
|
-
|
|
152
|
-
# 2. Full pre-change analysis
|
|
153
|
-
/fd-analyze-change --change "add Redis cache for checkout queries"
|
|
154
|
-
|
|
155
|
-
# 3. Gate decision for the specific file
|
|
156
|
-
/fd-guarded-edit --file "src/checkout/query.ts" --change "add Redis cache layer"
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
**In CI/CD pipelines:**
|
|
160
|
-
```bash
|
|
161
|
-
# Risk gate — fail if approval required
|
|
162
|
-
/fd-evaluate-risk --change "<PR description>" --json | jq '.approval_needed'
|
|
163
|
-
|
|
164
|
-
# Edit gate — fail if block decision
|
|
165
|
-
/fd-guarded-edit --file "<changed file>" --json | jq '.decision == "block"'
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
---
|
|
169
|
-
|
|
170
|
-
## Backward compatibility notes
|
|
171
|
-
|
|
172
|
-
- All 7 original intelligence commands (`/fd-impact-radar`, `/fd-blast-radius`, `/fd-regression-predict`, `/fd-test-gap`, `/fd-volatility-map`, `/fd-review-route`, `/fd-translate-intent`) remain registered and functional.
|
|
173
|
-
- Their implementations were not modified (except `/fd-translate-intent` which gained `assumptions`, `recommended_option`, and `clarifying_questions` in its output spec).
|
|
174
|
-
- The new umbrella commands are registered alongside the old ones — no commands were removed.
|
|
175
|
-
- Existing scripts, keybindings, or workflows that call the old commands will continue to work without changes.
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
# /fd-analyze-change
|
|
2
|
-
|
|
3
|
-
**Umbrella analysis command** — runs up to 6 analysis modules in a single pass and produces a consolidated pre-change risk report.
|
|
4
|
-
|
|
5
|
-
Replaces individual calls to `/fd-impact-radar`, `/fd-blast-radius`, `/fd-regression-predict`, `/fd-test-gap`, `/fd-volatility-map`, and `/fd-review-route`.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
/fd-analyze-change --change "<what's changing>" [flags]
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Arguments
|
|
16
|
-
|
|
17
|
-
| Flag | Type | Default | Description |
|
|
18
|
-
|------|------|---------|-------------|
|
|
19
|
-
| `--change` | string | — | Description of the proposed change |
|
|
20
|
-
| `--scope` | string | `"all"` | Module or file path scope |
|
|
21
|
-
| `--files` | string | — | Comma-separated file paths |
|
|
22
|
-
| `--depth` | number | `2` | Blast radius traversal depth |
|
|
23
|
-
| `--impact` | boolean | false | Run impact radar module |
|
|
24
|
-
| `--blast-radius` | boolean | false | Run blast radius module |
|
|
25
|
-
| `--regression` | boolean | false | Run regression prediction module |
|
|
26
|
-
| `--test-gap` | boolean | false | Run test gap detection module |
|
|
27
|
-
| `--volatility` | boolean | false | Run volatility map module |
|
|
28
|
-
| `--review-route` | boolean | false | Run reviewer routing module |
|
|
29
|
-
| `--all` | boolean | false | Force all modules (default when no module flags given) |
|
|
30
|
-
| `--json` | boolean | false | Return raw JSON instead of table |
|
|
31
|
-
|
|
32
|
-
**Default behaviour:** If no module flags are specified, all 6 modules run automatically.
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Output
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
════════════════════════════════════════════════════════════════
|
|
40
|
-
fd-analyze-change
|
|
41
|
-
────────────────────────────────────────────────────────────────
|
|
42
|
-
Change: update JWT token expiry
|
|
43
|
-
Scope: all
|
|
44
|
-
Modules: impact-radar, blast-radius, regression-predict, test-gap, volatility-map, review-route
|
|
45
|
-
────────────────────────────────────────────────────────────────
|
|
46
|
-
⚠ Affected zones: src/auth/, src/session/, src/middleware/
|
|
47
|
-
⚠ Known failures: F-023, F-031
|
|
48
|
-
≈ Regression cats: auth, performance, async-flow...
|
|
49
|
-
✗ Test gap types: 5 gap patterns checked
|
|
50
|
-
→ Route to: security, backend
|
|
51
|
-
────────────────────────────────────────────────────────────────
|
|
52
|
-
⚠ HIGH RISK: 3 volatile zone(s), 2 known failure(s), 1 fragile pattern(s)
|
|
53
|
-
════════════════════════════════════════════════════════════════
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### Top-level fields returned
|
|
57
|
-
|
|
58
|
-
| Field | Description |
|
|
59
|
-
|-------|-------------|
|
|
60
|
-
| `modules_run` | Which analysis modules were executed |
|
|
61
|
-
| `affected_zones` | Volatile/critical file paths matching the change |
|
|
62
|
-
| `recommended_reviewers` | Reviewer types suggested (security, backend, infra, etc.) |
|
|
63
|
-
| `risk_summary` | Human-readable risk advisory |
|
|
64
|
-
| `risk_score` | Numeric score 0–100 (higher = lower risk) |
|
|
65
|
-
| `config` | Full agent pipeline config dispatched to agents |
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## Examples
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
# Full analysis before editing auth middleware
|
|
73
|
-
/fd-analyze-change --change "replace JWT with session tokens" --files "src/auth/token.ts"
|
|
74
|
-
|
|
75
|
-
# Impact + regression only (partial analysis)
|
|
76
|
-
/fd-analyze-change --change "refactor database connection pool" --impact --regression
|
|
77
|
-
|
|
78
|
-
# JSON output for scripting
|
|
79
|
-
/fd-analyze-change --change "update payment webhook handler" --json
|
|
80
|
-
|
|
81
|
-
# Deep blast radius (3 levels)
|
|
82
|
-
/fd-analyze-change --change "extract user service" --blast-radius --depth 3
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Old commands (still supported)
|
|
88
|
-
|
|
89
|
-
These individual commands remain available and still work. Use `/fd-analyze-change` for combined analysis:
|
|
90
|
-
|
|
91
|
-
| Old command | Equivalent flag |
|
|
92
|
-
|-------------|----------------|
|
|
93
|
-
| `/fd-impact-radar` | `--impact` |
|
|
94
|
-
| `/fd-blast-radius` | `--blast-radius` |
|
|
95
|
-
| `/fd-regression-predict` | `--regression` |
|
|
96
|
-
| `/fd-test-gap` | `--test-gap` |
|
|
97
|
-
| `/fd-volatility-map` | `--volatility` |
|
|
98
|
-
| `/fd-review-route` | `--review-route` |
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## Agents dispatched
|
|
103
|
-
|
|
104
|
-
- `researcher` — traces dependency graph from changed paths
|
|
105
|
-
- `architect` — maps blast radius to configured depth, flags integration points
|
|
106
|
-
- `tester` — estimates coverage gaps per regression category and test gap types
|
|
107
|
-
- `reviewer` — ranks gaps by risk and confirms routing
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Open project dashboard — displays phase progress, milestones, and blockers
|
|
3
|
-
---
|
|
4
|
-
Run the FlowDeck dashboard to view project progress.
|
|
5
|
-
|
|
6
|
-
## What Next?
|
|
7
|
-
|
|
8
|
-
1. **Start feature work** → `/fd-new-feature [description]`
|
|
9
|
-
2. **Fix a bug** → `/fd-fix-bug [issue]`
|
|
10
|
-
3. **View roadmap** → `/fd-roadmap`
|
|
11
|
-
4. **Check progress** → `/fd-progress`
|