create-qa-architect 5.13.3 → 5.13.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.
@@ -22,8 +22,12 @@ jobs:
22
22
  node-version: '22'
23
23
  registry-url: 'https://registry.npmjs.org'
24
24
 
25
- - name: Upgrade npm for OIDC trusted publishing
26
- run: npm install -g npm@latest
25
+ # OIDC trusted publishing requires npm >= 11.5. We pin to 11.5.2 (the
26
+ # first OIDC-stable release) instead of `npm@latest` to avoid the
27
+ # MODULE_NOT_FOUND (promise-retry) regression hit when self-upgrading
28
+ # over the setup-node-provided npm on top of the newest 11.x.
29
+ - name: Pin npm for OIDC trusted publishing
30
+ run: npm install -g npm@11.5.2
27
31
 
28
32
  - name: Install dependencies
29
33
  run: npm ci --no-audit
package/LICENSE CHANGED
@@ -22,21 +22,9 @@ TERMS OF USE:
22
22
  - Smart Test Strategy
23
23
  - Multi-language support
24
24
  - Unlimited repos
25
- - Team: Contact us (coming soon)
26
- - All Pro features
27
- - RBAC and team policies
28
- - Slack alerts
29
- - Multi-repo dashboard
30
- - Enterprise: Contact us (coming soon)
31
- - All Team features
32
- - SSO/SAML integration
33
- - Custom policies
34
- - Compliance pack
35
- - Dedicated TAM
36
25
 
37
26
  3. VIBE LAB PRO BUNDLE
38
27
  Pro tier is included in the Vibe Lab Pro subscription.
39
- Team and Enterprise tiers are standalone purchases.
40
28
 
41
29
  4. PERMITTED USES
42
30
  - Use the free tier without restriction
@@ -1,5 +1,7 @@
1
1
  'use strict'
2
2
 
3
+ const { detectDepMajor } = require('../lib/project-module-type')
4
+
3
5
  const STYLELINT_EXTENSIONS = ['css', 'scss', 'sass', 'less', 'pcss']
4
6
  const DEFAULT_STYLELINT_TARGET = `**/*.{${STYLELINT_EXTENSIONS.join(',')}}`
5
7
 
@@ -123,13 +125,27 @@ function getDefaultScripts({ stylelintTargets } = {}) {
123
125
  }
124
126
 
125
127
  /**
126
- * @param {DefaultsOptions} [options]
128
+ * @param {DefaultsOptions & {projectPath?: string}} [options]
127
129
  */
