@iksnerd/blazon 0.3.3 → 0.5.1

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 (121) hide show
  1. package/CHANGELOG.md +375 -0
  2. package/dist/chunks/{site-builder-DlaZeZHi.js → site-builder-C8g2sfUv.js} +3471 -3650
  3. package/dist/cli/commands/approvals.d.ts +1 -1
  4. package/dist/cli/commands/approvals.d.ts.map +1 -1
  5. package/dist/cli/commands/mcp-check.d.ts +7 -4
  6. package/dist/cli/commands/mcp-check.d.ts.map +1 -1
  7. package/dist/cli/errors.d.ts +3 -1
  8. package/dist/cli/errors.d.ts.map +1 -1
  9. package/dist/cli/folder-first.d.ts +7 -0
  10. package/dist/cli/folder-first.d.ts.map +1 -0
  11. package/dist/cli/handlers/can.d.ts +1 -1
  12. package/dist/cli/handlers/can.d.ts.map +1 -1
  13. package/dist/cli/handlers/list.d.ts.map +1 -1
  14. package/dist/cli/index.js +1384 -1033
  15. package/dist/cli/json.d.ts +3 -2
  16. package/dist/cli/json.d.ts.map +1 -1
  17. package/dist/cli/operations.d.ts +1 -1
  18. package/dist/cli/operations.d.ts.map +1 -1
  19. package/dist/cli/read.d.ts +4 -1
  20. package/dist/cli/read.d.ts.map +1 -1
  21. package/dist/cli/where.d.ts +2 -0
  22. package/dist/cli/where.d.ts.map +1 -1
  23. package/dist/core/assets/representations.d.ts +44 -0
  24. package/dist/core/assets/representations.d.ts.map +1 -0
  25. package/dist/core/assets/scanner.d.ts.map +1 -1
  26. package/dist/core/assets/sidecar.d.ts.map +1 -1
  27. package/dist/core/blazon-pin.d.ts +19 -1
  28. package/dist/core/blazon-pin.d.ts.map +1 -1
  29. package/dist/core/brand/export.d.ts +13 -5
  30. package/dist/core/brand/export.d.ts.map +1 -1
  31. package/dist/core/brand/schema.d.ts +68 -0
  32. package/dist/core/brand/schema.d.ts.map +1 -1
  33. package/dist/core/checker/approvals.d.ts +5 -0
  34. package/dist/core/checker/approvals.d.ts.map +1 -1
  35. package/dist/core/checker/catalogue.d.ts +37 -7
  36. package/dist/core/checker/catalogue.d.ts.map +1 -1
  37. package/dist/core/checker/font-meta.d.ts.map +1 -1
  38. package/dist/core/checker/index.d.ts +5 -0
  39. package/dist/core/checker/index.d.ts.map +1 -1
  40. package/dist/core/checker/review.d.ts +19 -1
  41. package/dist/core/checker/review.d.ts.map +1 -1
  42. package/dist/core/docs/directives.d.ts +10 -0
  43. package/dist/core/docs/directives.d.ts.map +1 -1
  44. package/dist/core/docs/parser.d.ts.map +1 -1
  45. package/dist/core/font-roles.d.ts +11 -0
  46. package/dist/core/font-roles.d.ts.map +1 -0
  47. package/dist/core/index.d.ts.map +1 -1
  48. package/dist/core/init/from-site/fonts.d.ts.map +1 -1
  49. package/dist/core/logo/colorways.d.ts +29 -0
  50. package/dist/core/logo/colorways.d.ts.map +1 -0
  51. package/dist/core/logo/misuse.d.ts +18 -0
  52. package/dist/core/logo/misuse.d.ts.map +1 -0
  53. package/dist/core/mcp-config.d.ts +7 -0
  54. package/dist/core/mcp-config.d.ts.map +1 -1
  55. package/dist/core/operations/check.d.ts +1 -1
  56. package/dist/core/operations/check.d.ts.map +1 -1
  57. package/dist/core/operations/index.d.ts +1 -1
  58. package/dist/core/operations/index.d.ts.map +1 -1
  59. package/dist/core/operations/limits.d.ts +2 -0
  60. package/dist/core/operations/limits.d.ts.map +1 -1
  61. package/dist/core/operations/list.d.ts.map +1 -1
  62. package/dist/core/operations/types.d.ts +13 -0
  63. package/dist/core/operations/types.d.ts.map +1 -1
  64. package/dist/core/preflight.d.ts.map +1 -1
  65. package/dist/core/read/can.d.ts +14 -3
  66. package/dist/core/read/can.d.ts.map +1 -1
  67. package/dist/core/read/fonts.d.ts +2 -6
  68. package/dist/core/read/fonts.d.ts.map +1 -1
  69. package/dist/core/read/index.d.ts +3 -2
  70. package/dist/core/read/index.d.ts.map +1 -1
  71. package/dist/core/read/list.d.ts +15 -1
  72. package/dist/core/read/list.d.ts.map +1 -1
  73. package/dist/core/read/logo.d.ts +3 -3
  74. package/dist/core/read/logo.d.ts.map +1 -1
  75. package/dist/core/read/lookup.d.ts +2 -2
  76. package/dist/core/read/lookup.d.ts.map +1 -1
  77. package/dist/core/read/theme.d.ts +8 -0
  78. package/dist/core/read/theme.d.ts.map +1 -0
  79. package/dist/core/read/token.d.ts +6 -2
  80. package/dist/core/read/token.d.ts.map +1 -1
  81. package/dist/core/tokens/alias.d.ts +5 -3
  82. package/dist/core/tokens/alias.d.ts.map +1 -1
  83. package/dist/core/tokens/contexts.d.ts +11 -3
  84. package/dist/core/tokens/contexts.d.ts.map +1 -1
  85. package/dist/core/tokens/formatters/json.d.ts +4 -1
  86. package/dist/core/tokens/formatters/json.d.ts.map +1 -1
  87. package/dist/core/tokens/key-lines.d.ts.map +1 -1
  88. package/dist/core/tokens/merge.d.ts.map +1 -1
  89. package/dist/core/tokens/resolver/compile.d.ts.map +1 -1
  90. package/dist/core/tokens/resolver/parse.d.ts.map +1 -1
  91. package/dist/core/tokens/resolver/sources.d.ts.map +1 -1
  92. package/dist/core/tokens/walk.d.ts.map +1 -1
  93. package/dist/index.js +34 -34
  94. package/dist/plugins/host/call.d.ts.map +1 -1
  95. package/dist/plugins/roles/roles.d.ts.map +1 -1
  96. package/dist/server/plugin.d.ts.map +1 -1
  97. package/dist/types/assets.d.ts +19 -1
  98. package/dist/types/assets.d.ts.map +1 -1
  99. package/dist/types/parsed.d.ts +8 -0
  100. package/dist/types/parsed.d.ts.map +1 -1
  101. package/dist/types/tokens.d.ts +12 -0
  102. package/dist/types/tokens.d.ts.map +1 -1
  103. package/dist/ui/assets/index-b4HhGGrn.js +82 -0
  104. package/dist/ui/assets/index-pE1ku5gt.css +2 -0
  105. package/dist/ui/index.html +2 -2
  106. package/mcp/dist/index.js +358 -45
  107. package/package.json +3 -2
  108. package/plugins/blazon.brand-deck/README.md +1 -1
  109. package/plugins/blazon.brand-deck/bin/blazon-blazon.brand-deck./360/237/224/214 +106 -13
  110. package/plugins/blazon.favicons/bin/blazon-blazon.favicons./360/237/224/214 +120 -12
  111. package/plugins/blazon.logo-geometry/bin/blazon-blazon.logo-geometry./360/237/224/214 +45 -1
  112. package/plugins/blazon.logo-kit/bin/blazon-blazon.logo-kit./360/237/224/214 +45 -1
  113. package/plugins/blazon.office-template/bin/blazon-blazon.office-template./360/237/224/214 +66 -3
  114. package/plugins/blazon.platform-tokens/README.md +1 -1
  115. package/plugins/blazon.press-kit/README.md +17 -9
  116. package/plugins/blazon.press-kit/bin/blazon-blazon.press-kit./360/237/224/214 +621 -101
  117. package/plugins/blazon.print-book/README.md +16 -1
  118. package/plugins/blazon.social-cards/bin/blazon-blazon.social-cards./360/237/224/214 +59 -3
  119. package/plugins/shipped.lock +9 -9
  120. package/dist/ui/assets/index-Biy1hkeq.css +0 -2
  121. package/dist/ui/assets/index-dkJG6W9p.js +0 -82
