@nurix/etna 0.1.2 → 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.
Files changed (32) hide show
  1. package/README.md +34 -27
  2. package/bin/etna.js +82 -52
  3. package/data/harness-index.json +2 -8
  4. package/data/harnesses/code/CLAUDE.md +18 -9
  5. package/data/harnesses/code/agents/change-review.md +80 -0
  6. package/data/harnesses/code/agents/contract-monitor.md +65 -0
  7. package/data/harnesses/code/agents/dep-health.md +148 -0
  8. package/data/harnesses/code/agents/git-history.md +201 -0
  9. package/data/harnesses/code/agents/maintenance.md +112 -0
  10. package/data/harnesses/code/agents/review.md +109 -0
  11. package/data/harnesses/code/agents/spec-mode.md +56 -0
  12. package/data/harnesses/code/rules/general.md +96 -0
  13. package/data/harnesses/code/rules/nomenclature.md +34 -0
  14. package/data/harnesses/code/scripts/build-ownership-index.sh +138 -0
  15. package/data/harnesses/code/scripts/check-doc-drift.sh +125 -0
  16. package/data/harnesses/code/skills/documentation/SKILL.md +238 -0
  17. package/data/harnesses/code/skills/documentation/references/examples.md +193 -0
  18. package/data/harnesses/code/skills/documentation/references/style-guide.md +288 -0
  19. package/data/harnesses/code/skills/documentation/references/templates.md +901 -0
  20. package/data/harnesses/code/skills/introspect/SKILL.md +135 -0
  21. package/data/harnesses/code/skills/workflow-mapper/SKILL.md +430 -0
  22. package/data/harnesses/code/skills/workflow-mapper/references/patterns.md +214 -0
  23. package/data/harnesses/kb-agi/CLAUDE.md +57 -0
  24. package/data/harnesses/kb-agi/agents/kb-agi-init.md +276 -0
  25. package/data/harnesses/kb-agi/agents/kb-catch-stale.md +22 -0
  26. package/data/harnesses/kb-agi/agents/kb-find-gaps.md +27 -0
  27. package/data/harnesses/kb-agi/agents/kb-fix-links.md +22 -0
  28. package/data/harnesses/kb-agi/agents/kb-refresh-frontdoor.md +22 -0
  29. package/data/harnesses/kb-agi/agents/kb-refresh-summaries.md +22 -0
  30. package/data/harnesses/kb-agi/agents/kb-sync-metadata.md +25 -0
  31. package/data/harnesses/kb-agi/rules/kb.md +13 -0
  32. package/package.json +1 -1
