@primer/brand-mcp 0.0.0-20260626120119

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 (90) hide show
  1. package/README.md +43 -0
  2. package/dist/brand/detect-framework.d.ts +13 -0
  3. package/dist/brand/detect-framework.js +48 -0
  4. package/dist/brand/detect-framework.js.map +1 -0
  5. package/dist/brand/docs-source.d.ts +40 -0
  6. package/dist/brand/docs-source.js +82 -0
  7. package/dist/brand/docs-source.js.map +1 -0
  8. package/dist/brand/resolve-assets.d.ts +14 -0
  9. package/dist/brand/resolve-assets.js +101 -0
  10. package/dist/brand/resolve-assets.js.map +1 -0
  11. package/dist/brand/resolve-install.d.ts +25 -0
  12. package/dist/brand/resolve-install.js +63 -0
  13. package/dist/brand/resolve-install.js.map +1 -0
  14. package/dist/catalog/load.d.ts +3 -0
  15. package/dist/catalog/load.js +18 -0
  16. package/dist/catalog/load.js.map +1 -0
  17. package/dist/catalog/types.d.ts +60 -0
  18. package/dist/catalog/types.js +15 -0
  19. package/dist/catalog/types.js.map +1 -0
  20. package/dist/catalog.json +9964 -0
  21. package/dist/index.d.ts +2 -0
  22. package/dist/index.js +15 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/logger.d.ts +12 -0
  25. package/dist/logger.js +18 -0
  26. package/dist/logger.js.map +1 -0
  27. package/dist/review/rules.d.ts +5 -0
  28. package/dist/review/rules.js +235 -0
  29. package/dist/review/rules.js.map +1 -0
  30. package/dist/review/types.d.ts +15 -0
  31. package/dist/review/types.js +6 -0
  32. package/dist/review/types.js.map +1 -0
  33. package/dist/server.d.ts +2 -0
  34. package/dist/server.js +53 -0
  35. package/dist/server.js.map +1 -0
  36. package/dist/tools/format.d.ts +15 -0
  37. package/dist/tools/format.js +23 -0
  38. package/dist/tools/format.js.map +1 -0
  39. package/dist/tools/primer-brand-asset/index.d.ts +1 -0
  40. package/dist/tools/primer-brand-asset/index.js +2 -0
  41. package/dist/tools/primer-brand-asset/index.js.map +1 -0
  42. package/dist/tools/primer-brand-asset/primer-brand-asset.d.ts +18 -0
  43. package/dist/tools/primer-brand-asset/primer-brand-asset.js +43 -0
  44. package/dist/tools/primer-brand-asset/primer-brand-asset.js.map +1 -0
  45. package/dist/tools/primer-brand-component/index.d.ts +1 -0
  46. package/dist/tools/primer-brand-component/index.js +2 -0
  47. package/dist/tools/primer-brand-component/index.js.map +1 -0
  48. package/dist/tools/primer-brand-component/primer-brand-component.d.ts +12 -0
  49. package/dist/tools/primer-brand-component/primer-brand-component.js +72 -0
  50. package/dist/tools/primer-brand-component/primer-brand-component.js.map +1 -0
  51. package/dist/tools/primer-brand-docs/index.d.ts +1 -0
  52. package/dist/tools/primer-brand-docs/index.js +2 -0
  53. package/dist/tools/primer-brand-docs/index.js.map +1 -0
  54. package/dist/tools/primer-brand-docs/primer-brand-docs.d.ts +15 -0
  55. package/dist/tools/primer-brand-docs/primer-brand-docs.js +56 -0
  56. package/dist/tools/primer-brand-docs/primer-brand-docs.js.map +1 -0
  57. package/dist/tools/primer-brand-examples/index.d.ts +1 -0
  58. package/dist/tools/primer-brand-examples/index.js +2 -0
  59. package/dist/tools/primer-brand-examples/index.js.map +1 -0
  60. package/dist/tools/primer-brand-examples/primer-brand-examples.d.ts +12 -0
  61. package/dist/tools/primer-brand-examples/primer-brand-examples.js +48 -0
  62. package/dist/tools/primer-brand-examples/primer-brand-examples.js.map +1 -0
  63. package/dist/tools/primer-brand-review/index.d.ts +1 -0
  64. package/dist/tools/primer-brand-review/index.js +2 -0
  65. package/dist/tools/primer-brand-review/index.js.map +1 -0
  66. package/dist/tools/primer-brand-review/primer-brand-review.d.ts +15 -0
  67. package/dist/tools/primer-brand-review/primer-brand-review.js +63 -0
  68. package/dist/tools/primer-brand-review/primer-brand-review.js.map +1 -0
  69. package/dist/tools/primer-brand-setup/index.d.ts +1 -0
  70. package/dist/tools/primer-brand-setup/index.js +2 -0
  71. package/dist/tools/primer-brand-setup/index.js.map +1 -0
  72. package/dist/tools/primer-brand-setup/primer-brand-setup.d.ts +12 -0
  73. package/dist/tools/primer-brand-setup/primer-brand-setup.js +126 -0
  74. package/dist/tools/primer-brand-setup/primer-brand-setup.js.map +1 -0
  75. package/dist/tools/primer-brand-tokens/index.d.ts +1 -0
  76. package/dist/tools/primer-brand-tokens/index.js +2 -0
  77. package/dist/tools/primer-brand-tokens/index.js.map +1 -0
  78. package/dist/tools/primer-brand-tokens/primer-brand-tokens.d.ts +18 -0
  79. package/dist/tools/primer-brand-tokens/primer-brand-tokens.js +93 -0
  80. package/dist/tools/primer-brand-tokens/primer-brand-tokens.js.map +1 -0
  81. package/dist/tools/register.d.ts +3 -0
  82. package/dist/tools/register.js +45 -0
  83. package/dist/tools/register.js.map +1 -0
  84. package/dist/tools/types.d.ts +34 -0
  85. package/dist/tools/types.js +2 -0
  86. package/dist/tools/types.js.map +1 -0
  87. package/dist/util/text.d.ts +8 -0
  88. package/dist/util/text.js +31 -0
  89. package/dist/util/text.js.map +1 -0
  90. package/package.json +65 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primer-brand-component.js","sourceRoot":"","sources":["../../../src/tools/primer-brand-component/primer-brand-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAGrB,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAC,qBAAqB,EAAE,UAAU,EAAE,WAAW,EAAC,MAAM,cAAc,CAAA;AAG3E,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,kFAAkF,CAAC;CAChG,CAAC,CAAA;AAIF,MAAM,WAAW,GAAG,2eAA2e,CAAA;AAE/f,SAAS,cAAc,CAAC,GAAgB;IACtC,MAAM,EAAC,UAAU,EAAC,GAAG,GAAG,CAAC,OAAO,CAAA;IAChC,IAAI,UAAU,CAA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AiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAE/C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,qBAAqB,CAAC;SAC9D,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;SACX,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAA;IACzC,MAAM,IAAI,GACR,WAAW,CAAC,MAAM,GAAG,CAAC;QACpB,CAAC,CAAC,iBAAiB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;QAC5C,CAAC,CAAC,0EAA0E,CAAA;IAChF,OAAO;QACL,IAAI,EAAE,8CAA8C,IAAI,OAAO,IAAI,OAAO,WAAW,CAAC,GAAG,CAAC,EAAE;QAC5F,OAAO,EAAE,IAAI;KACd,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAsB;IACzD,IAAI,EAAE,wBAAwB;IAC9B,KAAK,EAAE,kCAAkC;IACzC,WAAW;IACX,UAAU,EAAE,WAAW,CAAC,KAAK;IAC7B,WAAW,EAAE,EAAC,YAAY,EAAE,IAAI,EAAC;IACjC,GAAG,CAAC,KAAK,EAAE,GAAG;QACZ,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAA;IACzE,CAAC;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ export * from './primer-brand-docs.js';
