mozaic-mcp-server 2.2.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +9 -5
  2. package/SKILLS.md +22 -0
  3. package/bin/install-skills.js +1 -0
  4. package/bin/install.js +4 -0
  5. package/data/mozaic.db +0 -0
  6. package/dist/index.js +60 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/parsers/freemarker-parser.d.ts +25 -0
  9. package/dist/parsers/freemarker-parser.d.ts.map +1 -0
  10. package/dist/parsers/freemarker-parser.js +299 -0
  11. package/dist/parsers/freemarker-parser.js.map +1 -0
  12. package/dist/parsers/web-components-parser.d.ts.map +1 -1
  13. package/dist/parsers/web-components-parser.js +33 -21
  14. package/dist/parsers/web-components-parser.js.map +1 -1
  15. package/dist/tools/generate-freemarker.d.ts +32 -0
  16. package/dist/tools/generate-freemarker.d.ts.map +1 -0
  17. package/dist/tools/generate-freemarker.js +146 -0
  18. package/dist/tools/generate-freemarker.js.map +1 -0
  19. package/dist/tools/get-component-info.d.ts +1 -1
  20. package/dist/tools/get-component-info.d.ts.map +1 -1
  21. package/dist/tools/get-component-info.js +5 -1
  22. package/dist/tools/get-component-info.js.map +1 -1
  23. package/dist/tools/get-freemarker-info.d.ts +27 -0
  24. package/dist/tools/get-freemarker-info.d.ts.map +1 -0
  25. package/dist/tools/get-freemarker-info.js +161 -0
  26. package/dist/tools/get-freemarker-info.js.map +1 -0
  27. package/dist/tools/list-freemarker.d.ts +23 -0
  28. package/dist/tools/list-freemarker.d.ts.map +1 -0
  29. package/dist/tools/list-freemarker.js +97 -0
  30. package/dist/tools/list-freemarker.js.map +1 -0
  31. package/package.json +1 -1
  32. package/skills/mozaic-freemarker-builder/scripts/generate-component.sh +27 -0
  33. package/skills/mozaic-freemarker-builder/scripts/get-component.sh +28 -0
  34. package/skills/mozaic-freemarker-builder/scripts/list-components.sh +13 -0
  35. package/skills/mozaic-freemarker-builder/scripts/search-components.sh +14 -0
  36. package/skills/mozaic-freemarker-builder/skill.md +145 -0
