@codewithjuber/forgekit 0.8.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 (140) hide show
  1. package/.claude-plugin/marketplace.json +12 -0
  2. package/.claude-plugin/plugin.json +20 -0
  3. package/.codex-plugin/plugin.json +29 -0
  4. package/.mcp.json +8 -0
  5. package/ARCHITECTURE.md +314 -0
  6. package/CHANGELOG.md +467 -0
  7. package/LICENSE +21 -0
  8. package/ONBOARDING.md +180 -0
  9. package/README.md +286 -0
  10. package/bin/claude-init.sh +90 -0
  11. package/bin/claude-taste.sh +33 -0
  12. package/bin/learn-consolidate.sh +51 -0
  13. package/brand.json +15 -0
  14. package/global/CLAUDE.md +31 -0
  15. package/global/crew/frontend-verifier.md +36 -0
  16. package/global/crew/independent-reviewer.md +29 -0
  17. package/global/crew/scout.md +24 -0
  18. package/global/crew/verifier.md +28 -0
  19. package/global/guards/_guardlib.sh +36 -0
  20. package/global/guards/cortex.sh +14 -0
  21. package/global/guards/cost-budget.sh +41 -0
  22. package/global/guards/doom-loop.sh +25 -0
  23. package/global/guards/format-on-edit.sh +32 -0
  24. package/global/guards/lean-guard.sh +20 -0
  25. package/global/guards/protect-paths.sh +45 -0
  26. package/global/guards/recall-load.sh +22 -0
  27. package/global/guards/secret-redact.sh +18 -0
  28. package/global/guards/session-learner.sh +72 -0
  29. package/global/recall/MEMORY.md +7 -0
  30. package/global/rules/self-correction.md +17 -0
  31. package/global/rules/stack-notes.md +24 -0
  32. package/global/rules/tech-currency.md +19 -0
  33. package/global/settings.template.json +183 -0
  34. package/global/statusline.sh +51 -0
  35. package/global/taste/brutalist.json +9 -0
  36. package/global/taste/brutalist.md +19 -0
  37. package/global/taste/corporate.json +9 -0
  38. package/global/taste/corporate.md +19 -0
  39. package/global/taste/editorial.json +9 -0
  40. package/global/taste/editorial.md +19 -0
  41. package/global/taste/minimalist.json +9 -0
  42. package/global/taste/minimalist.md +20 -0
  43. package/global/taste/playful.json +9 -0
  44. package/global/taste/playful.md +19 -0
  45. package/global/tools/atlas/SKILL.md +27 -0
  46. package/global/tools/code-modernization/SKILL.md +275 -0
  47. package/global/tools/code-modernization/references/cost-impact-preflight.md +54 -0
  48. package/global/tools/code-modernization/references/design-patterns-cheatsheet.md +24 -0
  49. package/global/tools/code-modernization/references/research-protocol.md +42 -0
  50. package/global/tools/code-modernization/scripts/preflight_scan.py +190 -0
  51. package/global/tools/cognitive-substrate/SKILL.md +56 -0
  52. package/global/tools/cognitive-substrate/references/capability-map.md +17 -0
  53. package/global/tools/cost-guard/SKILL.md +50 -0
  54. package/global/tools/design-md/SKILL.md +54 -0
  55. package/global/tools/dev-radar/SKILL.md +56 -0
  56. package/global/tools/explore-plan-code/SKILL.md +24 -0
  57. package/global/tools/lean/SKILL.md +41 -0
  58. package/global/tools/recall/SKILL.md +31 -0
  59. package/global/tools/reuse-first/SKILL.md +64 -0
  60. package/global/tools/self-improve/SKILL.md +44 -0
  61. package/global/tools/taste/SKILL.md +26 -0
  62. package/global/tools/tech-selector/SKILL.md +35 -0
  63. package/global/tools/ui-workflow/SKILL.md +44 -0
  64. package/hooks/hooks.json +107 -0
  65. package/install.sh +88 -0
  66. package/package.json +93 -0
  67. package/public/index.html +45 -0
  68. package/scripts/build-pages.mjs +180 -0
  69. package/scripts/bump.mjs +322 -0
  70. package/skills/cognitive-substrate/SKILL.md +56 -0
  71. package/skills/cognitive-substrate/references/capability-map.md +17 -0
  72. package/source/mcp.json +10 -0
  73. package/source/rules.json +106 -0
  74. package/source/substrate.json +41 -0
  75. package/src/adjudicate.js +84 -0
  76. package/src/anchor.js +210 -0
  77. package/src/atlas.js +487 -0
  78. package/src/brain.js +84 -0
  79. package/src/brand.js +25 -0
  80. package/src/cli.js +1509 -0
  81. package/src/context.js +273 -0
  82. package/src/cortex.js +251 -0
  83. package/src/cortex_distill.js +55 -0
  84. package/src/cortex_features.js +81 -0
  85. package/src/cortex_hook.js +197 -0
  86. package/src/cortex_hook_main.js +139 -0
  87. package/src/cortex_mcp.js +352 -0
  88. package/src/cost_report.js +271 -0
  89. package/src/dash.html +396 -0
  90. package/src/dash.js +220 -0
  91. package/src/diagnose.js +0 -0
  92. package/src/doctor.js +315 -0
  93. package/src/embed.js +244 -0
  94. package/src/emit/_shared.js +39 -0
  95. package/src/emit/aider.js +22 -0
  96. package/src/emit/claude.js +44 -0
  97. package/src/emit/codex.js +17 -0
  98. package/src/emit/continue.js +28 -0
  99. package/src/emit/copilot.js +12 -0
  100. package/src/emit/cursor.js +23 -0
  101. package/src/emit/gemini.js +40 -0
  102. package/src/emit/mcp.js +94 -0
  103. package/src/emit/windsurf.js +22 -0
  104. package/src/emit/zed.js +34 -0
  105. package/src/eval.js +47 -0
  106. package/src/extract.js +82 -0
  107. package/src/harden.js +44 -0
  108. package/src/imagine.js +301 -0
  109. package/src/init.js +178 -0
  110. package/src/lean.js +149 -0
  111. package/src/ledger.js +475 -0
  112. package/src/ledger_bridge.js +279 -0
  113. package/src/ledger_read.js +152 -0
  114. package/src/ledger_store.js +360 -0
  115. package/src/lessons.js +185 -0
  116. package/src/lessons_store.js +137 -0
  117. package/src/metrics.js +54 -0
  118. package/src/model_tiers.js +17 -0
  119. package/src/model_tiers.json +39 -0
  120. package/src/predictor.js +143 -0
  121. package/src/preflight.js +410 -0
  122. package/src/providers.js +320 -0
  123. package/src/recall.js +103 -0
  124. package/src/reuse.js +0 -0
  125. package/src/route.js +323 -0
  126. package/src/scope.js +122 -0
  127. package/src/skillgate.js +89 -0
  128. package/src/speclock.js +64 -0
  129. package/src/substrate.js +492 -0
  130. package/src/sync.js +132 -0
  131. package/src/taste.js +55 -0
  132. package/src/uicheck.js +96 -0
  133. package/src/uifingerprint.js +861 -0
  134. package/src/uivisual.js +334 -0
  135. package/src/util.js +71 -0
  136. package/src/verify.js +117 -0
  137. package/templates/project-layer/.claude/settings.json +22 -0
  138. package/templates/project-layer/.claude/skills/hostlelo-deploy/SKILL.md +38 -0
  139. package/templates/project-layer/AGENTS.md +28 -0
  140. package/templates/project-layer/CLAUDE.md +40 -0
