rafters 0.0.13 → 0.0.14

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 (2) hide show
  1. package/dist/index.js +140 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -52417,7 +52417,53 @@ Rafters Button, Input, Card, etc. include their own spacing, sizing, and states.
52417
52417
  UTILITIES EXIST FOR EDGE CASES.
52418
52418
  If no component fits your need, check @/lib/utils for official behavioral utilities. Do not invent your own. If nothing exists there either, ask the human.
52419
52419
 
52420
+ COLORS ARE TAILWIND CLASSES.
52421
+ Write border-l-primary, bg-success, text-info-foreground. Do not create color constants, mapping objects, or reference palette names (silver-true-sky-500, neutral-400, etc). The designer already decided what each token looks like. Palette families are internal -- never use them in consumer code.
52422
+
52423
+ SYSTEM COLOR TOKENS (use these as Tailwind class fragments):
52424
+ - primary / primary-foreground -- Main brand, CTA buttons, links
52425
+ - secondary / secondary-foreground -- Less prominent actions
52426
+ - accent / accent-foreground -- Hover highlights, emphasis
52427
+ - muted / muted-foreground -- Subdued backgrounds, disabled text
52428
+ - destructive / destructive-foreground -- Delete, remove, errors
52429
+ - success / success-foreground -- Confirmations, positive feedback
52430
+ - warning / warning-foreground -- Caution, important notices
52431
+ - info / info-foreground -- Tips, help, neutral information
52432
+ - chart-1 through chart-5 -- Categorical distinction (guaranteed harmonious)
52433
+ - card / card-foreground -- Card surfaces
52434
+ - popover / popover-foreground -- Overlay surfaces
52435
+ - border, input, ring -- Structural tokens
52436
+
52437
+ For categorical color coding (e.g. field types), use border-l-{token} on a container with bg-card. Example Tailwind classes: "border-l-4 border-l-primary", "border-l-4 border-l-info", "border-l-4 border-l-success".
52438
+
52420
52439
  When in doubt: less code, not more. Rafters has already made the design decision.`;
52440
+ var CONSUMER_QUICKSTART = {
52441
+ rule1: "Components are pre-styled. Import and render. Do not add className for visual styling -- only for layout context (e.g. border-l-4 for accent). Input knows its focus ring. Label knows its weight. You arrange, you do not style.",
52442
+ rule2: "Colors are Tailwind classes. Write border-l-primary, bg-success, text-info-foreground. Do not create color constants, mapping objects, or reference palette internals.",
52443
+ rule3: "Layout uses Container and Grid presets (sidebar-main, form, cards, row, stack, split). Do not write flex, grid, gap-* directly.",
52444
+ antiPatterns: [
52445
+ "Do NOT reference palette families (silver-true-sky-500, neutral-400). Those are internal.",
52446
+ "Do NOT add className to Input/Label/Select for styling. They handle their own styles.",
52447
+ "Do NOT create wrapper components that add styling to Rafters components.",
52448
+ "Do NOT define focus states, hover states, or error states. Components include these.",
52449
+ "Do NOT create color mapping objects. The Tailwind class name IS the mapping."
52450
+ ],
52451
+ colorTokens: {
52452
+ semantic: [
52453
+ "primary -- Main brand, CTA buttons, links",
52454
+ "secondary -- Less prominent actions",
52455
+ "accent -- Hover highlights, emphasis",
52456
+ "muted -- Subdued backgrounds, disabled text",
52457
+ "destructive -- Delete, remove, errors",
52458
+ "success -- Confirmations, positive feedback",
52459
+ "warning -- Caution, important notices",
52460
+ "info -- Tips, help, neutral information"
52461
+ ],
52462
+ categorical: "chart-1 through chart-5 -- For data viz and categorical distinction (guaranteed harmonious)",
52463
+ structural: "card, popover, border, input, ring -- Surface and boundary tokens",
52464
+ usage: "Use as Tailwind class fragments: bg-primary, text-info-foreground, border-l-success. Each token has a -foreground variant for text on that background."
52465
+ }
52466
+ };
52421
52467
  var DESIGN_PATTERNS = {
52422
52468
  "destructive-action": {
52423
52469
  name: "Destructive Action",
@@ -52717,7 +52763,7 @@ var DESIGN_PATTERNS = {
52717
52763
  var TOOL_DEFINITIONS = [
52718
52764
  {
52719
52765
  name: "rafters_vocabulary",
52720
- description: "Get compact design system vocabulary: color palette names, spacing scale, type scale, and component list with cognitive loads. Use this first to understand what you can compose with.",
52766
+ description: "Get design system vocabulary with consumer quickstart guide. Returns: system rules, onboarding guidance (what to do and what NOT to do), semantic color tokens, spacing scale, type scale, layout presets, and component list. ALWAYS call this first before building with Rafters.",
52721
52767
  inputSchema: {
52722
52768
  type: "object",
52723
52769
  properties: {},
@@ -52829,7 +52875,7 @@ var RaftersToolHandler = class {
52829
52875
  // ==================== Tool 1: Vocabulary ====================
52830
52876
  /**
52831
52877
  * Get compact design system vocabulary
52832
- * Returns: color palettes, spacing scale, type scale, component list with loads
52878
+ * Returns: system rules, consumer quickstart, color tokens, spacing, type scale, components
52833
52879
  */
52834
52880
  async getVocabulary() {
52835
52881
  try {
@@ -52841,6 +52887,7 @@ var RaftersToolHandler = class {
52841
52887
  ]);
52842
52888
  const vocabulary = {
52843
52889
  system: SYSTEM_PREAMBLE,
52890
+ quickstart: CONSUMER_QUICKSTART,
52844
52891
  components,
52845
52892
  colors,
52846
52893
  spacing,
@@ -52860,16 +52907,50 @@ var RaftersToolHandler = class {
52860
52907
  }
52861
52908
  }
52862
52909
  /**
52863
- * Extract compact color vocabulary
52910
+ * Extract compact color vocabulary.
52911
+ * Always includes the known semantic token list so consumers get guidance
52912
+ * even when dynamic token loading fails or returns empty.
52864
52913
  */
52865
52914
  async getColorVocabulary() {
52915
+ const knownSemantic = [
52916
+ "primary",
52917
+ "primary-foreground",
52918
+ "secondary",
52919
+ "secondary-foreground",
52920
+ "accent",
52921
+ "accent-foreground",
52922
+ "muted",
52923
+ "muted-foreground",
52924
+ "destructive",
52925
+ "destructive-foreground",
52926
+ "success",
52927
+ "success-foreground",
52928
+ "warning",
52929
+ "warning-foreground",
52930
+ "info",
52931
+ "info-foreground",
52932
+ "card",
52933
+ "card-foreground",
52934
+ "popover",
52935
+ "popover-foreground",
52936
+ "background",
52937
+ "foreground",
52938
+ "border",
52939
+ "input",
52940
+ "ring",
52941
+ "chart-1",
52942
+ "chart-2",
52943
+ "chart-3",
52944
+ "chart-4",
52945
+ "chart-5"
52946
+ ];
52866
52947
  try {
52867
52948
  const tokens = await this.loadNamespace("color");
52868
- const semantic = [];
52949
+ const dynamicSemantic = [];
52869
52950
  const palettes = /* @__PURE__ */ new Map();
52870
52951
  for (const token of tokens) {
52871
52952
  if (typeof token.value === "object" && "family" in token.value) {
52872
- semantic.push(token.name);
52953
+ dynamicSemantic.push(token.name);
52873
52954
  } else if (typeof token.value === "object" && "scale" in token.value) {
52874
52955
  const colorValue = token.value;
52875
52956
  palettes.set(
@@ -52878,19 +52959,26 @@ var RaftersToolHandler = class {
52878
52959
  );
52879
52960
  }
52880
52961
  }
52962
+ const allSemantic = [.../* @__PURE__ */ new Set([...knownSemantic, ...dynamicSemantic])];
52881
52963
  return {
52882
- semantic,
52964
+ semantic: allSemantic,
52883
52965
  palettes: [...palettes.entries()].map(([name2, positions]) => ({
52884
52966
  name: name2,
52885
52967
  positions: [...positions]
52886
- }))
52968
+ })),
52969
+ usage: "Use as Tailwind classes: bg-primary, text-info-foreground, border-l-success. Palette families are internal -- never reference them in consumer code."
52887
52970
  };
52888
52971
  } catch {
52889
- return { semantic: [], palettes: [] };
52972
+ return {
52973
+ semantic: knownSemantic,
52974
+ palettes: [],
52975
+ usage: "Use as Tailwind classes: bg-primary, text-info-foreground, border-l-success. Palette families are internal -- never reference them in consumer code."
52976
+ };
52890
52977
  }
52891
52978
  }
52892
52979
  /**
52893
- * Extract compact spacing vocabulary
52980
+ * Extract compact spacing vocabulary.
52981
+ * Includes static scale names so consumers always get guidance.
52894
52982
  */
52895
52983
  async getSpacingVocabulary() {
52896
52984
  try {
@@ -52901,13 +52989,32 @@ var RaftersToolHandler = class {
52901
52989
  scale2[token.name] = token.value;
52902
52990
  }
52903
52991
  }
52904
- return { scale: scale2 };
52992
+ if (Object.keys(scale2).length > 0) {
52993
+ return {
52994
+ scale: scale2,
52995
+ usage: "Container and Grid handle spacing. Do not use gap-*, p-*, m-* directly."
52996
+ };
52997
+ }
52905
52998
  } catch {
52906
- return { scale: {} };
52907
52999
  }
53000
+ return {
53001
+ scale: {
53002
+ "spacing-0": "0rem",
53003
+ "spacing-1": "0.25rem",
53004
+ "spacing-2": "0.5rem",
53005
+ "spacing-3": "0.75rem",
53006
+ "spacing-4": "1rem",
53007
+ "spacing-6": "1.5rem",
53008
+ "spacing-8": "2rem",
53009
+ "spacing-12": "3rem",
53010
+ "spacing-16": "4rem"
53011
+ },
53012
+ usage: "Container and Grid handle spacing. Do not use gap-*, p-*, m-* directly."
53013
+ };
52908
53014
  }
52909
53015
  /**
52910
- * Extract compact typography vocabulary
53016
+ * Extract compact typography vocabulary.
53017
+ * Includes static fallbacks so consumers always get guidance.
52911
53018
  */
52912
53019
  async getTypographyVocabulary() {
52913
53020
  try {
@@ -52923,10 +53030,29 @@ var RaftersToolHandler = class {
52923
53030
  }
52924
53031
  }
52925
53032
  }
52926
- return { sizes, weights: [...weights] };
53033
+ if (Object.keys(sizes).length > 0) {
53034
+ return {
53035
+ sizes,
53036
+ weights: [...weights],
53037
+ usage: "Typography components (H1-H4, P, Label) handle sizing. Do not set font sizes directly."
53038
+ };
53039
+ }
52927
53040
  } catch {
52928
- return { sizes: {}, weights: [] };
52929
53041
  }
53042
+ return {
53043
+ sizes: {
53044
+ "font-size-xs": "0.75rem",
53045
+ "font-size-sm": "0.875rem",
53046
+ "font-size-base": "1rem",
53047
+ "font-size-lg": "1.125rem",
53048
+ "font-size-xl": "1.25rem",
53049
+ "font-size-2xl": "1.5rem",
53050
+ "font-size-3xl": "1.875rem",
53051
+ "font-size-4xl": "2.25rem"
53052
+ },
53053
+ weights: ["normal", "medium", "semibold", "bold"],
53054
+ usage: "Typography components (H1-H4, P, Label) handle sizing. Do not set font sizes directly."
53055
+ };
52930
53056
  }
52931
53057
  /**
52932
53058
  * Load and cache the project's Rafters config from .rafters/config.rafters.json.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rafters",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "CLI for Rafters design system - scaffold tokens and add components",
5
5
  "license": "MIT",
6
6
  "type": "module",