@comfanion/workflow 3.0.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.
Files changed (95) hide show
  1. package/README.md +185 -0
  2. package/bin/cli.js +406 -0
  3. package/package.json +50 -0
  4. package/src/build-info.json +16 -0
  5. package/src/opencode/ARCHITECTURE.md +255 -0
  6. package/src/opencode/FLOW.yaml +900 -0
  7. package/src/opencode/agents/analyst.md +141 -0
  8. package/src/opencode/agents/architect.md +177 -0
  9. package/src/opencode/agents/change-manager.md +263 -0
  10. package/src/opencode/agents/dev.md +171 -0
  11. package/src/opencode/agents/module-docs.md +628 -0
  12. package/src/opencode/agents/pm.md +157 -0
  13. package/src/opencode/agents/researcher.md +254 -0
  14. package/src/opencode/agents/sm.md +184 -0
  15. package/src/opencode/agents/workflow-orchestrator.md +249 -0
  16. package/src/opencode/checklists/architecture-checklist.md +166 -0
  17. package/src/opencode/checklists/code-review-checklist.md +151 -0
  18. package/src/opencode/checklists/prd-checklist.md +140 -0
  19. package/src/opencode/checklists/requirements-checklist.md +86 -0
  20. package/src/opencode/checklists/story-checklist.md +137 -0
  21. package/src/opencode/commands/architecture.md +68 -0
  22. package/src/opencode/commands/archive.md +146 -0
  23. package/src/opencode/commands/change.md +169 -0
  24. package/src/opencode/commands/clarify.md +132 -0
  25. package/src/opencode/commands/code-review.md +96 -0
  26. package/src/opencode/commands/coding-standards.md +102 -0
  27. package/src/opencode/commands/dev-story.md +80 -0
  28. package/src/opencode/commands/diagram.md +152 -0
  29. package/src/opencode/commands/epics.md +52 -0
  30. package/src/opencode/commands/help.md +139 -0
  31. package/src/opencode/commands/jira-sync.md +58 -0
  32. package/src/opencode/commands/module-docs.md +158 -0
  33. package/src/opencode/commands/prd.md +63 -0
  34. package/src/opencode/commands/quick.md +166 -0
  35. package/src/opencode/commands/requirements.md +49 -0
  36. package/src/opencode/commands/research.md +113 -0
  37. package/src/opencode/commands/sprint-plan.md +59 -0
  38. package/src/opencode/commands/stories.md +61 -0
  39. package/src/opencode/commands/validate.md +84 -0
  40. package/src/opencode/commands/workflow-status.md +150 -0
  41. package/src/opencode/config.yaml +223 -0
  42. package/src/opencode/opencode.json +36 -0
  43. package/src/opencode/skills/acceptance-criteria/SKILL.md +212 -0
  44. package/src/opencode/skills/adr-writing/SKILL.md +241 -0
  45. package/src/opencode/skills/architecture-design/SKILL.md +183 -0
  46. package/src/opencode/skills/architecture-validation/SKILL.md +199 -0
  47. package/src/opencode/skills/archiving/SKILL.md +191 -0
  48. package/src/opencode/skills/changelog/SKILL.md +280 -0
  49. package/src/opencode/skills/code-review/SKILL.md +193 -0
  50. package/src/opencode/skills/coding-standards/SKILL.md +430 -0
  51. package/src/opencode/skills/diagram-creation/SKILL.md +273 -0
  52. package/src/opencode/skills/doc-todo/SKILL.md +325 -0
  53. package/src/opencode/skills/epic-writing/SKILL.md +291 -0
  54. package/src/opencode/skills/jira-integration/SKILL.md +560 -0
  55. package/src/opencode/skills/methodologies/SKILL.md +376 -0
  56. package/src/opencode/skills/module-documentation/SKILL.md +214 -0
  57. package/src/opencode/skills/prd-validation/SKILL.md +164 -0
  58. package/src/opencode/skills/prd-writing/SKILL.md +104 -0
  59. package/src/opencode/skills/requirements-gathering/SKILL.md +132 -0
  60. package/src/opencode/skills/requirements-validation/SKILL.md +141 -0
  61. package/src/opencode/skills/research-methodology/SKILL.md +140 -0
  62. package/src/opencode/skills/sprint-planning/SKILL.md +217 -0
  63. package/src/opencode/skills/story-writing/SKILL.md +574 -0
  64. package/src/opencode/skills/test-design/SKILL.md +313 -0
  65. package/src/opencode/skills/translation/SKILL.md +411 -0
  66. package/src/opencode/templates/CHANGELOG.md +82 -0
  67. package/src/opencode/templates/adr-template.md +115 -0
  68. package/src/opencode/templates/architecture-template.md +362 -0
  69. package/src/opencode/templates/change-proposal-template.md +186 -0
  70. package/src/opencode/templates/epic-template.md +151 -0
  71. package/src/opencode/templates/git-workflow-template.md +384 -0
  72. package/src/opencode/templates/integration-tests-template.md +265 -0
  73. package/src/opencode/templates/jira-cache-template.yaml +103 -0
  74. package/src/opencode/templates/module-index-template.md +139 -0
  75. package/src/opencode/templates/module-test-cases-template.md +230 -0
  76. package/src/opencode/templates/prd-acceptance-criteria-template.md +124 -0
  77. package/src/opencode/templates/prd-template.md +479 -0
  78. package/src/opencode/templates/requirements-template.md +132 -0
  79. package/src/opencode/templates/sprint-status-template.yaml +84 -0
  80. package/src/opencode/templates/story-template.md +437 -0
  81. package/src/opencode/templates/testing-standards-template.md +359 -0
  82. package/src/opencode/workflows/dev-story/instructions.md +529 -0
  83. package/src/repo-structure/.gitattributes +64 -0
  84. package/src/repo-structure/CONTRIBUTING.md +182 -0
  85. package/src/repo-structure/README.md +77 -0
  86. package/src/repo-structure/docs/README.md +62 -0
  87. package/src/repo-structure/docs/api/README.md +43 -0
  88. package/src/repo-structure/docs/architecture/README.md +36 -0
  89. package/src/repo-structure/docs/architecture/adr/README.md +53 -0
  90. package/src/repo-structure/docs/architecture/diagrams/README.md +59 -0
  91. package/src/repo-structure/docs/coding-standards/README.md +52 -0
  92. package/src/repo-structure/docs/confluence/README.md +43 -0
  93. package/src/repo-structure/docs/requirements/README.md +28 -0
  94. package/src/repo-structure/docs/sprint-artifacts/README.md +76 -0
  95. package/src/repo-structure/docs/sprint-artifacts/backlog/README.md +24 -0