package/src/uicheck.js ADDED
@@ -0,0 +1,96 @@
1
+ // forge uicheck — the ASSERTABLE half of UI review. AI UI-audits hallucinate on subjective
2
+ // calls (hierarchy, taste); this computes the things that are pure math or a DOM fact, so a
3
+ // verifier can state them without guessing. WCAG contrast is exact arithmetic — no LLM, no
4
+ // false positives. The subjective calls stay ADVISORY (see the frontend-verifier calibration).
5
+
6
+ /** Parse #rgb / #rrggbb → {r,g,b} in 0..255. */
7
+ function parseHex(hex) {
8
+ let h = String(hex).trim().replace(/^#/, "");
9
+ if (h.length === 3)
10
+ h = h
11
+ .split("")
12
+ .map((c) => c + c)
13
+ .join("");
14
+ if (!/^[0-9a-fA-F]{6}$/.test(h)) throw new Error(`bad hex color: ${hex}`);
15
+ return {
16
+ r: parseInt(h.slice(0, 2), 16),
17
+ g: parseInt(h.slice(2, 4), 16),
18
+ b: parseInt(h.slice(4, 6), 16),
19
+ };
20
+ }
21
+
22
+ // WCAG 2.1 sRGB → linear.
23
+ const linear = (c) => {
24
+ const s = c / 255;
25
+ return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
26
+ };
27
+
28
+ /** WCAG relative luminance of a color. */
29
+ export function relativeLuminance(hex) {
30
+ const { r, g, b } = parseHex(hex);
31
+ return 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);
32
+ }
33
+
34
+ /** WCAG contrast ratio between two colors (1..21). */
35
+ export function contrastRatio(fg, bg) {
36
+ const l1 = relativeLuminance(fg);
37
+ const l2 = relativeLuminance(bg);
38
+ const [hi, lo] = l1 >= l2 ? [l1, l2] : [l2, l1];
39
+ return (hi + 0.05) / (lo + 0.05);
40
+ }
41
+
42
+ /**
43
+ * Grade a contrast ratio. Normal text needs 4.5 (AA) / 7 (AAA); large text or UI components
44
+ * need 3 (AA) / 4.5 (AAA).
45
+ */
46
+ export function wcagLevel(ratio, { large = false } = {}) {
47
+ const aa = large ? 3 : 4.5;
48
+ const aaa = large ? 4.5 : 7;
49
+ return {
50
+ ratio: Math.round(ratio * 100) / 100,
51
+ passesAA: ratio >= aa,
52
+ passesAAA: ratio >= aaa,
53
+ level: ratio >= aaa ? "AAA" : ratio >= aa ? "AA" : "fail",
54
+ };
55
+ }
56
+
57
+ // The deterministic checks a verifier may ASSERT (vs. the advisory, subjective ones). Kept as
58
+ // data so the frontend-verifier and docs share one source of truth.
59
+ export const ASSERTABLE_CHECKS = [
60
+ { id: "contrast", how: "compute WCAG ratio; body ≥4.5:1, large/UI ≥3:1" },
61
+ {
62
+ id: "focus-visible",
63
+ how: "every interactive element has a visible :focus-visible style",
64
+ },
65
+ { id: "alt-text", how: "every <img> has a non-empty alt attribute" },
66
+ {
67
+ id: "form-labels",
68
+ how: "every input/select/textarea has a <label> or aria-label",
69
+ },
70
+ { id: "tap-target", how: "clickable targets ≥24×24px (AA) / ≥44×44px (AAA)" },
71
+ {
72
+ id: "reduced-motion",
73
+ how: "animations ≥200ms are wrapped in @media (prefers-reduced-motion)",
74
+ },
75
+ // Scale-conformance checks (P6): executable versions live in uifingerprint.js
76
+ // scaleChecks() under the SAME ids — a test pins the two lists together.
77
+ {
78
+ id: "spacing-scale",
79
+ how: "≥90% of spacing values are multiples of the declared base within ε=0.5px",
80
+ },
81
+ {
82
+ id: "radius-levels",
83
+ how: "≤3 distinct border-radius levels (a design system uses few, deliberately)",
84
+ },
85
+ { id: "shadow-levels", how: "≤3 distinct box-shadow levels (deliberate elevation steps)" },
86
+ { id: "palette-size", how: "≤8 distinct colors after HSL normalization" },
87
+ ];
88
+
89
+ export const ADVISORY_ONLY = [
90
+ "visual hierarchy / type-scale balance",
91
+ "which pattern fits (chatbot vs copilot vs canvas)",
92
+ "error-message clarity",
93
+ "empty-state usefulness",
94
+ "does the motion feel right",
95
+ "palette / taste",
96
+ ];