@kraftapps-ai/kai 1.6.4 → 1.7.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 (2) hide show
  1. package/kai +44 -11
  2. package/package.json +1 -1
package/kai CHANGED
@@ -130,8 +130,8 @@ if [ "$needs_mcp_update" = true ]; then
130
130
 
131
131
  if [ "$mantle_available" = false ] && ! echo "$mcp_config" | grep -q "mantle"; then
132
132
  echo "Setting up Mantle MCP (billing, subscriptions, analytics)..."
133
- mcp_config=$(echo "$mcp_config" | jq '.mcpServers["mantle-foundations"] = {"url": "https://mcp.heymantle.com/foundations"}')
134
- mcp_config=$(echo "$mcp_config" | jq '.mcpServers["mantle-core"] = {"url": "https://mcp.heymantle.com/core"}')
133
+ mcp_config=$(echo "$mcp_config" | jq '.mcpServers["mantle-foundations"] = {"type": "http", "url": "https://mcp.heymantle.com/foundations"}')
134
+ mcp_config=$(echo "$mcp_config" | jq '.mcpServers["mantle-core"] = {"type": "http", "url": "https://mcp.heymantle.com/core"}')
135
135
  fi
136
136
 
137
137
  echo "$mcp_config" > .mcp.json
@@ -153,9 +153,11 @@ if [ "$needs_mcp_update" = true ]; then
153
153
  "args": ["-y", "@shopify/dev-mcp@latest"]
154
154
  },
155
155
  "mantle-foundations": {
156
+ "type": "http",
156
157
  "url": "https://mcp.heymantle.com/foundations"
157
158
  },
158
159
  "mantle-core": {
160
+ "type": "http",
159
161
  "url": "https://mcp.heymantle.com/core"
160
162
  }
161
163
  }
@@ -201,23 +203,26 @@ You are an expert Shopify developer. You have access to the Shopify Dev MCP tool
201
203
  - `@.kai/stories.json` — user stories with `passes: true/false`.
202
204
  - `@.kai/progress.txt` — log of what has been done.
203
205
 
204
- ## Your task (ONE story per loop)
206
+ ## Your task (ONE story per loop) — TDD workflow
205
207
 
206
208
  1. Read .kai/stories.json, find the highest-priority story where `passes: false`.
207
209
  2. Read .kai/progress.txt for context on previous work.
208
210
  3. **PLAN before coding.** List files and changes before touching code.
209
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.
210
- 5. Implement ONLY that one story.
211
- 6. Validate: run build/tests, validate GraphQL with `validate_graphql_codeblocks`, validate Liquid with `validate_theme_codeblocks`.
212
- 7. **SELF-REVIEW.** For each acceptance criterion, cite evidence (file, line, command output). No "should work" or "probably".
213
- 8. Commit with a descriptive message.
214
- 9. Update .kai/stories.json: set `passes` to `true`.
215
- 10. Append to .kai/progress.txt.
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.
216
220
 
217
221
  ## Rules
218
222
  - ONE STORY PER LOOP.
223
+ - **TDD is mandatory.** Tests first, then implementation. No exceptions.
219
224
  - No placeholders. Fully implement or report BLOCKED.
220
- - Do not break existing functionality.
225
+ - Do not break existing functionality. Run the FULL test suite, not just your new tests.
221
226
  - ALWAYS validate GraphQL and Liquid code using the MCP tools before marking complete.
222
227
  - If ALL stories have `passes: true`, output: <promise>COMPLETE</promise>
223
228
 
@@ -229,7 +234,9 @@ You are an expert Shopify developer. You have access to the Shopify Dev MCP tool
229
234
  | "Build passes = works" | Build ≠ correct. | Check each criterion. |
230
235
  | "Close enough" | Partial = broken. | All criteria or BLOCKED. |
231
236
  | "Skip review" | Simple code has bugs. | Always self-review. |
232
- | "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. |'
233
240
 
234
241
  context_files="@${PRD_FILE} @${PROGRESS_FILE}"
235
242
  if [ -f ".kai/context.txt" ]; then
@@ -497,10 +504,36 @@ Then build: \`https://admin.shopify.com/store/{STORE_NAME}/apps/{HANDLE}/{PAGE}\
497
504
 
498
505
  When the developer says \"check /designs\", translate that to the full URL using the store name + app handle you found.
499
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
+
500
532
  ## Rules for good stories
501
533
  - Each story: independently committable, 5-15 min of work
502
534
  - Acceptance criteria must be objectively verifiable
503
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)
504
537
  - Last criterion should be a build/test command passing
505
538
  - Order by dependency (foundations first)
506
539
  - Include error handling, edge cases as separate stories
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kraftapps-ai/kai",
3
- "version": "1.6.4",
3
+ "version": "1.7.0",
4
4
  "description": "Autonomous AI developer loop for Claude Code",
5
5
  "bin": {
6
6
  "kai": "kai"