@kraftapps-ai/kai 1.6.5 → 1.7.1
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/kai +41 -10
- package/package.json +1 -1
package/kai
CHANGED
|
@@ -203,23 +203,26 @@ You are an expert Shopify developer. You have access to the Shopify Dev MCP tool
|
|
|
203
203
|
- `@.kai/stories.json` — user stories with `passes: true/false`.
|
|
204
204
|
- `@.kai/progress.txt` — log of what has been done.
|
|
205
205
|
|
|
206
|
-
## Your task (ONE story per loop)
|
|
206
|
+
## Your task (ONE story per loop) — TDD workflow
|
|
207
207
|
|
|
208
208
|
1. Read .kai/stories.json, find the highest-priority story where `passes: false`.
|
|
209
209
|
2. Read .kai/progress.txt for context on previous work.
|
|
210
210
|
3. **PLAN before coding.** List files and changes before touching code.
|
|
211
211
|
4. If the story involves Shopify APIs, call `learn_shopify_api` then use `introspect_graphql_schema` and `search_docs_chunks` to understand the right approach.
|
|
212
|
-
5.
|
|
213
|
-
6.
|
|
214
|
-
7. **
|
|
215
|
-
8.
|
|
216
|
-
9.
|
|
217
|
-
10.
|
|
212
|
+
5. **WRITE FAILING TESTS FIRST.** For each acceptance criterion, write a test that verifies it. Run the tests — they MUST fail (red). If a test already passes, your test is not testing the right thing.
|
|
213
|
+
6. **Implement ONLY enough code to make the tests pass (green).** No more, no less.
|
|
214
|
+
7. **Refactor** if needed — clean up while keeping tests green.
|
|
215
|
+
8. Validate: run full test suite, validate GraphQL with `validate_graphql_codeblocks`, validate Liquid with `validate_theme_codeblocks`.
|
|
216
|
+
9. **SELF-REVIEW.** For each acceptance criterion, cite the test that covers it AND evidence it passes (file, line, command output). No "should work" or "probably".
|
|
217
|
+
10. Commit with a descriptive message.
|
|
218
|
+
11. Update .kai/stories.json: set `passes` to `true`.
|
|
219
|
+
12. Append to .kai/progress.txt.
|
|
218
220
|
|
|
219
221
|
## Rules
|
|
220
222
|
- ONE STORY PER LOOP.
|
|
223
|
+
- **TDD is mandatory.** Tests first, then implementation. No exceptions.
|
|
221
224
|
- No placeholders. Fully implement or report BLOCKED.
|
|
222
|
-
- Do not break existing functionality.
|
|
225
|
+
- Do not break existing functionality. Run the FULL test suite, not just your new tests.
|
|
223
226
|
- ALWAYS validate GraphQL and Liquid code using the MCP tools before marking complete.
|
|
224
227
|
- If ALL stories have `passes: true`, output: <promise>COMPLETE</promise>
|
|
225
228
|
|
|
@@ -231,7 +234,9 @@ You are an expert Shopify developer. You have access to the Shopify Dev MCP tool
|
|
|
231
234
|
| "Build passes = works" | Build ≠ correct. | Check each criterion. |
|
|
232
235
|
| "Close enough" | Partial = broken. | All criteria or BLOCKED. |
|
|
233
236
|
| "Skip review" | Simple code has bugs. | Always self-review. |
|
|
234
|
-
| "I know the API" | APIs change. Schema is truth. | Introspect first. |
|
|
237
|
+
| "I know the API" | APIs change. Schema is truth. | Introspect first. |
|
|
238
|
+
| "Tests can come later" | TDD means tests FIRST. | Write failing test before any code. |
|
|
239
|
+
| "This is hard to test" | Find a way or report BLOCKED. | Never skip tests. |'
|
|
235
240
|
|
|
236
241
|
context_files="@${PRD_FILE} @${PROGRESS_FILE}"
|
|
237
242
|
if [ -f ".kai/context.txt" ]; then
|
|
@@ -263,7 +268,7 @@ while :; do
|
|
|
263
268
|
start_time=$(date +%s)
|
|
264
269
|
|
|
265
270
|
set +e
|
|
266
|
-
result=$(claude -p --dangerously-skip-permissions $context_files)
|
|
271
|
+
result=$(claude -p --dangerously-skip-permissions --system-prompt "$WORKER_PROMPT" $context_files)
|
|
267
272
|
exit_code=$?
|
|
268
273
|
set -e
|
|
269
274
|
|
|
@@ -499,10 +504,36 @@ Then build: \`https://admin.shopify.com/store/{STORE_NAME}/apps/{HANDLE}/{PAGE}\
|
|
|
499
504
|
|
|
500
505
|
When the developer says \"check /designs\", translate that to the full URL using the store name + app handle you found.
|
|
501
506
|
|
|
507
|
+
## QA gate — Playwright user testing
|
|
508
|
+
|
|
509
|
+
After the dev loop marks stories as complete, you MUST verify them yourself via Playwright before considering them truly done. This is non-negotiable.
|
|
510
|
+
|
|
511
|
+
### Post-loop QA workflow
|
|
512
|
+
1. When the dev loop finishes (or when the developer asks you to verify), navigate to the app in Shopify Admin using Playwright
|
|
513
|
+
2. For each completed story, visually verify every acceptance criterion:
|
|
514
|
+
- Navigate to the relevant page
|
|
515
|
+
- Take screenshots as evidence
|
|
516
|
+
- Click through the user flow
|
|
517
|
+
- Check for visual bugs, broken layouts, console errors
|
|
518
|
+
3. If a story **fails** visual QA:
|
|
519
|
+
- Report what you found (with screenshots)
|
|
520
|
+
- Set that story's \`passes\` back to \`false\` in .kai/stories.json
|
|
521
|
+
- Add a note to .kai/progress.txt explaining what failed visually
|
|
522
|
+
- The dev loop will pick it up again on next run
|
|
523
|
+
4. If a story **passes** visual QA:
|
|
524
|
+
- Confirm it to the developer with screenshot evidence
|
|
525
|
+
5. **A story is only truly done when both automated tests AND visual Playwright QA pass.**
|
|
526
|
+
|
|
527
|
+
### When to run QA
|
|
528
|
+
- After every dev loop completion
|
|
529
|
+
- When the developer asks you to verify/check/test
|
|
530
|
+
- Before reporting stories as done to the developer
|
|
531
|
+
|
|
502
532
|
## Rules for good stories
|
|
503
533
|
- Each story: independently committable, 5-15 min of work
|
|
504
534
|
- Acceptance criteria must be objectively verifiable
|
|
505
535
|
- For Shopify API stories: include the specific mutations/queries to use (introspect first!)
|
|
536
|
+
- Include testable criteria — the dev loop uses TDD (tests first, then implementation)
|
|
506
537
|
- Last criterion should be a build/test command passing
|
|
507
538
|
- Order by dependency (foundations first)
|
|
508
539
|
- Include error handling, edge cases as separate stories
|