qatools-cli 1.1.4 → 1.1.5

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/package.json +1 -1
  2. package/qatools.js +152 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qatools-cli",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "CLI for QA Tools — requirements, epics, sprints, sessions, App Context sync, project agenda. The companion to qa-tools.com.",
5
5
  "bin": {
6
6
  "qatools": "./qatools.js"
package/qatools.js CHANGED
@@ -1632,6 +1632,83 @@ program
1632
1632
 
1633
1633
  // 2. Write skills files
1634
1634
  const skills = {
1635
+ "qa-purpose.md": `---
1636
+ description: Read this BEFORE anything else. The purpose of qa-tools and what it expects from you as AI.
1637
+ ---
1638
+
1639
+ # Why qa-tools exists
1640
+
1641
+ qa-tools exists for one reason: to let anyone build production-quality apps with AI that follow their own rules — as if they had built it themselves, just faster.
1642
+
1643
+ Not "demo quality, fast". Not "good enough, fast". **The user's own quality bar, faster.**
1644
+
1645
+ ## What this means for you (the AI)
1646
+
1647
+ You are not a coding assistant. You are a substitute. The user is delegating
1648
+ construction of their app to you, and they expect what comes back to be what
1649
+ they would have built themselves if they had infinite time.
1650
+
1651
+ That standard rules out:
1652
+ - Guessing when verification is possible
1653
+ - "Looks right" without numbers
1654
+ - "User will test it" handoffs of responsibility
1655
+ - Shortcuts the user themselves wouldn't take
1656
+ - Pattern-matched code from training data when the project has its own rules
1657
+
1658
+ ## The chain
1659
+
1660
+ \`\`\`
1661
+ App Context (the user's rules: design, security, AI rules, constraints)
1662
+ ↓
1663
+ Epics (capabilities the user wants)
1664
+ ↓
1665
+ Requirements (Given/When/Then — the user's spec, testable)
1666
+ ↓
1667
+ Code (you build, must trace to requirement)
1668
+ ↓
1669
+ Tests (generated from REQUIREMENTS, not from code)
1670
+ ↓
1671
+ Backlog (signals when chain breaks: AVV / GAP / DEF / IMP)
1672
+ ↓
1673
+ Fix (against the requirement, with --evidence)
1674
+ ↓
1675
+ Requirement marked tested
1676
+ \`\`\`
1677
+
1678
+ Every link is enforceable. The CLI refuses status changes without evidence.
1679
+ The skills refuse vague claims. The model refuses circular fixes (backlog →
1680
+ backlog without going through requirements).
1681
+
1682
+ ## Your starting move
1683
+
1684
+ Before doing ANYTHING in this project:
1685
+ 1. Run \`qatools context\` — read the App Context. This is the user's rule book.
1686
+ 2. Run \`qatools epics\` — see what capabilities exist.
1687
+ 3. Run \`qatools next\` — see what's actually on the agenda.
1688
+
1689
+ If App Context is empty, the project hasn't been set up yet. Help the user
1690
+ draft one before building anything else. **Without App Context you have no
1691
+ basis for being a substitute** — you're just guessing what their rules are.
1692
+
1693
+ ## When you're tempted to skip the chain
1694
+
1695
+ You will be tempted. The user will be impatient. The bug will look obvious.
1696
+ You will think "I'll just fix it and they can verify".
1697
+
1698
+ That is exactly the failure mode qa-tools was built to prevent. The substitute
1699
+ that "just fixes things" is the substitute that drifts away from what the
1700
+ user actually wanted, one shortcut at a time.
1701
+
1702
+ When you feel that temptation, stop. Ask: would the user themselves skip this
1703
+ step if they were doing it manually? If no, you can't either.
1704
+
1705
+ ## Cross-reference
1706
+
1707
+ - qa-loop.md — the mechanics of the loop
1708
+ - qa-evidence-first.md — the core principle (cite, don't guess)
1709
+ - qa-numerical-verification.md — for algorithmic bugs
1710
+ - qa-developer.md — implementation guidance
1711
+ `,
1635
1712
  "qa-loop.md": `---
1636
1713
  description: Overview of the QA-Tools delivery loop — from requirement to verified release. Read this first.
1637
1714
  ---
@@ -1653,6 +1730,22 @@ Requirement → Build → Test → Backlog → Fix → Verify
1653
1730
  5. **AI analyzes and fixes** — AI identifies root cause: is it the code or the requirement? Fixes code or suggests requirement adjustment.
1654
1731
  6. **Retest verifies** — The loop closes only when the requirement is verified.
1655
1732
 
1733
+ ## What this means for you (the AI)
1734
+
1735
+ Each arrow in the loop is a rule on what you can and cannot do:
1736
+
1737
+ **Requirement → Build** means: you don't build until there's an approved requirement. Period. If the user asks you to fix something without a requirement, your first response is "can you formulate what the system should do as a requirement?" — not "sure, I'll fix it".
1738
+
1739
+ **Build → Test** means: the code is not done until there's a test that verifies it meets the requirement. "I compiled it" is not done. "I ran the file and it didn't crash" is not done.
1740
+
1741
+ **Test → Backlog** means: when the test fails, that's a signal to you that either the requirement or the code is wrong. You don't guess which — you investigate. The backlog item is the *observation*, not the diagnosis.
1742
+
1743
+ **Backlog → Fix** means: the fix comes from the requirement, not from the backlog item. The backlog item is the symptom. The requirement is what you build against. If you fix the symptom without going back to the requirement, you're patching, not building.
1744
+
1745
+ **Fix → Verify** means: you don't mark tested without --evidence. The CLI refuses status changes without it. That's not bureaucracy — it's the line between claiming and verifying. If you cannot articulate the verification, you have not verified.
1746
+
1747
+ If any of these feels like friction, that is the system working as intended. The friction is what keeps the chain unbroken.
1748
+
1656
1749
  ## CLI quick reference
1657
1750
 
1658
1751
  \`\`\`bash
@@ -2064,7 +2157,8 @@ If the verification fails: do NOT mark tested. Go back to step 1, find the discr
2064
2157
  for (const [filename, content] of Object.entries(skills)) {
2065
2158
  fs.writeFileSync(path.join(skillsDir, filename), content);
2066
2159
  }
2067
- console.log(" ✓ qa-loop.md (start here)");
2160
+ console.log(" ✓ qa-purpose.md (READ FIRST)");
2161
+ console.log(" ✓ qa-loop.md");
2068
2162
  console.log(" ✓ qa-requirement-analyst.md");
2069
2163
  console.log(" ✓ qa-developer.md");
2070
2164
  console.log(" ✓ qa-test-generator.md");
@@ -2115,23 +2209,32 @@ If the verification fails: do NOT mark tested. Go back to step 1, find the discr
2115
2209
  const qaSection = `
2116
2210
  ## QA-Tools Integration
2117
2211
 
2212
+ This project uses qa-tools (https://qa-tools.com) for requirement-driven AI development. The purpose: build production-quality apps with AI that follow your own rules — as if you built it yourself, just faster. The AI is the builder; you are the requirements author and reviewer.
2213
+
2214
+ **Read \`.claude/skills/qa-purpose.md\` before doing anything in this project.** It explains what qa-tools expects from the AI: not a coding assistant, a substitute for the developer.
2215
+
2118
2216
  \`\`\`bash
2119
2217
  export QATOOLS_API_KEY=${apiKey || "<din-nyckel>"}
2120
2218
  \`\`\`
2121
2219
 
2122
- ### Kommandon
2123
- - \`qatools requirements\` — lista krav
2124
- - \`qatools backlog\` — lista backlog
2125
- - \`qatools pending\` — väntande testsessioner
2126
- - \`qatools read-session -s <id>\` — läs session
2127
- - \`qatools upload-analysis -s <id> -f analysis.json\` — ladda upp analys
2128
- - \`qatools requirement-create -f file.json\` — skapa krav
2129
- - \`qatools template-upload -f file.json\` — ladda upp testprotokoll
2130
- - \`qatools backlog-create -d "..." -t task\` — skapa ärende
2131
- - \`qatools backlog-update -i <id> --status resolved\` — uppdatera
2132
-
2133
- ### Roller (skills)
2134
- Se \`.claude/skills/\` för instruktioner per roll.
2220
+ ### Commands
2221
+ - \`qatools context\` — read the project's rule book (App Context)
2222
+ - \`qatools epics\` — list capabilities
2223
+ - \`qatools next\` — what's on the agenda right now
2224
+ - \`qatools requirements\` — list requirements
2225
+ - \`qatools backlog\` — list backlog signals
2226
+ - \`qatools pending\` — test sessions awaiting analysis
2227
+ - \`qatools read-session -s <id>\` — read session details
2228
+ - \`qatools upload-analysis -s <id> -f analysis.json\` — upload analysis
2229
+ - \`qatools requirement-create -f file.json\` — create requirements
2230
+ - \`qatools requirement-update -i <id> --status tested --evidence "..."\` — mark verified (evidence required)
2231
+ - \`qatools template-upload -f file.json\` — upload test template
2232
+ - \`qatools backlog-create -d "..." -t bug\` — create backlog item
2233
+ - \`qatools backlog-update -i <id> --status resolved --evidence "..."\` — mark resolved (evidence required)
2234
+ - \`qatools access show\` — view access model
2235
+
2236
+ ### Skills
2237
+ See \`.claude/skills/\` for role-specific instructions. Start with \`qa-purpose.md\`.
2135
2238
  `;
2136
2239
 
2137
2240
  if (fs.existsSync(claudeMdPath)) {
@@ -2147,8 +2250,41 @@ Se \`.claude/skills/\` för instruktioner per roll.
2147
2250
  console.log("\n✓ Created CLAUDE.md with QA-Tools section");
2148
2251
  }
2149
2252
 
2150
- console.log("\n🎉 QA-Tools initialized! Claude is ready.");
2151
- if (!apiKey) console.log("\n⚠ No API key set. Add it to CLAUDE.md: export QATOOLS_API_KEY=<key>");
2253
+ // 5. Final purpose-first banner — check App Context state and tell the AI/user what to do
2254
+ let contextStateMessage = "";
2255
+ try {
2256
+ const creds = getCredentials();
2257
+ if (creds?.projectId) {
2258
+ const getCtx = httpsCallable(functions, "getAppContext");
2259
+ const ctxResult = await getCtx({ projectId: creds.projectId });
2260
+ const ctx = ctxResult.data.appContext;
2261
+ if (!ctx || (!ctx.purpose && !(ctx.stack || []).length && !(ctx.aiRules || []).length)) {
2262
+ contextStateMessage = "\n⚠ App Context is empty for this project.\n Without it, the AI has no basis for substituting for you.\n First step: open https://qa-tools.com and define App Context (purpose, stack, conventions, AI rules)\n or upload a JSON via: qatools context-set -f context.json\n";
2263
+ } else {
2264
+ const lastSync = ctx.updatedAt?._seconds ? new Date(ctx.updatedAt._seconds * 1000).toISOString().split('T')[0] : 'unknown';
2265
+ contextStateMessage = `\n✓ App Context loaded (last updated: ${lastSync})\n`;
2266
+ }
2267
+ }
2268
+ } catch (e) {
2269
+ // Best-effort — don't block init on this check
2270
+ }
2271
+
2272
+ console.log(`
2273
+ 🎉 QA-Tools initialized!
2274
+
2275
+ ⚠ READ THIS FIRST: .claude/skills/qa-purpose.md
2276
+
2277
+ qa-tools exists to let anyone build production-quality apps with AI
2278
+ that follow their own rules — as if you built it yourself, just faster.
2279
+ The AI is not an assistant. It is a substitute for the developer.
2280
+ Read qa-purpose.md before doing anything else in this project.
2281
+ ${contextStateMessage}
2282
+ Next steps for the AI in this project:
2283
+ 1. qatools context — read the project's rule book
2284
+ 2. qatools epics — see what capabilities exist
2285
+ 3. qatools next — see what's on the agenda
2286
+ `);
2287
+ if (!apiKey) console.log("⚠ No API key set. Add it to CLAUDE.md: export QATOOLS_API_KEY=<key>\n");
2152
2288
  process.exit(0);
2153
2289
  });
2154
2290