jattac.libs.web.zest-button 1.2.9 → 1.4.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.
@@ -0,0 +1,442 @@
1
+ # AI Workflow
2
+
3
+ ## Terminology
4
+
5
+ The words MUST, MUST NOT, SHALL, SHALL NOT, SHOULD and MAY are to be interpreted as defined by RFC 2119.
6
+
7
+ ---
8
+
9
+ # Objective
10
+
11
+ Correctness is the highest priority.
12
+
13
+ Order of priorities:
14
+
15
+ 1. Correctness
16
+ 2. Preservation of business behaviour
17
+ 3. Testability
18
+ 4. Maintainability
19
+ 5. Readability
20
+ 6. Performance
21
+ 7. Code elegance
22
+
23
+ Never sacrifice a higher priority for a lower one.
24
+
25
+ ---
26
+
27
+ # Required Workflow
28
+
29
+ Every task SHALL follow this exact sequence.
30
+
31
+ Do not skip steps.
32
+
33
+ Do not reorder steps.
34
+
35
+ ---
36
+
37
+ # Workflow Trigger Detection
38
+
39
+ Before ANY workflow step, detect whether a new work cycle is needed.
40
+
41
+ Read AI_WORKFLOW_TRIGGERS.md at session startup.
42
+
43
+ ## Detection Logic
44
+
45
+ For EVERY user message that involves code changes:
46
+
47
+ 1. Check message against trigger patterns
48
+ 2. Classify as: New Work Cycle / Continuation / No Code Change / Ambiguous
49
+ 3. If New Work Cycle → trigger full workflow (BRS → verify-pre → build → test → verify-post)
50
+ 4. If Continuation → amend existing BRS if needed, skip BRS creation
51
+ 5. If No Code Change → answer question, no workflow
52
+ 6. If Ambiguous → ask user to clarify
53
+
54
+ ## Strong Inference Rule
55
+
56
+ The LLM MUST infer work cycles from semantics, NOT wait for explicit announcements.
57
+
58
+ Humans do not say "I am starting a new feature." They say "add user authentication."
59
+
60
+ The LLM SHALL detect these patterns and trigger workflow automatically.
61
+
62
+ If the user corrects the classification:
63
+
64
+ • Update AI_WORKFLOW_TRIGGERS.md
65
+
66
+ • Remove pattern if user says it's not a trigger
67
+
68
+ • Add pattern if user introduces new trigger language
69
+
70
+ ## Workflow Interruption
71
+
72
+ If user pivots mid-implementation:
73
+
74
+ 1. PAUSE current work
75
+ 2. ASK: "Should I finish [current task] or switch to [new request]?"
76
+ 3. If new request: mark current BRS as "Paused", create new BRS
77
+ 4. If continuation: amend current BRS with new criteria
78
+
79
+ Never silently abandon a BRS mid-implementation.
80
+
81
+ ---
82
+
83
+ ## Step 0 — Session startup verification
84
+
85
+ Before ANY task, verify the project is ready for work.
86
+
87
+ Run `./scripts/verify-pre.ps1` from the project root.
88
+
89
+ If missing platform: the script skips platform-specific phases automatically.
90
+
91
+ The script checks:
92
+
93
+ • Git state (not on protected branch)
94
+
95
+ • Tools available (dotnet/node/npx)
96
+
97
+ • Dependencies restored
98
+
99
+ • Configuration files exist
100
+
101
+ • BRS exists and was approved
102
+
103
+ If the script reports NOT READY: fix the issues before proceeding.
104
+
105
+ Only proceed to Step 1 after verification passes.
106
+
107
+ ---
108
+
109
+ ## Step 1 — BRS
110
+
111
+ Every task MUST have a BRS before implementation begins.
112
+
113
+ If a BRS exists for this task:
114
+
115
+ Read it completely.
116
+
117
+ Verify all acceptance criteria are specific and testable.
118
+
119
+ Verify the definition of done is clear.
120
+
121
+ Verify the BRS is approved by the user.
122
+
123
+ If incomplete or unapproved, STOP.
124
+
125
+ If a BRS does not exist:
126
+
127
+ Collaborate with the user to create one.
128
+
129
+ Follow the template in AI_BRS.md.
130
+
131
+ The AI SHALL:
132
+
133
+ • Ask clarifying questions
134
+
135
+ • Identify gaps in requirements
136
+
137
+ • Suggest edge cases
138
+
139
+ • Critique technical decisions
140
+
141
+ • Recommend patterns
142
+
143
+ • Challenge assumptions
144
+
145
+ The BRS MUST be complete and approved before proceeding.
146
+
147
+ The user MUST explicitly approve the BRS. Do NOT assume approval.
148
+
149
+ Save the BRS co-located with the code it describes.
150
+
151
+ Do NOT write code.
152
+
153
+ Do NOT explore code yet.
154
+
155
+ ---
156
+
157
+ ## Step 2 — Read the code
158
+
159
+ Before modifying ANY file, you MUST read its complete contents.
160
+
161
+ You MUST also read every file that calls or is called by modified code.
162
+
163
+ You MUST NOT modify a file you have not read in this session.
164
+
165
+ State which files you read and why.
166
+
167
+ If you cannot determine which files are affected, STOP and ask the user.
168
+
169
+ ---
170
+
171
+ ## Step 3 — Build impact analysis
172
+
173
+ Identify:
174
+
175
+ • callers
176
+
177
+ • callees
178
+
179
+ • interfaces
180
+
181
+ • inheritance
182
+
183
+ • dependency injection
184
+
185
+ • configuration
186
+
187
+ • events
188
+
189
+ • persistence
190
+
191
+ • serialization
192
+
193
+ • external APIs
194
+
195
+ • background jobs
196
+
197
+ • scheduled jobs
198
+
199
+ • message queues
200
+
201
+ • reflection
202
+
203
+ • caches
204
+
205
+ • feature flags
206
+
207
+ • database schema
208
+
209
+ • SQL
210
+
211
+ • existing tests
212
+
213
+ Document all findings.
214
+
215
+ ---
216
+
217
+ ## Step 4 — Uncertainty gate
218
+
219
+ If you cannot fully trace a call chain, STOP.
220
+
221
+ If you cannot determine all consumers of a modified method, STOP.
222
+
223
+ If you are making ANY assumption about code you have not read, STOP.
224
+
225
+ Report the uncertainty to the user.
226
+
227
+ Do NOT proceed with incomplete understanding.
228
+
229
+ ---
230
+
231
+ ## Step 5 — Update knowledge
232
+
233
+ Update ai-knowledge.md with any newly discovered architectural knowledge.
234
+
235
+ This MUST happen BEFORE implementation.
236
+
237
+ ---
238
+
239
+ ## Step 6 — Determine blast radius
240
+
241
+ Every potentially affected behaviour MUST be identified.
242
+
243
+ For every affected behaviour:
244
+
245
+ Does a test exist?
246
+
247
+ YES
248
+
249
+ Continue.
250
+
251
+ NO
252
+
253
+ Write the test FIRST.
254
+
255
+ The purpose of these tests is to preserve existing business behaviour before modifications begin.
256
+
257
+ ---
258
+
259
+ ## Step 7 — Decomposition gate
260
+
261
+ If the task requires changes across more than 3-4 files, STOP.
262
+
263
+ Decompose into smaller units.
264
+
265
+ Present the decomposition to the user for approval before proceeding.
266
+
267
+ Each unit should be implemented and tested independently.
268
+
269
+ ---
270
+
271
+ ## Step 8 — Pattern discovery
272
+
273
+ Before writing any new code, find 2-3 existing examples of the same pattern in the codebase.
274
+
275
+ Write your code to match those examples exactly.
276
+
277
+ If you cannot find existing examples, ask the user how to proceed.
278
+
279
+ ---
280
+
281
+ ## Step 9 — Implementation
282
+
283
+ Only now may implementation begin.
284
+
285
+ During implementation, the following rules apply:
286
+
287
+ ### BRS compliance
288
+
289
+ Every change MUST trace back to a specific requirement in the BRS.
290
+
291
+ If you are making a change that is NOT in the BRS, STOP.
292
+
293
+ Ask the user whether the BRS needs updating.
294
+
295
+ ### Minimal change
296
+
297
+ Do NOT modify any line not directly required by the BRS.
298
+
299
+ Do NOT fix typos in comments.
300
+
301
+ Do NOT rename variables for clarity.
302
+
303
+ Do NOT reorder methods.
304
+
305
+ Do NOT reformat code.
306
+
307
+ Do NOT add missing validation.
308
+
309
+ Do NOT improve error messages.
310
+
311
+ Do NOT add comments unless explicitly requested.
312
+
313
+ Do NOT add logging unless explicitly requested.
314
+
315
+ Do NOT add error handling unless explicitly requested.
316
+
317
+ Do NOT add TODO comments.
318
+
319
+ NONE of these unless explicitly requested.
320
+
321
+ ### Diff gate
322
+
323
+ If your production code diff exceeds ~50 lines for a single behaviour change, STOP.
324
+
325
+ You are likely touching code you should not be touching.
326
+
327
+ Get user approval before proceeding.
328
+
329
+ ---
330
+
331
+ ## Step 10 — Change manifest
332
+
333
+ Before proceeding to testing, produce a manifest.
334
+
335
+ For every file modified, state in one sentence WHY this specific change is necessary for the BRS.
336
+
337
+ If any entry cannot be justified by the BRS, revert that file.
338
+
339
+ Format:
340
+
341
+ ```
342
+ file/path.ts — [BRS requirement this satisfies]
343
+ file/other.ts — [BRS requirement this satisfies]
344
+ ```
345
+
346
+ ---
347
+
348
+ ## Step 11 — Run tests
349
+
350
+ Run tests in this order:
351
+
352
+ New tests
353
+
354
+ ↓
355
+
356
+ Blast radius tests
357
+
358
+ ↓
359
+
360
+ Integration tests
361
+
362
+ ↓
363
+
364
+ Entire test suite
365
+
366
+ ↓
367
+
368
+ Build
369
+
370
+ Report the exact test output.
371
+
372
+ State the number of tests passed, failed, and skipped.
373
+
374
+ State the command used.
375
+
376
+ Do NOT claim tests pass without showing output.
377
+
378
+ If ANY test fails, the task is NOT complete.
379
+
380
+ Do NOT skip tests.
381
+
382
+ Do NOT disable tests.
383
+
384
+ Do NOT mark tests as ignored.
385
+
386
+ ---
387
+
388
+ ## Step 12 — Self review
389
+
390
+ Perform the review defined in AI_CODE_REVIEW.md.
391
+
392
+ Every item MUST be evaluated as PASS or FAIL with evidence.
393
+
394
+ If ANY item is FAIL, the task is NOT complete.
395
+
396
+ Additionally, verify BRS compliance:
397
+
398
+ • Every acceptance criterion in the BRS is satisfied by a test
399
+
400
+ • Every change traces to a BRS requirement
401
+
402
+ • No changes exist outside the BRS scope
403
+
404
+ ---
405
+
406
+ ## Step 13 — Update knowledge
407
+
408
+ Update ai-knowledge.md again if implementation revealed new information.
409
+
410
+ ---
411
+
412
+ ## Step 14 — Update decision log
413
+
414
+ Record in decision-log.md:
415
+
416
+ • What was requested
417
+
418
+ • What was changed
419
+
420
+ • What alternatives were considered
421
+
422
+ • Why this approach was chosen
423
+
424
+ ---
425
+
426
+ ## Step 15 — Report completion
427
+
428
+ Report:
429
+
430
+ • BRS compliance summary (which acceptance criteria are satisfied)
431
+
432
+ • Change manifest (from Step 10)
433
+
434
+ • Test results (from Step 11)
435
+
436
+ • Self review results (from Step 12)
437
+
438
+ • Known risks
439
+
440
+ • Remaining unknowns
441
+
442
+ • Confidence level
@@ -0,0 +1,222 @@
1
+ # AI Workflow Triggers
2
+
3
+ ## Terminology
4
+
5
+ The words MUST, MUST NOT, SHALL, SHALL NOT, SHOULD and MAY are to be interpreted as defined by RFC 2119.
6
+
7
+ ---
8
+
9
+ # Purpose
10
+
11
+ This file is a LIVING DOCUMENT.
12
+
13
+ It defines semantic patterns that trigger a new work cycle (BRS → verify-pre → build → test → verify-post).
14
+
15
+ The LLM MUST read this file at session startup.
16
+
17
+ The LLM MUST learn from user interactions and update this file.
18
+
19
+ ---
20
+
21
+ # How This File Works
22
+
23
+ ## Seed Patterns
24
+
25
+ The patterns below are starting points.
26
+
27
+ They are NOT permanent.
28
+
29
+ ## Learning Rules
30
+
31
+ ### Removing Patterns
32
+
33
+ If the user indicates a pattern is NOT a trigger:
34
+
35
+ 1. REMOVE it from the appropriate list
36
+ 2. ADD it to the "Retired Patterns" section with reason
37
+ 3. DO NOT re-add it in future sessions
38
+
39
+ Examples of user indication:
40
+
41
+ - "that's not a new task, just continue"
42
+ - "I don't need a BRS for small changes"
43
+ - "stop asking, just do it"
44
+
45
+ ### Adding Patterns
46
+
47
+ If the LLM observes a new trigger pattern:
48
+
49
+ 1. ADD it to the appropriate list
50
+ 2. Mark it as `[Observed]` with date
51
+ 3. After 3 consecutive uses, promote to `[Established]`
52
+
53
+ ### Retiring Patterns
54
+
55
+ If a pattern is never used after 10 sessions:
56
+
57
+ 1. MOVE to "Retired Patterns" with date
58
+ 2. DO NOT delete — history matters
59
+
60
+ ---
61
+
62
+ # Trigger Classification
63
+
64
+ ## New Work Cycle — Strong Inference
65
+
66
+ **Action:** Trigger FULL workflow (BRS → verify-pre → build → test → verify-post)
67
+
68
+ ### Feature Creation
69
+
70
+ | Pattern | Status | Added |
71
+ |---------|--------|-------|
72
+ | "add..." | [Established] | Seed |
73
+ | "create..." | [Established] | Seed |
74
+ | "implement..." | [Established] | Seed |
75
+ | "build..." | [Established] | Seed |
76
+ | "new feature..." | [Established] | Seed |
77
+ | "new page..." | [Established] | Seed |
78
+ | "new component..." | [Established] | Seed |
79
+ | "new endpoint..." | [Established] | Seed |
80
+ | "new table..." | [Established] | Seed |
81
+ | "new migration..." | [Established] | Seed |
82
+
83
+ ### Bug Fix
84
+
85
+ | Pattern | Status | Added |
86
+ |---------|--------|-------|
87
+ | "fix..." | [Established] | Seed |
88
+ | "bug..." | [Established] | Seed |
89
+ | "broken..." | [Established] | Seed |
90
+ | "error..." | [Established] | Seed |
91
+ | "crash..." | [Established] | Seed |
92
+ | "failing..." | [Established] | Seed |
93
+ | "doesn't work..." | [Established] | Seed |
94
+ | "not working..." | [Established] | Seed |
95
+ | "regression..." | [Established] | Seed |
96
+ | "the [thing] is wrong..." | [Established] | Seed |
97
+
98
+ ### Refactor
99
+
100
+ | Pattern | Status | Added |
101
+ |---------|--------|-------|
102
+ | "refactor..." | [Established] | Seed |
103
+ | "restructure..." | [Established] | Seed |
104
+ | "rewrite..." | [Established] | Seed |
105
+ | "reorganize..." | [Established] | Seed |
106
+ | "clean up..." | [Established] | Seed |
107
+ | "simplify..." | [Established] | Seed |
108
+ | "extract..." | [Established] | Seed |
109
+ | "move..." (code movement) | [Established] | Seed |
110
+
111
+ ---
112
+
113
+ ## Continuation — Same Work
114
+
115
+ **Action:** DO NOT trigger new BRS. Amend existing if needed.
116
+
117
+ ### Same Context Continuation
118
+
119
+ | Pattern | Status | Added |
120
+ |---------|--------|-------|
121
+ | "also..." | [Established] | Seed |
122
+ | "and..." | [Established] | Seed |
123
+ | "plus..." | [Established] | Seed |
124
+ | "while you're at it..." | [Established] | Seed |
125
+ | "can you also..." | [Established] | Seed |
126
+ | "don't forget..." | [Established] | Seed |
127
+ | "one more thing..." | [Established] | Seed |
128
+
129
+ ### Test Continuation
130
+
131
+ | Pattern | Status | Added |
132
+ |---------|--------|-------|
133
+ | "the test for..." | [Established] | Seed |
134
+ | "add a test for..." | [Established] | Seed |
135
+ | "test coverage for..." | [Established] | Seed |
136
+
137
+ ---
138
+
139
+ ## No Code Change
140
+
141
+ **Action:** Skip workflow entirely. Answer question.
142
+
143
+ | Pattern | Status | Added |
144
+ |---------|--------|-------|
145
+ | "what does..." | [Established] | Seed |
146
+ | "explain..." | [Established] | Seed |
147
+ | "how does..." | [Established] | Seed |
148
+ | "can you read..." | [Established] | Seed |
149
+ | "show me..." | [Established] | Seed |
150
+ | "question about..." | [Established] | Seed |
151
+ | "why..." | [Established] | Seed |
152
+ | "when..." | [Established] | Seed |
153
+ | "where..." | [Established] | Seed |
154
+
155
+ ---
156
+
157
+ ## Ambiguous — Ask for Clarification
158
+
159
+ **Action:** ASK user to clarify before proceeding.
160
+
161
+ | Pattern | Status | Added |
162
+ |---------|--------|-------|
163
+ | "I need help with..." | [Established] | Seed |
164
+ | "the [thing]..." | [Established] | Seed |
165
+ | "can you..." | [Established] | Seed |
166
+ | "would you..." | [Established] | Seed |
167
+ | "could you..." | [Established] | Seed |
168
+
169
+ ### Clarification Questions
170
+
171
+ When ambiguous, ask:
172
+
173
+ - "Is this a new feature, bug fix, or question?"
174
+ - "Should I implement this or just explain it?"
175
+ - "Do you want me to create a BRS for this?"
176
+
177
+ ---
178
+
179
+ # Retired Patterns
180
+
181
+ | Pattern | Reason | Retired Date |
182
+ |---------|--------|--------------|
183
+ | (none yet) | — | — |
184
+
185
+ ---
186
+
187
+ # Learned Patterns
188
+
189
+ This section is populated by the LLM during sessions.
190
+
191
+ ## User-Specific Patterns
192
+
193
+ | Pattern | Classification | Evidence | Confidence |
194
+ |---------|---------------|----------|------------|
195
+ | (none yet) | — | — | — |
196
+
197
+ ---
198
+
199
+ # Metrics
200
+
201
+ Track trigger accuracy:
202
+
203
+ | Metric | Value |
204
+ |--------|-------|
205
+ | Total triggers fired | 0 |
206
+ | Correct (user confirmed) | 0 |
207
+ | Incorrect (user corrected) | 0 |
208
+ | Accuracy | — |
209
+ | Patterns added | 0 |
210
+ | Patterns retired | 0 |
211
+ | Last updated | (session date) |
212
+
213
+ ---
214
+
215
+ # Usage
216
+
217
+ 1. LLM reads this file at session start
218
+ 2. When user sends a message, LLM checks patterns
219
+ 3. If match found → trigger appropriate workflow
220
+ 4. If user corrects → update this file
221
+ 5. If new pattern observed → add with `[Observed]` status
222
+ 6. After implementation → update metrics