@@ -0,0 +1,193 @@
1
+ # Documentation Examples
2
+
3
+ Good vs bad examples showing the key differences.
4
+
5
+ ---
6
+
7
+ ## Example 1: Function Documentation
8
+
9
+ ### ❌ Bad: Full Implementation
10
+
11
+ ```markdown
12
+ ### mergeData
13
+
14
+ function mergeData(server, local, changes) {
15
+ const result = {};
16
+ const serverMap = new Map(server.map((i) => [i.id, i]));
17
+ // ... 30 more lines
18
+ return result;
19
+ }
20
+ ```
21
+
22
+ **Problems:** Will become obsolete, focuses on HOW not WHAT.
23
+
24
+ ### ✅ Good: Contract Only
25
+
26
+ ```markdown
27
+ ### `mergeData(serverData, localData, changes)`
28
+
29
+ **Goal:** Merge server data with local changes
30
+ **Input:**
31
+
32
+ - `serverData` (array) - Fresh from API
33
+ - `localData` (array) - Current state
34
+ - `changes` (object) - `{ added, updated, removed }`
35
+ **Output:** `{ merged: array, conflicts: array }`
36
+
37
+ **Merge Rules:**
38
+
39
+ - Server wins for conflicts
40
+ - Local additions preserved
41
+ - Local removals marked as intent
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Example 2: State Documentation
47
+
48
+ ### ❌ Bad: State Everywhere
49
+
50
+ ```markdown
51
+ ## Component State
52
+
53
+ const [items, setItems] = useState([]);
54
+
55
+ ## Hook State
56
+
57
+ { data: items, isLoading: loading, error: null }
58
+
59
+ ## Redux State
60
+
61
+ { items: [], loading: false, error: null }
62
+ ```
63
+
64
+ **Problems:** Documents transient state, repeats shapes.
65
+
66
+ ### ✅ Good: Persistence Points Only
67
+
68
+ ```markdown
69
+ ## State
70
+
71
+ **Frontend (at persistence):**
72
+ {
73
+ "data": [],
74
+ "changes": { "added": [], "updated": [], "removed": [] }
75
+ // "cache": {} // UNUSED: Deprecated
76
+ }
77
+
78
+ **Storage:** localStorage `app_state`
79
+
80
+ **Backend:**
81
+ model Item {
82
+ id String @id
83
+ data Json
84
+ }
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Example 3: Changelog
90
+
91
+ ### ❌ Bad: Vague
92
+
93
+ ```markdown
94
+ # 2025-01-05 - Updates
95
+
96
+ ## Changes
97
+
98
+ - Updated editor
99
+ - Fixed bugs
100
+ - Improved performance
101
+
102
+ ## Files
103
+
104
+ - Various files in src/
105
+ ```
106
+
107
+ ### ✅ Good: Function-Level Detail
108
+
109
+ ```markdown
110
+ # 2025-01-05 - Version-Based Merge
111
+
112
+ ## Summary
113
+
114
+ Replaced change-tracking merge with version-based conflict resolution.
115
+
116
+ ## Changes
117
+
118
+ ### Added
119
+
120
+ - `mergeAndDerive(server, local, versionsMatch, type)` in `src/utils/merge.js`
121
+ - Purpose: Single-pass merge with change detection
122
+ - Returns: `{ merged, changes }`
123
+
124
+ ### Modified
125
+
126
+ - `useDataSync()` in `src/hooks/useDataSync.js`
127
+ - Changed: Now compares versions before merge
128
+
129
+ ### Removed
130
+
131
+ - `deriveChanges()` from `src/utils/derive.js`
132
+ - Replaced by: Logic in `mergeAndDerive()`
133
+
134
+ ## Breaking Changes
135
+
136
+ ⚠️ **Merge behavior changed**
137
+
138
+ - Old: Local changes always preserved
139
+ - New: Local preserved only if versions match
140
+
141
+ ## Files Changed
142
+
143
+ - `src/hooks/useDataSync.js`
144
+ - `src/utils/merge.js`
145
+ - `src/utils/derive.js` (deleted)
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Example 4: Data Flow
151
+
152
+ ### ❌ Bad: Prose Description
153
+
154
+ ```markdown
155
+ When the page loads, the useAppInit hook calls the syncData function.
156
+ This function first fetches data from the server using the API. Then
157
+ it gets the local data from Redux. After that, it compares versions...
158
+ ```
159
+
160
+ ### ✅ Good: Diagram + Key Points
161
+
162
+ ```markdown
163
+ ## Data Flow
164
+
165
+ ┌─────────────────────────────────────────┐
166
+ │ DATA SYNC │
167
+ ├─────────────────────────────────────────┤
168
+ │ │
169
+ │ ┌──────┐ ┌──────┐ ┌──────┐ │
170
+ │ │Server│────▶│Merge │────▶│Redux │ │
171
+ │ │ API │ │ │ │Store │ │
172
+ │ └──────┘ └──────┘ └──────┘ │
173
+ │ │ │
174
+ │ ▼ │
175
+ │ Version Check │
176
+ │ │
177
+ └─────────────────────────────────────────┘
178
+
179
+ **Trigger:** `useAppInit()` on page load
180
+ **Version Rule:** Match → local wins, Mismatch → server wins
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Quick Comparison
186
+
187
+ | Aspect | Bad | Good |
188
+ | ---------- | -------------------- | --------------------------- |
189
+ | Code | Full implementations | Signatures + contracts |
190
+ | State | Every occurrence | Persistence points only |
191
+ | Flows | Prose paragraphs | ASCII diagrams |
192
+ | Changelogs | "Updated X" | Function names + migrations |
193
+ | Length | 100+ lines | 20-40 lines |
@@ -0,0 +1,288 @@
1
+ # Documentation Style Guide
2
+
3
+ Writing rules for clear, maintainable documentation.
4
+
5
+ ---
6
+
7
+ ## Function Documentation
8
+
9
+ ### Signature Format
10
+
11
+ ```markdown
12
+ ### `functionName(param1, param2, options)`
13
+
14
+ **Goal:** One-line purpose
15
+ **Input:**
16
+
17
+ - `param1` (type) - Description
18
+ - `param2` (type, optional) - Description
19
+ **Output:** `{ field1, field2 }`
20
+ **Side Effects:** State updates, API calls, etc.
21
+ ```
22
+
23
+ ### Parameter Rules
24
+
25
+ - Name + type + one-line purpose
26
+ - Mark optional params with `(type, optional)`
27
+ - Nest object properties:
28
+ ```markdown
29
+ - `options` (object) - Configuration
30
+ - `options.retry` (boolean) - Enable retries
31
+ - `options.timeout` (number) - Timeout in ms
32
+ ```
33
+
34
+ ### Return Values
35
+
36
+ Always specify:
37
+
38
+ - Type: `Array<Object>`, `boolean`, `{ merged, changes }`
39
+ - Shape for objects/arrays
40
+ - Meaning: "True if sync successful"
41
+
42
+ ---
43
+
44
+ ## State Documentation
45
+
46
+ ### When to Document State
47
+
48
+ ✅ Do:
49
+
50
+ - Redux persistence (localStorage, IndexedDB)
51
+ - Database schemas
52
+ - API request/response shapes
53
+
54
+ ❌ Don't:
55
+
56
+ - Component-level state
57
+ - Derived/computed state
58
+ - Temporary UI state
59
+
60
+ ### Format
61
+
62
+ ````markdown
63
+ **Frontend (at persistence):**
64
+
65
+ ```json
66
+ {
67
+ "activeField": "value"
68
+ // "deprecated": null // UNUSED: Remove in v3
69
+ }
70
+ ```
71
+ ````
72
+
73
+ **Storage:** localStorage key `state_key`
74
+
75
+ **Backend:**
76
+
77
+ ```sql
78
+ model Table {
79
+ id String @id
80
+ data Json
81
+ // old String? // UNUSED: Legacy
82
+ }
83
+ ```
84
+
85
+ ````
86
+
87
+ ### Mark Unused Keys
88
+
89
+ Always comment deprecated/unused fields:
90
+ ```json
91
+ {
92
+ "active": [],
93
+ // "legacy": {} // UNUSED: Migrated to newField
94
+ }
95
+ ````
96
+
97
+ ---
98
+
99
+ ## ASCII Diagrams
100
+
101
+ ### When to Use
102
+
103
+ - Data flows
104
+ - System architecture
105
+ - Component interactions
106
+ - Process flows
107
+
108
+ ### Pattern
109
+
110
+ ```
111
+ ┌─────────────────────────────────────────┐
112
+ │ TITLE │
113
+ ├─────────────────────────────────────────┤
114
+ │ │
115
+ │ ┌──────┐ ┌──────┐ ┌──────┐ │
116
+ │ │ A │────▶│ B │────▶│ C │ │
117
+ │ └──────┘ └──────┘ └──────┘ │
118
+ │ │ │ │
119
+ │ ▼ ▼ │
120
+ │ Detail Detail │
121
+ │ │
122
+ └─────────────────────────────────────────┘
123
+ ```
124
+
125
+ ### Characters
126
+
127
+ - Boxes: `┌─┐│└┘├┤┬┴┼`
128
+ - Arrows: `───▶` `◀───` `│▼` `│▲`
129
+ - Width: ~70 chars max
130
+
131
+ ### UI Wireframes
132
+
133
+ For screen layouts (not data flows), use these conventions:
134
+
135
+ ```
136
+ **Route:** `path/:id`
137
+ **Tab:** Tab Name
138
+
139
+ ┌────────────────────────────────────┐
140
+ │ Title [i]3 [Button]│
141
+ │ [i]Label [Tag1][Tag2][+Add] │
142
+ └────────────────────────────────────┘
143
+ ```
144
+
145
+ - `[text]` = clickable button/badge
146
+ - `[i]` = icon (followed by label or count)
147
+ - `v` / `^` = expand/collapse indicator
148
+ - Show each UI state (collapsed/expanded) as separate diagrams
149
+ - Include Route/Tab context above wireframe
150
+
151
+ ---
152
+
153
+ ## Code Examples
154
+
155
+ ### Rules
156
+
157
+ - Under 15 lines
158
+ - Show contracts, not implementations
159
+ - Use pseudocode for algorithms
160
+
161
+ ✅ Good:
162
+
163
+ ```javascript
164
+ // Critical: Balanced brace matching
165
+ function extract(json) {
166
+ // Track brace depth
167
+ // Ignore braces inside strings
168
+ // Return complete objects only
169
+ }
170
+ ```
171
+
172
+ ❌ Bad: Full 50-line implementation
173
+
174
+ ---
175
+
176
+ ## Writing Style
177
+
178
+ ### Voice
179
+
180
+ Use imperative/active:
181
+
182
+ - ✅ "Fetches data from server"
183
+ - ✅ "Returns array of objects"
184
+ - ❌ "This function is used to fetch"
185
+ - ❌ "An array is returned"
186
+
187
+ ### When Prose Adds Value
188
+
189
+ Prose is valuable for context that contracts can't capture:
190
+
191
+ | Use Prose For | Example |
192
+ | -------------------- | ------------------------------------------------------------------------------------------------- |
193
+ | Section intros | "When the editor mounts, `useAppInit` is called with the `appId` from URL." |
194
+ | Non-obvious behavior | "The hook always fetches fresh data. There is no caching or version checking." |
195
+ | Design rationale | "Why parallel fetches? Each entity type is independent, reducing load time." |
196
+ | Edge cases | "If created then deleted before save, it's removed from `added[]` without adding to `removed[]`." |
197
+ | Current limitations | "This hook is not currently integrated into the main flow." |
198
+ | Usage context | "Used to show 'Unsaved' badge, warn before navigation, enable save buttons." |
199
+
200
+ ### When to Avoid Prose
201
+
202
+ - Describing WHAT code does (use signatures instead)
203
+ - Step-by-step flows (use diagrams instead)
204
+ - Structured comparisons (use tables instead)
205
+
206
+ ### Conciseness
207
+
208
+ One line when possible:
209
+
210
+ - ✅ "Merge server data with local changes using version-based conflict resolution"
211
+ - ❌ "This function takes the data from the server and also takes the local data..."
212
+
213
+ ### Tables
214
+
215
+ Use for structured info:
216
+
217
+ ```markdown
218
+ | Parameter | Type | Description |
219
+ | --------- | ------ | -------------- |
220
+ | `data` | object | Fresh from API |
221
+ | `local` | object | Current state |
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Structure
227
+
228
+ ### Headers
229
+
230
+ ```markdown
231
+ # Document Title (H1 - once)
232
+
233
+ ## Major Section (H2)
234
+
235
+ ### Subsection (H3)
236
+
237
+ #### Detail (H4 - sparingly)
238
+ ```
239
+
240
+ ### Standard Layout
241
+
242
+ ```markdown
243
+ # [Title]
244
+
245
+ **Goal:** One-line purpose
246
+
247
+ ## Architecture
248
+
249
+ [Diagram + explanation]
250
+
251
+ ## Key Functions
252
+
253
+ [Signatures and contracts]
254
+
255
+ ## State
256
+
257
+ [Persistence shapes]
258
+
259
+ ## Files
260
+
261
+ [Source file list]
262
+ ```
263
+
264
+ ### File References
265
+
266
+ Always end with:
267
+
268
+ ```markdown
269
+ ## Files
270
+
271
+ - `src/path/main.js` - Core logic
272
+ - `src/path/hooks.js` - React hooks
273
+ ```
274
+
275
+ ---
276
+
277
+ ## Summary
278
+
279
+ | Aspect | Rule |
280
+ | ---------- | ------------------------------- |
281
+ | Functions | Always include signatures |
282
+ | Parameters | Type + purpose |
283
+ | Returns | Type + shape |
284
+ | State | Persistence points only |
285
+ | Diagrams | ASCII for all flows |
286
+ | Code | Under 15 lines, contracts only |
287
+ | Voice | Imperative/active |
288
+ | Length | Concise, one line when possible |