@@ -0,0 +1,97 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * List Freemarker components by category
4
+ *
5
+ * Returns a list of all Freemarker macro components, optionally filtered by category.
6
+ */
7
+ const _ListFreemarkerInputSchema = z.object({
8
+ category: z
9
+ .enum(["all", "action", "form", "feedback", "navigation", "layout", "data-display", "other"])
10
+ .optional()
11
+ .default("all")
12
+ .describe("Filter by category (default: all)"),
13
+ });
14
+ export function handleListFreemarker(db, input) {
15
+ const category = input.category || "all";
16
+ let query = `
17
+ SELECT name, slug, category, description
18
+ FROM components
19
+ WHERE frameworks LIKE '%freemarker%'
20
+ `;
21
+ const params = [];
22
+ if (category !== "all") {
23
+ query += ` AND category = ?`;
24
+ params.push(category);
25
+ }
26
+ query += ` ORDER BY category ASC, name ASC`;
27
+ const components = db.prepare(query).all(...params);
28
+ if (components.length === 0) {
29
+ return {
30
+ content: [
31
+ {
32
+ type: "text",
33
+ text: `No Freemarker components found${category !== "all" ? ` in category "${category}"` : ""}.`,
34
+ },
35
+ ],
36
+ };
37
+ }
38
+ // Group components by category
39
+ const groupedComponents = new Map();
40
+ components.forEach((component) => {
41
+ const cat = component.category;
42
+ if (!groupedComponents.has(cat)) {
43
+ groupedComponents.set(cat, []);
44
+ }
45
+ const group = groupedComponents.get(cat);
46
+ if (group) {
47
+ group.push(component);
48
+ }
49
+ });
50
+ // Build output
51
+ let output = `# Freemarker Components\n\n`;
52
+ output += `Found ${components.length} components`;
53
+ if (category !== "all") {
54
+ output += ` in category "${category}"`;
55
+ }
56
+ output += `\n\n`;
57
+ // List by category
58
+ const categories = Array.from(groupedComponents.keys()).sort();
59
+ categories.forEach((cat) => {
60
+ const comps = groupedComponents.get(cat);
61
+ if (!comps)
62
+ return;
63
+ output += `## ${cat.charAt(0).toUpperCase() + cat.slice(1)} (${comps.length})\n\n`;
64
+ comps.forEach((comp) => {
65
+ output += `### ${comp.name}\n`;
66
+ output += `- **Slug:** \`${comp.slug}\`\n`;
67
+ if (comp.description) {
68
+ output += `- **Description:** ${comp.description}\n`;
69
+ }
70
+ const macroName = comp.slug.replace(/-/g, "");
71
+ output += `- **Usage:** \`<#import "mozaic/${macroName}.ftl" as ${macroName}>\`\n`;
72
+ output += `\n`;
73
+ });
74
+ });
75
+ // Summary by category
76
+ output += `---\n\n`;
77
+ output += `## Summary by Category\n\n`;
78
+ categories.forEach((cat) => {
79
+ const group = groupedComponents.get(cat);
80
+ if (group) {
81
+ output += `- **${cat}**: ${group.length} components\n`;
82
+ }
83
+ });
84
+ output += `\n`;
85
+ output += `## Next Steps\n\n`;
86
+ output += `Use \`get_freemarker_info\` to view detailed information about a specific component.\n`;
87
+ output += `Use \`generate_freemarker\` to generate ready-to-use code for a component.\n`;
88
+ return {
89
+ content: [
90
+ {
91
+ type: "text",
92
+ text: output,
93
+ },
94
+ ],
95
+ };
96
+ }
97
+ //# sourceMappingURL=list-freemarker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-freemarker.js","sourceRoot":"","sources":["../../src/tools/list-freemarker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AAEH,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,QAAQ,EAAE,CAAC;SACR,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;SAC5F,QAAQ,EAAE;SACV,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,mCAAmC,CAAC;CACjD,CAAC,CAAC;AAIH,MAAM,UAAU,oBAAoB,CAClC,EAAqB,EACrB,KAA0B;IAE1B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC;IAEzC,IAAI,KAAK,GAAG;;;;GAIX,CAAC;I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,EAAE,CAAC;YACV,MAAM,IAAI,OAAO,GAAG,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;QACzD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,IAAI,CAAC;IACf,MAAM,IAAI,mBAAmB,CAAC;IAC9B,MAAM,IAAI,wFAAwF,CAAC;IACnG,MAAM,IAAI,8EAA8E,CAAC;IAEzF,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,MAAM;aACb;SACF;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mozaic-mcp-server",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "Self-contained Claude Code skills for Mozaic Design System by ADEO",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,27 @@
1
+ #!/bin/bash
2
+ # Generate Freemarker macro usage code
3
+ COMPONENT="${1:?Component name required}"
4
+ CONFIG="${2:-{}}"
5
+ CONTENT="${3:-Content goes here}"
6
+ DB_PATH="${MOZAIC_DB_PATH:-${HOME}/.claude/mozaic.db}"
7
+
8
+ # Get component info
9
+ COMP_DATA=$(sqlite3 "$DB_PATH" "SELECT slug FROM components WHERE frameworks LIKE '%freemarker%' AND (LOWER(slug) LIKE LOWER('%$COMPONENT%') OR LOWER(name) LIKE LOWER('%$COMPONENT%')) LIMIT 1;")
10
+
11
+ if [ -z "$COMP_DATA" ]; then
12
+ echo "Component '$COMPONENT' not found"
13
+ exit 1
14
+ fi
15
+
16
+ MACRO_NAME=$(echo "$COMP_DATA" | tr '-' '')
17
+
18
+ # Generate code
19
+ cat <<EOF
20
+ <#import "mozaic/${MACRO_NAME}.ftl" as ${MACRO_NAME}>
21
+
22
+ <#assign config = ${CONFIG}>
23
+
24
+ <@${MACRO_NAME}.${MACRO_NAME} config=config>
25
+ ${CONTENT}
26
+ </@${MACRO_NAME}.${MACRO_NAME}>
27
+ EOF
@@ -0,0 +1,28 @@
1
+ #!/bin/bash
2
+ # Get detailed Freemarker component information
3
+ COMPONENT="${1:?Component name required}"
4
+ DB_PATH="${MOZAIC_DB_PATH:-${HOME}/.claude/mozaic.db}"
5
+
6
+ sqlite3 "$DB_PATH" <<EOF
7
+ .mode json
8
+ SELECT
9
+ c.name,
10
+ c.slug,
11
+ c.category,
12
+ c.description,
13
+ json_group_array(
14
+ json_object(
15
+ 'name', p.name,
16
+ 'type', p.type,
17
+ 'required', p.required,
18
+ 'default', p.default_value,
19
+ 'description', p.description
20
+ )
21
+ ) as props
22
+ FROM components c
23
+ LEFT JOIN component_props p ON p.component_id = c.id
24
+ WHERE c.frameworks LIKE '%freemarker%'
25
+ AND (LOWER(c.slug) LIKE LOWER('%$COMPONENT%') OR LOWER(c.name) LIKE LOWER('%$COMPONENT%'))
26
+ GROUP BY c.id
27
+ LIMIT 1;
28
+ EOF
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+ # List Freemarker components by category
3
+ CATEGORY="${1:-all}"
4
+ DB_PATH="${MOZAIC_DB_PATH:-${HOME}/.claude/mozaic.db}"
5
+
6
+ sqlite3 "$DB_PATH" <<EOF
7
+ .mode json
8
+ SELECT name, slug, category, description
9
+ FROM components
10
+ WHERE frameworks LIKE '%freemarker%'
11
+ ${CATEGORY:+AND category = '$CATEGORY'}
12
+ ORDER BY category, name;
13
+ EOF
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+ # Search Freemarker components by name or description
3
+ QUERY="${1:?Search query required}"
4
+ DB_PATH="${MOZAIC_DB_PATH:-${HOME}/.claude/mozaic.db}"
5
+
6
+ sqlite3 "$DB_PATH" <<EOF
7
+ .mode json
8
+ SELECT name, slug, category, description
9
+ FROM components
10
+ WHERE frameworks LIKE '%freemarker%'
11
+ AND (LOWER(name) LIKE LOWER('%$QUERY%') OR LOWER(description) LIKE LOWER('%$QUERY%'))
12
+ ORDER BY name
13
+ LIMIT 20;
14
+ EOF
@@ -0,0 +1,145 @@
1
+ # Mozaic Freemarker Builder
2
+
3
+ Interactive Freemarker macro generator for Mozaic Design System. Help users discover, configure, and generate production-ready Freemarker template code with proper imports and configuration.
4
+
5
+ ## Activation
6
+
7
+ This skill activates when users:
8
+ - Ask about Freemarker components or macros
9
+ - Want to generate Freemarker template code
10
+ - Need help with Mozaic Freemarker implementation
11
+ - Mention ".ftl" files or Freemarker templates
12
+
13
+ ## Workflow
14
+
15
+ ### 1. Discovery Phase
16
+ Ask user what they want to build or which component they need:
17
+ ```bash
18
+ # List all Freemarker components
19
+ ./scripts/list-components.sh all
20
+
21
+ # List by category
22
+ ./scripts/list-components.sh form
23
+ ./scripts/list-components.sh navigation
24
+ ```
25
+
26
+ ### 2. Component Selection
27
+ Let user browse and select:
28
+ ```bash
29
+ # Search for specific component
30
+ ./scripts/search-components.sh "button"
31
+
32
+ # Get detailed component info
33
+ ./scripts/get-component.sh "button"
34
+ ```
35
+
36
+ ### 3. Configuration
37
+ Help user configure the component:
38
+ - Show available configuration options (props)
39
+ - Explain required vs optional parameters
40
+ - Provide examples of common configurations
41
+
42
+ ### 4. Code Generation
43
+ Generate ready-to-use Freemarker code:
44
+ ```bash
45
+ # Generate basic code
46
+ ./scripts/generate-component.sh "button"
47
+
48
+ # Generate with configuration
49
+ ./scripts/generate-component.sh "button" '{"color": "primary", "size": "m"}'
50
+
51
+ # Generate with content
52
+ ./scripts/generate-component.sh "button" '{"color": "accent"}' "Click Me"
53
+ ```
54
+
55
+ ## Output Format
56
+
57
+ Always provide:
58
+ 1. **Import statement** - Freemarker import directive
59
+ 2. **Configuration object** - <#assign config = {...}>
60
+ 3. **Macro invocation** - <@macroname.macroname config=config>...</@>
61
+ 4. **Installation info** - Maven dependency
62
+
63
+ Example output:
64
+ ```ftl
65
+ <#import "mozaic/button.ftl" as button>
66
+
67
+ <#assign configButton = {
68
+ "color": "primary",
69
+ "size": "m",
70
+ "outlined": false
71
+ }>
72
+
73
+ <@button.button config=configButton>
74
+ Click Me
75
+ </@button.button>
76
+ ```
77
+
78
+ ## Component Categories
79
+
80
+ - **action**: Buttons, links, icon buttons
81
+ - **form**: Text inputs, checkboxes, radio buttons, fields, file uploaders
82
+ - **feedback**: Notifications, messages, badges, flags, loaders, progress bars, toasters, tooltips
83
+ - **navigation**: Breadcrumbs, tabs, pagination, steppers, menus
84
+ - **layout**: Containers, dividers, modals, drawers, accordions, popovers
85
+ - **data-display**: Cards, tiles, images, avatars, logos, carousels, callouts, tags, ratings
86
+
87
+ ## Best Practices
88
+
89
+ 1. **Always import macros** at the top of .ftl files
90
+ 2. **Define configuration separately** using <#assign>
91
+ 3. **Use descriptive variable names** (e.g., configButton, configModal)
92
+ 4. **Set locale** with <#global locale="fr_FR"/> for i18n
93
+ 5. **Nested content** goes between opening and closing macro tags
94
+
95
+ ## Installation
96
+
97
+ Maven dependency:
98
+ ```xml
99
+ <dependency>
100
+ <groupId>com.adeo.mozaic</groupId>
101
+ <artifactId>mozaic-freemarker</artifactId>
102
+ <version>LATEST_VERSION</version>
103
+ </dependency>
104
+ ```
105
+
106
+ ## Documentation
107
+
108
+ Repository: https://github.com/adeo/mozaic-freemarker
109
+ Design System: https://mozaic.adeo.cloud/
110
+
111
+ ## Example Interaction
112
+
113
+ **User**: "I need a button for my Freemarker template"
114
+
115
+ **Assistant**: "I'll help you create a button with Mozaic Freemarker. Let me show you the available options..."
116
+
117
+ *Runs ./scripts/get-component.sh "button"*
118
+
119
+ "Here are the button configuration options:
120
+ - color: standard, accent, danger, ghost, inverse
121
+ - size: s, m (default), l
122
+ - outlined: boolean for outlined style
123
+ - loading: boolean for loading state
124
+
125
+ What style would you like?"
126
+
127
+ **User**: "Primary colored, medium size"
128
+
129
+ **Assistant**: *Generates code*
130
+
131
+ "Here's your Freemarker button code:
132
+ ```ftl
133
+ <#import "mozaic/button.ftl" as button>
134
+
135
+ <#assign configButton = {
136
+ "color": "primary",
137
+ "size": "m"
138
+ }>
139
+
140
+ <@button.button config=configButton>
141
+ Click Me
142
+ </@button.button>
143
+ ```
144
+
145
+ This will render a primary-colored, medium-sized button. You can customize the text between the tags."