@donotdev/cli 0.1.45 → 0.2.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 (47) hide show
  1. package/dependencies-matrix.json +191 -150
  2. package/dist/bin/commands/agent-setup.js +632 -524
  3. package/dist/bin/commands/build.js +1239 -935
  4. package/dist/bin/commands/bump.js +1285 -946
  5. package/dist/bin/commands/cacheout.js +543 -405
  6. package/dist/bin/commands/coach.js +546 -408
  7. package/dist/bin/commands/create-app.js +1198 -862
  8. package/dist/bin/commands/create-project.js +1238 -902
  9. package/dist/bin/commands/db.js +139128 -93775
  10. package/dist/bin/commands/deploy.js +2308 -1936
  11. package/dist/bin/commands/dev.js +912 -662
  12. package/dist/bin/commands/doctor.js +634 -526
  13. package/dist/bin/commands/emu.js +1093 -785
  14. package/dist/bin/commands/format.js +588 -450
  15. package/dist/bin/commands/get-demo.js +1043 -756
  16. package/dist/bin/commands/make-admin.js +20974 -38424
  17. package/dist/bin/commands/preview.js +913 -663
  18. package/dist/bin/commands/seed.js +139129 -93776
  19. package/dist/bin/commands/setup-cicd.js +1130 -817
  20. package/dist/bin/commands/setup.js +1299 -960
  21. package/dist/bin/commands/staging.js +2308 -1936
  22. package/dist/bin/commands/sync-secrets.js +996 -733
  23. package/dist/bin/commands/type-check.js +733 -598
  24. package/dist/bin/commands/wai.js +533 -395
  25. package/dist/bin/dndev.js +9 -8
  26. package/dist/index.js +2720 -2290
  27. package/package.json +3 -3
  28. package/templates/app-next/src/app/ClientLayout.tsx.example +11 -1
  29. package/templates/app-next/src/app/layout.tsx.example +19 -1
  30. package/templates/functions-firebase/src/billing/handleStripeWebhook.ts.example +8 -18
  31. package/templates/functions-firebase/src/billing/index.ts.example +0 -1
  32. package/templates/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +4 -8
  33. package/templates/functions-firebase/src/index.ts.example +0 -1
  34. package/templates/functions-supabase/supabase/config.toml.example +4 -0
  35. package/templates/functions-supabase/supabase/functions/stripe-webhook/index.ts.example +12 -0
  36. package/templates/functions-supabase/supabase/migrations/20250101000005_webhook_events.sql +133 -0
  37. package/templates/functions-vercel/.env.example +9 -0
  38. package/templates/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +12 -14
  39. package/templates/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +4 -14
  40. package/templates/overlay-supabase/src/config/providers.ts.example +2 -2
  41. package/templates/root-consumer/.claude/hooks/guard-write.sh.example +32 -0
  42. package/templates/root-consumer/.claude/hooks/record-lookup.sh.example +22 -0
  43. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +7 -0
  44. package/templates/root-consumer/.claude/rules/framework.md.example +6 -0
  45. package/templates/root-consumer/.claude/settings.json.example +11 -1
  46. package/templates/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
  47. package/templates/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@donotdev/cli",
3
- "version": "0.1.45",
3
+ "version": "0.2.0",
4
4
  "description": "Command-line interface for DoNotDev Framework",
5
5
  "type": "module",
6
6
  "private": false,
@@ -32,7 +32,7 @@
32
32
  "type-check": "bunx tsc --noEmit"
33
33
  },
34
34
  "dependencies": {
35
- "@clack/prompts": "^1.0.1",
35
+ "@clack/prompts": "^1.8.1",
36
36
  "commander": "^14.0.3",
37
37
  "fast-glob": "^3.3.3"
38
38
  },
@@ -60,4 +60,4 @@
60
60
  "access": "public"
61
61
  },
62
62
  "peerDependencies": {}
63
- }
63
+ }
@@ -18,6 +18,10 @@ import { appConfig } from '../config/app';
18
18
 
19
19
  interface ClientLayoutProps {
20
20
  children: React.ReactNode;
21
+ /** Request Cookie header (language cookie, auth session), from the root layout */
22
+ serverCookies: string;
23
+ /** Request Accept-Language header, from the root layout */
24
+ acceptLanguage: string | null;
21
25
  }