128
- function getDefaultDevDependencies({ typescript } = {}) {
130
+ function getDefaultDevDependencies({ typescript, projectPath } = {}) {
129
131
  const devDeps = { ...clone(baseDevDependencies) }
130
132
  if (typescript) {
131
133
  Object.assign(devDeps, typeScriptDevDependencies)
132
134
  }
135
+
136
+ // Align @vitest/coverage-v8 with the target project's installed vitest
137
+ // major. vitest and its coverage adapter must share a major or npm install
138
+ // fails with ERESOLVE. Without this, a project already on vitest@4 gets
139
+ // our @vitest/coverage-v8@^2.x injected and breaks.
140
+ if (projectPath) {
141
+ const vitestMajor = detectDepMajor(projectPath, 'vitest')
142
+ if (vitestMajor && vitestMajor >= 3) {
143
+ devDeps['@vitest/coverage-v8'] = `^${vitestMajor}.0.0`
144
+ // Also drop our pinned vitest so we don't downgrade the project
145
+ delete devDeps.vitest
146
+ }
147
+ }
148
+
133
149
  return devDeps
134
150
  }
135
151
 
@@ -0,0 +1,208 @@
1
+ # Stripe Live Mode Deployment Guide
2
+
3
+ Deploy the `webhook-handler.js` server to process real Stripe payments and issue signed Pro licenses automatically.
4
+
5
+ ## Overview
6
+
7
+ The payment flow:
8
+ 1. Customer purchases Pro at `buildproven.ai/qa-architect`
9
+ 2. Stripe fires a `checkout.session.completed` webhook to your server
10
+ 3. `webhook-handler.js` validates the event, generates a signed license key, and saves it to Vercel Blob
11
+ 4. Customer runs `npx create-qa-architect@latest --activate-license` and enters their key
12
+
13
+ ---
14
+
15
+ ## Prerequisites
16
+
17
+ - A [Stripe](https://stripe.com) account with live mode enabled
18
+ - A [Vercel](https://vercel.com) account (for Blob storage and hosting)
19
+ - Node.js >=20
20
+ - The ED25519 private key used to sign licenses (in `public-key.pem` + your private key)
21
+
22
+ ---
23
+
24
+ ## Step 1: Create Stripe Products and Prices
25
+
26
+ In the [Stripe Dashboard](https://dashboard.stripe.com/products) → Products → Add product:
27
+
28
+ | Product | Price | Billing | Price ID (example) |
29
+ |---|---|---|---|
30
+ | QA Architect Pro | $49.00 | Monthly | `price_1St9K2Gv7Su9XNJbdYoH3K32` |
31
+ | QA Architect Pro | $490.00 | Yearly | `price_1St9KGGv7Su9XNJbrwKMsh1R` |
32
+
33
+ The price IDs above are already mapped in `webhook-handler.js:315-318`. If your actual Stripe price IDs differ, update `mapPriceToTier()` in `webhook-handler.js`.
34
+
35
+ ---
36
+
37
+ ## Step 2: Set Up Vercel Blob Storage
38
+
39
+ ```bash
40
+ # Install Vercel CLI
41
+ npm install -g vercel
42
+
43
+ # Link your project
44
+ vercel link
45
+
46
+ # Create a Blob store in the Vercel dashboard
47
+ # Dashboard → Storage → Create → Blob → name it "qa-architect-licenses"
48
+ # Copy the BLOB_READ_WRITE_TOKEN
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Step 3: Deploy to Vercel
54
+
55
+ `webhook-handler.js` exports an Express app compatible with Vercel serverless.
56
+
57
+ Create `vercel.json` in the project root (do not commit secrets):
58
+
59
+ ```json
60
+ {
61
+ "version": 2,
62
+ "builds": [{ "src": "webhook-handler.js", "use": "@vercel/node" }],
63
+ "routes": [{ "src": "/(.*)", "dest": "/webhook-handler.js" }]
64
+ }
65
+ ```
66
+
67
+ Deploy:
68
+
69
+ ```bash
70
+ vercel --prod
71
+ ```
72
+
73
+ Your webhook URL will be: `https://your-project.vercel.app/webhook`
74
+
75
+ ---
76
+
77
+ ## Step 4: Set Environment Variables
78
+
79
+ In the Vercel dashboard → Project → Settings → Environment Variables, add:
80
+
81
+ | Variable | Value | Notes |
82
+ |---|---|---|
83
+ | `STRIPE_SECRET_KEY` | `sk_live_...` | From Stripe Dashboard → Developers → API keys |
84
+ | `STRIPE_WEBHOOK_SECRET` | `whsec_...` | Generated in Step 5 below |
85
+ | `LICENSE_REGISTRY_PRIVATE_KEY` | Base64-encoded ED25519 private key | See note below |
86
+ | `LICENSE_REGISTRY_KEY_ID` | `default` | Or a versioned ID like `v1` |
87
+ | `BLOB_READ_WRITE_TOKEN` | `vercel_blob_...` | From Vercel Blob store settings |
88
+ | `STATUS_API_TOKEN` | A strong random string | Protects the `/status` endpoint |
89
+ | `NODE_ENV` | `production` | Enables HSTS and production error handling |
90
+
91
+ **Private key format:** The key must be a PEM-encoded ED25519 private key, base64-encoded as a single line (no newlines):
92
+
93
+ ```bash
94
+ # Encode your private key for the env var
95
+ base64 -w 0 < your-private-key.pem
96
+ ```
97
+
98
+ The `loadKeyFromEnv()` function in `lib/license-signing.js` decodes it automatically.
99
+
100
+ ---
101
+
102
+ ## Step 5: Register the Stripe Webhook
103
+
104
+ In the [Stripe Dashboard](https://dashboard.stripe.com/webhooks) → Webhooks → Add endpoint:
105
+
106
+ - **URL:** `https://your-project.vercel.app/webhook`
107
+ - **Events to listen for:**
108
+ - `checkout.session.completed`
109
+ - `invoice.payment_succeeded`
110
+ - `customer.subscription.deleted`
111
+
112
+ Copy the **Signing secret** (`whsec_...`) and add it as `STRIPE_WEBHOOK_SECRET` in Vercel.
113
+
114
+ ---
115
+
116
+ ## Step 6: Verify the Deployment
117
+
118
+ ```bash
119
+ # Health check
120
+ curl https://your-project.vercel.app/health
121
+
122
+ # Expected response:
123
+ # {"status":"ok","timestamp":"...","database":"missing"}
124
+ # (missing is fine before any licenses are issued)
125
+
126
+ # Test license database endpoint (used by CLI)
127
+ curl https://your-project.vercel.app/legitimate-licenses.json
128
+
129
+ # Test status endpoint (replace TOKEN with your STATUS_API_TOKEN)
130
+ curl -H "Authorization: Bearer TOKEN" https://your-project.vercel.app/status
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Step 7: Test with Stripe Test Mode First
136
+
137
+ Before going live, test the full flow:
138
+
139
+ ```bash
140
+ # Install Stripe CLI
141
+ brew install stripe/stripe-cli/stripe
142
+
143
+ # Forward webhooks to your local server
144
+ stripe listen --forward-to localhost:3000/webhook
145
+
146
+ # Trigger a test checkout event
147
+ stripe trigger checkout.session.completed
148
+
149
+ # Verify a license was created
150
+ curl http://localhost:3000/legitimate-licenses.json
151
+ ```
152
+
153
+ Switch to live mode keys once the test flow works end-to-end.
154
+
155
+ ---
156
+
157
+ ## Step 8: Connect Your Checkout Page
158
+
159
+ Your Stripe Checkout session must:
160
+ - Use one of the two price IDs mapped in `mapPriceToTier()`
161
+ - Be a **subscription** mode checkout (not one-time payment)
162
+ - Collect a customer email
163
+
164
+ Example Stripe Checkout session creation (server-side):
165
+
166
+ ```javascript
167
+ const session = await stripe.checkout.sessions.create({
168
+ mode: 'subscription',
169
+ payment_method_types: ['card'],
170
+ line_items: [{ price: 'price_1St9K2Gv7Su9XNJbdYoH3K32', quantity: 1 }],
171
+ success_url: 'https://buildproven.ai/qa-architect/success?session_id={CHECKOUT_SESSION_ID}',
172
+ cancel_url: 'https://buildproven.ai/qa-architect',
173
+ })
174
+ ```
175
+
176
+ ---
177
+
178
+ ## License Key Delivery
179
+
180
+ After a successful checkout, the license key is stored in Vercel Blob. The customer retrieves it by running:
181
+
182
+ ```bash
183
+ npx create-qa-architect@latest --activate-license
184
+ ```
185
+
186
+ They enter their email and the license key format `QAA-XXXX-XXXX-XXXX-XXXX`.
187
+
188
+ The key is deterministic from the Stripe customer ID — you can regenerate it at any time using `admin-license.js` or `scripts/generate-license-keys.js`.
189
+
190
+ > **Note:** The current flow requires customers to manually enter their key. Consider adding an email delivery step in `handleCheckoutCompleted()` in `webhook-handler.js` (the comment at line 511 marks where to add this).
191
+
192
+ ---
193
+
194
+ ## Cancellation Handling
195
+
196
+ When a subscription is canceled in Stripe, the `customer.subscription.deleted` event fires and `handleSubscriptionCanceled()` marks the license as `status: "canceled"` in the database. The CLI checks this status during `getLicenseInfo()` and downgrades the user to FREE tier automatically.
197
+
198
+ ---
199
+
200
+ ## Troubleshooting
201
+
202
+ | Symptom | Likely cause | Fix |
203
+ |---|---|---|
204
+ | Webhook returns 400 | Wrong `STRIPE_WEBHOOK_SECRET` | Re-copy the signing secret from Stripe Dashboard |
205
+ | License not created after payment | Unknown price ID | Update `mapPriceToTier()` with your actual Stripe price IDs |
206
+ | CLI can't find license | Wrong blob URL | Check `BLOB_PATHS` in `lib/blob-storage.js` matches your Vercel Blob store |
207
+ | `sk_test_` warning in logs | Test key in production | Replace with `sk_live_...` key |
208
+ | `/status` returns 503 | `STATUS_API_TOKEN` not set | Add the env var in Vercel settings |
@@ -149,7 +149,7 @@ Turborepo caches and parallelizes tasks based on `turbo.json`:
149
149
 
150
150
  ### Issue: "package.json not found" in subdirectory
151
151
 
152
- This is expected in monorepos. qa-architect gracefully handles missing package.json in workspace subdirectories (see `docs/MONOREPO-COMPATIBILITY-FIX.md`).
152
+ This is expected in monorepos. qa-architect gracefully handles missing package.json in workspace subdirectories.
153
153
 
154
154
  ## Testing
155
155
 
@@ -165,7 +165,6 @@ npx create-qa-architect@latest --dry-run
165
165
 
166
166
  ## Related Documentation
167
167
 
168
- - [Monorepo Compatibility Fix](./MONOREPO-COMPATIBILITY-FIX.md) - Handling workspaces
169
168
  - [CI Cost Analysis](./CI-COST-ANALYSIS.md) - Workflow tier pricing
170
169
  - [pnpm CI Example](../.github/workflows/pnpm-ci.yml.example) - Complete example
171
170
 
@@ -11,7 +11,7 @@ QA Architect (`create-qa-architect`) is a CLI tool that bootstraps quality autom
11
11
 
12
12
  **Entry point:** `setup.js` — CLI argument parsing and orchestration. Run as `npx create-qa-architect` or `node setup.js`.
13
13
 
14
- **npm package:** `create-qa-architect` v5.13.2 (published via GitHub trusted publishing)
14
+ **npm package:** `create-qa-architect` v5.13.4 (published via GitHub trusted publishing)
15
15
 
16
16
  ## Directory Structure
17
17
 
@@ -442,15 +442,9 @@
442
442
  )
443
443
  } finally {
444
444
  checkoutBtn.disabled = false
445
- if (selectedTier === 'pro') {
446
- checkoutBtn.textContent = isFounder
447
- ? 'Start Pro Subscription - $24.50/month (Founder Price)'
448
- : 'Start Pro Subscription - $49/month'
449
- } else {
450
- checkoutBtn.textContent = isFounder
451
- ? 'Start Enterprise Subscription - $74.50/month (Founder Price)'
452
- : 'Start Enterprise Subscription - $149/month'
453
- }
445
+ checkoutBtn.textContent = isFounder
446
+ ? 'Start Pro Subscription - $24.50/month (Founder Price)'
447
+ : 'Start Pro Subscription - $49/month'
454
448
  }
455
449
  }
456
450
 
@@ -12,6 +12,7 @@ const path = require('path')
12
12
  const { execSync } = require('child_process')
13
13
  const yaml = require('js-yaml')
14
14
  const { showProgress } = require('../ui-helpers')
15
+ const { hasFeature, showUpgradeMessage } = require('../licensing')
15
16
 
16
17
  const DAYS_PER_MONTH = 30
17
18
  const DEFAULT_PULL_REQUEST_FACTOR = 0.8
@@ -383,17 +384,20 @@ function calculateMonthlyCosts(workflows, commitsPerDay, options = {}) {
383
384
  const workflowRunsPerDay = totalWorkflowRunsPerMonth / DAYS_PER_MONTH
384
385
 
385
386
  // GitHub Actions pricing (as of 2024)
386
- const FREE_TIER_MINUTES = 2000 // Free tier monthly limit
387
- const TEAM_TIER_MINUTES = 3000 // Team tier monthly limit
387
+ const FREE_TIER_MINUTES = 2000 // GitHub Free plan monthly limit
388
+ const GITHUB_TEAM_PLAN_MINUTES = 3000 // GitHub Team plan monthly limit ($4/user/month)
388
389
  const COST_PER_MINUTE = 0.008 // $0.008/min for private repos
389
390
  const TARGET_BUDGET_MINUTES = 1000
390
391
  const STRETCH_BUDGET_MINUTES = 1500
391
392
 
392
393
  const freeOverage = Math.max(0, minutesPerMonth - FREE_TIER_MINUTES)
393
- const teamOverage = Math.max(0, minutesPerMonth - TEAM_TIER_MINUTES)
394
+ const githubTeamOverage = Math.max(
395
+ 0,
396
+ minutesPerMonth - GITHUB_TEAM_PLAN_MINUTES
397
+ )
394
398
 
395
399
  const freeOverageCost = freeOverage * COST_PER_MINUTE
396
- const teamOverageCost = teamOverage * COST_PER_MINUTE
400
+ const githubTeamOverageCost = githubTeamOverage * COST_PER_MINUTE
397
401
 
398
402
  return {
399
403
  minutesPerMonth,
@@ -419,11 +423,11 @@ function calculateMonthlyCosts(workflows, commitsPerDay, options = {}) {
419
423
  withinLimit: minutesPerMonth <= FREE_TIER_MINUTES,
420
424
  },
421
425
  team: {
422
- limit: TEAM_TIER_MINUTES,
423
- overage: teamOverage,
424
- cost: teamOverageCost,
425
- withinLimit: minutesPerMonth <= TEAM_TIER_MINUTES,
426
- monthlyCost: 4, // $4/user/month
426
+ limit: GITHUB_TEAM_PLAN_MINUTES,
427
+ overage: githubTeamOverage,
428
+ cost: githubTeamOverageCost,
429
+ withinLimit: minutesPerMonth <= GITHUB_TEAM_PLAN_MINUTES,
430
+ monthlyCost: 4, // $4/user/month (GitHub Team plan price)
427
431
  },
428
432
  },
429
433
  }
@@ -672,10 +676,10 @@ function generateReport(analysis) {
672
676
  console.log('')
673
677
  console.log('Alternative options:')
674
678
 
675
- // Team tier comparison
679
+ // GitHub Team plan comparison (GitHub's billing tier, not QA Architect tier)
676
680
  if (costs.tiers.team.withinLimit) {
677
681
  console.log(
678
- ` Team plan ($${costs.tiers.team.monthlyCost}/user/month): ✅ Stays within ${costs.tiers.team.limit.toLocaleString()} min limit`
682
+ ` GitHub Team plan ($${costs.tiers.team.monthlyCost}/user/month): ✅ Stays within ${costs.tiers.team.limit.toLocaleString()} min limit`
679
683
  )
680
684
  const savings = costs.tiers.free.cost - costs.tiers.team.monthlyCost
681
685
  if (savings > 0) {
@@ -683,7 +687,7 @@ function generateReport(analysis) {
683
687
  }
684
688
  } else {
685
689
  console.log(
686
- ` Team plan ($${costs.tiers.team.monthlyCost}/user/month): Still exceeds (${costs.tiers.team.overage.toLocaleString()} min overage)`
690
+ ` GitHub Team plan ($${costs.tiers.team.monthlyCost}/user/month): Still exceeds (${costs.tiers.team.overage.toLocaleString()} min overage)`
687
691
  )
688
692
  console.log(
689
693
  ` Total cost: $${(costs.tiers.team.monthlyCost + costs.tiers.team.cost).toFixed(2)}/month`
@@ -772,13 +776,10 @@ function generateReport(analysis) {
772
776
  async function handleAnalyzeCi() {
773
777
  const projectPath = process.cwd()
774
778
 
775
- // Check if Pro feature (FREE tier for now during development)
776
- // TODO: Enable Pro gating after testing
777
- // const license = getLicenseInfo()
778
- // if (!hasFeature('ciCostAnalysis')) {
779
- // showUpgradeMessage('GitHub Actions cost analysis')
780
- // process.exit(1)
781
- // }
779
+ if (!hasFeature('ciCostAnalysis')) {
780
+ showUpgradeMessage('GitHub Actions cost analysis')
781
+ process.exit(1)
782
+ }
782
783
 
783
784
  const spinner = showProgress('Analyzing GitHub Actions workflows...')
784
785
 
@@ -60,7 +60,7 @@ function detectRubyProject(projectPath) {
60
60
  }
61
61
 
62
62
  /**
63
- * Handle dependency monitoring command (Free/Pro/Team/Enterprise)
63
+ * Handle dependency monitoring command (Free/Pro)
64
64
  */
65
65
  async function handleDependencyMonitoring() {
66
66
  const projectPath = process.cwd()
@@ -95,7 +95,7 @@ async function handleDependencyMonitoring() {
95
95
  if (!capCheck.allowed) {
96
96
  console.error(`❌ ${capCheck.reason}`)
97
97
  console.error(
98
- ' Upgrade to Pro, Team, or Enterprise for unlimited runs: https://buildproven.ai/qa-architect'
98
+ ' Upgrade to Pro for unlimited runs: https://buildproven.ai/qa-architect'
99
99
  )
100
100
  process.exit(1)
101
101
  }
@@ -108,7 +108,7 @@ async function handleDependencyMonitoring() {
108
108
  // Free tier only supports npm projects. Fail fast with a clear message.
109
109
  if (!shouldUsePremium && !hasNpm && (hasPython || hasRust || hasRuby)) {
110
110
  console.error(
111
- '❌ Dependency monitoring for this project requires a Pro, Team, or Enterprise license.'
111
+ '❌ Dependency monitoring for this project requires a Pro license.'
112
112
  )
113
113
  console.error(
114
114
  ' Free tier supports npm projects only. Detected non-npm ecosystems.'
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Premium Dependency Monitoring Library (Pro/Team/Enterprise Tiers)
2
+ * Premium Dependency Monitoring Library (Pro Tier)
3
3
  * Framework-aware dependency grouping with intelligent batching
4
4
  *
5
5
  * @module dependency-monitoring-premium
@@ -1,107 +1,28 @@
1
1
  'use strict'
2
2
 
3
- const crypto = require('crypto')
4
-
5
- // TD15 fix: Single source of truth for license key format validation
6
- const LICENSE_KEY_PATTERN =
7
- /^QAA-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/
8
-
9
3
  /**
10
- * Deterministic JSON stringify with sorted keys for signature verification.
11
- * TD13 fix: Added circular reference protection using WeakSet.
4
+ * License signing primitives thin adapter over @buildproven/license-core.
5
+ *
6
+ * The package is the single source of truth for the signing/verification
7
+ * algorithm. This file exists for backward compatibility with existing
8
+ * `require('./license-signing')` callers in licensing.js, license-validator.js,
9
+ * admin-license.js, and tests. The bit-for-bit format is locked by the
10
+ * package's golden-vector tests against this exact file's prior behavior.
11
+ *
12
+ * QAA-specific bits (loadKeyFromEnv, LICENSE_KEY_PATTERN) stay here because
13
+ * they're not generic to all BuildProven products.
12
14
  */
13
- function stableStringify(value, seen = new WeakSet()) {
14
- if (value === null || typeof value !== 'object') {
15
- return JSON.stringify(value)
16
- }
17
- // TD13 fix: Detect circular references to prevent stack overflow
18
- if (seen.has(value)) {
19
- throw new Error('Circular reference detected in payload - cannot serialize')
20
- }
21
- seen.add(value)
22
15
 
23
- if (Array.isArray(value)) {
24
- return `[${value.map(item => stableStringify(item, seen)).join(',')}]`
25
- }
26
- const keys = Object.keys(value).sort()
27
- const entries = keys.map(
28
- key => `${JSON.stringify(key)}:${stableStringify(value[key], seen)}`
29
- )
30
- return `{${entries.join(',')}}`
31
- }
16
+ const core = require('@buildproven/license-core')
32
17
 
33
- /**
34
- * Normalize and validate email format
35
- * DR21 fix: Added email format validation before hashing
36
- * @param {string} email - Email address to normalize
37
- * @returns {string|null} - Normalized email or null if invalid
38
- */
39
- function normalizeEmail(email) {
40
- if (!email || typeof email !== 'string') return null
41
- const normalized = email.trim().toLowerCase()
42
-
43
- // Basic email format validation (RFC 5322 simplified)
44
- // Must have: local@domain.tld format
45
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
46
-
47
- if (!emailRegex.test(normalized)) {
48
- return null
49
- }
50
-
51
- return normalized.length > 0 ? normalized : null
52
- }
53
-
54
- function hashEmail(email) {
55
- const normalized = normalizeEmail(email)
56
- if (!normalized) return null
57
- return crypto.createHash('sha256').update(normalized).digest('hex')
58
- }
59
-
60
- /**
61
- * Build a license payload for signing/verification.
62
- * TD14 fix: Added input validation to prevent signature mismatches from invalid data.
63
- */
64
- function buildLicensePayload({
65
- licenseKey,
66
- tier,
67
- isFounder,
68
- emailHash,
69
- issued,
70
- }) {
71
- // TD14 fix: Validate required fields to catch issues early
72
- if (!licenseKey || typeof licenseKey !== 'string') {
73
- throw new Error('licenseKey is required and must be a string')
74
- }
75
- if (!tier || typeof tier !== 'string') {
76
- throw new Error('tier is required and must be a string')
77
- }
78
- if (!issued || typeof issued !== 'string') {
79
- throw new Error('issued is required and must be a string')
80
- }
81
-
82
- const payload = {
83
- licenseKey,
84
- tier,
85
- isFounder: Boolean(isFounder),
86
- issued,
87
- }
88
- if (emailHash) {
89
- payload.emailHash = emailHash
90
- }
91
- return payload
92
- }
93
-
94
- function signPayload(payload, privateKey) {
95
- const data = Buffer.from(stableStringify(payload))
96
- const signature = crypto.sign(null, data, privateKey)
97
- return signature.toString('base64')
98
- }
99
-
100
- function verifyPayload(payload, signature, publicKey) {
101
- const data = Buffer.from(stableStringify(payload))
102
- return crypto.verify(null, data, publicKey, Buffer.from(signature, 'base64'))
103
- }
18
+ // QAA license key format — kept here, not in the shared package, because
19
+ // each product has its own prefix.
20
+ const LICENSE_KEY_PATTERN =
21
+ /^QAA-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/
104
22
 
23
+ // QAA-specific helper: load a PEM key from either an env var (raw value)
24
+ // or a path env var (file contents). Not in the shared package because
25
+ // other consumers (Vercel functions) read keys differently.
105
26
  function loadKeyFromEnv(envValue, envPathValue) {
106
27
  if (envValue) return envValue
107
28
  if (envPathValue) {
@@ -115,11 +36,12 @@ function loadKeyFromEnv(envValue, envPathValue) {
115
36
 
116
37
  module.exports = {
117
38
  LICENSE_KEY_PATTERN,
118
- stableStringify,
119
- normalizeEmail,
120
- hashEmail,
121
- buildLicensePayload,
122
- signPayload,
123
- verifyPayload,
124
39
  loadKeyFromEnv,
40
+ // Re-exports — single source of truth in @buildproven/license-core
41
+ stableStringify: core.stableStringify,
42
+ normalizeEmail: core.normalizeEmail,
43
+ hashEmail: core.hashEmail,
44
+ buildLicensePayload: core.buildLicensePayload,
45
+ signPayload: core.signPayload,
46
+ verifyPayload: core.verifyPayload,
125
47
  }
@@ -15,9 +15,12 @@ const {
15
15
  buildLicensePayload,
16
16
  hashEmail,
17
17
  verifyPayload,
18
- stableStringify,
19
18
  loadKeyFromEnv,
20
19
  } = require('./license-signing')
20
+ const {
21
+ validateRegistryEntry,
22
+ verifyRegistryMetadata,
23
+ } = require('@buildproven/license-core')
21
24
 
22
25
  /**
23
26
  * TD10 fix: Timing-safe string comparison to prevent timing attacks
@@ -85,7 +88,7 @@ class LicenseValidator {
85
88
  // Allow enterprises to host their own registry
86
89
  this.licenseDbUrl =
87
90
  process.env.QAA_LICENSE_DB_URL ||
88
- 'https://buildproven.ai/api/licenses/qa-architect.json'
91
+ 'https://licenses.buildproven.ai/api/licenses/qa-architect.json'
89
92
 
90
93
  this.licensePublicKey = loadKeyFromEnv(
91
94
  process.env.QAA_LICENSE_PUBLIC_KEY,
@@ -351,14 +354,6 @@ class LicenseValidator {
351
354
  }
352
355
  }
353
356
 
354
- const payload = buildLicensePayload({
355
- licenseKey: normalizedKey,
356
- tier: licenseInfo.tier,
357
- isFounder: licenseInfo.isFounder,
358
- emailHash: licenseInfo.emailHash,
359
- issued: licenseInfo.issued,
360
- })
361
-
362
357
  if (!licenseInfo.signature) {
363
358
  return {
364
359
  valid: false,
@@ -366,7 +361,18 @@ class LicenseValidator {
366
361
  }
367
362
  }
368
363
 
369
- if (!this.verifySignature(payload, licenseInfo.signature)) {
364
+ // Delegate signature verification to @buildproven/license-core so
365
+ // every BuildProven product validates against the same code path.
366
+ // Email hash check is duplicated above (with QAA-specific error message);
367
+ // pass userEmailHash here as defense-in-depth.
368
+ const verification = validateRegistryEntry({
369
+ licenseKey: normalizedKey,
370
+ entry: licenseInfo,
371
+ publicKeyPem: this.licensePublicKey,
372
+ userEmailHash: emailHash || undefined,
373
+ })
374
+
375
+ if (!verification.valid) {
370
376
  return {
371
377
  valid: false,
372
378
  error:
@@ -374,6 +380,15 @@ class LicenseValidator {
374
380
  }
375
381
  }
376
382
 
383
+ // saveLicense() reads .payload off the result — rebuild for persistence.
384
+ const payload = buildLicensePayload({
385
+ licenseKey: normalizedKey,
386
+ tier: licenseInfo.tier,
387
+ isFounder: licenseInfo.isFounder,
388
+ emailHash: licenseInfo.emailHash,
389
+ issued: licenseInfo.issued,
390
+ })
391
+
377
392
  // License is valid
378
393
  console.log(
379
394
  `✅ License validated: ${licenseInfo.tier} ${licenseInfo.isFounder ? '(Founder)' : ''}`
@@ -563,12 +578,11 @@ class LicenseValidator {
563
578
  }
564
579
 
565
580
  verifyRegistrySignature(database) {
566
- // DR17 fix: Dev mode should still verify signatures if present, only bypass when missing
581
+ // DR17 fix: Dev mode bypasses ONLY when signature or key is missing.
582
+ // When both are present, always verify (no bypass).
567
583
  const isDevMode = this.isDevBypassAllowed()
568
- const signature = database?._metadata?.registrySignature
569
584
 
570
- // Missing signature handling
571
- if (!signature) {
585
+ if (!database?._metadata?.registrySignature) {
572
586
  if (isDevMode) {
573
587
  console.warn(
574
588
  '⚠️ DEV MODE: License database signature missing (bypassed)'
@@ -578,7 +592,6 @@ class LicenseValidator {
578
592
  throw new Error('license database missing registry signature')
579
593
  }
580
594
 
581
- // Missing public key handling
582
595
  if (!this.licensePublicKey) {
583
596
  if (isDevMode) {
584
597
  console.warn(
@@ -589,22 +602,9 @@ class LicenseValidator {
589
602
  throw new Error('license public key not configured')
590
603
  }
591
604
 
592
- // Always verify signature if both signature and key are present (destructure to exclude metadata)
593
- const { _metadata: _unused3, ...licenses } = database
594
- void _unused3
595
- const isValid = verifyPayload(licenses, signature, this.licensePublicKey)
596
- if (!isValid) {
597
- throw new Error('license database signature verification failed')
598
- }
599
-
600
- // TD10 fix: Use timing-safe comparison for hash verification
601
- const expectedHash = database?._metadata?.hash
602
- if (expectedHash) {
603
- const computed = this.computeSha256(stableStringify(licenses))
604
- if (!timingSafeEqual(computed, expectedHash)) {
605
- throw new Error('license database hash mismatch')
606
- }
607
- }
605
+ // Delegate to @buildproven/license-core. Throws on signature or hash
606
+ // mismatch. Single source of truth shared with fulfillment + claude-kit-pro.
607
+ verifyRegistryMetadata(database, this.licensePublicKey)
608
608
  return true
609
609
  }
610
610
 
package/lib/licensing.js CHANGED
@@ -947,9 +947,9 @@ function saveUsage(usage) {
947
947
 
948
948
  throw error // Don't allow FREE tier to continue without tracking
949
949
  } else {
950
- // Pro/Team/Enterprise - warn but don't fail
950
+ // Pro - warn but don't fail
951
951
  console.warn(`⚠️ Failed to save usage data: ${error.message}`)
952
- console.warn(` This won't affect Pro/Team/Enterprise functionality`)
952
+ console.warn(` This won't affect Pro functionality`)
953
953
  return false
954
954
  }
955
955
  }
@@ -0,0 +1,66 @@
1
+ 'use strict'
2
+
3
+ const fs = require('fs')
4
+ const path = require('path')
5
+
6
+ /**
7
+ * Detect the target project's module system.
8
+ *
9
+ * Returns 'esm' if package.json has `"type": "module"`, otherwise 'cjs'.
10
+ * Missing or unreadable package.json falls back to 'cjs' (Node's default).
11
+ *
12
+ * @param {string} projectPath - Path to project root
13
+ * @returns {'esm'|'cjs'}
14
+ */
15
+ function detectModuleType(projectPath) {
16
+ const packageJsonPath = path.join(projectPath, 'package.json')
17
+ if (!fs.existsSync(packageJsonPath)) {
18
+ return 'cjs'
19
+ }
20
+ try {
21
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
22
+ return pkg.type === 'module' ? 'esm' : 'cjs'
23
+ } catch {
24
+ return 'cjs'
25
+ }
26
+ }
27
+
28
+ /**
29
+ * Convenience: true when the target project is ESM.
30
+ * @param {string} projectPath
31
+ * @returns {boolean}
32
+ */
33
+ function isESMProject(projectPath) {
34
+ return detectModuleType(projectPath) === 'esm'
35
+ }
36
+
37
+ /**
38
+ * Detect the major version of an installed dep in the target project's
39
+ * package.json (checks dependencies + devDependencies). Returns null if
40
+ * not present or unparseable.
41
+ *
42
+ * @param {string} projectPath
43
+ * @param {string} depName
44
+ * @returns {number|null}
45
+ */
46
+ function detectDepMajor(projectPath, depName) {
47
+ const packageJsonPath = path.join(projectPath, 'package.json')
48
+ if (!fs.existsSync(packageJsonPath)) return null
49
+ try {
50
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
51
+ const range =
52
+ (pkg.dependencies && pkg.dependencies[depName]) ||
53
+ (pkg.devDependencies && pkg.devDependencies[depName])
54
+ if (!range) return null
55
+ const match = String(range).match(/(\d+)\./)
56
+ return match ? parseInt(match[1], 10) : null
57
+ } catch {
58
+ return null
59
+ }
60
+ }
61
+
62
+ module.exports = {
63
+ detectModuleType,
64
+ isESMProject,
65
+ detectDepMajor,
66
+ }
@@ -10,6 +10,7 @@
10
10
 
11
11
  const fs = require('fs')
12
12
  const path = require('path')
13
+ const { isESMProject } = require('./project-module-type')
13
14
 
14
15
  /**
15
16
  * Generate Lighthouse CI configuration
@@ -435,11 +436,17 @@ function writeSizeLimitConfig(projectPath, options = {}) {
435
436
  }
436
437
 
437
438
  /**
438
- * Write commitlint config to project
439
+ * Write commitlint config to project.
440
+ * ESM projects ("type": "module" in package.json) need `.cjs` so Node
441
+ * loads our CommonJS `module.exports` template without throwing
442
+ * "module is not defined in ES module scope".
439
443
  * @param {string} projectPath - Path to project
440
444
  */
441
445
  function writeCommitlintConfig(projectPath) {
442
- const configPath = path.join(projectPath, 'commitlint.config.js')
446
+ const filename = isESMProject(projectPath)
447
+ ? 'commitlint.config.cjs'
448
+ : 'commitlint.config.js'
449
+ const configPath = path.join(projectPath, filename)
443
450
  const config = generateCommitlintConfig()
444
451
 
445
452
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-qa-architect",
3
- "version": "5.13.3",
3
+ "version": "5.13.5",
4
4
  "description": "QA Architect - Bootstrap quality automation for JavaScript/TypeScript and Python projects with GitHub Actions, pre-commit hooks, linting, formatting, and smart test strategy",
5
5
  "main": "setup.js",
6
6
  "bin": {
@@ -20,8 +20,8 @@
20
20
  "validate:comprehensive": "node setup.js --comprehensive --no-markdownlint",
21
21
  "validate:all": "npm run validate:comprehensive && npm run security:audit",
22
22
  "validate:pre-push": "npm run test:patterns --if-present && npm run lint && npm run format:check && npm run test:commands --if-present && npm test --if-present",
23
- "test": "export QAA_DEVELOPER=true && node tests/result-types.test.js && node tests/setup.test.js && node tests/integration.test.js && node tests/error-paths.test.js && node tests/error-messages.test.js && node tests/cache-manager.test.js && node tests/parallel-validation.test.js && node tests/python-integration.test.js && node tests/interactive.test.js && node tests/monorepo.test.js && node tests/template-loader.test.js && node tests/critical-fixes.test.js && node tests/interactive-routing-fix.test.js && node tests/telemetry.test.js && node tests/error-reporter.test.js && node tests/premium-dependency-monitoring.test.js && node tests/multi-language-dependency-monitoring.test.js && node tests/cli-deps-integration.test.js && node tests/deps-edge-cases.test.js && node tests/real-world-packages.test.js && node tests/validation-factory.test.js && node tests/setup-error-coverage.test.js && node tests/python-detection-sensitivity.test.js && node tests/python-parser-fixes.test.js && node tests/licensing.test.js && node tests/security-licensing.test.js && node tests/real-purchase-flow.test.js && node tests/base-validator.test.js && node tests/dependency-monitoring-basic.test.js && node tests/workflow-validation.test.js && node tests/workflow-tiers.test.js && node tests/analyze-ci.test.js && node tests/analyze-ci-integration.test.js && node tests/setup-critical-paths.test.js && node tests/project-maturity.test.js && node tests/project-maturity-cli.test.js && node tests/package-manager-detection.test.js && node tests/check-docs.test.js && node tests/validate-command-patterns.test.js && node tests/gitleaks-binary-resolution.test.js && node tests/gitleaks-production-checksums.test.js && node tests/gitleaks-checksum-verification.test.js && node tests/gitleaks-real-binary-test.js && node tests/tier-enforcement.test.js && node tests/lazy-loader.test.js && node tests/template-content-validation.test.js && node tests/ci-environment.test.js && node tests/turborepo-detection.test.js && node tests/consumer-workflow-integration.test.js",
24
- "test:unit": "export QAA_DEVELOPER=true && node tests/result-types.test.js && node tests/setup.test.js && node tests/error-paths.test.js && node tests/error-messages.test.js && node tests/cache-manager.test.js && node tests/template-loader.test.js && node tests/telemetry.test.js && node tests/error-reporter.test.js && node tests/validation-factory.test.js && node tests/setup-error-coverage.test.js && node tests/licensing.test.js && node tests/security-licensing.test.js && node tests/base-validator.test.js && node tests/dependency-monitoring-basic.test.js && node tests/workflow-validation.test.js && node tests/workflow-tiers.test.js && node tests/analyze-ci.test.js && node tests/setup-critical-paths.test.js && node tests/project-maturity.test.js && node tests/package-manager-detection.test.js && node tests/check-docs.test.js && node tests/validate-command-patterns.test.js && node tests/gitleaks-binary-resolution.test.js && node tests/gitleaks-production-checksums.test.js && node tests/gitleaks-checksum-verification.test.js && node tests/lazy-loader.test.js && node tests/template-content-validation.test.js && node tests/ci-environment.test.js && node tests/turborepo-detection.test.js",
23
+ "test": "export QAA_DEVELOPER=true && node tests/result-types.test.js && node tests/setup.test.js && node tests/integration.test.js && node tests/error-paths.test.js && node tests/error-messages.test.js && node tests/cache-manager.test.js && node tests/parallel-validation.test.js && node tests/python-integration.test.js && node tests/interactive.test.js && node tests/monorepo.test.js && node tests/template-loader.test.js && node tests/critical-fixes.test.js && node tests/interactive-routing-fix.test.js && node tests/telemetry.test.js && node tests/error-reporter.test.js && node tests/premium-dependency-monitoring.test.js && node tests/multi-language-dependency-monitoring.test.js && node tests/cli-deps-integration.test.js && node tests/deps-edge-cases.test.js && node tests/real-world-packages.test.js && node tests/validation-factory.test.js && node tests/setup-error-coverage.test.js && node tests/python-detection-sensitivity.test.js && node tests/python-parser-fixes.test.js && node tests/licensing.test.js && node tests/security-licensing.test.js && node tests/real-purchase-flow.test.js && node tests/base-validator.test.js && node tests/dependency-monitoring-basic.test.js && node tests/workflow-validation.test.js && node tests/workflow-tiers.test.js && node tests/analyze-ci.test.js && node tests/analyze-ci-integration.test.js && node tests/setup-critical-paths.test.js && node tests/project-maturity.test.js && node tests/project-maturity-cli.test.js && node tests/package-manager-detection.test.js && node tests/check-docs.test.js && node tests/validate-command-patterns.test.js && node tests/gitleaks-binary-resolution.test.js && node tests/gitleaks-production-checksums.test.js && node tests/gitleaks-checksum-verification.test.js && node tests/gitleaks-real-binary-test.js && node tests/tier-enforcement.test.js && node tests/lazy-loader.test.js && node tests/template-content-validation.test.js && node tests/ci-environment.test.js && node tests/turborepo-detection.test.js && node tests/consumer-workflow-integration.test.js && node tests/esm-project-support.test.js",
24
+ "test:unit": "export QAA_DEVELOPER=true && node tests/result-types.test.js && node tests/setup.test.js && node tests/error-paths.test.js && node tests/error-messages.test.js && node tests/cache-manager.test.js && node tests/template-loader.test.js && node tests/telemetry.test.js && node tests/error-reporter.test.js && node tests/validation-factory.test.js && node tests/setup-error-coverage.test.js && node tests/licensing.test.js && node tests/security-licensing.test.js && node tests/base-validator.test.js && node tests/dependency-monitoring-basic.test.js && node tests/workflow-validation.test.js && node tests/workflow-tiers.test.js && node tests/analyze-ci.test.js && node tests/setup-critical-paths.test.js && node tests/project-maturity.test.js && node tests/package-manager-detection.test.js && node tests/check-docs.test.js && node tests/validate-command-patterns.test.js && node tests/gitleaks-binary-resolution.test.js && node tests/gitleaks-production-checksums.test.js && node tests/gitleaks-checksum-verification.test.js && node tests/lazy-loader.test.js && node tests/template-content-validation.test.js && node tests/ci-environment.test.js && node tests/turborepo-detection.test.js && node tests/esm-project-support.test.js",
25
25
  "test:fast": "npm run test:unit",
26
26
  "test:medium": "npm run test:fast && npm run test:patterns && npm run test:commands",
27
27
  "test:slow": "export QAA_DEVELOPER=true && node tests/python-integration.test.js && node tests/interactive.test.js && node tests/monorepo.test.js && node tests/critical-fixes.test.js && node tests/interactive-routing-fix.test.js && node tests/premium-dependency-monitoring.test.js && node tests/multi-language-dependency-monitoring.test.js && node tests/cli-deps-integration.test.js && node tests/real-world-packages.test.js && node tests/python-detection-sensitivity.test.js && node tests/python-parser-fixes.test.js && node tests/real-purchase-flow.test.js && node tests/project-maturity-cli.test.js && node tests/gitleaks-real-binary-test.js && npm run test:e2e",
@@ -121,7 +121,13 @@
121
121
  "table": {
122
122
  "ajv": "$ajv"
123
123
  }
124
- }
124
+ },
125
+ "picomatch": "^2.3.2",
126
+ "basic-ftp": "^5.3.0",
127
+ "tmp": "^0.2.5",
128
+ "external-editor": "^3.1.0",
129
+ "inquirer": "^13.4.1",
130
+ "esbuild": "^0.25.0"
125
131
  },
126
132
  "devDependencies": {
127
133
  "@commitlint/cli": "^19.0.0",
@@ -213,6 +219,7 @@
213
219
  ]
214
220
  },
215
221
  "dependencies": {
222
+ "@buildproven/license-core": "^1.0.2",
216
223
  "@npmcli/package-json": "^7.0.4",
217
224
  "ajv": "^8.17.1",
218
225
  "ajv-formats": "^3.0.1",
package/setup.js CHANGED
@@ -723,7 +723,7 @@ VALIDATION OPTIONS:
723
723
 
724
724
  LICENSE, TELEMETRY & ERROR REPORTING:
725
725
  --license-status Show current license tier and available features
726
- --activate-license Activate Pro/Team/Enterprise license key from Stripe purchase
726
+ --activate-license Activate Pro license key from Stripe purchase
727
727
  --telemetry-status Show telemetry status and opt-in instructions
728
728
  --error-reporting-status Show error reporting status and privacy information
729
729
 
@@ -750,7 +750,7 @@ EXAMPLES:
750
750
  → Show current license tier and upgrade options
751
751
 
752
752
  npx create-qa-architect@latest --activate-license
753
- → Activate Pro/Team/Enterprise license after Stripe purchase
753
+ → Activate Pro license after Stripe purchase
754
754
 
755
755
  npx create-qa-architect@latest --telemetry-status
756
756
  → Show telemetry status and privacy information
@@ -1398,6 +1398,7 @@ HELP:
1398
1398
  console.log('📦 Adding devDependencies...')
1399
1399
  const defaultDevDependencies = getDefaultDevDependencies({
1400
1400
  typescript: usesTypeScript,
1401
+ projectPath: process.cwd(),
1401
1402
  })
1402
1403
  packageJson.devDependencies = mergeDevDependencies(
1403
1404
  packageJson.devDependencies || {},
@@ -1974,7 +1975,7 @@ try {
1974
1975
  const CAP = 50
1975
1976
  if (usage.prePushRuns >= CAP) {
1976
1977
  console.error('❌ Free tier limit reached: ' + usage.prePushRuns + '/' + CAP + ' pre-push runs this month')
1977
- console.error(' Upgrade to Pro, Team, or Enterprise: https://buildproven.ai/qa-architect')
1978
+ console.error(' Upgrade to Pro: https://buildproven.ai/qa-architect')
1978
1979
  process.exit(1)
1979
1980
  }
1980
1981
 
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
  # Smart Test Strategy - {{PROJECT_NAME}}
3
- # Generated by create-qa-architect (Pro/Team/Enterprise feature)
3
+ # Generated by create-qa-architect (Pro feature)
4
4
  # https://buildproven.ai/qa-architect
5
5
  set -e
6
6