baldart 5.0.1 → 5.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 (58) hide show
  1. package/CHANGELOG.md +157 -0
  2. package/README.md +6 -6
  3. package/VERSION +1 -1
  4. package/framework/.claude/agents/CHANGELOG.md +90 -0
  5. package/framework/.claude/agents/REGISTRY.md +5 -5
  6. package/framework/.claude/agents/coder.md +3 -3
  7. package/framework/.claude/agents/remotion-animator-orchestrator.md +4 -3
  8. package/framework/.claude/agents/senior-researcher.md +166 -151
  9. package/framework/.claude/agents/ui-expert.md +4 -10
  10. package/framework/.claude/agents/ui-quality-critic.md +27 -11
  11. package/framework/.claude/skills/design-system-init/CHANGELOG.md +5 -0
  12. package/framework/.claude/skills/design-system-init/SKILL.md +2 -2
  13. package/framework/.claude/skills/e2e-review/CHANGELOG.md +5 -0
  14. package/framework/.claude/skills/e2e-review/SKILL.md +2 -2
  15. package/framework/.claude/skills/frontend-design/CHANGELOG.md +20 -0
  16. package/framework/.claude/skills/frontend-design/SKILL.md +39 -216
  17. package/framework/.claude/skills/gamification-design/CHANGELOG.md +5 -0
  18. package/framework/.claude/skills/gamification-design/SKILL.md +2 -2
  19. package/framework/.claude/skills/prd/CHANGELOG.md +16 -0
  20. package/framework/.claude/skills/prd/SKILL.md +1 -1
  21. package/framework/.claude/skills/prd/references/discovery-phase.md +5 -1
  22. package/framework/.claude/skills/prd/references/research-phase.md +32 -12
  23. package/framework/.claude/skills/research/CHANGELOG.md +9 -0
  24. package/framework/.claude/skills/research/SKILL.md +94 -0
  25. package/framework/.claude/skills/research/assets/report-compare.template.md +50 -0
  26. package/framework/.claude/skills/research/assets/report-decision.template.md +42 -0
  27. package/framework/.claude/skills/research/assets/report-deep.template.md +61 -0
  28. package/framework/.claude/skills/research/assets/report-regulatory.template.md +44 -0
  29. package/framework/.claude/skills/research/references/playbook.md +112 -0
  30. package/framework/.claude/skills/research/scripts/rebuild-research-index.mjs +77 -0
  31. package/framework/.claude/skills/ui-design/CHANGELOG.md +60 -1
  32. package/framework/.claude/skills/ui-design/SKILL.md +127 -75
  33. package/framework/.claude/skills/ui-design/references/anti-slop.md +106 -0
  34. package/framework/.claude/skills/ui-design/references/craft-standards.md +259 -0
  35. package/framework/.claude/skills/ui-design/references/design-brief.md +92 -0
  36. package/framework/.claude/skills/ui-design/references/design-directions.md +188 -0
  37. package/framework/.claude/skills/ui-design/references/evaluation.md +125 -165
  38. package/framework/.claude/skills/ui-design/references/generation.md +125 -92
  39. package/framework/.claude/skills/ui-design/references/inventory.md +9 -2
  40. package/framework/.claude/skills/ui-design/scripts/craft-check.mjs +248 -0
  41. package/framework/agents/component-manifest-schema.md +1 -1
  42. package/framework/agents/design-system-protocol.md +6 -6
  43. package/framework/agents/index.md +3 -0
  44. package/framework/agents/research-protocol.md +228 -0
  45. package/framework/agents/skills-mapping.md +42 -23
  46. package/framework/docs/PROJECT-CONFIGURATION.md +28 -5
  47. package/framework/templates/baldart.config.template.yml +6 -0
  48. package/framework/templates/research-index.template.md +13 -0
  49. package/framework/templates/research-sources.CHANGELOG.md +14 -0
  50. package/framework/templates/research-sources.template.md +31 -0
  51. package/package.json +1 -1
  52. package/src/commands/configure.js +27 -1
  53. package/src/commands/doctor.js +82 -0
  54. package/src/commands/update.js +48 -1
  55. package/src/utils/__tests__/classify-divergence.test.js +42 -0
  56. package/src/utils/git.js +45 -9
  57. package/src/utils/research-library.js +92 -0
  58. package/src/utils/symlinks.js +3 -0
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Research library scaffolding (v5.1.0).
3
+ *
4
+ * Creates/seeds the consumer-owned research library at `paths.research_dir`:
5
+ * category subdirectories + two seed files copied from framework-internal
6
+ * templates (INDEX.md — the library map; SOURCES.md — the live source matrix).
7
+ *
8
+ * Lifecycle ownership (deliberate, see research-protocol.md):
9
+ * - `configure` CREATES (right after writing the key) — createDir: true
10
+ * - `doctor` REPAIRS (confirmable actions) — createDir: true
11
+ * - `update` only BACKFILLS seeds into an EXISTING dir — createDir: false
12
+ * (never resurrects a deliberately deleted library)
13
+ *
14
+ * Idempotent and silent on already-existing artifacts (no per-run warnings).
15
+ * Returns the repo-relative paths it created THIS run, so `update` can scope
16
+ * its auto-commit to exactly these artifacts (v4.89.2 lesson) while the rest
17
+ * of the library stays consumer-owned and untouched.
18
+ */
19
+
20
+ const fs = require('fs');
21
+ const path = require('path');
22
+
23
+ const FRAMEWORK_TEMPLATES = path.join('.framework', 'framework', 'templates');
24
+
25
+ const CATEGORY_DIRS = [
26
+ 'architecture',
27
+ 'integrations',
28
+ 'regulatory',
29
+ 'ux-patterns',
30
+ 'algorithms',
31
+ 'tooling',
32
+ '_archive',
33
+ ];
34
+
35
+ const SEEDS = [
36
+ { template: 'research-index.template.md', dest: 'INDEX.md' },
37
+ { template: 'research-sources.template.md', dest: 'SOURCES.md' },
38
+ ];
39
+
40
+ /**
41
+ * @param {string} cwd - consumer repo root
42
+ * @param {object|null} config - parsed baldart.config.yml
43
+ * @param {{createDir?: boolean}} [opts]
44
+ * @returns {string[]} repo-relative paths created this run
45
+ */
46
+ function ensureResearchLibrary(cwd, config, opts = {}) {
47
+ const createDir = opts.createDir !== false;
48
+ const created = [];
49
+
50
+ const key = config && config.paths && config.paths.research_dir;
51
+ if (!key || typeof key !== 'string') return created; // opt-out / unconfigured — no-op
52
+
53
+ const dirAbs = path.join(cwd, key);
54
+ if (!fs.existsSync(dirAbs)) {
55
+ if (!createDir) return created; // update path: never resurrect a deleted library
56
+ fs.mkdirSync(dirAbs, { recursive: true });
57
+ created.push(key);
58
+ }
59
+
60
+ for (const sub of CATEGORY_DIRS) {
61
+ const subAbs = path.join(dirAbs, sub);
62
+ if (!fs.existsSync(subAbs)) fs.mkdirSync(subAbs, { recursive: true });
63
+ }
64
+
65
+ for (const seed of SEEDS) {
66
+ const destAbs = path.join(dirAbs, seed.dest);
67
+ if (fs.existsSync(destAbs)) continue; // consumer-owned — never overwrite, never warn
68
+ const srcAbs = path.join(cwd, FRAMEWORK_TEMPLATES, seed.template);
69
+ if (!fs.existsSync(srcAbs)) continue; // older framework payload — doctor backfills later
70
+ fs.copyFileSync(srcAbs, destAbs);
71
+ created.push(path.join(key, seed.dest));
72
+ }
73
+
74
+ return created;
75
+ }
76
+
77
+ /**
78
+ * Parse the `matrix_version:` frontmatter value from a source-matrix file.
79
+ * Returns null when the file is missing/unreadable or carries no version —
80
+ * callers treat null as "cannot compare" (never a failure).
81
+ */
82
+ function readMatrixVersion(fileAbs) {
83
+ try {
84
+ const head = fs.readFileSync(fileAbs, 'utf8').slice(0, 500);
85
+ const m = head.match(/^matrix_version:\s*["']?(\d+\.\d+\.\d+)["']?\s*$/m);
86
+ return m ? m[1] : null;
87
+ } catch {
88
+ return null;
89
+ }
90
+ }
91
+
92
+ module.exports = { ensureResearchLibrary, readMatrixVersion, CATEGORY_DIRS };
@@ -948,6 +948,9 @@ class SymlinkUtils {
948
948
  'skill-project-context.snippet.md',
949
949
  'component-spec.template.md', // canonical prose-body template — consumed by serialize-spec.mjs, not hand-edited
950
950
  'overlays', // example overlays directory — consumers reference, don't copy wholesale
951
+ 'research-index.template.md', // research library seed — copied to ${paths.research_dir}/INDEX.md by ensureResearchLibrary
952
+ 'research-sources.template.md', // source matrix seed + default-matrix SSOT — copied to ${paths.research_dir}/SOURCES.md
953
+ 'research-sources.CHANGELOG.md', // matrix version history — framework metadata, never installed
951
954
  ]);
952
955
 
953
956
  this.ensureDirectory('templates');