@dv.nghiem/flowdeck 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +136 -0
- package/bin/flowdeck.js +108 -0
- package/dist/agents/architect.d.ts +3 -0
- package/dist/agents/architect.d.ts.map +1 -0
- package/dist/agents/code-explorer.d.ts +3 -0
- package/dist/agents/code-explorer.d.ts.map +1 -0
- package/dist/agents/coder.d.ts +3 -0
- package/dist/agents/coder.d.ts.map +1 -0
- package/dist/agents/debug.d.ts +4 -0
- package/dist/agents/debug.d.ts.map +1 -0
- package/dist/agents/doc-updater.d.ts +3 -0
- package/dist/agents/doc-updater.d.ts.map +1 -0
- package/dist/agents/flowdeck.d.ts +5 -0
- package/dist/agents/flowdeck.d.ts.map +1 -0
- package/dist/agents/index.d.ts +38 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/mapper.d.ts +3 -0
- package/dist/agents/mapper.d.ts.map +1 -0
- package/dist/agents/orchestrator.d.ts +10 -0
- package/dist/agents/orchestrator.d.ts.map +1 -0
- package/dist/agents/performance.d.ts +4 -0
- package/dist/agents/performance.d.ts.map +1 -0
- package/dist/agents/planner.d.ts +3 -0
- package/dist/agents/planner.d.ts.map +1 -0
- package/dist/agents/policy-enforcer.d.ts +3 -0
- package/dist/agents/policy-enforcer.d.ts.map +1 -0
- package/dist/agents/researcher.d.ts +3 -0
- package/dist/agents/researcher.d.ts.map +1 -0
- package/dist/agents/reviewer.d.ts +3 -0
- package/dist/agents/reviewer.d.ts.map +1 -0
- package/dist/agents/risk-analyst.d.ts +3 -0
- package/dist/agents/risk-analyst.d.ts.map +1 -0
- package/dist/agents/security-auditor.d.ts +3 -0
- package/dist/agents/security-auditor.d.ts.map +1 -0
- package/dist/agents/specialist.d.ts +5 -0
- package/dist/agents/specialist.d.ts.map +1 -0
- package/dist/agents/tester.d.ts +3 -0
- package/dist/agents/tester.d.ts.map +1 -0
- package/dist/agents/types.d.ts +20 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/writer.d.ts +3 -0
- package/dist/agents/writer.d.ts.map +1 -0
- package/dist/commands/analysis/analysis.test.d.ts +2 -0
- package/dist/commands/analysis/analysis.test.d.ts.map +1 -0
- package/dist/commands/analysis/analyze-change.d.ts +148 -0
- package/dist/commands/analysis/analyze-change.d.ts.map +1 -0
- package/dist/commands/analysis/evaluate-risk.d.ts +77 -0
- package/dist/commands/analysis/evaluate-risk.d.ts.map +1 -0
- package/dist/commands/analysis/guarded-edit.d.ts +72 -0
- package/dist/commands/analysis/guarded-edit.d.ts.map +1 -0
- package/dist/commands/execution/deploy-check.d.ts +91 -0
- package/dist/commands/execution/deploy-check.d.ts.map +1 -0
- package/dist/commands/execution/fix-bug.d.ts +187 -0
- package/dist/commands/execution/fix-bug.d.ts.map +1 -0
- package/dist/commands/execution/new-feature.d.ts +171 -0
- package/dist/commands/execution/new-feature.d.ts.map +1 -0
- package/dist/commands/execution/review-code.d.ts +130 -0
- package/dist/commands/execution/review-code.d.ts.map +1 -0
- package/dist/commands/execution/write-docs.d.ts +94 -0
- package/dist/commands/execution/write-docs.d.ts.map +1 -0
- package/dist/commands/governance/approve.d.ts +80 -0
- package/dist/commands/governance/approve.d.ts.map +1 -0
- package/dist/commands/intelligence/blast-radius.d.ts +67 -0
- package/dist/commands/intelligence/blast-radius.d.ts.map +1 -0
- package/dist/commands/intelligence/impact-radar.d.ts +71 -0
- package/dist/commands/intelligence/impact-radar.d.ts.map +1 -0
- package/dist/commands/intelligence/intelligence.test.d.ts +2 -0
- package/dist/commands/intelligence/intelligence.test.d.ts.map +1 -0
- package/dist/commands/intelligence/regression-predict.d.ts +75 -0
- package/dist/commands/intelligence/regression-predict.d.ts.map +1 -0
- package/dist/commands/intelligence/review-route.d.ts +65 -0
- package/dist/commands/intelligence/review-route.d.ts.map +1 -0
- package/dist/commands/intelligence/test-gap.d.ts +73 -0
- package/dist/commands/intelligence/test-gap.d.ts.map +1 -0
- package/dist/commands/intelligence/translate-intent.d.ts +87 -0
- package/dist/commands/intelligence/translate-intent.d.ts.map +1 -0
- package/dist/commands/intelligence/volatility-map-cmd.d.ts +68 -0
- package/dist/commands/intelligence/volatility-map-cmd.d.ts.map +1 -0
- package/dist/commands/planning/ask.d.ts +62 -0
- package/dist/commands/planning/ask.d.ts.map +1 -0
- package/dist/commands/planning/ask.test.d.ts +2 -0
- package/dist/commands/planning/ask.test.d.ts.map +1 -0
- package/dist/commands/planning/dashboard.d.ts +30 -0
- package/dist/commands/planning/dashboard.d.ts.map +1 -0
- package/dist/commands/planning/discuss.d.ts +39 -0
- package/dist/commands/planning/discuss.d.ts.map +1 -0
- package/dist/commands/planning/plan.d.ts +67 -0
- package/dist/commands/planning/plan.d.ts.map +1 -0
- package/dist/commands/planning/roadmap.d.ts +105 -0
- package/dist/commands/planning/roadmap.d.ts.map +1 -0
- package/dist/commands/setup/doctor.d.ts +10 -0
- package/dist/commands/setup/doctor.d.ts.map +1 -0
- package/dist/commands/setup/map-codebase.d.ts +62 -0
- package/dist/commands/setup/map-codebase.d.ts.map +1 -0
- package/dist/commands/setup/new-project.d.ts +19 -0
- package/dist/commands/setup/new-project.d.ts.map +1 -0
- package/dist/commands/setup/settings.d.ts +57 -0
- package/dist/commands/setup/settings.d.ts.map +1 -0
- package/dist/commands/state/checkpoint.d.ts +27 -0
- package/dist/commands/state/checkpoint.d.ts.map +1 -0
- package/dist/commands/state/multi-repo.d.ts +63 -0
- package/dist/commands/state/multi-repo.d.ts.map +1 -0
- package/dist/commands/state/progress.d.ts +57 -0
- package/dist/commands/state/progress.d.ts.map +1 -0
- package/dist/commands/state/resume.d.ts +11 -0
- package/dist/commands/state/resume.d.ts.map +1 -0
- package/dist/commands/state/workspace-commands.d.ts +207 -0
- package/dist/commands/state/workspace-commands.d.ts.map +1 -0
- package/dist/dashboard/lib/port-finder.d.ts +10 -0
- package/dist/dashboard/lib/port-finder.d.ts.map +1 -0
- package/dist/dashboard/lib/port-finder.test.d.ts +2 -0
- package/dist/dashboard/lib/port-finder.test.d.ts.map +1 -0
- package/dist/dashboard/lib/state-reader.d.ts +3 -0
- package/dist/dashboard/lib/state-reader.d.ts.map +1 -0
- package/dist/dashboard/server.d.ts +2 -0
- package/dist/dashboard/server.d.ts.map +1 -0
- package/dist/dashboard/server.mjs +13649 -0
- package/dist/dashboard/types.d.ts +72 -0
- package/dist/dashboard/types.d.ts.map +1 -0
- package/dist/dashboard/views/index.ejs +391 -0
- package/dist/dashboard/views/partials/blockers.ejs +10 -0
- package/dist/dashboard/views/partials/header.ejs +20 -0
- package/dist/dashboard/views/partials/phase-timeline.ejs +40 -0
- package/dist/dashboard/views/partials/progress.ejs +12 -0
- package/dist/hooks/approval-hook.d.ts +13 -0
- package/dist/hooks/approval-hook.d.ts.map +1 -0
- package/dist/hooks/compaction-hook.d.ts +23 -0
- package/dist/hooks/compaction-hook.d.ts.map +1 -0
- package/dist/hooks/context-window-monitor.d.ts +21 -0
- package/dist/hooks/context-window-monitor.d.ts.map +1 -0
- package/dist/hooks/decision-trace-hook.d.ts +13 -0
- package/dist/hooks/decision-trace-hook.d.ts.map +1 -0
- package/dist/hooks/file-tracker.d.ts +29 -0
- package/dist/hooks/file-tracker.d.ts.map +1 -0
- package/dist/hooks/guard-rails.d.ts +33 -0
- package/dist/hooks/guard-rails.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/notifications.d.ts +21 -0
- package/dist/hooks/notifications.d.ts.map +1 -0
- package/dist/hooks/patch-trust.d.ts +27 -0
- package/dist/hooks/patch-trust.d.ts.map +1 -0
- package/dist/hooks/patch-trust.test.d.ts +2 -0
- package/dist/hooks/patch-trust.test.d.ts.map +1 -0
- package/dist/hooks/session-events.d.ts +8 -0
- package/dist/hooks/session-events.d.ts.map +1 -0
- package/dist/hooks/session-idle-hook.d.ts +21 -0
- package/dist/hooks/session-idle-hook.d.ts.map +1 -0
- package/dist/hooks/session-start.d.ts +10 -0
- package/dist/hooks/session-start.d.ts.map +1 -0
- package/dist/hooks/shell-env-hook.d.ts +21 -0
- package/dist/hooks/shell-env-hook.d.ts.map +1 -0
- package/dist/hooks/telemetry-hook.d.ts +25 -0
- package/dist/hooks/telemetry-hook.d.ts.map +1 -0
- package/dist/hooks/todo-hook.d.ts +25 -0
- package/dist/hooks/todo-hook.d.ts.map +1 -0
- package/dist/hooks/tool-guard.d.ts +41 -0
- package/dist/hooks/tool-guard.d.ts.map +1 -0
- package/dist/hooks/tool-guard.test.d.ts +2 -0
- package/dist/hooks/tool-guard.test.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6639 -0
- package/dist/lib/confirmation.d.ts +20 -0
- package/dist/lib/confirmation.d.ts.map +1 -0
- package/dist/lib/impact-radar.d.ts +35 -0
- package/dist/lib/impact-radar.d.ts.map +1 -0
- package/dist/lib/signatures.d.ts +12 -0
- package/dist/lib/signatures.d.ts.map +1 -0
- package/dist/lib/timestamps.d.ts +23 -0
- package/dist/lib/timestamps.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +20 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/services/agent-performance.d.ts +29 -0
- package/dist/services/agent-performance.d.ts.map +1 -0
- package/dist/services/approval-manager.d.ts +30 -0
- package/dist/services/approval-manager.d.ts.map +1 -0
- package/dist/services/index.d.ts +7 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/model-router.d.ts +35 -0
- package/dist/services/model-router.d.ts.map +1 -0
- package/dist/services/policy-compiler.d.ts +27 -0
- package/dist/services/policy-compiler.d.ts.map +1 -0
- package/dist/services/run-trace.d.ts +34 -0
- package/dist/services/run-trace.d.ts.map +1 -0
- package/dist/services/services.test.d.ts +2 -0
- package/dist/services/services.test.d.ts.map +1 -0
- package/dist/services/telemetry.d.ts +34 -0
- package/dist/services/telemetry.d.ts.map +1 -0
- package/dist/tools/agent-dispatch.test.d.ts +2 -0
- package/dist/tools/agent-dispatch.test.d.ts.map +1 -0
- package/dist/tools/codebase-state.d.ts +4 -0
- package/dist/tools/codebase-state.d.ts.map +1 -0
- package/dist/tools/context-generator.d.ts +3 -0
- package/dist/tools/context-generator.d.ts.map +1 -0
- package/dist/tools/council.d.ts +4 -0
- package/dist/tools/council.d.ts.map +1 -0
- package/dist/tools/decision-trace.d.ts +16 -0
- package/dist/tools/decision-trace.d.ts.map +1 -0
- package/dist/tools/delegate.d.ts +4 -0
- package/dist/tools/delegate.d.ts.map +1 -0
- package/dist/tools/failure-replay.d.ts +19 -0
- package/dist/tools/failure-replay.d.ts.map +1 -0
- package/dist/tools/failure-replay.test.d.ts +2 -0
- package/dist/tools/failure-replay.test.d.ts.map +1 -0
- package/dist/tools/hash-edit.d.ts +3 -0
- package/dist/tools/hash-edit.d.ts.map +1 -0
- package/dist/tools/planning-state-lib.d.ts +65 -0
- package/dist/tools/planning-state-lib.d.ts.map +1 -0
- package/dist/tools/planning-state.d.ts +3 -0
- package/dist/tools/planning-state.d.ts.map +1 -0
- package/dist/tools/policy-engine.d.ts +19 -0
- package/dist/tools/policy-engine.d.ts.map +1 -0
- package/dist/tools/repo-memory.d.ts +20 -0
- package/dist/tools/repo-memory.d.ts.map +1 -0
- package/dist/tools/repo-memory.test.d.ts +2 -0
- package/dist/tools/repo-memory.test.d.ts.map +1 -0
- package/dist/tools/run-parallel.d.ts +4 -0
- package/dist/tools/run-parallel.d.ts.map +1 -0
- package/dist/tools/run-pipeline.d.ts +4 -0
- package/dist/tools/run-pipeline.d.ts.map +1 -0
- package/dist/tools/volatility-map.d.ts +18 -0
- package/dist/tools/volatility-map.d.ts.map +1 -0
- package/dist/tools/volatility-map.test.d.ts +2 -0
- package/dist/tools/volatility-map.test.d.ts.map +1 -0
- package/dist/tools/workspace-state.d.ts +3 -0
- package/dist/tools/workspace-state.d.ts.map +1 -0
- package/docs/USER_GUIDE.md +20 -0
- package/docs/agents.md +562 -0
- package/docs/best-practices.md +47 -0
- package/docs/command-migration.md +175 -0
- package/docs/commands/fd-analyze-change.md +107 -0
- package/docs/commands/fd-ask.md +51 -0
- package/docs/commands/fd-checkpoint.md +10 -0
- package/docs/commands/fd-dashboard.md +11 -0
- package/docs/commands/fd-deploy-check.md +11 -0
- package/docs/commands/fd-discuss.md +28 -0
- package/docs/commands/fd-evaluate-risk.md +134 -0
- package/docs/commands/fd-fix-bug.md +24 -0
- package/docs/commands/fd-guarded-edit.md +105 -0
- package/docs/commands/fd-map-codebase.md +27 -0
- package/docs/commands/fd-multi-repo.md +63 -0
- package/docs/commands/fd-new-feature.md +25 -0
- package/docs/commands/fd-new-project.md +24 -0
- package/docs/commands/fd-plan.md +33 -0
- package/docs/commands/fd-progress.md +11 -0
- package/docs/commands/fd-resume.md +10 -0
- package/docs/commands/fd-review-code.md +29 -0
- package/docs/commands/fd-roadmap.md +10 -0
- package/docs/commands/fd-settings.md +10 -0
- package/docs/commands/fd-write-docs.md +10 -0
- package/docs/commands.md +476 -0
- package/docs/configuration.md +211 -0
- package/docs/feature-integration-architecture.md +255 -0
- package/docs/index.md +75 -0
- package/docs/installation.md +134 -0
- package/docs/intelligence.md +294 -0
- package/docs/multi-repo.md +201 -0
- package/docs/notifications.md +170 -0
- package/docs/parallel-execution.md +227 -0
- package/docs/quick-start.md +174 -0
- package/docs/rules.md +459 -0
- package/docs/skills.md +408 -0
- package/docs/workflows.md +376 -0
- package/package.json +58 -0
- package/postinstall.mjs +102 -0
- package/src/rules/README.md +37 -0
- package/src/rules/common/agent-orchestration.md +86 -0
- package/src/rules/common/coding-style.md +120 -0
- package/src/rules/common/git-workflow.md +77 -0
- package/src/rules/common/security.md +94 -0
- package/src/rules/common/testing.md +105 -0
- package/src/rules/golang/patterns.md +187 -0
- package/src/rules/java/patterns.md +204 -0
- package/src/rules/python/patterns.md +141 -0
- package/src/rules/rust/patterns.md +210 -0
- package/src/rules/typescript/patterns.md +168 -0
- package/src/skills/api-design/SKILL.md +143 -0
- package/src/skills/arch-constraint-guard/SKILL.md +61 -0
- package/src/skills/blast-radius-preview/SKILL.md +65 -0
- package/src/skills/change-impact-radar/SKILL.md +63 -0
- package/src/skills/code-review/SKILL.md +108 -0
- package/src/skills/code-tour/SKILL.md +101 -0
- package/src/skills/codebase-mapping/SKILL.md +87 -0
- package/src/skills/codebase-onboarding/SKILL.md +133 -0
- package/src/skills/confidence-aware-planning/SKILL.md +67 -0
- package/src/skills/context-load/SKILL.md +63 -0
- package/src/skills/debug-flow/SKILL.md +75 -0
- package/src/skills/decision-trace/SKILL.md +72 -0
- package/src/skills/dependency-audit/SKILL.md +126 -0
- package/src/skills/deploy-check/SKILL.md +87 -0
- package/src/skills/documentation-writer/SKILL.md +154 -0
- package/src/skills/failure-replay-engine/SKILL.md +59 -0
- package/src/skills/git-release/SKILL.md +94 -0
- package/src/skills/git-workflow/SKILL.md +177 -0
- package/src/skills/golang-patterns/SKILL.md +511 -0
- package/src/skills/human-review-routing/SKILL.md +65 -0
- package/src/skills/intent-translator/SKILL.md +57 -0
- package/src/skills/java-patterns/SKILL.md +479 -0
- package/src/skills/multi-repo/SKILL.md +187 -0
- package/src/skills/parallel-execute/SKILL.md +92 -0
- package/src/skills/patch-trust-score/SKILL.md +44 -0
- package/src/skills/performance-profiling/SKILL.md +153 -0
- package/src/skills/plan-task/SKILL.md +101 -0
- package/src/skills/python-patterns/SKILL.md +529 -0
- package/src/skills/refactor-guide/SKILL.md +117 -0
- package/src/skills/regression-prediction/SKILL.md +57 -0
- package/src/skills/repo-memory-graph/SKILL.md +49 -0
- package/src/skills/rust-patterns/SKILL.md +492 -0
- package/src/skills/security-scan/SKILL.md +91 -0
- package/src/skills/self-healing-policies/SKILL.md +76 -0
- package/src/skills/tdd-workflow/SKILL.md +126 -0
- package/src/skills/test-coverage/SKILL.md +94 -0
- package/src/skills/test-gap-detector/SKILL.md +58 -0
- package/src/skills/volatility-map/SKILL.md +52 -0
- package/src/workflows/debug-flow.md +119 -0
- package/src/workflows/deploy-check-flow.md +98 -0
- package/src/workflows/discuss-flow.md +97 -0
- package/src/workflows/execute-flow.md +233 -0
- package/src/workflows/execute-phase.md +142 -0
- package/src/workflows/fix-bug-flow.md +210 -0
- package/src/workflows/map-codebase-flow.md +92 -0
- package/src/workflows/multi-repo-flow.md +226 -0
- package/src/workflows/parallel-execution-flow.md +236 -0
- package/src/workflows/plan-flow.md +126 -0
- package/src/workflows/plan-phase.md +101 -0
- package/src/workflows/refactor-flow.md +122 -0
- package/src/workflows/review-code-flow.md +105 -0
- package/src/workflows/spec-driven-flow.md +43 -0
- package/src/workflows/write-docs-flow.md +95 -0
package/docs/rules.md
ADDED
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
# FlowDeck Rules
|
|
2
|
+
|
|
3
|
+
Rules are coding standard documents that you load into OpenCode's context. They give the AI consistent style, testing, security, and language-specific guidelines to follow across all sessions.
|
|
4
|
+
|
|
5
|
+
## How to Use Rules
|
|
6
|
+
|
|
7
|
+
### Method 1 — Project-level (recommended)
|
|
8
|
+
|
|
9
|
+
Add the rules you want to your project's `opencode.json`. This ensures every OpenCode session in the project automatically picks them up:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"instructions": [
|
|
14
|
+
".flowdeck-rules/common/coding-style.md",
|
|
15
|
+
".flowdeck-rules/common/testing.md",
|
|
16
|
+
".flowdeck-rules/common/security.md",
|
|
17
|
+
".flowdeck-rules/typescript/patterns.md"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Where `.flowdeck-rules/` is a symlink or copy of the FlowDeck rules directory:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
ln -s ~/.config/opencode/node_modules/@dv.nghiem/flowdeck/rules .flowdeck-rules
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Method 2 — Per-session
|
|
29
|
+
|
|
30
|
+
Reference a rule file directly in your prompt:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
Follow the rules in ~/.config/opencode/node_modules/@dv.nghiem/flowdeck/rules/typescript/patterns.md
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Method 3 — Copy to project
|
|
37
|
+
|
|
38
|
+
Copy the rules directory into your project for version-controlled standards:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
cp -r ~/.config/opencode/node_modules/@dv.nghiem/flowdeck/rules ./flowdeck-rules
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then commit `flowdeck-rules/` to your repository so the entire team uses the same standards.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Rules Structure
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
rules/
|
|
52
|
+
common/
|
|
53
|
+
coding-style.md ← Universal principles: names, simplicity, comments
|
|
54
|
+
testing.md ← Coverage, naming, isolation, AAA pattern
|
|
55
|
+
security.md ← Prohibited patterns, credentials, input validation
|
|
56
|
+
git-workflow.md ← Branch strategy, Conventional Commits, PR standards
|
|
57
|
+
agent-orchestration.md ← When to use which agent, parallel execution gates
|
|
58
|
+
python/
|
|
59
|
+
patterns.md ← Type hints, asyncio, pytest, pitfalls
|
|
60
|
+
golang/
|
|
61
|
+
patterns.md ← Error handling, goroutines, interfaces, testing
|
|
62
|
+
java/
|
|
63
|
+
patterns.md ← Modern Java 17+, Spring Boot, JPA, testing
|
|
64
|
+
rust/
|
|
65
|
+
patterns.md ← Ownership, traits, Tokio async, error handling
|
|
66
|
+
typescript/
|
|
67
|
+
patterns.md ← Strict mode, interfaces, async patterns, naming
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Common Rules Reference
|
|
73
|
+
|
|
74
|
+
### coding-style.md
|
|
75
|
+
|
|
76
|
+
Applies to all languages and frameworks.
|
|
77
|
+
|
|
78
|
+
**Key rules:**
|
|
79
|
+
|
|
80
|
+
- **Names that explain intent.** Variables, functions, and types should read like prose. `getUserById` is acceptable; `getU` is not. If you need a comment to explain what a name means, rename it instead.
|
|
81
|
+
- **Functions under 20 lines.** If a function exceeds 20 lines, it is doing too much. Extract sub-functions with descriptive names. Exceptions require an inline comment explaining why the complexity is necessary.
|
|
82
|
+
- **Comments explain why, not what.** The code already shows what is happening. Comments are for decisions that are not obvious from reading the code: trade-offs, workarounds, business rules that contradict the obvious approach.
|
|
83
|
+
- **No dead code in pull requests.** Commented-out code, unused variables, and unreachable branches must be removed before a PR is opened. Use version control to recover deleted code if needed.
|
|
84
|
+
- **Match existing style exactly.** If the file uses tabs, use tabs. If the module uses a particular naming convention, follow it — even if your preference differs. Consistency across a file matters more than personal style.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### testing.md
|
|
89
|
+
|
|
90
|
+
Applies to all automated test suites.
|
|
91
|
+
|
|
92
|
+
**Key rules:**
|
|
93
|
+
|
|
94
|
+
- **TDD first.** Write the failing test before writing the implementation. The test defines the contract; the implementation satisfies it. This produces smaller, more focused implementations.
|
|
95
|
+
- **Coverage ≥ 80% for new code.** All new code introduced in a PR must achieve at least 80% line coverage. This is a floor, not a target — critical paths should aim for 100%.
|
|
96
|
+
- **Test names describe the scenario.** Test names follow the pattern `<subject>_<condition>_<expected outcome>`. For example: `createUser_withDuplicateEmail_returnsConflictError`. The name should be readable without opening the test body.
|
|
97
|
+
- **No implementation details in tests.** Tests assert on outputs and observable behavior — not on private methods, internal state, or call counts that are not part of the contract. Testing internals makes refactoring painful.
|
|
98
|
+
- **Integration tests at every external boundary.** Any code that touches a database, external API, file system, or message queue must have at least one integration test. Unit tests alone are insufficient at these boundaries.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### security.md
|
|
103
|
+
|
|
104
|
+
Applies to all code that handles user input, credentials, or external communication.
|
|
105
|
+
|
|
106
|
+
**Key rules:**
|
|
107
|
+
|
|
108
|
+
- **Never store secrets in code.** No API keys, passwords, connection strings, or tokens in source files — including comments. Use environment variables or a secrets manager. The `.planning/config.json` stores settings, not credentials.
|
|
109
|
+
- **Validate all inputs.** Every value that originates outside the current process (HTTP request, CLI argument, file content, environment variable) must be validated for type, length, format, and range before use.
|
|
110
|
+
- **Use parameterized queries.** String-concatenated SQL is prohibited regardless of context. Use your framework's parameterized query or ORM interface for every database interaction.
|
|
111
|
+
- **HTTPS only for external communication.** No HTTP calls to external services in production code. Certificate verification must not be disabled.
|
|
112
|
+
- **Log security events.** Authentication successes, authentication failures, authorization denials, and privilege escalations must be logged with enough context to reconstruct the event. Do not log passwords, tokens, or PII.
|
|
113
|
+
- **No `eval()` or dynamic code execution.** `eval`, `exec`, `Function()`, and their equivalents are prohibited. If a use case seems to require them, escalate to `@architect` for a safer alternative.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### git-workflow.md
|
|
118
|
+
|
|
119
|
+
Applies to all commits, branches, and pull requests in FlowDeck-managed projects.
|
|
120
|
+
|
|
121
|
+
**Key rules:**
|
|
122
|
+
|
|
123
|
+
- **Conventional Commits format.** All commit messages must follow the format `<type>(<scope>): <subject>`. Types: `feat`, `fix`, `chore`, `docs`, `refactor`, `test`, `perf`. Example: `feat(auth): add JWT refresh token rotation`.
|
|
124
|
+
- **Branch naming: `<type>/issue-<number>-<short-description>`.** Example: `feat/issue-123-user-preferences`. The issue number creates a traceable link; the description makes the branch list scannable.
|
|
125
|
+
- **Squash before merge.** Work-in-progress commits (`wip: trying approach`, `fix typo`) must be squashed before a PR is merged. The squashed commit message must follow Conventional Commits.
|
|
126
|
+
- **Every PR requires a description.** The PR body must include: what changed, why it changed, how to test it, and any migration steps. A blank PR description blocks review.
|
|
127
|
+
- **No force-push to shared branches.** `main`, `develop`, and release branches are protected. Force-push is only permitted on personal feature branches before a PR is opened.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### agent-orchestration.md
|
|
132
|
+
|
|
133
|
+
Governs how FlowDeck agents are selected and coordinated.
|
|
134
|
+
|
|
135
|
+
**Key rules:**
|
|
136
|
+
|
|
137
|
+
- **Use `@orchestrator` for multi-step work.** Any task that spans more than one agent or involves sequencing should be delegated to `@orchestrator`. Do not manually chain agents — let `@orchestrator` manage handoffs and error recovery.
|
|
138
|
+
- **Run `@task-splitter` before `/fd-new-feature` on large scope.** If a feature description spans more than a few hours of work, invoke `@task-splitter` first to break it into independent sub-features. Attempting to implement large scope in one `/fd-new-feature` call produces lower-quality output.
|
|
139
|
+
- **`@reviewer` is mandatory before merge.** Every code-producing command (`/fd-new-feature`, `/fd-fix-bug`) must be followed by at least one `@reviewer` pass. This is enforced when guard mode is enabled in `.planning/config.json`.
|
|
140
|
+
- **`@security-auditor` is mandatory for auth, payment, and PII code.** Any change to authentication flows, payment processing, or code that stores or transmits personally identifiable information must be audited by `@security-auditor` before merge — regardless of the change size.
|
|
141
|
+
- **Wave gates are not optional.** In parallel execution, Wave 3 (`@coder` + `@tester`) must not begin until Wave 2 (`@architect`) has produced its output. Starting implementation before design is complete produces rework.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Language Rules Reference
|
|
146
|
+
|
|
147
|
+
### Python — `rules/python/patterns.md`
|
|
148
|
+
|
|
149
|
+
**Key rules:**
|
|
150
|
+
|
|
151
|
+
1. **Type annotations on all public functions.**
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
# Required
|
|
155
|
+
def get_user(user_id: int) -> User | None:
|
|
156
|
+
...
|
|
157
|
+
|
|
158
|
+
# Not allowed
|
|
159
|
+
def get_user(user_id):
|
|
160
|
+
...
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
2. **Never use mutable default arguments.**
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
# Required
|
|
167
|
+
def append_item(item: str, items: list[str] | None = None) -> list[str]:
|
|
168
|
+
items = items or []
|
|
169
|
+
items.append(item)
|
|
170
|
+
return items
|
|
171
|
+
|
|
172
|
+
# Not allowed — items persists across calls
|
|
173
|
+
def append_item(item: str, items: list[str] = []) -> list[str]:
|
|
174
|
+
items.append(item)
|
|
175
|
+
return items
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
3. **Use f-strings for string formatting.**
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
# Required
|
|
182
|
+
message = f"User {user.name} logged in at {timestamp}"
|
|
183
|
+
|
|
184
|
+
# Not allowed
|
|
185
|
+
message = "User %s logged in at %s" % (user.name, timestamp)
|
|
186
|
+
message = "User {} logged in at {}".format(user.name, timestamp)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
4. **Use `pathlib.Path`, not `os.path`.**
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
# Required
|
|
193
|
+
from pathlib import Path
|
|
194
|
+
config_path = Path("~/.config/opencode").expanduser() / "settings.json"
|
|
195
|
+
|
|
196
|
+
# Not allowed
|
|
197
|
+
import os
|
|
198
|
+
config_path = os.path.join(os.path.expanduser("~"), ".config", "opencode", "settings.json")
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
5. **Use pytest for all tests.** No `unittest.TestCase` in new code. Use `pytest.fixture` for setup, `pytest.mark.parametrize` for table-driven tests.
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
import pytest
|
|
205
|
+
|
|
206
|
+
@pytest.mark.parametrize("email,expected", [
|
|
207
|
+
("valid@example.com", True),
|
|
208
|
+
("not-an-email", False),
|
|
209
|
+
("", False),
|
|
210
|
+
])
|
|
211
|
+
def test_validate_email(email: str, expected: bool) -> None:
|
|
212
|
+
assert validate_email(email) == expected
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### Go — `rules/golang/patterns.md`
|
|
218
|
+
|
|
219
|
+
**Key rules:**
|
|
220
|
+
|
|
221
|
+
1. **Always handle errors explicitly. Never discard with `_`.**
|
|
222
|
+
|
|
223
|
+
```go
|
|
224
|
+
// Required
|
|
225
|
+
result, err := db.Query(ctx, query)
|
|
226
|
+
if err != nil {
|
|
227
|
+
return fmt.Errorf("querying users: %w", err)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Not allowed
|
|
231
|
+
result, _ := db.Query(ctx, query)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
2. **Error strings: lowercase, no trailing punctuation.**
|
|
235
|
+
|
|
236
|
+
```go
|
|
237
|
+
// Required
|
|
238
|
+
return fmt.Errorf("user not found: id %d", userID)
|
|
239
|
+
|
|
240
|
+
// Not allowed
|
|
241
|
+
return fmt.Errorf("User not found: id %d.", userID)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
3. **Pass `context.Context` as the first argument for any cancellable operation.**
|
|
245
|
+
|
|
246
|
+
```go
|
|
247
|
+
// Required
|
|
248
|
+
func FetchUser(ctx context.Context, id int) (*User, error) {
|
|
249
|
+
return db.QueryRowContext(ctx, "SELECT * FROM users WHERE id = $1", id)
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
4. **Table-driven tests for functions with multiple cases.**
|
|
254
|
+
|
|
255
|
+
```go
|
|
256
|
+
func TestValidateEmail(t *testing.T) {
|
|
257
|
+
cases := []struct {
|
|
258
|
+
name string
|
|
259
|
+
input string
|
|
260
|
+
wantOK bool
|
|
261
|
+
}{
|
|
262
|
+
{"valid", "user@example.com", true},
|
|
263
|
+
{"missing at", "userexample.com", false},
|
|
264
|
+
{"empty", "", false},
|
|
265
|
+
}
|
|
266
|
+
for _, tc := range cases {
|
|
267
|
+
t.Run(tc.name, func(t *testing.T) {
|
|
268
|
+
got := validateEmail(tc.input)
|
|
269
|
+
if got != tc.wantOK {
|
|
270
|
+
t.Errorf("validateEmail(%q) = %v, want %v", tc.input, got, tc.wantOK)
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
5. **No `panic` for expected error conditions.** Use `panic` only for programmer errors (nil pointer in invariant-violation scenarios). All expected failures return an `error`.
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
### Java — `rules/java/patterns.md`
|
|
282
|
+
|
|
283
|
+
Targets Java 17+ with Spring Boot.
|
|
284
|
+
|
|
285
|
+
**Key rules:**
|
|
286
|
+
|
|
287
|
+
1. **Constructor injection only. Never `@Autowired` on a field.**
|
|
288
|
+
|
|
289
|
+
```java
|
|
290
|
+
// Required
|
|
291
|
+
@Service
|
|
292
|
+
public class UserService {
|
|
293
|
+
private final UserRepository userRepository;
|
|
294
|
+
|
|
295
|
+
public UserService(UserRepository userRepository) {
|
|
296
|
+
this.userRepository = userRepository;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Not allowed
|
|
301
|
+
@Service
|
|
302
|
+
public class UserService {
|
|
303
|
+
@Autowired
|
|
304
|
+
private UserRepository userRepository;
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
2. **Never return `null` from a public method.** Return `Optional<T>` for values that may be absent, or throw a typed exception.
|
|
309
|
+
|
|
310
|
+
```java
|
|
311
|
+
// Required
|
|
312
|
+
public Optional<User> findById(long id) {
|
|
313
|
+
return userRepository.findById(id);
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
3. **All DTOs are Java records.**
|
|
318
|
+
|
|
319
|
+
```java
|
|
320
|
+
// Required
|
|
321
|
+
public record CreateUserRequest(String email, String displayName) {}
|
|
322
|
+
|
|
323
|
+
// Not allowed
|
|
324
|
+
public class CreateUserRequest {
|
|
325
|
+
private String email;
|
|
326
|
+
// getters, setters, constructors...
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
4. **No checked exceptions in new code.** Wrap checked exceptions in unchecked runtime exceptions at integration boundaries.
|
|
331
|
+
|
|
332
|
+
```java
|
|
333
|
+
// Required
|
|
334
|
+
try {
|
|
335
|
+
Files.readString(path);
|
|
336
|
+
} catch (IOException e) {
|
|
337
|
+
throw new StorageException("Failed to read config file: " + path, e);
|
|
338
|
+
}
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
5. **`@Transactional` on the service layer only.** Never place `@Transactional` on repository methods or controller methods.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
### Rust — `rules/rust/patterns.md`
|
|
346
|
+
|
|
347
|
+
**Key rules:**
|
|
348
|
+
|
|
349
|
+
1. **Return `Result<T, E>` from library code. Never `panic`.**
|
|
350
|
+
|
|
351
|
+
```rust
|
|
352
|
+
// Required
|
|
353
|
+
pub fn parse_config(path: &Path) -> Result<Config, ConfigError> {
|
|
354
|
+
let content = fs::read_to_string(path)
|
|
355
|
+
.map_err(|e| ConfigError::Io { path: path.to_owned(), source: e })?;
|
|
356
|
+
toml::from_str(&content).map_err(ConfigError::Parse)
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
2. **Use `expect()` with a descriptive message. Never bare `unwrap()`.**
|
|
361
|
+
|
|
362
|
+
```rust
|
|
363
|
+
// Required
|
|
364
|
+
let port: u16 = env::var("PORT")
|
|
365
|
+
.expect("PORT environment variable must be set")
|
|
366
|
+
.parse()
|
|
367
|
+
.expect("PORT must be a valid u16");
|
|
368
|
+
|
|
369
|
+
// Not allowed
|
|
370
|
+
let port: u16 = env::var("PORT").unwrap().parse().unwrap();
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
3. **All public items have rustdoc comments.**
|
|
374
|
+
|
|
375
|
+
```rust
|
|
376
|
+
/// Fetches a user by their unique identifier.
|
|
377
|
+
///
|
|
378
|
+
/// Returns `None` if no user with the given `id` exists.
|
|
379
|
+
pub async fn get_user(id: UserId) -> Option<User> {
|
|
380
|
+
...
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
4. **`clippy` must pass with no warnings before review.** Run `cargo clippy -- -D warnings` as part of the PR process. Suppress specific lints only with a comment explaining why.
|
|
385
|
+
|
|
386
|
+
5. **`#[cfg(test)]` for unit tests; `tests/` for integration tests.** Unit tests live in the same file as the code they test. Integration tests that require external services live under `tests/`.
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
### TypeScript — `rules/typescript/patterns.md`
|
|
391
|
+
|
|
392
|
+
**Key rules:**
|
|
393
|
+
|
|
394
|
+
1. **`strict: true` is always enabled.** No exceptions. If `strict` is disabled in a `tsconfig.json`, that is a bug.
|
|
395
|
+
|
|
396
|
+
```json
|
|
397
|
+
{
|
|
398
|
+
"compilerOptions": {
|
|
399
|
+
"strict": true
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
2. **Prefer `interface` over `type` aliases for object shapes.**
|
|
405
|
+
|
|
406
|
+
```typescript
|
|
407
|
+
// Required
|
|
408
|
+
interface UserProfile {
|
|
409
|
+
id: string;
|
|
410
|
+
email: string;
|
|
411
|
+
displayName: string;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Acceptable for unions and intersections only
|
|
415
|
+
type UserOrAdmin = User | Admin;
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
3. **`async`/`await` over `.then()` chains.**
|
|
419
|
+
|
|
420
|
+
```typescript
|
|
421
|
+
// Required
|
|
422
|
+
async function fetchUser(id: string): Promise<User> {
|
|
423
|
+
const response = await fetch(`/api/users/${id}`);
|
|
424
|
+
if (!response.ok) throw new ApiError(response.status);
|
|
425
|
+
return response.json() as Promise<User>;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// Not allowed
|
|
429
|
+
function fetchUser(id: string): Promise<User> {
|
|
430
|
+
return fetch(`/api/users/${id}`)
|
|
431
|
+
.then(response => { if (!response.ok) throw new ApiError(response.status); return response; })
|
|
432
|
+
.then(response => response.json());
|
|
433
|
+
}
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
4. **Use `unknown` over `any`.** If you do not know the type, use `unknown` and narrow it before use. `any` disables type checking and is banned except in test utilities.
|
|
437
|
+
|
|
438
|
+
```typescript
|
|
439
|
+
// Required
|
|
440
|
+
function parseResponse(data: unknown): User {
|
|
441
|
+
if (!isUser(data)) throw new TypeError("Invalid user shape");
|
|
442
|
+
return data;
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
5. **Named exports preferred over default exports.** Named exports are tree-shakeable and produce better refactoring tooling support.
|
|
447
|
+
|
|
448
|
+
```typescript
|
|
449
|
+
// Required
|
|
450
|
+
export function createUser(email: string): User { ... }
|
|
451
|
+
export interface UserRepository { ... }
|
|
452
|
+
|
|
453
|
+
// Avoid
|
|
454
|
+
export default function createUser(email: string): User { ... }
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
← [Back to Index](index.md)
|