package/mcp/dist/index.js CHANGED
@@ -21612,7 +21612,7 @@ function typeOk(type, value) {
21612
21612
  }
21613
21613
  /**
21614
21614
  * Checks `value` against a schema and returns what is wrong, one sentence each, as a list that is empty when the value fits. Understands
21615
- * type, enum, pattern, maxLength, minimum, maximum, items, properties, required and additionalProperties; any other keyword is ignored.
21615
+ * type, enum, pattern, maxLength, minimum, maximum, minItems, maxItems, items, properties, required and additionalProperties; any other keyword is ignored.
21616
21616
  * The one check for the arguments of a tool call and for the answer the server sends back.
21617
21617
  */
21618
21618
  function checkAgainst(schema, value, at = "the value") {
@@ -21628,6 +21628,10 @@ function checkAgainst(schema, value, at = "the value") {
21628
21628
  if (typeof schema.minimum === "number" && value < schema.minimum) problems.push(`${at} must be at least ${schema.minimum}`);
21629
21629
  if (typeof schema.maximum === "number" && value > schema.maximum) problems.push(`${at} must be at most ${schema.maximum}`);
21630
21630
  }
21631
+ if (Array.isArray(value)) {
21632
+ if (typeof schema.minItems === "number" && value.length < schema.minItems) problems.push(`${at} must have at least ${schema.minItems} items`);
21633
+ if (typeof schema.maxItems === "number" && value.length > schema.maxItems) problems.push(`${at} must have at most ${schema.maxItems} items`);
21634
+ }
21631
21635
  if (Array.isArray(value) && isRecord(schema.items)) value.forEach((item, i) => problems.push(...checkAgainst(schema.items, item, `${at}[${i}]`)));
21632
21636
  if (isRecord(value)) {
21633
21637
  const properties = isRecord(schema.properties) ? schema.properties : {};
@@ -21668,7 +21672,7 @@ var OPERATIONS = [
21668
21672
  {
21669
21673
  name: "check_brand",
21670
21674
  title: "Check the brand",
21671
- description: "Runs blazon check on the brand, without plugins, and returns its findings and counts. Plugins in blazon.json do not run, so the counts can be lower than `blazon check` prints, but only for a plugin with a check role; a build-only plugin adds no finding. `pluginsSkipped` and `warnings` list every configured plugin, since a role is known only by starting the plugin. `passed` is false when the brand has errors, and values read from such a brand can be wrong. Returns at most `limit` findings (default 50, at most 500); `counts` stay whole. Not for reading a value: use get_token.",
21675
+ description: "Runs blazon check on the brand, without plugins, and returns its findings and counts. Plugins in blazon.json do not run, so the counts can be lower than `blazon check` prints, but only for a plugin with a check role; a build-only plugin adds no finding. `pluginsSkipped` and `warnings` list every configured plugin, since a role is known only by starting the plugin. `passed` is false when the brand's own data has errors (`brandHasErrors`), and values read from such a brand can be wrong; a `pin-mismatch` finding is listed and counted but does not make `passed` false, and is also in `pinMismatch`. Returns at most `limit` findings (default 50, at most 500); `counts` stay whole. Not for reading a value: use get_token.",
21672
21676
  annotations: {
21673
21677
  readOnlyHint: true,
21674
21678
  destructiveHint: false,
@@ -21707,7 +21711,31 @@ var OPERATIONS = [
21707
21711
  },
21708
21712
  brandHasErrors: {
21709
21713
  type: "boolean",
21710
- description: "True when the brand has errors, so values read from it may be wrong. Run check_brand to see them"
21714
+ description: "True when the brand's own data has error findings, so a value read from it may be wrong. Run check_brand to see them. A blazon.lock that names another blazon build does not set it: that is `pinMismatch`"
21715
+ },
21716
+ pinMismatch: {
21717
+ type: "object",
21718
+ properties: {
21719
+ pinned: {
21720
+ type: "string",
21721
+ description: "The blazon build blazon.lock names, as blazon prints it (12 hex digits)"
21722
+ },
21723
+ running: {
21724
+ type: "string",
21725
+ description: "The blazon build running, as blazon prints it, or \"unknown\" when it cannot say"
21726
+ },
21727
+ message: {
21728
+ type: "string",
21729
+ description: "One line: which build the book is pinned to, which is running, and what to do"
21730
+ }
21731
+ },
21732
+ required: [
21733
+ "pinned",
21734
+ "running",
21735
+ "message"
21736
+ ],
21737
+ additionalProperties: {},
21738
+ description: "Present only when blazon.lock names a different blazon build than the one running. The build and the book disagree; no token or value is wrong because of it, so there is no need to re-check values. Tell the user. `blazon check`, `build` and `tokens` refuse until it is fixed"
21711
21739
  },
21712
21740
  truncated: {
21713
21741
  description: "True when the answer was cut to fit the size limit. `notice` says how to narrow the question",
@@ -21719,7 +21747,7 @@ var OPERATIONS = [
21719
21747
  },
21720
21748
  passed: {
21721
21749
  type: "boolean",
21722
- description: "True when the brand has no errors"
21750
+ description: "True when no finding other than the pin family is an error. A pin-mismatch alone leaves it true"
21723
21751
  },
21724
21752
  counts: {
21725
21753
  type: "object",
@@ -21803,7 +21831,7 @@ var OPERATIONS = [
21803
21831
  {
21804
21832
  name: "list_tokens",
21805
21833
  title: "List the tokens",
21806
- description: "Lists the design tokens of the brand, or of one group, or of one type, each with its path, type and value, in the order the token files write them. Use it to find a path or to read many values at once. For a token's CSS variable names and rules use get_token; for the brand's usage rules use get_rules. An answer over 40000 characters is cut to whole tokens, and `tokensTotal` says how many matched: narrow with `group` or `type`.",
21834
+ description: "Lists the design tokens of the brand, or of one group, type or tier, each with its path, type, tier and value, in the order the token files write them. Use it to find a path or to read many values at once. `tier` (primitive, semantic or component) keeps to one layer of the brand. `theme` gives the values as that theme resolves them, and `defaultValue` on a token the theme changes; `themes` names the themes the brand has. For a token's CSS variable names and rules use get_token; for the brand's usage rules use get_rules. An answer over 40000 characters is cut to whole tokens, and `tokensTotal` says how many matched: narrow with `group`, `type` or `tier`.",
21807
21835
  annotations: {
21808
21836
  readOnlyHint: true,
21809
21837
  destructiveHint: false,
@@ -21825,6 +21853,18 @@ var OPERATIONS = [
21825
21853
  maxLength: 40,
21826
21854
  pattern: "^[A-Za-z0-9_][A-Za-z0-9_-]*$"
21827
21855
  },
21856
+ tier: {
21857
+ description: "A tier: primitive, semantic or component. Leave out for every tier. An unknown tier is refused with the list of tiers",
21858
+ type: "string",
21859
+ maxLength: 40,
21860
+ pattern: "^[A-Za-z0-9_][A-Za-z0-9_-]*$"
21861
+ },
21862
+ theme: {
21863
+ type: "string",
21864
+ maxLength: 200,
21865
+ pattern: "^[A-Za-z0-9_][A-Za-z0-9_-]*$",
21866
+ description: "List the values in this context of the resolver's theme modifier, such as dark. An unknown theme is refused with the list of themes. Default: the default tokens"
21867
+ },
21828
21868
  dir: {
21829
21869
  type: "string",
21830
21870
  description: "The brand folder. Default: the current folder"
@@ -21842,7 +21882,31 @@ var OPERATIONS = [
21842
21882
  },
21843
21883
  brandHasErrors: {
21844
21884
  type: "boolean",
21845
- description: "True when the brand has errors, so values read from it may be wrong. Run check_brand to see them"
21885
+ description: "True when the brand's own data has error findings, so a value read from it may be wrong. Run check_brand to see them. A blazon.lock that names another blazon build does not set it: that is `pinMismatch`"
21886
+ },
21887
+ pinMismatch: {
21888
+ type: "object",
21889
+ properties: {
21890
+ pinned: {
21891
+ type: "string",
21892
+ description: "The blazon build blazon.lock names, as blazon prints it (12 hex digits)"
21893
+ },
21894
+ running: {
21895
+ type: "string",
21896
+ description: "The blazon build running, as blazon prints it, or \"unknown\" when it cannot say"
21897
+ },
21898
+ message: {
21899
+ type: "string",
21900
+ description: "One line: which build the book is pinned to, which is running, and what to do"
21901
+ }
21902
+ },
21903
+ required: [
21904
+ "pinned",
21905
+ "running",
21906
+ "message"
21907
+ ],
21908
+ additionalProperties: {},
21909
+ description: "Present only when blazon.lock names a different blazon build than the one running. The build and the book disagree; no token or value is wrong because of it, so there is no need to re-check values. Tell the user. `blazon check`, `build` and `tokens` refuse until it is fixed"
21846
21910
  },
21847
21911
  truncated: {
21848
21912
  description: "True when the answer was cut to fit the size limit. `notice` says how to narrow the question",
@@ -21860,6 +21924,19 @@ var OPERATIONS = [
21860
21924
  description: "The type asked for. Absent when every type was listed",
21861
21925
  type: "string"
21862
21926
  },
21927
+ tier: {
21928
+ description: "The tier asked for. Absent when every tier was listed",
21929
+ type: "string"
21930
+ },
21931
+ theme: {
21932
+ description: "The theme the values are resolved in. Absent when the default tokens were listed",
21933
+ type: "string"
21934
+ },
21935
+ themes: {
21936
+ description: "The names of the themes the brand has, to pass as `theme`. Absent when the brand has no resolver theme modifier",
21937
+ type: "array",
21938
+ items: { type: "string" }
21939
+ },
21863
21940
  tokens: {
21864
21941
  type: "array",
21865
21942
  items: {
@@ -21877,7 +21954,12 @@ var OPERATIONS = [
21877
21954
  aliasOf: {
21878
21955
  description: "The token this one is an alias of, when it is one",
21879
21956
  type: "string"
21880
- }
21957
+ },
21958
+ tier: {
21959
+ description: "primitive, semantic or component, when the brand writes one",
21960
+ type: "string"
21961
+ },
21962
+ defaultValue: { description: "With `theme`: the value in the default tokens, present only when the theme changes it" }
21881
21963
  },
21882
21964
  required: ["path", "value"],
21883
21965
  additionalProperties: {}
@@ -21903,20 +21985,33 @@ var OPERATIONS = [
21903
21985
  cliOnly: ["dir"],
21904
21986
  folder: "group",
21905
21987
  summary: "List the tokens: path, type and value, and the token each aliases. With a group path, only the tokens in that group",
21906
- options: [{
21907
- property: "json",
21908
- description: "Print the list as JSON on standard output"
21909
- }, {
21910
- property: "type",
21911
- value: "type",
21912
- description: "List only the tokens of one $type (color, dimension, fontFamily, ...)"
21913
- }]
21988
+ options: [
21989
+ {
21990
+ property: "json",
21991
+ description: "Print the list as JSON on standard output"
21992
+ },
21993
+ {
21994
+ property: "type",
21995
+ value: "type",
21996
+ description: "List only the tokens of one $type (color, dimension, fontFamily, ...)"
21997
+ },
21998
+ {
21999
+ property: "tier",
22000
+ value: "tier",
22001
+ description: "List only the tokens of one tier: primitive, semantic or component"
22002
+ },
22003
+ {
22004
+ property: "theme",
22005
+ value: "name",
22006
+ description: "list the values as this context of the resolver's theme modifier resolves them (such as dark), and the default value of each token it changes; exits 2 for an unknown theme"
22007
+ }
22008
+ ]
21914
22009
  }
21915
22010
  },
21916
22011
  {
21917
22012
  name: "get_token",
21918
22013
  title: "Read a token",
21919
- description: "Looks up one design token of the brand: its value, type, the CSS variable names it gets, and the rules that apply to it. Use it for the value of a path you know; a group path is refused. For a path you do not know use list_tokens.",
22014
+ description: "Looks up one design token of the brand: its value, type, the CSS variable names it gets, and the rules that apply to it. Use it for the value of a path you know; a group path is refused. With `theme` the value is the one that theme resolves, and `defaultValue` is the default one when it differs. For a path you do not know use list_tokens.",
21920
22015
  annotations: {
21921
22016
  readOnlyHint: true,
21922
22017
  destructiveHint: false,
@@ -21932,6 +22027,12 @@ var OPERATIONS = [
21932
22027
  pattern: "^[A-Za-z0-9_][A-Za-z0-9_-]*(\\.[A-Za-z0-9_][A-Za-z0-9_-]*)*$",
21933
22028
  description: "The token path, for example color.brand.primary. A path from list_tokens works"
21934
22029
  },
22030
+ theme: {
22031
+ type: "string",
22032
+ maxLength: 200,
22033
+ pattern: "^[A-Za-z0-9_][A-Za-z0-9_-]*$",
22034
+ description: "Read the value in this context of the resolver's theme modifier, such as dark. An unknown theme is refused with the list of themes. Default: the default tokens"
22035
+ },
21935
22036
  dir: {
21936
22037
  type: "string",
21937
22038
  description: "The brand folder. Default: the current folder"
@@ -21950,7 +22051,31 @@ var OPERATIONS = [
21950
22051
  },
21951
22052
  brandHasErrors: {
21952
22053
  type: "boolean",
21953
- description: "True when the brand has errors, so values read from it may be wrong. Run check_brand to see them"
22054
+ description: "True when the brand's own data has error findings, so a value read from it may be wrong. Run check_brand to see them. A blazon.lock that names another blazon build does not set it: that is `pinMismatch`"
22055
+ },
22056
+ pinMismatch: {
22057
+ type: "object",
22058
+ properties: {
22059
+ pinned: {
22060
+ type: "string",
22061
+ description: "The blazon build blazon.lock names, as blazon prints it (12 hex digits)"
22062
+ },
22063
+ running: {
22064
+ type: "string",
22065
+ description: "The blazon build running, as blazon prints it, or \"unknown\" when it cannot say"
22066
+ },
22067
+ message: {
22068
+ type: "string",
22069
+ description: "One line: which build the book is pinned to, which is running, and what to do"
22070
+ }
22071
+ },
22072
+ required: [
22073
+ "pinned",
22074
+ "running",
22075
+ "message"
22076
+ ],
22077
+ additionalProperties: {},
22078
+ description: "Present only when blazon.lock names a different blazon build than the one running. The build and the book disagree; no token or value is wrong because of it, so there is no need to re-check values. Tell the user. `blazon check`, `build` and `tokens` refuse until it is fixed"
21954
22079
  },
21955
22080
  truncated: {
21956
22081
  description: "True when the answer was cut to fit the size limit. `notice` says how to narrow the question",
@@ -21972,7 +22097,16 @@ var OPERATIONS = [
21972
22097
  description: "The token type, such as color",
21973
22098
  type: "string"
21974
22099
  },
21975
- value: { description: "The value as CSS needs it, with aliases resolved" }
22100
+ value: { description: "The value as CSS needs it, with aliases resolved; with `theme`, as that theme resolves it" },
22101
+ defaultValue: { description: "With `theme`: the value in the default tokens, present only when the theme changes it" },
22102
+ theme: {
22103
+ description: "The theme the value is resolved in. Absent for the default tokens",
22104
+ type: "string"
22105
+ },
22106
+ tier: {
22107
+ description: "primitive, semantic or component, when the brand writes one",
22108
+ type: "string"
22109
+ }
21976
22110
  },
21977
22111
  required: ["path", "value"],
21978
22112
  additionalProperties: {}
@@ -21988,6 +22122,10 @@ var OPERATIONS = [
21988
22122
  cliOnly: ["dir"],
21989
22123
  summary: "Read one token: its value, type, CSS variable name in theme.css, its usage, pairs and logo rules, and the file it is in. To find a path, use blazon list",
21990
22124
  options: [{
22125
+ property: "theme",
22126
+ value: "name",
22127
+ description: "read the value as this context of the resolver's theme modifier resolves it (such as dark), and the default value when it differs; exits 2 for an unknown theme"
22128
+ }, {
21991
22129
  property: "json",
21992
22130
  description: "Print the token as JSON on standard output"
21993
22131
  }]
@@ -22029,7 +22167,31 @@ var OPERATIONS = [
22029
22167
  },
22030
22168
  brandHasErrors: {
22031
22169
  type: "boolean",
22032
- description: "True when the brand has errors, so values read from it may be wrong. Run check_brand to see them"
22170
+ description: "True when the brand's own data has error findings, so a value read from it may be wrong. Run check_brand to see them. A blazon.lock that names another blazon build does not set it: that is `pinMismatch`"
22171
+ },
22172
+ pinMismatch: {
22173
+ type: "object",
22174
+ properties: {
22175
+ pinned: {
22176
+ type: "string",
22177
+ description: "The blazon build blazon.lock names, as blazon prints it (12 hex digits)"
22178
+ },
22179
+ running: {
22180
+ type: "string",
22181
+ description: "The blazon build running, as blazon prints it, or \"unknown\" when it cannot say"
22182
+ },
22183
+ message: {
22184
+ type: "string",
22185
+ description: "One line: which build the book is pinned to, which is running, and what to do"
22186
+ }
22187
+ },
22188
+ required: [
22189
+ "pinned",
22190
+ "running",
22191
+ "message"
22192
+ ],
22193
+ additionalProperties: {},
22194
+ description: "Present only when blazon.lock names a different blazon build than the one running. The build and the book disagree; no token or value is wrong because of it, so there is no need to re-check values. Tell the user. `blazon check`, `build` and `tokens` refuse until it is fixed"
22033
22195
  },
22034
22196
  truncated: {
22035
22197
  description: "True when the answer was cut to fit the size limit. `notice` says how to narrow the question",
@@ -22077,7 +22239,7 @@ var OPERATIONS = [
22077
22239
  {
22078
22240
  name: "can_use",
22079
22241
  title: "Can this color be used here",
22080
- description: "Answers whether one color token may be text on another color token, by the brand rules. Set `role` to ui for a focus ring, border or icon stroke: it is judged against the 3:1 non-text contrast and the pairs rules do not apply. A denied answer is a normal result (`allowed` is false, `reason` names the rule), not an error. For a color you have not picked, find one with list_tokens and type color.",
22242
+ description: "Answers whether one color token may be text on another color token, by the brand rules. Give `fg` and `bg` for one pair, or `pairs` (at most 50) for several in one call: the answer then has one result per pair, in order, and `allowed` is true only when every pair is. Exactly one of the two forms. Set `role` to ui for a focus ring, border or icon stroke: it is judged against the 3:1 non-text contrast and the pairs rules do not apply. `verbose` false leaves out the `checks` of an allowed answer; a denial keeps them. A denied answer is a normal result (`allowed` is false, `reason` names the rule), not an error. Pairs come only from the `pairs` rules of token groups; component tokens are not read for them. For a color you have not picked, find one with list_tokens and type color.",
22081
22243
  annotations: {
22082
22244
  readOnlyHint: true,
22083
22245
  destructiveHint: false,
@@ -22091,13 +22253,43 @@ var OPERATIONS = [
22091
22253
  type: "string",
22092
22254
  maxLength: 200,
22093
22255
  pattern: "^[A-Za-z0-9_][A-Za-z0-9_-]*(\\.[A-Za-z0-9_][A-Za-z0-9_-]*)*$",
22094
- description: "The text color token path, for example text.primary"
22256
+ description: "The text color token path, for example text.primary. Give it with bg, or give pairs instead"
22095
22257
  },
22096
22258
  bg: {
22097
22259
  type: "string",
22098
22260
  maxLength: 200,
22099
22261
  pattern: "^[A-Za-z0-9_][A-Za-z0-9_-]*(\\.[A-Za-z0-9_][A-Za-z0-9_-]*)*$",
22100
- description: "The background color token path, for example surface.background"
22262
+ description: "The background color token path, for example surface.background. Give it with fg, or give pairs instead"
22263
+ },
22264
+ pairs: {
22265
+ type: "array",
22266
+ minItems: 1,
22267
+ maxItems: 50,
22268
+ description: "Several pairs to judge in one call, each a text color token fg and a background color token bg, in place of fg and bg. At most 50",
22269
+ items: {
22270
+ type: "object",
22271
+ properties: {
22272
+ fg: {
22273
+ type: "string",
22274
+ maxLength: 200,
22275
+ pattern: "^[A-Za-z0-9_][A-Za-z0-9_-]*(\\.[A-Za-z0-9_][A-Za-z0-9_-]*)*$",
22276
+ description: "The text color token path"
22277
+ },
22278
+ bg: {
22279
+ type: "string",
22280
+ maxLength: 200,
22281
+ pattern: "^[A-Za-z0-9_][A-Za-z0-9_-]*(\\.[A-Za-z0-9_][A-Za-z0-9_-]*)*$",
22282
+ description: "The background color token path"
22283
+ }
22284
+ },
22285
+ required: ["fg", "bg"],
22286
+ additionalProperties: false
22287
+ }
22288
+ },
22289
+ verbose: {
22290
+ type: "boolean",
22291
+ default: true,
22292
+ description: "False leaves out the `checks` of an answer that is allowed, which shortens the answer; a denial keeps its checks, since they are the reason. Default: true"
22101
22293
  },
22102
22294
  role: {
22103
22295
  type: "string",
@@ -22116,7 +22308,6 @@ var OPERATIONS = [
22116
22308
  description: "The brand folder. Default: the current folder"
22117
22309
  }
22118
22310
  },
22119
- required: ["fg", "bg"],
22120
22311
  additionalProperties: false
22121
22312
  },
22122
22313
  outputSchema: {
@@ -22129,7 +22320,31 @@ var OPERATIONS = [
22129
22320
  },
22130
22321
  brandHasErrors: {
22131
22322
  type: "boolean",
22132
- description: "True when the brand has errors, so values read from it may be wrong. Run check_brand to see them"
22323
+ description: "True when the brand's own data has error findings, so a value read from it may be wrong. Run check_brand to see them. A blazon.lock that names another blazon build does not set it: that is `pinMismatch`"
22324
+ },
22325
+ pinMismatch: {
22326
+ type: "object",
22327
+ properties: {
22328
+ pinned: {
22329
+ type: "string",
22330
+ description: "The blazon build blazon.lock names, as blazon prints it (12 hex digits)"
22331
+ },
22332
+ running: {
22333
+ type: "string",
22334
+ description: "The blazon build running, as blazon prints it, or \"unknown\" when it cannot say"
22335
+ },
22336
+ message: {
22337
+ type: "string",
22338
+ description: "One line: which build the book is pinned to, which is running, and what to do"
22339
+ }
22340
+ },
22341
+ required: [
22342
+ "pinned",
22343
+ "running",
22344
+ "message"
22345
+ ],
22346
+ additionalProperties: {},
22347
+ description: "Present only when blazon.lock names a different blazon build than the one running. The build and the book disagree; no token or value is wrong because of it, so there is no need to re-check values. Tell the user. `blazon check`, `build` and `tokens` refuse until it is fixed"
22133
22348
  },
22134
22349
  truncated: {
22135
22350
  description: "True when the answer was cut to fit the size limit. `notice` says how to narrow the question",
@@ -22141,7 +22356,12 @@ var OPERATIONS = [
22141
22356
  },
22142
22357
  allowed: {
22143
22358
  type: "boolean",
22144
- description: "True when the brand allows this text color on this background"
22359
+ description: "True when the brand allows this text color on this background; with `pairs`, true when it allows every pair"
22360
+ },
22361
+ results: {
22362
+ description: "With `pairs`: one answer for each pair, in order, each with the fields of a single answer: fg, bg, allowed, reason, role, contrast and, unless `verbose` is false and the pair is allowed, checks",
22363
+ type: "array",
22364
+ items: { type: "object" }
22145
22365
  },
22146
22366
  reason: {
22147
22367
  type: "string",
@@ -22172,8 +22392,7 @@ var OPERATIONS = [
22172
22392
  required: [
22173
22393
  "warnings",
22174
22394
  "brandHasErrors",
22175
- "allowed",
22176
- "reason"
22395
+ "allowed"
22177
22396
  ],
22178
22397
  additionalProperties: {}
22179
22398
  },
@@ -22186,8 +22405,21 @@ var OPERATIONS = [
22186
22405
  "dir"
22187
22406
  ],
22188
22407
  cliOnly: ["dir"],
22189
- summary: "Ask whether the foreground token may be text (or, with --role ui, a border or focus ring) on the background token, by the brand rules; exits 0 allowed, 1 denied, 2 unknown token",
22408
+ folder: "fg",
22409
+ summary: "Ask whether the foreground token may be text (or, with --role ui, a border or focus ring) on the background token, by the brand rules; exits 0 allowed, 1 denied, 2 unknown token. Several pairs: --pair fg:bg, repeated",
22190
22410
  options: [
22411
+ {
22412
+ property: "pairs",
22413
+ flag: "pair",
22414
+ value: "fg:bg",
22415
+ items: ["fg", "bg"],
22416
+ description: "judge this pair, in place of the fg and bg arguments; repeat the flag for up to 50 pairs, one result each, in order; exits 0 when every pair is allowed, else 1"
22417
+ },
22418
+ {
22419
+ property: "verbose",
22420
+ flag: "no-verbose",
22421
+ description: "leave out the checks of an allowed answer, which are all it adds to the reason; a denial keeps them"
22422
+ },
22191
22423
  {
22192
22424
  property: "role",
22193
22425
  value: "text|ui",
@@ -22195,7 +22427,7 @@ var OPERATIONS = [
22195
22427
  },
22196
22428
  {
22197
22429
  property: "theme",
22198
- value: "<name>",
22430
+ value: "name",
22199
22431
  description: "judge the pair in this context of the resolver's theme modifier (such as dark); exits 2 for an unknown theme"
22200
22432
  },
22201
22433
  {
@@ -22244,7 +22476,31 @@ var OPERATIONS = [
22244
22476
  },
22245
22477
  brandHasErrors: {
22246
22478
  type: "boolean",
22247
- description: "True when the brand has errors, so values read from it may be wrong. Run check_brand to see them"
22479
+ description: "True when the brand's own data has error findings, so a value read from it may be wrong. Run check_brand to see them. A blazon.lock that names another blazon build does not set it: that is `pinMismatch`"
22480
+ },
22481
+ pinMismatch: {
22482
+ type: "object",
22483
+ properties: {
22484
+ pinned: {
22485
+ type: "string",
22486
+ description: "The blazon build blazon.lock names, as blazon prints it (12 hex digits)"
22487
+ },
22488
+ running: {
22489
+ type: "string",
22490
+ description: "The blazon build running, as blazon prints it, or \"unknown\" when it cannot say"
22491
+ },
22492
+ message: {
22493
+ type: "string",
22494
+ description: "One line: which build the book is pinned to, which is running, and what to do"
22495
+ }
22496
+ },
22497
+ required: [
22498
+ "pinned",
22499
+ "running",
22500
+ "message"
22501
+ ],
22502
+ additionalProperties: {},
22503
+ description: "Present only when blazon.lock names a different blazon build than the one running. The build and the book disagree; no token or value is wrong because of it, so there is no need to re-check values. Tell the user. `blazon check`, `build` and `tokens` refuse until it is fixed"
22248
22504
  },
22249
22505
  truncated: {
22250
22506
  description: "True when the answer was cut to fit the size limit. `notice` says how to narrow the question",
@@ -22328,7 +22584,31 @@ var OPERATIONS = [
22328
22584
  },
22329
22585
  brandHasErrors: {
22330
22586
  type: "boolean",
22331
- description: "True when the brand has errors, so values read from it may be wrong. Run check_brand to see them"
22587
+ description: "True when the brand's own data has error findings, so a value read from it may be wrong. Run check_brand to see them. A blazon.lock that names another blazon build does not set it: that is `pinMismatch`"
22588
+ },
22589
+ pinMismatch: {
22590
+ type: "object",
22591
+ properties: {
22592
+ pinned: {
22593
+ type: "string",
22594
+ description: "The blazon build blazon.lock names, as blazon prints it (12 hex digits)"
22595
+ },
22596
+ running: {
22597
+ type: "string",
22598
+ description: "The blazon build running, as blazon prints it, or \"unknown\" when it cannot say"
22599
+ },
22600
+ message: {
22601
+ type: "string",
22602
+ description: "One line: which build the book is pinned to, which is running, and what to do"
22603
+ }
22604
+ },
22605
+ required: [
22606
+ "pinned",
22607
+ "running",
22608
+ "message"
22609
+ ],
22610
+ additionalProperties: {},
22611
+ description: "Present only when blazon.lock names a different blazon build than the one running. The build and the book disagree; no token or value is wrong because of it, so there is no need to re-check values. Tell the user. `blazon check`, `build` and `tokens` refuse until it is fixed"
22332
22612
  },
22333
22613
  truncated: {
22334
22614
  description: "True when the answer was cut to fit the size limit. `notice` says how to narrow the question",
@@ -22400,7 +22680,16 @@ function commandFor(op, args) {
22400
22680
  const flags = mcp.flags ?? (cli?.options ?? []).map((option) => option.property).filter((name) => name !== "json" && !positional.includes(name) && !only.has(name));
22401
22681
  const argv = [...words, ...mcp.fixed ?? []];
22402
22682
  for (const name of positional) if (args[name] !== void 0) argv.push(String(args[name]));
22403
- for (const name of flags) if (args[name] !== void 0) argv.push(`--${kebab(name)}=${String(args[name])}`);
22683
+ for (const name of flags) {
22684
+ const value = args[name];
22685
+ if (value === void 0) continue;
22686
+ const option = cli?.options.find((o) => o.property === name);
22687
+ const flag = option?.flag ?? kebab(name);
22688
+ if (Array.isArray(value)) for (const item of value) argv.push(`--${flag}=${option?.items ? option.items.map((field) => String(item[field])).join(":") : String(item)}`);
22689
+ else if (flag.startsWith("no-")) {
22690
+ if (value === false) argv.push(`--${flag}`);
22691
+ } else argv.push(`--${flag}=${String(value)}`);
22692
+ }
22404
22693
  return {
22405
22694
  argv,
22406
22695
  options: {
@@ -22450,13 +22739,31 @@ function stripInvisible(value) {
22450
22739
  }
22451
22740
  /** The line that tells the model its answer was cleaned. */
22452
22741
  var removedNotice = (count) => `Removed ${count} invisible character(s) from the brand's text in this answer.`;
22742
+ /** The line `blazon list`, `get` and the other read commands print for a mismatch (src/core/blazon-pin.ts, pinMismatchLine). */
22743
+ var PIN_MISMATCH_LINE = /^blazon: pin mismatch \(pinned (\S+), running (.+?)\): (.+)$/;
22744
+ /** The mismatch in blazon's lines on standard error, or undefined. */
22745
+ function pinMismatchIn(warnings) {
22746
+ for (const line of warnings) {
22747
+ const m = PIN_MISMATCH_LINE.exec(line);
22748
+ if (m) return {
22749
+ pinned: m[1],
22750
+ running: m[2],
22751
+ message: m[3]
22752
+ };
22753
+ }
22754
+ }
22755
+ /**
22756
+ * Whether the brand's own data has errors, so a value may be wrong. blazon says so: `check --json` in its `brandHasErrors` field, and a read
22757
+ * command in an "N error(s)" line on standard error. A pin mismatch is neither: it is `pinMismatch`.
22758
+ */
22759
+ var hasBrandErrors = (document, warnings) => typeof document.brandHasErrors === "boolean" ? document.brandHasErrors : warnings.some((w) => /\b\d+ error\(s\)/.test(w));
22453
22760
  /**
22454
22761
  * A successful answer. `structuredContent` is blazon's document plus `warnings` (what blazon said on standard error) and `brandHasErrors`;
22455
22762
  * the text is the same JSON, compact, as the MCP spec asks for a client that reads only content. Warnings also come first as their own text
22456
22763
  * block, since a model reads that before it reads the value. A document over MAX_TEXT characters is cut in the text, and the
22457
22764
  * structured result then holds the notice, the warnings and, when the document has them, `counts` and `passed`.
22458
22765
  */
22459
- function answerWith(document, warnings, narrow = NARROW_BY_PATH, brandHasErrors = warnings.some((w) => /\b\d+ error\(s\)/.test(w))) {
22766
+ function answerWith(document, warnings, narrow = NARROW_BY_PATH, brandHasErrors = hasBrandErrors(document, warnings)) {
22460
22767
  const structured = {
22461
22768
  ...document,
22462
22769
  warnings,
@@ -22476,7 +22783,11 @@ function answerWith(document, warnings, narrow = NARROW_BY_PATH, brandHasErrors
22476
22783
  };
22477
22784
  const points = Array.from(json);
22478
22785
  const notice = `Truncated: the answer is ${points.length} characters (Unicode code points) and the limit is ${MAX_TEXT}; ${narrow}.`;
22479
- const whole = ["counts", "passed"].filter((key) => key in document).map((key) => [key, document[key]]);
22786
+ const whole = [
22787
+ "counts",
22788
+ "passed",
22789
+ "pinMismatch"
22790
+ ].filter((key) => key in document).map((key) => [key, document[key]]);
22480
22791
  return {
22481
22792
  content: [...lead, {
22482
22793
  type: "text",
@@ -22544,7 +22855,7 @@ function buildPageText(description) {
22544
22855
  * read from the packages installed at the repository root. The server's `version` is blazon's, since it ships inside blazon.
22545
22856
  */
22546
22857
  var VERSIONS = {
22547
- "blazon": "0.3.3",
22858
+ "blazon": "0.5.1",
22548
22859
  "sdk": "1.32.2",
22549
22860
  "zod": "4.6.7"
22550
22861
  };
@@ -22586,8 +22897,10 @@ var LOOKUPS = {
22586
22897
  check_brand: {
22587
22898
  narrow: NARROW_FINDINGS,
22588
22899
  notes: skippedPlugins,
22589
- shape: (document, args, warnings) => limitItems(document, "findings", Number(args.limit), NARROW_FINDINGS, warnings),
22590
- brandHasErrors: (document) => (document.counts?.errors ?? 0) > 0
22900
+ shape: (document, args, warnings) => ({
22901
+ ...limitItems(document, "findings", Number(args.limit), NARROW_FINDINGS, warnings),
22902
+ passed: document.brandHasErrors !== true
22903
+ })
22591
22904
  },
22592
22905
  list_tokens: {
22593
22906
  hint: "Call list_tokens with no arguments to see every path.",
@@ -22602,7 +22915,8 @@ var LOOKUPS = {
22602
22915
  get_rules: { hint: FIND_PATH },
22603
22916
  can_use: {
22604
22917
  hint: FIND_PATH,
22605
- narrow: NARROW_NONE
22918
+ narrow: "send fewer pairs, or set verbose to false",
22919
+ shape: (document, _args, warnings) => Array.isArray(document.results) ? limitItems(document, "results", Number.POSITIVE_INFINITY, "send fewer pairs, or set verbose to false", warnings) : document
22606
22920
  },
22607
22921
  get_fonts: { narrow: NARROW_NONE },
22608
22922
  get_logo: { narrow: NARROW_NONE }
@@ -22636,7 +22950,7 @@ function createServer(target, runner = new BlazonRunner(target)) {
22636
22950
  }, { instructions: INSTRUCTIONS });
22637
22951
  /** Runs a call; blazon's own error message becomes a tool error, and anything else is reported as one too. */
22638
22952
  async function answer(op, args) {
22639
- const { hint, narrow, shape, reword, brandHasErrors, notes } = LOOKUPS[op.name] ?? {};
22953
+ const { hint, narrow, shape, reword, notes } = LOOKUPS[op.name] ?? {};
22640
22954
  try {
22641
22955
  const { argv, options } = commandFor(op, args);
22642
22956
  const run = await runner.run(argv, options);
@@ -22650,14 +22964,13 @@ function createServer(target, runner = new BlazonRunner(target)) {
22650
22964
  ...cleaned.removed > 0 ? [removedNotice(cleaned.removed)] : [],
22651
22965
  ...extra.warnings
22652
22966
  ];
22653
- const shaped = shape ? shape({
22654
- ...cleaned.value,
22655
- ...extra.fields
22656
- }, args, warnings) : {
22967
+ const pin = cleaned.value.pinMismatch ?? pinMismatchIn(run.warnings);
22968
+ const whole = {
22657
22969
  ...cleaned.value,
22658
- ...extra.fields
22970
+ ...extra.fields,
22971
+ ...pin !== void 0 && { pinMismatch: stripInvisible(pin).value }
22659
22972
  };
22660
- return answerWith(shaped, warnings, narrow, brandHasErrors ? brandHasErrors(shaped) : run.warnings.some((w) => /\b\d+ error\(s\)/.test(w)));
22973
+ return answerWith(shape ? shape(whole, args, warnings) : whole, warnings, narrow, hasBrandErrors(cleaned.value, run.warnings));
22661
22974
  } catch (error) {
22662
22975
  if (error instanceof BlazonError) return failure(stripInvisible((error.fromBlazon ? reword?.(error.message, args) : void 0) ?? (error.fromBlazon && hint ? `${error.message} ${hint}` : error.message)).value);
22663
22976
  throw error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iksnerd/blazon",
3
- "version": "0.3.3",
3
+ "version": "0.5.1",
4
4
  "description": "Brand book and design token compiler: DTCG tokens, brand rules checked by blazon check, a static brand book that wears the brand",
5
5
  "type": "module",
6
6
  "bin": {
@@ -27,7 +27,8 @@
27
27
  "mcp/dist/index.js",
28
28
  "plugins",
29
29
  "template",
30
- "THIRD-PARTY-NOTICES.md"
30
+ "THIRD-PARTY-NOTICES.md",
31
+ "CHANGELOG.md"
31
32
  ],
32
33
  "workspaces": [
33
34
  "mcp"