@@ -0,0 +1,2 @@
1
+ export * from './primer-brand-docs.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/primer-brand-docs/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import type { ToolModule } from '../types.js';
3
+ declare const inputSchema: z.ZodObject<{
4
+ query: z.ZodOptional<z.ZodString>;
5
+ path: z.ZodOptional<z.ZodString>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ path?: string | undefined;
8
+ query?: string | undefined;
9
+ }, {
10
+ path?: string | undefined;
11
+ query?: string | undefined;
12
+ }>;
13
+ type Input = z.infer<typeof inputSchema>;
14
+ export declare const primerBrandDocsTool: ToolModule<Input>;
15
+ export {};
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ import { rank } from '../../util/text.js';
3
+ import { versionNote } from '../format.js';
4
+ const inputSchema = z.object({
5
+ query: z.string().optional().describe('Search guidance, e.g. "accessibility", "color usage", "getting started".'),
6
+ path: z.string().optional().describe('Read a specific doc by its path (from a previous search result).'),
7
+ });
8
+ const description = `Search and read Primer Brand guidance — principles, accessibility, content, and getting started. Prefers the version-pinned docs bundled with the installed @primer/react-brand, falling back to the live site (https://primer.style/brand) for general guidance. This is brand concepts and how-to, not component APIs (use primer_brand_component for those).`;
9
+ async function readPath(path, ctx) {
10
+ const doc = await ctx.docs.read(path);
11
+ if (!doc) {
12
+ return {
13
+ text: `Could not read \`${path}\`. Run \`primer_brand_docs\` with a \`query\` to find valid paths.`,
14
+ isError: true,
15
+ };
16
+ }
17
+ const origin = doc.origin === 'installed' ? 'installed package (version-pinned)' : 'live site';
18
+ return { text: `${doc.text}\n\n---\n_Doc source: ${origin}._` };
19
+ }
20
+ async function search(query, ctx) {
21
+ const entries = await ctx.docs.index();
22
+ if (entries.length === 0) {
23
+ return {
24
+ text: `No documentation index is available (no bundled docs found and the live site was unreachable).\n\n${versionNote(ctx)}`,
25
+ isError: true,
26
+ };
27
+ }
28
+ const ranked = query
29
+ ? rank(query, entries, entry => [entry.label, entry.description, entry.path]).map(entry => entry.item)
30
+ : entries;
31
+ const chosen = ranked.length > 0 ? ranked : entries;
32
+ const note = query && ranked.length === 0
33
+ ? `No exact match for "${query}". Showing the full index:`
34
+ : query
35
+ ? `Results for "${query}":`
36
+ : 'Primer Brand documentation:';
37
+ const lines = chosen
38
+ .slice(0, 25)
39
+ .map(entry => `- **${entry.label}** — \`${entry.path}\`${entry.description ? `: ${entry.description}` : ''}`);
40
+ return {
41
+ text: `${note}\n\n${lines.join('\n')}\n\nCall \`primer_brand_docs\` with a \`path\` to read one.\n\n${versionNote(ctx)}`,
42
+ };
43
+ }
44
+ export const primerBrandDocsTool = {
45
+ name: 'primer_brand_docs',
46
+ title: 'Primer Brand guidance',
47
+ description,
48
+ inputShape: inputSchema.shape,
49
+ annotations: { readOnlyHint: true },
50
+ run(input, ctx) {
51
+ if (input.path)
52
+ return readPath(input.path, ctx);
53
+ return search(input.query ?? '', ctx);
54
+ },
55
+ };
56
+ //# sourceMappingURL=primer-brand-docs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primer-brand-docs.js","sourceRoot":"","sources":["../../../src/tools/primer-brand-docs/primer-brand-docs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAErB,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAA;AAGxC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0EAA0E,CAAC;IACjH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kEAAkE,CAAC;CACzG,CAAC,CAAA;AAIF,MAAM,WAAW,GAAG,iWAAiW,CAAA;AAErX,KAAK,UAAU,QAAQ,CAAC,IAAY,EAAE,GAAgB;IACpD,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO;YACL,IA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AE,EAAE,CAAC;SACZ,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,KAAK,CAAC,KAAK,UAAU,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IAC/G,OAAO;QACL,IAAI,EAAE,GAAG,IAAI,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,kEAAkE,WAAW,CAC/G,GAAG,CACJ,EAAE;KACJ,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,IAAI,EAAE,mBAAmB;IACzB,KAAK,EAAE,uBAAuB;IAC9B,WAAW;IACX,UAAU,EAAE,WAAW,CAAC,KAAK;IAC7B,WAAW,EAAE,EAAC,YAAY,EAAE,IAAI,EAAC;IACjC,GAAG,CAAC,KAAK,EAAE,GAAG;QACZ,IAAI,KAAK,CAAC,IAAI;YAAE,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QAChD,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE,GAAG,CAAC,CAAA;IACvC,CAAC;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ export * from './primer-brand-examples.js';
@@ -0,0 +1,2 @@
1
+ export * from './primer-brand-examples.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/primer-brand-examples/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import type { ToolModule } from '../types.js';
3
+ declare const inputSchema: z.ZodObject<{
4
+ goal: z.ZodOptional<z.ZodString>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ goal?: string | undefined;
7
+ }, {
8
+ goal?: string | undefined;
9
+ }>;
10
+ type Input = z.infer<typeof inputSchema>;
11
+ export declare const primerBrandExamplesTool: ToolModule<Input>;
12
+ export {};
@@ -0,0 +1,48 @@
1
+ import { z } from 'zod';
2
+ import { rank } from '../../util/text.js';
3
+ import { componentSearchFields, versionNote } from '../format.js';
4
+ const inputSchema = z.object({
5
+ goal: z
6
+ .string()
7
+ .optional()
8
+ .describe('What you are building, e.g. "education landing page" or "pricing section". Omit for a foundational starter set.'),
9
+ });
10
+ const description = `Get ranked, copy-and-adapt examples of correct Primer Brand usage for a goal, taken from the component library's own tested Storybook stories — real compositions to adapt, not turnkey templates. Pass a goal like "pricing section" or "education landing page" for the closest matching examples; with no match you get a default foundational set, so it is never a dead end. Because they come verbatim from stories, examples may include Storybook scaffolding — \`{...args}\` spreads, \`args\`-driven props, and imported demo assets (images, avatars); treat those as placeholders to fill in with real props and content, not literal code to copy. Use it to start from approved patterns instead of hand-building.`;
11
+ /** Foundational sections that anchor almost every GitHub landing page, in composition order. */
12
+ const DEFAULT_COMPONENTS = ['Hero', 'SectionIntro', 'River', 'Pillar', 'CTABanner'];
13
+ function exampleCode(component) {
14
+ return component.examples.find(entry => entry.code)?.code?.trim();
15
+ }
16
+ export const primerBrandExamplesTool = {
17
+ name: 'primer_brand_examples',
18
+ title: 'Primer Brand usage examples',
19
+ description,
20
+ inputShape: inputSchema.shape,
21
+ annotations: { readOnlyHint: true },
22
+ run(input, ctx) {
23
+ const goal = input.goal?.trim() || 'landing page';
24
+ // Only surface components that actually have a tested example — never emit a stub.
25
+ const withExamples = ctx.catalog.components.filter(component => exampleCode(component));
26
+ if (withExamples.length === 0) {
27
+ return {
28
+ text: `No usage examples are available yet. Call \`primer_brand_component\` to explore component APIs.\n\n${versionNote(ctx)}`,
29
+ isError: true,
30
+ };
31
+ }
32
+ const matched = rank(goal, withExamples, componentSearchFields)
33
+ .slice(0, 6)
34
+ .map(entry => entry.item);
35
+ const useDefault = matched.length === 0;
36
+ const defaultSet = DEFAULT_COMPONENTS.map(name => withExamples.find(component => component.name === name)).filter((component) => Boolean(component));
37
+ // Guarantee content even if none of the default components have an example yet.
38
+ const shown = useDefault ? (defaultSet.length > 0 ? defaultSet : withExamples.slice(0, 5)) : matched;
39
+ const note = useDefault
40
+ ? `No example matched "${goal}", so here is the default foundational set — compose these in order and adapt the copy and props to your theme.`
41
+ : `Closest tested examples for "${goal}". Adapt the copy and props to your theme; don't paste verbatim.`;
42
+ const examples = shown
43
+ .map(component => `### ${component.name}\n\`\`\`tsx\n${exampleCode(component)}\n\`\`\``)
44
+ .join('\n\n');
45
+ return { text: [`# Examples for "${goal}"`, note, examples, versionNote(ctx)].join('\n\n') };
46
+ },
47
+ };
48
+ //# sourceMappingURL=primer-brand-examples.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primer-brand-examples.js","sourceRoot":"","sources":["../../../src/tools/primer-brand-examples/primer-brand-examples.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAGrB,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAC,qBAAqB,EAAE,WAAW,EAAC,MAAM,cAAc,CAAA;AAG/D,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,iHAAiH,CAClH;CACJ,CAAC,CAAA;AAIF,MAAM,WAAW,GAAG,ksBAAksB,CAAA;AAEttB,gGAAgG;AAChG,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAA;AAEnF,SAAS,WAAW,CAAC,SAA2B;IAC9C,OAAO,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;AACnE,CAAC;AAED,MAAM,CAAC,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AAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;QAEpG,MAAM,IAAI,GAAG,UAAU;YACrB,CAAC,CAAC,uBAAuB,IAAI,iHAAiH;YAC9I,CAAC,CAAC,gCAAgC,IAAI,kEAAkE,CAAA;QAE1G,MAAM,QAAQ,GAAG,KAAK;aACnB,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,SAAS,CAAC,IAAI,gBAAgB,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC;aACvF,IAAI,CAAC,MAAM,CAAC,CAAA;QACf,OAAO,EAAC,IAAI,EAAE,CAAC,mBAAmB,IAAI,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAC,CAAA;IAC5F,CAAC;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ export * from './primer-brand-review.js';
@@ -0,0 +1,2 @@
1
+ export * from './primer-brand-review.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/primer-brand-review/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import type { ToolModule } from '../types.js';
3
+ declare const inputSchema: z.ZodObject<{
4
+ code: z.ZodString;
5
+ filename: z.ZodOptional<z.ZodString>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ code: string;
8
+ filename?: string | undefined;
9
+ }, {
10
+ code: string;
11
+ filename?: string | undefined;
12
+ }>;
13
+ type Input = z.infer<typeof inputSchema>;
14
+ export declare const primerBrandReviewTool: ToolModule<Input>;
15
+ export {};
@@ -0,0 +1,63 @@
1
+ import { z } from 'zod';
2
+ import { allRules, brandComponentsUsed } from '../../review/rules.js';
3
+ import { versionNote } from '../format.js';
4
+ const inputSchema = z.object({
5
+ code: z
6
+ .string()
7
+ .describe('Your COMPLETE output to check: the JSX/TSX AND all CSS/stylesheets together. Include App.css and any *.module.css — hardcoded px/hex usually live there.'),
8
+ filename: z.string().optional().describe('Optional filename, used only to label the report.'),
9
+ });
10
+ const description = `The final on-brand gate. Before you finish, paste your COMPLETE output in one call — the JSX/TSX AND every stylesheet (App.css, *.module.css, styled blocks) together — because hardcoded sizes/colors and raw HTML most often hide in CSS. Flags non-compliant components or sub-components, invalid prop values, headings left at their oversized default (a \`Heading\` with no explicit \`size\`), raw HTML where a brand component exists, hardcoded colors/sizes that should be tokens, and off-brand visual tells (purple gradients, pill buttons, glassmorphism, placeholder copy). Run it on everything you wrote and fix what it reports rather than guessing.`;
11
+ function formatFindings(label, findings) {
12
+ if (findings.length === 0)
13
+ return '';
14
+ const lines = findings.map(finding => {
15
+ const evidenceLine = finding.evidence ? `\n > \`${finding.evidence}\`` : '';
16
+ return `- **${finding.rule}**: ${finding.message}${evidenceLine}`;
17
+ });
18
+ return `## ${label}\n${lines.join('\n')}`;
19
+ }
20
+ const hasJsx = (code) => /<[A-Za-z][A-Za-z0-9.]*[\s/>]/.test(code);
21
+ // Clearly a stylesheet: a class/id/at-rule selector carrying CSS declarations (not a TS object/type).
22
+ const hasStylesheet = (code) => /[.#][\w-]+[^{}]*\{[^{}]*:[^{}]*;/.test(code) || /@(?:media|font-face|keyframes|supports|import)\b/.test(code);
23
+ /** Nudge agents to include their CSS — where most hardcoded px/hex and raw elements actually hide. */
24
+ function cssGateReminder(code) {
25
+ if (!hasJsx(code) || hasStylesheet(code))
26
+ return '';
27
+ return '> **Include your CSS.** This looks like JSX/TSX only. Hardcoded `px`/hex and raw elements most often live in a separate stylesheet — re-run `primer_brand_review` with the JSX **and** every stylesheet (`App.css`, `*.module.css`, styled blocks) together. This is the final gate over your COMPLETE output.';
28
+ }
29
+ export const primerBrandReviewTool = {
30
+ name: 'primer_brand_review',
31
+ title: 'Review code against Primer Brand',
32
+ description,
33
+ inputShape: inputSchema.shape,
34
+ annotations: { readOnlyHint: true },
35
+ run(input, ctx) {
36
+ const findings = allRules.flatMap(rule => rule.run(input.code, ctx.catalog));
37
+ const errors = findings.filter(finding => finding.severity === 'error');
38
+ const warnings = findings.filter(finding => finding.severity === 'warning');
39
+ const used = brandComponentsUsed(input.code, ctx.catalog);
40
+ const header = input.filename ? `# Brand review — \`${input.filename}\`` : '# Brand review';
41
+ const reminder = cssGateReminder(input.code);
42
+ const usedLine = used.length > 0
43
+ ? `Approved Primer Brand components used: ${used.map(component => `\`${component.name}\``).join(', ')}.`
44
+ : 'No `@primer/react-brand` components were imported. Build from Primer Brand components rather than raw HTML.';
45
+ if (findings.length === 0) {
46
+ return {
47
+ text: [header, reminder, `No issues found. ${usedLine}`, versionNote(ctx)].filter(Boolean).join('\n\n'),
48
+ };
49
+ }
50
+ const summary = `${errors.length} error(s), ${warnings.length} warning(s).`;
51
+ const blocks = [
52
+ header,
53
+ reminder,
54
+ summary,
55
+ usedLine,
56
+ formatFindings('Errors', errors),
57
+ formatFindings('Warnings', warnings),
58
+ versionNote(ctx),
59
+ ].filter(Boolean);
60
+ return { text: blocks.join('\n\n') };
61
+ },
62
+ };
63
+ //# sourceMappingURL=primer-brand-review.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primer-brand-review.js","sourceRoot":"","sources":["../../../src/tools/primer-brand-review/primer-brand-review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAErB,OAAO,EAAC,QAAQ,EAAE,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AAEnE,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAA;AAGxC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,CACP,0JAA0J,CAC3J;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,E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AG,GAAG,MAAM,CAAC,MAAM,cAAc,QAAQ,CAAC,MAAM,cAAc,CAAA;QAC3E,MAAM,MAAM,GAAG;YACb,MAAM;YACN,QAAQ;YACR,OAAO;YACP,QAAQ;YACR,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC;YAChC,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC;YACpC,WAAW,CAAC,GAAG,CAAC;SACjB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAEjB,OAAO,EAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAC,CAAA;IACpC,CAAC;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ export * from './primer-brand-setup.js';
@@ -0,0 +1,2 @@
1
+ export * from './primer-brand-setup.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/primer-brand-setup/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { z } from 'zod';
2
+ import type { ToolModule } from '../types.js';
3
+ declare const inputSchema: z.ZodObject<{
4
+ framework: z.ZodDefault<z.ZodOptional<z.ZodEnum<["auto", "next-app", "next-pages", "vite", "astro", "remix"]>>>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ framework: "next-app" | "next-pages" | "vite" | "astro" | "remix" | "auto";
7
+ }, {
8
+ framework?: "next-app" | "next-pages" | "vite" | "astro" | "remix" | "auto" | undefined;
9
+ }>;
10
+ type Input = z.infer<typeof inputSchema>;
11
+ export declare const primerBrandSetupTool: ToolModule<Input>;
12
+ export {};
@@ -0,0 +1,126 @@
1
+ import { z } from 'zod';
2
+ import { detectFramework } from '../../brand/detect-framework.js';
3
+ import { versionNote } from '../format.js';
4
+ const fence = '```';
5
+ const inputSchema = z.object({
6
+ framework: z
7
+ .enum(['auto', 'next-app', 'next-pages', 'vite', 'astro', 'remix'])
8
+ .optional()
9
+ .default('auto')
10
+ .describe('Target framework. "auto" detects it from the project; override if detection is wrong.'),
11
+ });
12
+ const description = `Set up the Primer Brand (@primer/react-brand) foundation that agents routinely forget: the ThemeProvider at the app root, the Mona Sans font import, the correct style import, and the \`'use client'\` boundary for React Server Components. Detects the framework (Next App/Pages, Vite, Astro, Remix) and returns tailored, copy-ready setup. Call this once before building a Primer Brand page.`;
13
+ const STATIC = {
14
+ 'next-app': { label: 'Next.js (App Router)', rsc: true },
15
+ 'next-pages': { label: 'Next.js (Pages Router)', rsc: false },
16
+ vite: { label: 'Vite + React', rsc: false },
17
+ astro: { label: 'Astro', rsc: false },
18
+ remix: { label: 'Remix', rsc: false },
19
+ unknown: { label: 'a React project', rsc: false },
20
+ };
21
+ const ROOT_SNIPPETS = {
22
+ 'next-app': `// app/providers.tsx
23
+ 'use client'
24
+ import {ThemeProvider} from '@primer/react-brand/esm'
25
+
26
+ export function Providers({children}: {children: React.ReactNode}) {
27
+ return <ThemeProvider>{children}</ThemeProvider>
28
+ }
29
+
30
+ // app/layout.tsx
31
+ import '@primer/react-brand/fonts/fonts.css'
32
+ import {Providers} from './providers'
33
+
34
+ export default function RootLayout({children}: {children: React.ReactNode}) {
35
+ return (
36
+ <html lang="en">
37
+ <body>
38
+ <Providers>{children}</Providers>
39
+ </body>
40
+ </html>
41
+ )
42
+ }`,
43
+ 'next-pages': `// pages/_app.tsx
44
+ import '@primer/react-brand/fonts/fonts.css'
45
+ import {ThemeProvider} from '@primer/react-brand/esm'
46
+ import type {AppProps} from 'next/app'
47
+
48
+ export default function App({Component, pageProps}: AppProps) {
49
+ return (
50
+ <ThemeProvider>
51
+ <Component {...pageProps} />
52
+ </ThemeProvider>
53
+ )
54
+ }`,
55
+ vite: `// src/main.tsx
56
+ import '@primer/react-brand/fonts/fonts.css'
57
+ import {StrictMode} from 'react'
58
+ import {createRoot} from 'react-dom/client'
59
+ import {ThemeProvider} from '@primer/react-brand/esm'
60
+ import App from './App'
61
+
62
+ createRoot(document.getElementById('root')!).render(
63
+ <StrictMode>
64
+ <ThemeProvider>
65
+ <App />
66
+ </ThemeProvider>
67
+ </StrictMode>,
68
+ )`,
69
+ remix: `// app/root.tsx
70
+ import '@primer/react-brand/fonts/fonts.css'
71
+ import {ThemeProvider} from '@primer/react-brand/esm'
72
+ import {Outlet} from '@remix-run/react'
73
+
74
+ export default function App() {
75
+ return (
76
+ <ThemeProvider>
77
+ <Outlet />
78
+ </ThemeProvider>
79
+ )
80
+ }`,
81
+ astro: `// src/components/BrandRoot.tsx — a React island wrapper
82
+ import '@primer/react-brand/fonts/fonts.css'
83
+ import {ThemeProvider} from '@primer/react-brand/esm'
84
+
85
+ export default function BrandRoot({children}: {children: React.ReactNode}) {
86
+ return <ThemeProvider>{children}</ThemeProvider>
87
+ }
88
+
89
+ // In an .astro file, hydrate it: <BrandRoot client:load>...</BrandRoot>`,
90
+ };
91
+ const GENERIC_SNIPPET = `import '@primer/react-brand/fonts/fonts.css'
92
+ import {ThemeProvider} from '@primer/react-brand/esm'
93
+
94
+ // Wrap the very root of your app so theming applies everywhere:
95
+ <ThemeProvider>
96
+ <App />
97
+ </ThemeProvider>`;
98
+ function build(id, ctx) {
99
+ const { label, rsc } = STATIC[id];
100
+ const snippet = id === 'unknown' ? GENERIC_SNIPPET : ROOT_SNIPPETS[id];
101
+ const rscNote = rsc
102
+ ? `\n\n> **RSC boundary:** \`ThemeProvider\` uses React context, so it must live in a \`'use client'\` component (the \`Providers\` wrapper above). It cannot go directly in the server-rendered \`layout.tsx\`.`
103
+ : '';
104
+ return [
105
+ `# Set up Primer Brand — ${label}`,
106
+ `## 1. Install\n${fence}bash\nnpm install @primer/react-brand\n${fence}`,
107
+ `## 2. Root setup (the step agents usually skip)\n${fence}tsx\n${snippet}\n${fence}${rscNote}\n\n_Optional: set the theme with \`<ThemeProvider colorMode="light">\` — also accepts \`"dark"\` or \`"auto"\`._`,
108
+ `## 3. Fonts\nPrimer Brand uses **Mona Sans / Hubot Sans**. The \`fonts.css\` import above loads them — pages without these fonts read as off-brand.`,
109
+ `## 4. Styles\nImporting components from \`@primer/react-brand/esm\` auto-includes each component's styles. **Do not also import \`@primer/react-brand/lib/css/main.css\`** — that is the non-ESM path, and mixing the two double-loads styles.`,
110
+ `## 5. Build the page\n- \`primer_brand_examples\` for a correct starting composition, then \`primer_brand_component\` for exact props\n- \`primer_brand_tokens\` / \`primer_brand_asset\` for colors, spacing, and icons\n- \`primer_brand_review\` on your complete output — JSX and CSS together — before you finish`,
111
+ `## 6. Header & footer\nFor a global header use \`SubdomainNavBar\`; for the footer use \`MinimalFooter\`. Don't hand-roll a \`<header>\`, \`<nav>\`, or \`<footer>\` — call \`primer_brand_component\` with "SubdomainNavBar" or "MinimalFooter" for their APIs.`,
112
+ versionNote(ctx),
113
+ ].join('\n\n');
114
+ }
115
+ export const primerBrandSetupTool = {
116
+ name: 'primer_brand_setup',
117
+ title: 'Set up Primer Brand in a project',
118
+ description,
119
+ inputShape: inputSchema.shape,
120
+ annotations: { readOnlyHint: true },
121
+ run(input, ctx) {
122
+ const id = input.framework === 'auto' ? detectFramework().id : input.framework;
123
+ return { text: build(id, ctx) };
124
+ },
125
+ };
126
+ //# sourceMappingURL=primer-brand-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primer-brand-setup.js","sourceRoot":"","sources":["../../../src/tools/primer-brand-setup/primer-brand-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAErB,OAAO,EAAC,eAAe,EAAmB,MAAM,iCAAiC,CAAA;AACjF,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAA;AAGxC,MAAM,KAAK,GAAG,KAAK,CAAA;AAEnB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,SAAS,EAAE,CAAC;SACT,IAAI,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SACl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2B,KAAK,EAAE;QAClC,kBAAkB,KAAK,0CAA0C,KAAK,EAAE;QACxE,oDAAoD,KAAK,QAAQ,OAAO,KAAK,KAAK,GAAG,OAAO,mHAAmH;QAC/M,qJAAqJ;QACrJ,gPAAgP;QAChP,wTAAwT;QACxT,kQAAkQ;QAClQ,WAAW,CAAC,GAAG,CAAC;KACjB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACrD,IAAI,EAAE,oBAAoB;IAC1B,KAAK,EAAE,kCAAkC;IACzC,WAAW;IACX,UAAU,EAAE,WAAW,CAAC,KAAK;IAC7B,WAAW,EAAE,EAAC,YAAY,EAAE,IAAI,EAAC;IACjC,GAAG,CAAC,KAAK,EAAE,GAAG;QACZ,MAAM,EAAE,GAAgB,KAAK,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAA;QAC3F,OAAO,EAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC,EAAC,CAAA;IAC/B,CAAC;CACF,CAAA"}
@@ -0,0 +1 @@
1
+ export * from './primer-brand-tokens.js';
@@ -0,0 +1,2 @@
1
+ export * from './primer-brand-tokens.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/primer-brand-tokens/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ import type { ToolModule } from '../types.js';
3
+ declare const inputSchema: z.ZodObject<{
4
+ query: z.ZodDefault<z.ZodOptional<z.ZodString>>;
5
+ group: z.ZodOptional<z.ZodString>;
6
+ limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ query: string;
9
+ limit: number;
10
+ group?: string | undefined;
11
+ }, {
12
+ query?: string | undefined;
13
+ limit?: number | undefined;
14
+ group?: string | undefined;
15
+ }>;
16
+ type Input = z.infer<typeof inputSchema>;
17
+ export declare const primerBrandTokensTool: ToolModule<Input>;
18
+ export {};
@@ -0,0 +1,93 @@
1
+ import { z } from 'zod';
2
+ import { rank } from '../../util/text.js';
3
+ import { versionNote } from '../format.js';
4
+ const inputSchema = z.object({
5
+ query: z
6
+ .string()
7
+ .optional()
8
+ .default('')
9
+ .describe('What you need, e.g. "accent background", "danger text", "spacing", "border width", "border radius". Spacing maps to the size/spacing scale; "border" surfaces border-width and border-color tokens.'),
10
+ group: z
11
+ .string()
12
+ .optional()
13
+ .describe('Filter by token category, matched against token names: e.g. "color", "size", "spacing", "border", "shadow", "radius", "font". Combine with query to narrow.'),
14
+ limit: z.number().int().min(1).max(50).optional().default(15).describe('Max results.'),
15
+ });
16
+ const description = `Resolve Primer Brand design tokens to CSS variables and values. Searches by intent — mapping color words to GitHub semantics (blue->accent, red->danger, green->success, yellow->attention) and spacing words to the size/spacing scale — and \`group\` filters by category (e.g. "color", "size", "border", "shadow"). Use these CSS variables instead of hardcoded hex/px so pages adapt across light and dark themes.`;
17
+ /**
18
+ * Map human words to the vocabulary that actually appears in Primer token names, so intent-based
19
+ * queries and the `group` facet resolve to real tokens. Spacing is expressed with size/spacing
20
+ * tokens, and the GitHub functional palette renames the usual colour words.
21
+ */
22
+ const TOKEN_SYNONYMS = {
23
+ blue: ['accent'],
24
+ red: ['danger'],
25
+ green: ['success'],
26
+ yellow: ['attention'],
27
+ orange: ['severe'],
28
+ gray: ['neutral'],
29
+ grey: ['neutral'],
30
+ space: ['spacing', 'size'],
31
+ spacing: ['spacing', 'size'],
32
+ gap: ['gap', 'spacing', 'size'],
33
+ padding: ['padding', 'spacing', 'size'],
34
+ margin: ['margin', 'spacing', 'size'],
35
+ size: ['size'],
36
+ // "border" alone otherwise ranks border-COLOR tokens above the border-WIDTH family (the 1px/2px
37
+ // primitives agents actually need); boosting borderWidth surfaces them alongside the colors.
38
+ border: ['borderWidth'],
39
+ width: ['borderWidth'],
40
+ radius: ['radius'],
41
+ rounded: ['radius'],
42
+ font: ['font'],
43
+ typography: ['font', 'lineHeight'],
44
+ };
45
+ /** A category term plus its synonyms, lower-cased — what token names and groups are matched against. */
46
+ function categoryNeedles(term) {
47
+ const lower = term.trim().toLowerCase();
48
+ return [lower, ...(TOKEN_SYNONYMS[lower] ?? [])];
49
+ }
50
+ function expandQuery(query) {
51
+ const extra = query
52
+ .toLowerCase()
53
+ .split(/\s+/)
54
+ .flatMap(word => TOKEN_SYNONYMS[word] ?? []);
55
+ return [query, ...extra].join(' ');
56
+ }
57
+ export const primerBrandTokensTool = {
58
+ name: 'primer_brand_tokens',
59
+ title: 'Primer Brand design tokens',
60
+ description,
61
+ inputShape: inputSchema.shape,
62
+ annotations: { readOnlyHint: true },
63
+ run(input, ctx) {
64
+ let tokens = ctx.catalog.tokens;
65
+ if (tokens.length === 0) {
66
+ return {
67
+ text: `Token data is not available. Ensure \`@primer/brand-primitives\` is installed/built.\n\n${versionNote(ctx)}`,
68
+ isError: true,
69
+ };
70
+ }
71
+ if (input.group) {
72
+ const needles = categoryNeedles(input.group);
73
+ tokens = tokens.filter(token => {
74
+ const haystack = `${token.name} ${token.group}`.toLowerCase();
75
+ return needles.some(needle => haystack.includes(needle));
76
+ });
77
+ }
78
+ const query = input.query.trim();
79
+ const chosen = query
80
+ ? rank(expandQuery(query), tokens, token => [token.name, token.group, token.value]).map(entry => entry.item)
81
+ : tokens;
82
+ if (chosen.length === 0) {
83
+ return {
84
+ text: `No tokens matched "${query}"${input.group ? ` in category "${input.group}"` : ''}. Try a broader term like "color", "size", or "border".\n\n${versionNote(ctx)}`,
85
+ };
86
+ }
87
+ const shown = chosen.slice(0, input.limit);
88
+ const more = chosen.length > shown.length ? `\n\n_${chosen.length - shown.length} more — narrow your query to see them._` : '';
89
+ const lines = shown.map(token => `- \`var(${token.name})\` = \`${token.value}\` _(${token.group})_`).join('\n');
90
+ return { text: `${lines}${more}\n\n${versionNote(ctx)}` };
91
+ },
92
+ };
93
+ //# sourceMappingURL=primer-brand-tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primer-brand-tokens.js","sourceRoot":"","sources":["../../../src/tools/primer-brand-tokens/primer-brand-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAA;AAErB,OAAO,EAAC,IAAI,EAAC,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAA;AAGxC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,OAAO,CAAC,EAAE,CAAC;SACX,QAAQ,CACP,qMAAqM,CACtM;IACH,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,6JAA6J,CAC9J;IACH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC;CACvF,CAAC,CAAA;AAIF,MAAM,WAAW,GAAG,0ZAA0Z,CAAA;AAE9a;;;;GAIG;AACH,MAAM,cAAc,GAA6B;IAC/C,IAAI,EAAE,CAAC,QAAQ,CAAC;IAChB,GAAG,EAAE,CAAC,QAAQ,CAAC;IACf,KAAK,EAAE,CAAC,SAAS,CAAC;IAClB,MAAM,EAAE,CAAC,WAAW,CAAC;IACrB,MAAM,EAAE,CAAC,QAAQ,CAAC;IAClB,IAAI,EAAE,CAAC,SAAS,CAAC;IACjB,IAAI,EAAE,CAAC,SAAS,CAAC;IACjB,KAAK,EAAE,CAAC,SAAS,EAAE,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C,iBAAiB,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAClD,8DAA8D,WAAW,CAAC,GAAG,CAAC,EAAE;aACjF,CAAA;QACH,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;QAC1C,MAAM,IAAI,GACR,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,yCAAyC,CAAC,CAAC,CAAC,EAAE,CAAA;QACnH,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,WAAW,KAAK,CAAC,IAAI,WAAW,KAAK,CAAC,KAAK,QAAQ,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC/G,OAAO,EAAC,IAAI,EAAE,GAAG,KAAK,GAAG,IAAI,OAAO,WAAW,CAAC,GAAG,CAAC,EAAE,EAAC,CAAA;IACzD,CAAC;CACF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { ToolContext } from './types.js';
3
+ export declare function registerTools(server: McpServer, ctx: ToolContext): void;
@@ -0,0 +1,45 @@
1
+ import { primerBrandAssetTool } from './primer-brand-asset/index.js';
2
+ import { primerBrandComponentTool } from './primer-brand-component/index.js';
3
+ import { primerBrandDocsTool } from './primer-brand-docs/index.js';
4
+ import { primerBrandExamplesTool } from './primer-brand-examples/index.js';
5
+ import { primerBrandReviewTool } from './primer-brand-review/index.js';
6
+ import { primerBrandTokensTool } from './primer-brand-tokens/index.js';
7
+ import { primerBrandSetupTool } from './primer-brand-setup/index.js';
8
+ /**
9
+ * Register a single tool, preserving its input type end to end. The SDK validates `args`
10
+ * against the tool's zod shape before calling the handler, so the cast is safe.
11
+ */
12
+ function add(server, tool, ctx) {
13
+ server.registerTool(tool.name, {
14
+ title: tool.title,
15
+ description: tool.description,
16
+ inputSchema: tool.inputShape,
17
+ annotations: tool.annotations,
18
+ }, async (args) => {
19
+ try {
20
+ const result = await tool.run(args, ctx);
21
+ return {
22
+ content: [{ type: 'text', text: result.text }],
23
+ isError: result.isError ?? false,
24
+ };
25
+ }
26
+ catch (error) {
27
+ const message = error instanceof Error ? error.message : String(error);
28
+ ctx.logger.error(`tool ${tool.name} failed: ${message}`);
29
+ return {
30
+ content: [{ type: 'text', text: `The ${tool.name} tool failed: ${message}` }],
31
+ isError: true,
32
+ };
33
+ }
34
+ });
35
+ }
36
+ export function registerTools(server, ctx) {
37
+ add(server, primerBrandSetupTool, ctx);
38
+ add(server, primerBrandComponentTool, ctx);
39
+ add(server, primerBrandExamplesTool, ctx);
40
+ add(server, primerBrandTokensTool, ctx);
41
+ add(server, primerBrandAssetTool, ctx);
42
+ add(server, primerBrandDocsTool, ctx);
43
+ add(server, primerBrandReviewTool, ctx);
44
+ }
45
+ //# sourceMappingURL=register.js.map