22
26
 
23
27
  /**
@@ -31,11 +35,17 @@ interface ClientLayoutProps {
31
35
  *
32
36
  * Theme detection happens client-side to avoid Next.js 16 race condition.
33
37
  */
34
- export function ClientLayout({ children }: ClientLayoutProps) {
38
+ export function ClientLayout({
39
+ children,
40
+ serverCookies,
41
+ acceptLanguage,
42
+ }: ClientLayoutProps) {
35
43
  return (
36
44
  <div id="root">
37
45
  <NextJsAppProviders
38
46
  config={appConfig}
47
+ serverCookies={serverCookies}
48
+ acceptLanguage={acceptLanguage}
39
49
  layout={{
40
50
  breadcrumbs: 'smart', // 'smart' | 'always' | 'never'
41
51
  header: {
@@ -1,4 +1,5 @@
1
1
  import type { Metadata } from 'next';
2
+ import { headers } from 'next/headers';
2
3
 
3
4
  import { getMetadataForPath } from '@donotdev/core/next';
4
5
  import { FontPreloadLinks } from '@donotdev/ui/next';
@@ -39,6 +40,23 @@ export const dynamic = 'force-dynamic';
39
40
  * Next.js 16 + Turbopack race condition with async layouts.
40
41
  * Brief FOUC possible on first load, but prevents build-manifest.json errors.
41
42
  */
43
+ /**
44
+ * Passes the request's Cookie and Accept-Language headers to the providers: the server
45
+ * render and the hydration pass then show the visitor's language and signed-in state
46
+ * on the first paint. Async child, so the root layout itself stays synchronous.
47
+ */
48
+ async function RequestLayout({ children }: { children: React.ReactNode }) {
49
+ const requestHeaders = await headers();
50
+ return (
51
+ <ClientLayout
52
+ serverCookies={requestHeaders.get('cookie') ?? ''}
53
+ acceptLanguage={requestHeaders.get('accept-language')}
54
+ >
55
+ {children}
56
+ </ClientLayout>
57
+ );
58
+ }
59
+
42
60
  export default function RootLayout({
43
61
  children,
44
62
  }: {
@@ -55,7 +73,7 @@ export default function RootLayout({
55
73
  <FontPreloadLinks />
56
74
  </head>
57
75
  <body className="light">
58
- <ClientLayout>{children}</ClientLayout>
76
+ <RequestLayout>{children}</RequestLayout>
59
77
  </body>
60
78
  </html>
61
79
  );
@@ -1,24 +1,14 @@
1
1
  // functions/src/billing/handleStripeWebhook.ts
2
2
 
3
3
  /**
4
- * @fileoverview {{APP_NAME}} Stripe Webhook Wrapper
5
- * @description Wrapper for framework's createStripeWebhookHandler with {{APP_NAME}}-specific configuration
4
+ * @fileoverview {{APP_NAME}} Stripe Webhook
5
+ * @description Framework Stripe webhook (subscriptions, payments, orders) for {{APP_NAME}}
6
6
  */
7
7
 
8
- import { createStripeWebhookHandler } from '@donotdev/functions/firebase';
8
+ import { createStripeWebhook } from '@donotdev/functions/firebase';
9
9
 
10
- /**
11
- * {{APP_NAME}} Stripe webhook handler
12
- * Configured with {{APP_NAME}}-specific product types and settings
13
- */
14
- export const stripeWebhook = createStripeWebhookHandler({
15
- productTypes: {
16
- // Add your product types here
17
- // Example:
18
- // premium_plan: {
19
- // tier: 'premium',
20
- // subscriptionEnd: '2099-12-31T23:59:59.000Z',
21
- // githubRepo: { owner: 'your-org', repo: 'your-repo' },
22
- // },
23
- },
24
- });
10
+ // Import your billing config
11
+ // import { billingConfig } from '../config/billingConfig';
12
+ const billingConfig = {}; // TODO: Replace with your StripeBackConfig
13
+
14
+ export const stripeWebhook = createStripeWebhook(billingConfig);
@@ -5,6 +5,5 @@
5
5
  * @description Exports all billing-related functions for the {{APP_NAME}} app
6
6
  */
7
7
 
8
- export { processPaymentSuccess } from './processPaymentSuccess';
9
8
  export { refreshSubscriptionStatus } from './refreshSubscriptionStatus';
10
9
  export { stripeWebhook } from './handleStripeWebhook';
@@ -1,14 +1,10 @@
1
1
  // functions/src/billing/refreshSubscriptionStatus.ts
2
2
 
3
3
  /**
4
- * @fileoverview {{APP_NAME}} Subscription Status Wrapper
5
- * @description Wrapper for framework's refreshSubscriptionStatus with {{APP_NAME}}-specific configuration
4
+ * @fileoverview {{APP_NAME}} Subscription Status Refresh
5
+ * @description Framework callable that re-syncs the user's subscription from Stripe
6
6
  */
7
7
 
8
- import { refreshSubscriptionStatus as frameworkRefreshSubscriptionStatus } from '@donotdev/functions/firebase';
8
+ import { refreshSubscriptionStatus as createRefreshSubscriptionStatus } from '@donotdev/functions/firebase';
9
9
 
10
- /**
11
- * {{APP_NAME}} subscription status refresh
12
- * Wraps the framework function with {{APP_NAME}}-specific configuration
13
- */
14
- export const refreshSubscriptionStatus = frameworkRefreshSubscriptionStatus;
10
+ export const refreshSubscriptionStatus = createRefreshSubscriptionStatus();
@@ -39,7 +39,6 @@ export {
39
39
 
40
40
  // Export billing functions
41
41
  export {
42
- processPaymentSuccess,
43
42
  refreshSubscriptionStatus,
44
43
  stripeWebhook,
45
44
  } from './billing';
@@ -57,3 +57,7 @@ inspector_port = 8083
57
57
  enabled = true
58
58
  port = 54327
59
59
  backend = "postgres"
60
+
61
+ # Stripe authenticates webhook calls with its signature, not a Supabase JWT
62
+ [functions.stripe-webhook]
63
+ verify_jwt = false
@@ -0,0 +1,12 @@
1
+ // supabase/functions/stripe-webhook/index.ts
2
+ // Supabase Edge Function — Stripe webhook (subscriptions, payments, orders)
3
+ // Deploy with JWT verification off: Stripe authenticates with its signature.
4
+ // Requires migration 20250101000005_webhook_events.sql
5
+
6
+ import { createStripeWebhook } from '@donotdev/functions/supabase';
7
+
8
+ // Import your billing config
9
+ // import { billingConfig } from '../_shared/billingConfig.ts';
10
+ const billingConfig = {}; // TODO: Replace with your StripeBackConfig
11
+
12
+ Deno.serve(createStripeWebhook(billingConfig));
@@ -0,0 +1,133 @@
1
+ -- Migration: Create webhook_events table for Stripe webhook idempotency
2
+ -- Generated: 2026-11-04
3
+ -- Purpose: Atomic per-event reservation with an owner token, so each Stripe event is processed once
4
+ -- Schedule: Daily at 5 AM UTC (cleanup of rows older than 30 days)
5
+ -- Source of truth: WEBHOOK_EVENTS_SQL in @donotdev/functions (shared/billing/idempotency.ts)
6
+
7
+ CREATE TABLE IF NOT EXISTS public.webhook_events (
8
+ event_id TEXT PRIMARY KEY,
9
+ status TEXT NOT NULL CHECK (status IN ('processing', 'processed')),
10
+ owner_token UUID NOT NULL,
11
+ reserved_at TIMESTAMPTZ NOT NULL DEFAULT now(),
12
+ processed_at TIMESTAMPTZ
13
+ );
14
+
15
+ -- Only service_role accesses this table
16
+ ALTER TABLE public.webhook_events ENABLE ROW LEVEL SECURITY;
17
+
18
+ CREATE INDEX IF NOT EXISTS idx_webhook_events_processed_at
19
+ ON public.webhook_events (processed_at);
20
+
21
+ -- The functions below run as the caller (SECURITY INVOKER) and refuse every
22
+ -- role but service_role. EXECUTE is deliberately not revoked: on Supabase
23
+ -- Postgres 17.6.1.x a permission-denied function call by anon/authenticated
24
+ -- crashes the backend (signal 11), which restarts every connection.
25
+ CREATE OR REPLACE FUNCTION public.webhook_events_assert_service_role()
26
+ RETURNS VOID
27
+ LANGUAGE plpgsql
28
+ SET search_path = public
29
+ AS $$
30
+ BEGIN
31
+ IF current_user IS DISTINCT FROM 'service_role' THEN
32
+ RAISE EXCEPTION 'webhook_events is reserved to service_role (current role: %)', current_user
33
+ USING ERRCODE = 'insufficient_privilege';
34
+ END IF;
35
+ END;
36
+ $$;
37
+
38
+ -- Atomic reservation. Returns:
39
+ -- 'reserved' the caller now owns the event under p_owner_token
40
+ -- 'processed' the event was already processed (skip, answer 2xx)
41
+ -- 'in_progress' another worker holds a live lease (answer non-2xx, Stripe retries)
42
+ -- A 'processing' row older than the lease is retaken (abandoned worker).
43
+ CREATE OR REPLACE FUNCTION public.webhook_event_reserve(
44
+ p_event_id TEXT,
45
+ p_owner_token UUID,
46
+ p_lease_seconds INT
47
+ )
48
+ RETURNS TEXT
49
+ LANGUAGE plpgsql
50
+ SET search_path = public
51
+ AS $$
52
+ DECLARE
53
+ v_status TEXT;
54
+ BEGIN
55
+ PERFORM public.webhook_events_assert_service_role();
56
+
57
+ INSERT INTO public.webhook_events (event_id, status, owner_token, reserved_at)
58
+ VALUES (p_event_id, 'processing', p_owner_token, clock_timestamp())
59
+ ON CONFLICT (event_id) DO UPDATE
60
+ SET owner_token = EXCLUDED.owner_token,
61
+ reserved_at = clock_timestamp()
62
+ WHERE webhook_events.status = 'processing'
63
+ AND webhook_events.reserved_at
64
+ < clock_timestamp() - make_interval(secs => p_lease_seconds);
65
+ IF FOUND THEN
66
+ RETURN 'reserved';
67
+ END IF;
68
+
69
+ SELECT status INTO v_status
70
+ FROM public.webhook_events
71
+ WHERE event_id = p_event_id;
72
+ IF v_status = 'processed' THEN
73
+ RETURN 'processed';
74
+ END IF;
75
+ -- Live lease, or the row was released in between: Stripe retries either way
76
+ RETURN 'in_progress';
77
+ END;
78
+ $$;
79
+
80
+ -- Mark a reservation processed. Returns false when p_owner_token no longer owns
81
+ -- the row (lease retaken, released, or deleted). Repeating it for the same
82
+ -- owner is a no-op that returns true.
83
+ CREATE OR REPLACE FUNCTION public.webhook_event_mark_processed(
84
+ p_event_id TEXT,
85
+ p_owner_token UUID
86
+ )
87
+ RETURNS BOOLEAN
88
+ LANGUAGE plpgsql
89
+ SET search_path = public
90
+ AS $$
91
+ BEGIN
92
+ PERFORM public.webhook_events_assert_service_role();
93
+
94
+ UPDATE public.webhook_events
95
+ SET status = 'processed',
96
+ processed_at = COALESCE(processed_at, clock_timestamp())
97
+ WHERE event_id = p_event_id
98
+ AND owner_token = p_owner_token;
99
+ RETURN FOUND;
100
+ END;
101
+ $$;
102
+
103
+ -- Drop a reservation after a processing failure. Returns false when
104
+ -- p_owner_token does not own a 'processing' row (nothing is deleted).
105
+ CREATE OR REPLACE FUNCTION public.webhook_event_release(
106
+ p_event_id TEXT,
107
+ p_owner_token UUID
108
+ )
109
+ RETURNS BOOLEAN
110
+ LANGUAGE plpgsql
111
+ SET search_path = public
112
+ AS $$
113
+ BEGIN
114
+ PERFORM public.webhook_events_assert_service_role();
115
+
116
+ DELETE FROM public.webhook_events
117
+ WHERE event_id = p_event_id
118
+ AND owner_token = p_owner_token
119
+ AND status = 'processing';
120
+ RETURN FOUND;
121
+ END;
122
+ $$;
123
+
124
+ -- Enable pg_cron extension (if not already enabled)
125
+ CREATE EXTENSION IF NOT EXISTS pg_cron;
126
+
127
+ -- Cleanup webhook events older than 30 days (daily at 5 AM UTC).
128
+ -- Stripe retries an event for up to 3 days, so older rows are never read again.
129
+ SELECT cron.schedule(
130
+ 'cleanup-webhook-events',
131
+ '0 5 * * *',
132
+ $$DELETE FROM public.webhook_events WHERE COALESCE(processed_at, reserved_at) < now() - interval '30 days'$$
133
+ );
@@ -12,6 +12,15 @@ STRIPE_SECRET_KEY=<stripe_secret_key>
12
12
  # Stripe Webhook Secret (for webhook signature verification)
13
13
  STRIPE_WEBHOOK_SECRET=<stripe_webhook_secret>
14
14
 
15
+ # =============================================================================
16
+ # Supabase Backend (only for handlers created with { backend: 'supabase' })
17
+ # =============================================================================
18
+ # Server-side only. Never expose the secret key to the browser.
19
+ # Get both from: Supabase Dashboard > Project Settings > API Keys
20
+ # SUPABASE_URL=https://<project-ref>.supabase.co
21
+ # Secret key (sb_secret_...). Legacy projects: SUPABASE_SERVICE_ROLE_KEY instead.
22
+ # SUPABASE_SECRET_KEY=<supabase_secret_key>
23
+
15
24
  # =============================================================================
16
25
  # GitHub Configuration
17
26
  # =============================================================================
@@ -1,20 +1,18 @@
1
1
  // functions/src/api/billing/handleStripeWebhook.ts
2
2
 
3
3
  /**
4
- * @fileoverview {{APP_NAME}} Stripe Webhook Wrapper
5
- * @description Wrapper for framework's handleStripeWebhook with {{APP_NAME}}-specific configuration
4
+ * @fileoverview {{APP_NAME}} Stripe Webhook
5
+ * @description Framework Stripe webhook (subscriptions, payments, orders) for {{APP_NAME}}
6
6
  */
7
7
 
8
- import type { NextApiRequest, NextApiResponse } from 'next';
9
- import { handleStripeWebhook as frameworkHandleStripeWebhook } from '@donotdev/functions/vercel';
8
+ import { createStripeWebhook } from '@donotdev/functions/vercel';
10
9
 
11
- /**
12
- * {{APP_NAME}} Stripe webhook handler
13
- * Configured with {{APP_NAME}}-specific product types and settings
14
- */
15
- export default async function handler(
16
- req: NextApiRequest,
17
- res: NextApiResponse
18
- ) {
19
- return frameworkHandleStripeWebhook(req, res);
20
- }
10
+ // Import your billing config
11
+ // import { billingConfig } from '../../config/billingConfig';
12
+ const billingConfig = {}; // TODO: Replace with your StripeBackConfig
13
+
14
+ // Stripe signs the raw body: disable Next.js body parsing
15
+ export const config = { api: { bodyParser: false } };
16
+
17
+ // backend: 'firebase' | 'supabase' (token verification, claims, idempotency storage)
18
+ export default createStripeWebhook(billingConfig, { backend: 'firebase' });
@@ -1,20 +1,10 @@
1
1
  // functions/src/api/billing/refreshSubscriptionStatus.ts
2
2
 
3
3
  /**
4
- * @fileoverview {{APP_NAME}} Subscription Status Wrapper
5
- * @description Wrapper for framework's refreshSubscriptionStatus with {{APP_NAME}}-specific configuration
4
+ * @fileoverview {{APP_NAME}} Subscription Status Refresh
5
+ * @description Framework route that re-syncs the user's subscription from Stripe (Firebase auth)
6
6
  */
7
7
 
8
- import type { NextApiRequest, NextApiResponse } from 'next';
9
- import { refreshSubscriptionStatus as frameworkRefreshSubscriptionStatus } from '@donotdev/functions/vercel';
8
+ import { refreshSubscriptionStatus } from '@donotdev/functions/vercel';
10
9
 
11
- /**
12
- * {{APP_NAME}} subscription status refresh
13
- * Wraps the framework function with {{APP_NAME}}-specific configuration
14
- */
15
- export default async function handler(
16
- req: NextApiRequest,
17
- res: NextApiResponse
18
- ) {
19
- return frameworkRefreshSubscriptionStatus(req, res);
20
- }
10
+ export default refreshSubscriptionStatus();
@@ -4,7 +4,7 @@
4
4
 
5
5
  import { configureProviders } from '@donotdev/core';
6
6
  import {
7
- createClient,
7
+ createBrowserClient,
8
8
  SupabaseAuth,
9
9
  SupabaseCallableProvider,
10
10
  SupabaseCrudAdapter,
@@ -19,7 +19,7 @@ if (!url || !publicKey) {
19
19
  '[dndev] Supabase not configured. Set VITE_SUPABASE_URL and VITE_SUPABASE_PUBLIC_KEY (or VITE_SUPABASE_ANON_KEY) in .env'
20
20
  );
21
21
  } else {
22
- const supabase = createClient(url, publicKey);
22
+ const supabase = createBrowserClient(url, publicKey);
23
23
 
24
24
  /**
25
25
  * Register Supabase as the backend provider.
@@ -43,6 +43,38 @@ RESULT=$(echo "$INPUT" | bun -e "
43
43
  checks.push('BLOCK:Secret scan error: ' + e.message);
44
44
  }
45
45
 
46
+ // --- LOOKUP GATE (fail closed) ---
47
+ // Every symbol imported from @donotdev/* must have been passed to
48
+ // lookup_symbol first (ledger written by record-lookup.sh).
49
+ try {
50
+ if (/\.(ts|tsx)$/.test(fp) && !/\.d\.ts$/.test(fp) && !/\/node_modules\//.test(fp)) {
51
+ let result = content;
52
+ if (tn === 'Edit') {
53
+ const f = Bun.file(fp);
54
+ const before = (await f.exists()) ? await f.text() : '';
55
+ const oldS = input.tool_input?.old_string ?? '';
56
+ const newS = input.tool_input?.new_string ?? '';
57
+ result = input.tool_input?.replace_all ? before.split(oldS).join(newS) : before.replace(oldS, () => newS);
58
+ }
59
+ const imported = new Set();
60
+ for (const m of result.matchAll(/import\s+(?:type\s+)?\{([^}]+)\}\s+from\s+['\"]@donotdev\/[^'\"]+['\"]/g)) {
61
+ for (const raw of m[1].split(',')) {
62
+ const name = raw.trim().replace(/^type\s+/, '').split(/\s+as\s+/)[0].trim();
63
+ if (name) imported.add(name);
64
+ }
65
+ }
66
+ if (imported.size) {
67
+ const ledger = Bun.file(process.env.CLAUDE_PROJECT_DIR + '/.dndev/lookups.json');
68
+ const known = (await ledger.exists()) ? await ledger.json() : [];
69
+ const missing = [...imported].filter(n => !known.includes(n) && !known.includes(n + 'Props'));
70
+ if (missing.length)
71
+ checks.push('BLOCK:lookup_symbol was never called for: ' + missing.join(', ') + '. Call mcp__donotdev__lookup_symbol for each, use only the props it returns, then retry.');
72
+ }
73
+ }
74
+ } catch (e) {
75
+ checks.push('BLOCK:Lookup gate error: ' + e.message);
76
+ }
77
+
46
78
  const block = checks.find(c => c.startsWith('BLOCK:'));
47
79
  process.stdout.write(block ?? 'OK');
48
80
  " 2>/dev/null || echo "OK")
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+ # .claude/hooks/record-lookup.sh
3
+ # PostToolUse:mcp__donotdev__lookup_symbol — append the looked-up symbol to
4
+ # .dndev/lookups.json, the ledger guard-write.sh checks @donotdev imports against.
5
+ # Kept outside the MCP server: its protocol state is cached in memory and is
6
+ # not on disk while a session runs.
7
+
8
+ set -eo pipefail
9
+
10
+ bun -e "
11
+ const input = JSON.parse(await Bun.stdin.text());
12
+ const symbol = input.tool_input?.symbol;
13
+ if (typeof symbol !== 'string' || symbol === '') process.exit(0);
14
+ const path = process.env.CLAUDE_PROJECT_DIR + '/.dndev/lookups.json';
15
+ const file = Bun.file(path);
16
+ const list = (await file.exists()) ? await file.json() : [];
17
+ if (!list.includes(symbol)) {
18
+ list.push(symbol);
19
+ list.sort();
20
+ await Bun.write(path, JSON.stringify(list, null, 2) + '\n');
21
+ }
22
+ "
@@ -18,6 +18,11 @@ Every change is incomplete until ALL applicable items are done.
18
18
  4. **Tests** - unit test for new logic, page test for new pages
19
19
  5. **Spec compliance** - if a spec exists, verify delivery matches it
20
20
 
21
+ ## Mandatory for new or changed pages
22
+
23
+ 6. **Visual review** - page rendered in a browser, screenshots at mobile and desktop width looked at, not just typechecked
24
+ 7. **Design pass** - page audited for hierarchy, imagery, density and generic-template tells, findings fixed
25
+
21
26
  ## Output format
22
27
 
23
28
  Every skill output MUST end with:
@@ -29,4 +34,6 @@ Every skill output MUST end with:
29
34
  - [x] i18n: <locale files updated, or N/A>
30
35
  - [x] Tests: <test file, or N/A>
31
36
  - [x] Spec compliance: <verified, or N/A>
37
+ - [x] Visual review: <screenshot paths, or N/A>
38
+ - [x] Design pass: <findings fixed, or N/A>
32
39
  ```
@@ -14,6 +14,12 @@ The framework's MCP server and component library cover 99% of what you need. Use
14
14
  3. Common hallucination traps (these DO NOT exist): `size`, `tone`, `color`, `padding`, `margin`, `spacing`, `columns`, `background`, `fields`.
15
15
  4. Import from `@donotdev/<pkg>` top-level only. Never sub-paths.
16
16
 
17
+ Hook-enforced: writing a `.ts`/`.tsx` file that imports a `@donotdev` symbol never passed to `lookup_symbol` is blocked (ledger: `.dndev/lookups.json`).
18
+
19
+ ## Templates before pages
20
+
21
+ Before hand-building a page, run `search_framework("Template")` and use the matching `@donotdev/templates` template (checkout, profile, settings, dashboard, product list, legal, login...) when one exists. Hand-build only what no template covers, and say why.
22
+
17
23
  ## Use framework components, not HTML
18
24
 
19
25
  `<div>` → Stack | `<button>` → Button | `<input>` → TextInput | `<a>` → Link | `<p>`/`<h1>` → Text | `<table>` → DataTable | `<form>` → Form | `<ul>` → List | `<img>` → Image
@@ -32,7 +32,17 @@
32
32
  ]
33
33
  }
34
34
  ],
35
- "PostToolUse": [],
35
+ "PostToolUse": [
36
+ {
37
+ "matcher": "mcp__donotdev__lookup_symbol",
38
+ "hooks": [
39
+ {
40
+ "type": "command",
41
+ "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/record-lookup.sh\""
42
+ }
43
+ ]
44
+ }
45
+ ],
36
46
  "Stop": [
37
47
  {
38
48
  "matcher": "",
@@ -1,14 +0,0 @@
1
- // functions/src/billing/processPaymentSuccess.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} Payment Success Wrapper
5
- * @description Wrapper for framework's processPaymentSuccess with {{APP_NAME}}-specific configuration
6
- */
7
-
8
- import { processPaymentSuccess as frameworkProcessPaymentSuccess } from '@donotdev/functions/firebase';
9
-
10
- /**
11
- * {{APP_NAME}} payment success processing
12
- * Wraps the framework function with {{APP_NAME}}-specific configuration
13
- */
14
- export const processPaymentSuccess = frameworkProcessPaymentSuccess;
@@ -1,20 +0,0 @@
1
- // functions/src/api/billing/processPaymentSuccess.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} Payment Success Wrapper
5
- * @description Wrapper for framework's processPaymentSuccess with {{APP_NAME}}-specific configuration
6
- */
7
-
8
- import type { NextApiRequest, NextApiResponse } from 'next';
9
- import { processPaymentSuccess as frameworkProcessPaymentSuccess } from '@donotdev/functions/vercel';
10
-
11
- /**
12
- * {{APP_NAME}} payment success processing
13
- * Wraps the framework function with {{APP_NAME}}-specific configuration
14
- */
15
- export default async function handler(
16
- req: NextApiRequest,
17
- res: NextApiResponse
18
- ) {
19
- return frameworkProcessPaymentSuccess(req, res);
20
- }