@donotdev/cli 0.2.3 → 0.3.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 (30) hide show
  1. package/dependencies-matrix.json +27 -26
  2. package/dist/bin/commands/build.js +64 -2
  3. package/dist/bin/commands/bump.js +98 -13
  4. package/dist/bin/commands/db-check.js +192804 -0
  5. package/dist/bin/commands/db.js +16 -1
  6. package/dist/bin/commands/make-admin.js +22 -6
  7. package/dist/bin/commands/seed.js +313 -236
  8. package/dist/bin/commands/setup.js +549 -97
  9. package/dist/bin/dndev.js +23 -7
  10. package/dist/index.js +64 -2
  11. package/package.json +1 -1
  12. package/templates/app-demo/index.html.example +1 -1
  13. package/templates/app-dndev/index.html.example +1 -1
  14. package/templates/app-dndev/src/globals.css.example +1 -1
  15. package/templates/app-next/src/app/AppDocument.tsx.example +3 -2
  16. package/templates/app-next/src/globals.css.example +1 -1
  17. package/templates/app-vite/csp.example.json +1 -1
  18. package/templates/app-vite/index.html.example +1 -1
  19. package/templates/app-vite/src/globals.css.example +1 -1
  20. package/templates/deploy-config/vercel.json.example +2 -2
  21. package/templates/functions-supabase/supabase/migrations/20250101000006_crud_bulk_status_guard.sql +258 -0
  22. package/templates/functions-supabase/supabase/migrations/20250101000007_rate_limit_check.sql +76 -0
  23. package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +3 -3
  24. package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +2 -2
  25. package/templates/root-consumer/.claude/rules/definition-of-done.md.example +2 -2
  26. package/templates/root-consumer/.claude/rules/framework.md.example +1 -1
  27. package/templates/root-consumer/.claude/skills/build/SKILL.md.example +1 -1
  28. package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +1 -1
  29. package/templates/root-consumer/AGENTS.md.example +25 -2
  30. package/templates/root-consumer/README.md.example +1 -1
@@ -2,7 +2,7 @@
2
2
  "$schema": "./dependencies-matrix.schema.json",
3
3
  "version": "0.0.8",
4
4
  "description": "Centralized dependency versions for DoNotDev framework. Single source of truth for all external dependencies. Third-party optional deps are auto-detected from peerDependenciesMeta via scanInstalledPackageOptionals() — no manual constants update needed.",