@@ -0,0 +1,359 @@
1
+ # Testing Standards
2
+
3
+ **Version:** 1.0
4
+ **Status:** Active
5
+
6
+ ---
7
+
8
+ ## 1. Testing Philosophy
9
+
10
+ ### Testing Pyramid
11
+
12
+ ```
13
+ /\
14
+ / \ E2E Tests (Few)
15
+ /____\ - Full system integration
16
+ / \ - Critical user flows
17
+ /________\ Integration Tests (Some)
18
+ / \ - Database interactions
19
+ /____________\ - External API contracts
20
+ / \ Unit Tests (Many)
21
+ - Domain logic
22
+ - Use case handlers
23
+ - Business rules
24
+ ```
25
+
26
+ **Core Principle:** Focus on domain layer testing - easiest to write, most valuable for catching bugs!
27
+
28
+ ---
29
+
30
+ ## 2. Coverage Targets
31
+
32
+ | Layer | Minimum | Target | Priority |
33
+ |-------|---------|--------|----------|
34
+ | **Domain** | 90% | **100%** | HIGHEST |
35
+ | Application | 70% | 80% | High |
36
+ | Infrastructure | 50% | 60% | Medium |
37
+ | Interfaces | 60% | 70% | Medium |
38
+ | **Overall** | **75%** | **85%** | - |
39
+
40
+ **Why Domain Tests First?**
41
+ - Easiest to write - No mocks, no database, pure code
42
+ - Fastest to run - No external dependencies
43
+ - Most valuable - Business logic bugs affect everything
44
+ - 100% achievable - No infrastructure complexity
45
+
46
+ ---
47
+
48
+ ## 3. Testing Framework
49
+
50
+ ### Libraries
51
+
52
+ | Library | Purpose | Usage |
53
+ |---------|---------|-------|
54
+ | `testing` | Standard Go testing | All tests |
55
+ | `testify/assert` | Assertions (non-fatal) | Regular checks |
56
+ | `testify/require` | Fatal assertions | Preconditions |
57
+ | `testify/mock` | Mocking framework | External dependencies |
58
+ | `testcontainers` | Integration testing | Real DB/Redis |
59
+ | `k6` | Load testing | Performance tests |
60
+
61
+ ### Import Pattern
62
+
63
+ ```go
64
+ import (
65
+ "testing"
66
+
67
+ "github.com/stretchr/testify/assert"
68
+ "github.com/stretchr/testify/require"
69
+ "github.com/stretchr/testify/mock"
70
+ )
71
+ ```
72
+
73
+ ---
74
+
75
+ ## 4. Test Types
76
+
77
+ ### 4.1 Unit Tests (Domain Layer)
78
+
79
+ **Location:** `domain/*_test.go`
80
+ **Dependencies:** None (pure Go)
81
+ **Speed:** < 1ms per test
82
+
83
+ **What to test:**
84
+ - Aggregates (business rules, state transitions)
85
+ - Value Objects (validation, equality)
86
+ - Domain Services (cross-aggregate logic)
87
+ - Domain Events (event creation)
88
+
89
+ **Pattern:** Table-driven tests + Arrange-Act-Assert
90
+
91
+ ```go
92
+ func TestOrder_AddItem(t *testing.T) {
93
+ tests := []struct {
94
+ name string
95
+ quantity int
96
+ wantError bool
97
+ }{
98
+ {"valid quantity", 5, false},
99
+ {"zero quantity", 0, true},
100
+ {"negative quantity", -1, true},
101
+ }
102
+
103
+ for _, tt := range tests {
104
+ t.Run(tt.name, func(t *testing.T) {
105
+ // Arrange
106
+ order := NewOrder()
107
+
108
+ // Act
109
+ err := order.AddItem(Item{Quantity: tt.quantity})
110
+
111
+ // Assert
112
+ if tt.wantError {
113
+ assert.Error(t, err)
114
+ } else {
115
+ assert.NoError(t, err)
116
+ }
117
+ })
118
+ }
119
+ }
120
+ ```
121
+
122
+ ### 4.2 Application Tests (Use Case Layer)
123
+
124
+ **Location:** `application/usecase/*_test.go`
125
+ **Dependencies:** Mocked repositories/ports
126
+ **Speed:** < 10ms per test
127
+
128
+ **What to test:**
129
+ - Use case orchestration
130
+ - Error handling
131
+ - DTO mapping
132
+
133
+ **Pattern:** Mock dependencies, test orchestration
134
+
135
+ ### 4.3 Integration Tests
136
+
137
+ **Location:** `infrastructure/*_test.go` or `tests/integration/`
138
+ **Dependencies:** Real database (testcontainers)
139
+ **Speed:** 100ms - 1s per test
140
+
141
+ **What to test:**
142
+ - Repository implementations
143
+ - Database queries
144
+ - External API contracts
145
+ - Message queue consumers/producers
146
+
147
+ **Pattern:** Testcontainers for real infrastructure
148
+
149
+ ### 4.4 HTTP Handler Tests
150
+
151
+ **Location:** `interfaces/http/*_test.go`
152
+ **Dependencies:** Mocked use cases
153
+ **Speed:** < 50ms per test
154
+
155
+ **What to test:**
156
+ - Request parsing
157
+ - Response formatting
158
+ - Validation errors
159
+ - HTTP status codes
160
+
161
+ ### 4.5 E2E Tests
162
+
163
+ **Location:** `tests/e2e/`
164
+ **Dependencies:** Full system
165
+ **Speed:** 1-10s per test
166
+
167
+ **What to test:**
168
+ - Critical user flows only
169
+ - Happy path scenarios
170
+ - Cross-module interactions
171
+
172
+ ### 4.6 Load Tests
173
+
174
+ **Tool:** k6
175
+ **Location:** `tests/load/`
176
+
177
+ **What to test:**
178
+ - Throughput (RPS)
179
+ - Latency (p50, p95, p99)
180
+ - Error rate under load
181
+ - Resource usage
182
+
183
+ ---
184
+
185
+ ## 5. Test File Naming
186
+
187
+ | Type | Pattern | Example |
188
+ |------|---------|---------|
189
+ | Unit test | `*_test.go` | `order_test.go` |
190
+ | Integration | `*_integration_test.go` | `repo_integration_test.go` |
191
+ | E2E | `*_e2e_test.go` | `checkout_e2e_test.go` |
192
+ | Benchmark | `*_bench_test.go` | `search_bench_test.go` |
193
+
194
+ ---
195
+
196
+ ## 6. Test Commands
197
+
198
+ ```bash
199
+ # Unit tests only (fast)
200
+ go test -short ./...
201
+
202
+ # All tests with race detector
203
+ go test -race ./...
204
+
205
+ # Coverage report
206
+ go test -coverprofile=coverage.out ./...
207
+ go tool cover -html=coverage.out
208
+
209
+ # Specific package
210
+ go test ./domain/aggregate/...
211
+
212
+ # Specific test
213
+ go test -run TestOrder_AddItem ./domain/aggregate/
214
+
215
+ # Verbose output
216
+ go test -v ./...
217
+
218
+ # Integration tests (requires docker)
219
+ go test -tags=integration ./...
220
+
221
+ # Benchmark
222
+ go test -bench=. ./...
223
+ ```
224
+
225
+ ---
226
+
227
+ ## 7. Best Practices
228
+
229
+ ### DO
230
+
231
+ 1. **Start with domain tests** - Easiest, most valuable
232
+ 2. **Use table-driven tests** - Test multiple scenarios efficiently
233
+ 3. **Test business rules thoroughly** - Cover edge cases
234
+ 4. **Use descriptive test names** - `TestOrder_AddItem_NegativeQuantity_ReturnsError`
235
+ 5. **Follow Arrange-Act-Assert** - Clear test structure
236
+ 6. **Mock external dependencies** - Repos, APIs, time
237
+ 7. **Use testcontainers for integration** - Real infrastructure
238
+ 8. **Write tests BEFORE fixing bugs** - Reproduce bug, then fix
239
+ 9. **Keep tests isolated** - No shared state between tests
240
+ 10. **Test behavior, not implementation** - Focus on what, not how
241
+
242
+ ### DON'T
243
+
244
+ 1. **Don't test framework code** - Echo, pgx, etc. are already tested
245
+ 2. **Don't test third-party libraries** - Trust they're tested
246
+ 3. **Don't over-mock domain tests** - Domain needs ZERO mocks
247
+ 4. **Don't skip domain tests** - Most valuable tests!
248
+ 5. **Don't test implementation details** - Refactoring will break tests
249
+ 6. **Don't share test state** - Each test should be isolated
250
+ 7. **Don't write flaky tests** - Fix or delete unreliable tests
251
+ 8. **Don't test private methods** - Test through public API
252
+ 9. **Don't ignore test failures** - Red tests = blocked development
253
+
254
+ ---
255
+
256
+ ## 8. CI/CD Integration
257
+
258
+ ### Pipeline Requirements
259
+
260
+ ```yaml
261
+ test:
262
+ stage: test
263
+ script:
264
+ - go test -race -coverprofile=coverage.out ./...
265
+ - go tool cover -func=coverage.out
266
+ coverage: '/total:\s+\(statements\)\s+(\d+\.\d+%)/'
267
+ ```
268
+
269
+ ### Quality Gates
270
+
271
+ | Check | Threshold | Action |
272
+ |-------|-----------|--------|
273
+ | Overall coverage | < 75% | Block merge |
274
+ | Domain coverage | < 90% | Warn |
275
+ | Test failures | Any | Block merge |
276
+ | Race conditions | Any | Block merge |
277
+
278
+ ---
279
+
280
+ ## 9. Mocking Guidelines
281
+
282
+ ### When to Mock
283
+
284
+ | Dependency | Mock? | Reason |
285
+ |------------|-------|--------|
286
+ | Domain logic | NO | Test real behavior |
287
+ | Repositories | YES | Avoid DB dependency |
288
+ | External APIs | YES | Avoid network calls |
289
+ | Time/Clock | YES | Deterministic tests |
290
+ | Random | YES | Reproducible tests |
291
+
292
+ ### Mock Structure
293
+
294
+ ```go
295
+ // Interface in domain
296
+ type OrderRepository interface {
297
+ Save(ctx context.Context, order *Order) error
298
+ FindByID(ctx context.Context, id OrderID) (*Order, error)
299
+ }
300
+
301
+ // Mock for tests
302
+ type MockOrderRepository struct {
303
+ mock.Mock
304
+ }
305
+
306
+ func (m *MockOrderRepository) Save(ctx context.Context, order *Order) error {
307
+ args := m.Called(ctx, order)
308
+ return args.Error(0)
309
+ }
310
+ ```
311
+
312
+ ---
313
+
314
+ ## 10. Test Data
315
+
316
+ ### Builders for Test Data
317
+
318
+ ```go
319
+ // Test data builder
320
+ func NewTestOrder() *Order {
321
+ return &Order{
322
+ ID: NewOrderID(),
323
+ Status: StatusDraft,
324
+ Items: []Item{},
325
+ }
326
+ }
327
+
328
+ func (o *Order) WithItems(items ...Item) *Order {
329
+ o.Items = items
330
+ return o
331
+ }
332
+
333
+ func (o *Order) WithStatus(status Status) *Order {
334
+ o.Status = status
335
+ return o
336
+ }
337
+
338
+ // Usage
339
+ order := NewTestOrder().
340
+ WithStatus(StatusPending).
341
+ WithItems(Item{SKU: "TEST", Quantity: 1})
342
+ ```
343
+
344
+ ### Golden Files (for complex output)
345
+
346
+ ```go
347
+ func TestComplexOutput(t *testing.T) {
348
+ result := GenerateReport()
349
+
350
+ golden := filepath.Join("testdata", "expected_report.json")
351
+
352
+ if *update {
353
+ os.WriteFile(golden, result, 0644)
354
+ }
355
+
356
+ expected, _ := os.ReadFile(golden)
357
+ assert.JSONEq(t, string(expected), string(result))
358
+ }
359
+ ```