5
- "lastUpdated": "2026-11-12",
5
+ "lastUpdated": "2026-11-17",
6
6
  "migrationGuides": {
7
7
  "0.0→0.1": {
8
8
  "path": "docs/migration/v0.0-to-v0.1.md",
@@ -17,103 +17,103 @@
17
17
  "@donotdev/ai": {
18
18
  "description": "AI package - provider-agnostic LLM plumbing",
19
19
  "packages": {
20
- "@donotdev/ai": "^0.2.3"
20
+ "@donotdev/ai": "^0.3.0"
21
21
  }
22
22
  },
23
23
  "@donotdev/graphql": {
24
24
  "description": "GraphQL data provider - opt-in, not scaffolded by default",
25
25
  "packages": {
26
- "@donotdev/graphql": "^0.2.3"
26
+ "@donotdev/graphql": "^0.3.0"
27
27
  }
28
28
  },
29
29
  "@donotdev/restcrud": {
30
30
  "description": "REST CRUD data provider - opt-in, not scaffolded by default",
31
31
  "packages": {
32
- "@donotdev/restcrud": "^0.2.3"
32
+ "@donotdev/restcrud": "^0.3.0"
33
33
  }
34
34
  },
35
35
  "@donotdev/testing": {
36
36
  "description": "Testing utilities - opt-in, not scaffolded by default",
37
37
  "packages": {
38
- "@donotdev/testing": "^0.2.3"
38
+ "@donotdev/testing": "^0.3.0"
39
39
  }
40
40
  },
41
41
  "@donotdev/auth": {
42
42
  "description": "Authentication package",
43
43
  "packages": {
44
- "@donotdev/auth": "^0.2.3"
44
+ "@donotdev/auth": "^0.3.0"
45
45
  }
46
46
  },
47
47
  "@donotdev/billing": {
48
48
  "description": "Billing package",
49
49
  "packages": {
50
- "@donotdev/billing": "^0.2.3"
50
+ "@donotdev/billing": "^0.3.0"
51
51
  }
52
52
  },
53
53
  "@donotdev/components": {
54
54
  "description": "UI components package",
55
55
  "packages": {
56
- "@donotdev/components": "^0.2.3"
56
+ "@donotdev/components": "^0.3.0"
57
57
  }
58
58
  },
59
59
  "@donotdev/core": {
60
60
  "description": "Core framework package",
61
61
  "packages": {
62
- "@donotdev/core": "^0.2.3"
62
+ "@donotdev/core": "^0.3.0"
63
63
  }
64
64
  },
65
65
  "@donotdev/crud": {
66
66
  "description": "CRUD operations package",
67
67
  "packages": {
68
- "@donotdev/crud": "^0.2.3"
68
+ "@donotdev/crud": "^0.3.0"
69
69
  }
70
70
  },
71
71
  "@donotdev/demo": {
72
72
  "description": "Zero-backend demo provider package",
73
73
  "packages": {
74
- "@donotdev/demo": "^0.2.3"
74
+ "@donotdev/demo": "^0.3.0"
75
75
  }
76
76
  },
77
77
  "@donotdev/firebase": {
78
78
  "description": "Firebase provider package",
79
79
  "packages": {
80
- "@donotdev/firebase": "^0.2.3"
80
+ "@donotdev/firebase": "^0.3.0"
81
81
  }
82
82
  },
83
83
  "@donotdev/functions": {
84
84
  "description": "Firebase Functions package",
85
85
  "packages": {
86
- "@donotdev/functions": "^0.2.3"
86
+ "@donotdev/functions": "^0.3.0"
87
87
  }
88
88
  },
89
89
  "@donotdev/oauth": {
90
90
  "description": "OAuth package",
91
91
  "packages": {
92
- "@donotdev/oauth": "^0.2.3"
92
+ "@donotdev/oauth": "^0.3.0"
93
93
  }
94
94
  },
95
95
  "@donotdev/templates": {
96
96
  "description": "Page templates package",
97
97
  "packages": {
98
- "@donotdev/templates": "^0.2.3"
98
+ "@donotdev/templates": "^0.3.0"
99
99
  }
100
100
  },
101
101
  "@donotdev/ui": {
102
102
  "description": "UI and routing package",
103
103
  "packages": {
104
- "@donotdev/ui": "^0.2.3"
104
+ "@donotdev/ui": "^0.3.0"
105
105
  }
106
106
  },
107
107
  "@donotdev/expo": {
108
108
  "description": "Expo/React Native components package",
109
109
  "packages": {
110
- "@donotdev/expo": "^0.2.3"
110
+ "@donotdev/expo": "^0.3.0"
111
111
  }
112
112
  },
113
113
  "@donotdev/supabase": {
114
114
  "description": "Supabase provider package",
115
115
  "packages": {
116
- "@donotdev/supabase": "^0.2.3"
116
+ "@donotdev/supabase": "^0.3.0"
117
117
  }
118
118
  },
119
119
  "supabase-js": {
@@ -312,10 +312,11 @@
312
312
  "@ai-sdk/google": "^4.0.118"
313
313
  }
314
314
  },
315
- "isomorphic-dompurify": {
316
- "description": "HTML sanitization: DOMPurify in the browser, DOMPurify + jsdom on the server (SSR). Pulled in by @donotdev/components; consumer apps never add it.",
315
+ "html-sanitizer": {
316
+ "description": "HTML sanitization: DOMPurify in the browser, DOMPurify + jsdom on the server (SSR). jsdom stays on 26.x: later releases require an ESM-only package that Vercel's function runtime cannot load. Pulled in by @donotdev/components; consumer apps never add it.",
317
317
  "packages": {
318
- "isomorphic-dompurify": "^4.7.0"
318
+ "dompurify": "^3.4.18",
319
+ "jsdom": "^26.1.0"
319
320
  }
320
321
  },
321
322
  "tiptap": {
@@ -481,13 +482,13 @@
481
482
  "@donotdev/cli": {
482
483
  "description": "Cli package",
483
484
  "packages": {
484
- "@donotdev/cli": "^0.2.3"
485
+ "@donotdev/cli": "^0.3.0"
485
486
  }
486
487
  },
487
488
  "@donotdev/mcp-server": {
488
489
  "description": "MCP server for component type lookups",
489
490
  "packages": {
490
- "@donotdev/mcp-server": "^0.2.3"
491
+ "@donotdev/mcp-server": "^0.3.0"
491
492
  }
492
493
  },
493
494
  "mcp-sdk": {
@@ -513,7 +514,7 @@
513
514
  "@donotdev/security": {
514
515
  "description": "Security package",
515
516
  "packages": {
516
- "@donotdev/security": "^0.2.3"
517
+ "@donotdev/security": "^0.3.0"
517
518
  }
518
519
  },
519
520
  "xterm": {
@@ -559,7 +560,7 @@
559
560
  "@donotdev/canvas": {
560
561
  "description": "Canvas package",
561
562
  "packages": {
562
- "@donotdev/canvas": "^0.2.3"
563
+ "@donotdev/canvas": "^0.3.0"
563
564
  }
564
565
  }
565
566
  },
@@ -636,7 +637,7 @@
636
637
  "radix",
637
638
  "styling",
638
639
  "react-day-picker",
639
- "isomorphic-dompurify"
640
+ "html-sanitizer"
640
641
  ],
641
642
  "peerDependencies": [
642
643
  "react",
@@ -5207,7 +5207,7 @@ var require_tasks = __commonJS({
5207
5207
  const positivePatterns = getPositivePatterns(patterns);
5208
5208
  const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
5209
5209
  const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings2));
5210
- const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
5210
+ const dynamicPatterns2 = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings2));
5211
5211
  const staticTasks = convertPatternsToTasks(
5212
5212
  staticPatterns,
5213
5213
  negativePatterns,
@@ -5215,7 +5215,7 @@ var require_tasks = __commonJS({
5215
5215
  false
5216
5216
  );
5217
5217
  const dynamicTasks = convertPatternsToTasks(
5218
- dynamicPatterns,
5218
+ dynamicPatterns2,
5219
5219
  negativePatterns,
5220
5220
  /* dynamic */
5221
5221
  true
@@ -11967,6 +11967,67 @@ function checkConfigPlaceholders(appDir) {
11967
11967
  return bad.length > 0;
11968
11968
  }
11969
11969
 
11970
+ // packages/tooling/src/apps/sitemap-report.ts
11971
+ init_utils2();
11972
+ init_cli_output();
11973
+ init_pathResolver();
11974
+ var SITEMAP_BODY = ".next/server/app/sitemap.xml.body";
11975
+ var PRERENDER_MANIFEST = ".next/prerender-manifest.json";
11976
+ var ROUTE_MANIFEST = "public/route-manifest.json";
11977
+ function dynamicPatterns(appDir) {
11978
+ const manifestPath = joinPath(appDir, ROUTE_MANIFEST);
11979
+ if (!pathExists(manifestPath)) return [];
11980
+ const manifest = readSync(manifestPath, { format: "json" });
11981
+ return (manifest?.routes ?? []).filter(
11982
+ (route) => route.path.includes(":") && (!route.auth || route.auth === false) && route.meta?.seo?.noindex !== true
11983
+ ).map((route) => route.path);
11984
+ }
11985
+ function patternRegExp(pattern) {
11986
+ const body = pattern.split("/").map(
11987
+ (segment) => segment.startsWith(":") ? "[^/]+" : segment.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
11988
+ ).join("/");
11989
+ return new RegExp(`^(?:/[^/]+)?${body}/?$`);
11990
+ }
11991
+ function reportSitemap(appDir) {
11992
+ const bodyPath = joinPath(appDir, SITEMAP_BODY);
11993
+ if (!pathExists(bodyPath)) {
11994
+ log2.info(
11995
+ `\u{1F5FA}\uFE0F sitemap: URL count unavailable (no prerendered sitemap at ${SITEMAP_BODY})`
11996
+ );
11997
+ return;
11998
+ }
11999
+ const xml = readSync(bodyPath, { format: "text" });
12000
+ if (typeof xml !== "string") {
12001
+ log2.info(`\u{1F5FA}\uFE0F sitemap: URL count unavailable (${SITEMAP_BODY} unreadable)`);
12002
+ return;
12003
+ }
12004
+ const paths = [...xml.matchAll(/<loc>([^<]+)<\/loc>/g)].map(
12005
+ (match) => new URL(match[1]).pathname
12006
+ );
12007
+ const patterns = dynamicPatterns(appDir).map((pattern) => ({
12008
+ pattern,
12009
+ regExp: patternRegExp(pattern),
12010
+ count: 0
12011
+ }));
12012
+ let staticCount = 0;
12013
+ for (const path of paths) {
12014
+ const dynamic = patterns.find(({ regExp }) => regExp.test(path));
12015
+ if (dynamic) dynamic.count += 1;
12016
+ else staticCount += 1;
12017
+ }
12018
+ const parts = [
12019
+ `${staticCount} static`,
12020
+ ...patterns.map(({ pattern, count }) => `${count} from ${pattern}`)
12021
+ ];
12022
+ const prerenderPath = joinPath(appDir, PRERENDER_MANIFEST);
12023
+ const manifest = pathExists(prerenderPath) ? readSync(prerenderPath, { format: "json" }) : null;
12024
+ const revalidate = manifest?.routes?.["/sitemap.xml"]?.initialRevalidateSeconds;
12025
+ const refresh = typeof revalidate === "number" ? `; re-read every ${revalidate}s` : "; not re-read until the next build";
12026
+ log2.info(
12027
+ `\u{1F5FA}\uFE0F sitemap: ${paths.length} URLs at build (${parts.join(" + ")})${refresh}`
12028
+ );
12029
+ }
12030
+
11970
12031
  // packages/tooling/src/apps/build.ts
11971
12032
  init_app_detection();
11972
12033
  init_app_selector();
@@ -12125,6 +12186,7 @@ async function main(options = {}) {
12125
12186
  if (result.status !== 0) {
12126
12187
  return result.status || 1;
12127
12188
  }
12189
+ if (app.framework === "nextjs") reportSitemap(appDir);
12128
12190
  }
12129
12191
  if (buildType === "functions" || buildType === "both") {
12130
12192
  if (!hasFunc) {
@@ -8850,7 +8850,7 @@ function globSync(pattern, options = {}) {
8850
8850
  });
8851
8851
  return results.map((p) => pathResolverInstance.normalizePath(p));
8852
8852
  }
8853
- var pathResolverInstance, getRepoRoot, getAppRoot, resolveFrameworkPackage, normalizePath, pathExists, read, readSync, write, writeSync, removeSync, ensureDir, getRelativePathBetween, getDirname, joinPath;
8853
+ var pathResolverInstance, getRepoRoot, getAppRoot, resolveFrameworkPackage, normalizePath, pathExists, read, readSync, write, writeSync, removeSync, ensureDir, getRelativePathBetween, getDirname, getBasename, joinPath;
8854
8854
  var init_pathResolver = __esm({
8855
8855
  "packages/tooling/src/utils/pathResolver.ts"() {
8856
8856
  "use strict";
@@ -8876,6 +8876,9 @@ var init_pathResolver = __esm({
8876
8876
  getDirname = (filePath) => {
8877
8877
  return normalizePath(dirname3(filePath));
8878
8878
  };
8879
+ getBasename = (filePath, ext) => {
8880
+ return basename2(filePath, ext);
8881
+ };
8879
8882
  joinPath = (...pathSegments) => {
8880
8883
  return normalizePath(...pathSegments);
8881
8884
  };
@@ -8883,6 +8886,9 @@ var init_pathResolver = __esm({
8883
8886
  });
8884
8887
 
8885
8888
  // packages/tooling/src/utils/type-guards.ts
8889
+ function isRecord(value) {
8890
+ return typeof value === "object" && value !== null && !Array.isArray(value);
8891
+ }
8886
8892
  function asText(value) {
8887
8893
  return typeof value === "string" ? value : null;
8888
8894
  }
@@ -9616,10 +9622,14 @@ var SYNC_PATHS = [
9616
9622
  ".claude/skills/**/*.md",
9617
9623
  // Agents
9618
9624
  ".claude/agents/**/*.md.example",
9625
+ // Hooks (template-owned, overwritten) + their registration (merged)
9626
+ ".claude/hooks/**/*.example",
9627
+ ".claude/settings.json.example",
9619
9628
  // AI instructions (SSOT for agent behavior)
9620
9629
  "AGENTS.md.example",
9621
9630
  "CLAUDE.md.example",
9622
- ".claude/CLAUDE.md.example",
9631
+ // Rules
9632
+ ".claude/rules/**/*.md.example",
9623
9633
  // Config files
9624
9634
  ".claude/mcp.json.example",
9625
9635
  // MCP config
@@ -9636,6 +9646,78 @@ var PRESERVE_IF_EXISTS = [
9636
9646
  "args.json"
9637
9647
  // User/agent may have customized features
9638
9648
  ];
9649
+ var PROJECT_SECTION_MARKER = "<!-- dndev:project-specific -->";
9650
+ function mergeProjectSection(template, existing) {
9651
+ const templateIndex = template.indexOf(PROJECT_SECTION_MARKER);
9652
+ if (templateIndex === -1 || existing === null) return template;
9653
+ const existingIndex = existing.indexOf(PROJECT_SECTION_MARKER);
9654
+ if (existingIndex === -1) return template;
9655
+ return template.slice(0, templateIndex + PROJECT_SECTION_MARKER.length) + existing.slice(existingIndex + PROJECT_SECTION_MARKER.length);
9656
+ }
9657
+ function mergeMcpConfig(template, existing) {
9658
+ if (existing === null) return template;
9659
+ const templateConfig = JSON.parse(template);
9660
+ const existingConfig = JSON.parse(existing);
9661
+ const merged = {
9662
+ ...existingConfig,
9663
+ ...templateConfig,
9664
+ mcpServers: {
9665
+ ...existingConfig.mcpServers,
9666
+ ...templateConfig.mcpServers
9667
+ }
9668
+ };
9669
+ if (JSON.stringify(merged) === JSON.stringify(existingConfig)) {
9670
+ return existing;
9671
+ }
9672
+ return JSON.stringify(merged, null, 2) + "\n";
9673
+ }
9674
+ function mergeHookGroups(existing, template) {
9675
+ const groupHooks = (group2) => isRecord(group2) && Array.isArray(group2.hooks) ? group2.hooks : [];
9676
+ const hookCommand = (hook) => isRecord(hook) ? hook.command : void 0;
9677
+ const templateCommands = new Set(
9678
+ template.flatMap((group2) => groupHooks(group2).map(hookCommand))
9679
+ );
9680
+ const kept = existing.flatMap((group2) => {
9681
+ if (!isRecord(group2)) return [group2];
9682
+ const ownHooks = groupHooks(group2).filter(
9683
+ (hook) => !templateCommands.has(hookCommand(hook))
9684
+ );
9685
+ return ownHooks.length > 0 ? [{ ...group2, hooks: ownHooks }] : [];
9686
+ });
9687
+ return [...template, ...kept];
9688
+ }
9689
+ function mergeJsonValue(existing, template, path) {
9690
+ if (Array.isArray(existing) && Array.isArray(template)) {
9691
+ if (path.length === 2 && path[0] === "hooks") {
9692
+ return mergeHookGroups(existing, template);
9693
+ }
9694
+ const existingItems = new Set(existing.map((item) => JSON.stringify(item)));
9695
+ return [
9696
+ ...existing,
9697
+ ...template.filter((item) => !existingItems.has(JSON.stringify(item)))
9698
+ ];
9699
+ }
9700
+ if (isRecord(existing) && isRecord(template)) {
9701
+ const merged = {};
9702
+ for (const key of Object.keys(existing)) {
9703
+ merged[key] = key in template ? mergeJsonValue(existing[key], template[key], [...path, key]) : existing[key];
9704
+ }
9705
+ for (const key of Object.keys(template)) {
9706
+ if (!(key in existing)) merged[key] = template[key];
9707
+ }
9708
+ return merged;
9709
+ }
9710
+ return template;
9711
+ }
9712
+ function mergeClaudeSettings(template, existing) {
9713
+ if (existing === null) return template;
9714
+ const existingSettings = JSON.parse(existing);
9715
+ const merged = mergeJsonValue(existingSettings, JSON.parse(template), []);
9716
+ if (JSON.stringify(merged) === JSON.stringify(existingSettings)) {
9717
+ return existing;
9718
+ }
9719
+ return JSON.stringify(merged, null, 2) + "\n";
9720
+ }
9639
9721
  function getSourceTemplatesPath() {
9640
9722
  try {
9641
9723
  const templatesRoot = getTemplatesRoot();
@@ -9679,20 +9761,23 @@ async function syncFile(sourcePath, destPath, preserveIfExists, appRoot) {
9679
9761
  log2.warn(`Source file not found: ${sourcePath}`);
9680
9762
  return false;
9681
9763
  }
9682
- const content = asText(await read(sourcePath, { format: "text" }));
9683
- if (!content) {
9764
+ const templateContent = asText(await read(sourcePath, { format: "text" }));
9765
+ if (!templateContent) {
9684
9766
  log2.warn(`Source file is empty: ${sourcePath}`);
9685
9767
  return false;
9686
9768
  }
9687
- if (pathExists(destPathWithoutExample)) {
9688
- const existingContent = asText(
9689
- await read(destPathWithoutExample, {
9690
- format: "text"
9691
- })
9692
- );
9693
- if (existingContent === content) {
9694
- return false;
9695
- }
9769
+ const existingContent = pathExists(destPathWithoutExample) ? asText(await read(destPathWithoutExample, { format: "text" })) : null;
9770
+ const relativeDest = getRelativePathBetween(appRoot, destPathWithoutExample);
9771
+ let content;
9772
+ if (getBasename(relativeDest).endsWith("mcp.json")) {
9773
+ content = mergeMcpConfig(templateContent, existingContent);
9774
+ } else if (relativeDest === ".claude/settings.json") {
9775
+ content = mergeClaudeSettings(templateContent, existingContent);
9776
+ } else {
9777
+ content = mergeProjectSection(templateContent, existingContent);
9778
+ }
9779
+ if (existingContent === content) {
9780
+ return false;
9696
9781
  }
9697
9782
  await ensureDir(getDirname(destPathWithoutExample));
9698
9783
  await write(destPathWithoutExample, content, {