climaybe 1.7.2 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +9 -7
  2. package/bin/version.txt +1 -1
  3. package/package.json +6 -7
  4. package/src/commands/add-cursor-skill.js +12 -7
  5. package/src/commands/init.js +10 -5
  6. package/src/cursor/rules/00-rule-index.mdc +24 -0
  7. package/src/cursor/rules/accessibility-rules.mdc +527 -0
  8. package/src/cursor/rules/commit-rules.mdc +286 -0
  9. package/src/cursor/rules/cursor-rule-template.mdc +66 -0
  10. package/src/cursor/rules/examples/section-example.liquid +52 -0
  11. package/src/cursor/rules/examples/snippet-example.liquid +83 -0
  12. package/src/cursor/rules/figma-design-system.mdc +182 -0
  13. package/src/cursor/rules/global-rules-reference.mdc +62 -0
  14. package/src/cursor/rules/javascript-standards.mdc +1125 -0
  15. package/src/cursor/rules/js-refactor-tasks.mdc +123 -0
  16. package/src/cursor/rules/linear-task-creation.mdc +105 -0
  17. package/src/cursor/rules/liquid-doc-rules.mdc +595 -0
  18. package/src/cursor/rules/liquid.mdc +228 -0
  19. package/src/cursor/rules/project-overview.mdc +81 -0
  20. package/src/cursor/rules/schemas.mdc +150 -0
  21. package/src/cursor/rules/sections.mdc +25 -0
  22. package/src/cursor/rules/snippets.mdc +134 -0
  23. package/src/cursor/rules/tailwindcss-rules.mdc +410 -0
  24. package/src/cursor/skills/accessibility-pass/SKILL.md +54 -0
  25. package/src/cursor/skills/changelog-release/SKILL.md +50 -0
  26. package/src/cursor/skills/commit/SKILL.md +27 -0
  27. package/src/cursor/skills/commit-in-groups/SKILL.md +55 -0
  28. package/src/cursor/skills/linear-create-task/SKILL.md +81 -0
  29. package/src/cursor/skills/liquid-doc-comments/SKILL.md +37 -0
  30. package/src/cursor/skills/locale-translation-prep/SKILL.md +49 -0
  31. package/src/cursor/skills/schema-section-change/SKILL.md +39 -0
  32. package/src/cursor/skills/section-from-spec/SKILL.md +39 -0
  33. package/src/cursor/skills/theme-check-fix/SKILL.md +47 -0
  34. package/src/index.js +3 -2
  35. package/src/lib/commit-tooling.js +0 -44
  36. package/src/lib/config.js +1 -1
  37. package/src/lib/cursor-bundle.js +47 -0
  38. package/src/lib/prompts.js +3 -2
  39. package/src/workflows/shared/version-bump.yml +5 -2
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: liquid-doc-comments
3
+ description: Adds or updates LiquidDoc documentation blocks in Liquid snippets and blocks. Use when the user says "add LiquidDoc", "document this snippet", "add doc block", or "update snippet docs". Follows liquid-doc-rules.mdc.
4
+ ---
5
+
6
+ # Liquid Doc Comments
7
+
8
+ Adds or updates the `{%- doc -%}` block at the top of a snippet or block so it meets project LiquidDoc standards.
9
+
10
+ ## Rules to Apply
11
+
12
+ Before writing or editing doc blocks, read and apply:
13
+
14
+ 1. `.cursor/rules/00-rule-index.mdc` — rule index
15
+ 2. `.cursor/rules/liquid-doc-rules.mdc` — required structure, @param format, @example, types, placement
16
+
17
+ ## Workflow
18
+
19
+ 1. **Identify file** — Snippet in `snippets/` or block in `blocks/`. If user didn’t specify, use current file or ask.
20
+ 2. **Load rules** — Read liquid-doc-rules.mdc for exact `{%- doc -%}` format, parameter types, and example requirements.
21
+ 3. **Inspect snippet/block** — List parameters (from `render` usage or Liquid assigns). Note required vs optional. Infer types (string, number, boolean, object).
22
+ 4. **Write or replace doc block** — At top of file (after any initial comment):
23
+ - One-sentence description, then 2–3 sentences detail.
24
+ - `@param {type} name` for each parameter; `[optional_param]` for optional.
25
+ - At least one `@example` with realistic `{% render 'snippet', param: value %}`.
26
+ 5. **Preserve whitespace** — Use `{%- doc -%}` and `{%- enddoc -%}`. No stray newlines that would break LiquidDoc parsing.
27
+ 6. **If updating** — Merge new params into existing doc; don’t remove existing examples unless redundant.
28
+
29
+ ## Output
30
+
31
+ - Edit the file(s) with the new or updated doc block.
32
+ - Briefly list what was added (params, examples) so the user can verify.
33
+
34
+ ## Example Trigger
35
+
36
+ User: "Add LiquidDoc to this snippet" (with a snippet open).
37
+ → Add a full `{%- doc -%}` block at the top per liquid-doc-rules.mdc, with params and at least one example.
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: locale-translation-prep
3
+ description: Compares locale files and lists new or changed keys that need translation. Use when the user says "translation prep", "locale diff", "what needs translating", "missing translations", or "locale sync". Uses project locales (e.g. locales/*.json).
4
+ ---
5
+
6
+ # Locale / Translation Prep
7
+
8
+ Compares the default locale with others and reports which keys are new or changed so translators know what to update.
9
+
10
+ ## Rules to Apply
11
+
12
+ For context on how the project uses locales (e.g. in sections/snippets), the rule index is useful:
13
+
14
+ 1. `.cursor/rules/00-rule-index.mdc` — rule index (schemas.mdc prefers translation keys over schema text; locales live in `locales/`)
15
+
16
+ No single "locale rules" file is required; this skill focuses on file comparison and reporting.
17
+
18
+ ## Workflow
19
+
20
+ 1. **Identify default locale** — Usually `locales/en.default.json` or `locales/en.json`. Confirm by checking `locales/` directory. List other locale files (e.g. `de.json`, `fr.json`).
21
+ 2. **Collect keys** — Parse default locale (and schema locale files if present) to get the full list of translation keys (including nested keys; use dot or path notation for nesting).
22
+ 3. **Compare** — For each other locale file:
23
+ - Keys in default but missing in locale → "Missing"
24
+ - Keys in default with different value in locale → "Changed" (default changed; translation may need update)
25
+ - Keys in locale but not in default → "Obsolete" (optional to report)
26
+ 4. **Report** — Output a concise list per locale:
27
+ - **Missing keys** — List key paths so translators can add them.
28
+ - **Possibly stale** — Keys where default changed (if we can detect; e.g. compare to previous default or just list "present in both" and note that defaults were updated).
29
+ 5. **Optional** — Output a minimal JSON or CSV of missing keys for import into a translation tool. Or suggest adding keys to locale files with empty or placeholder values.
30
+
31
+ ## Output Format
32
+
33
+ ```markdown
34
+ ## Translation prep (default: en.default.json)
35
+
36
+ ### de.json
37
+ - **Missing:** `section.foo.title`, `snippet.bar.label`, ...
38
+ - **Note:** Default locale has X keys; de has Y. Z keys missing.
39
+
40
+ ### fr.json
41
+ - **Missing:** ...
42
+ ```
43
+
44
+ If the user wants, add stub entries (e.g. empty string or key as value) for missing keys in each locale file.
45
+
46
+ ## Example Trigger
47
+
48
+ User: "What needs translating?"
49
+ → Compare `locales/en.default.json` (or project default) to other `locales/*.json`, list missing and optionally changed keys per file.
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: schema-section-change
3
+ description: Adds or changes a section setting (schema) and keeps section Liquid in sync. Use when the user asks to "add a section setting", "add schema setting", "new section option", or "change section config". Follows schema and section rules.
4
+ ---
5
+
6
+ # Schema / Section Change
7
+
8
+ Safely adds or changes a section setting: updates both the section Liquid and the `{% schema %}` block, with defaults and locales in mind.
9
+
10
+ ## Rules to Apply
11
+
12
+ Before making changes, read and apply:
13
+
14
+ 1. `.cursor/rules/00-rule-index.mdc` — rule index
15
+ 2. `.cursor/rules/schemas.mdc` — minimal settings, no redundancy, translation keys, max 5 settings, "question every setting"
16
+ 3. `.cursor/rules/sections.mdc` — section structure and schema requirement
17
+
18
+ ## Workflow
19
+
20
+ 1. **Clarify** — Which section file? What setting (e.g. toggle, select, range, color)? Should it be in a block or at section level?
21
+ 2. **Validate need** — Per schemas.mdc: Is this necessary? Could it be translation/CSS/existing theme setting instead? If adding multiple settings, confirm with user.
22
+ 3. **Schema** — Add or edit the setting in `{% schema %}`:
23
+ - Use correct type (checkbox, select, range, color, text, etc.).
24
+ - Sensible default. For text, prefer translation key reference in schema (e.g. label only) and actual copy in locales.
25
+ - Keep max 5 settings per section; use headers to group if needed.
26
+ 4. **Section Liquid** — Use the new setting in the section (e.g. `section.settings.setting_id`). Provide defaults in Liquid if needed (e.g. `section.settings.foo | default: 'bar'`).
27
+ 5. **Locales** — If the setting exposes a label or option text that should be translatable, add or point to keys in `locales/` (e.g. `en.default.json`). Don’t duplicate long copy in schema.
28
+ 6. **Blocks** — If the setting is on a block, ensure block schema and Liquid both use it; preserve existing block structure.
29
+
30
+ ## Output
31
+
32
+ - List exact edits (file + snippet of change).
33
+ - Note any new locale keys to add.
34
+ - Remind about max 5 settings and "prefer translations over schema text" if relevant.
35
+
36
+ ## Example Trigger
37
+
38
+ User: "Add a setting to turn the heading off in the FAQ section."
39
+ → Edit `sections/collection--faq.liquid` (or the correct FAQ section): add a checkbox in schema, use it in Liquid to hide the heading, add/use a translation key for the setting label if needed.
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: section-from-spec
3
+ description: Creates new Shopify theme sections and snippets from a spec or description. Use when the user asks for a new section, new snippet, "section from spec", "create section", or "add a section/snippet". Follows project section, snippet, schema, and Liquid doc rules.
4
+ ---
5
+
6
+ # Section / Snippet from Spec
7
+
8
+ Creates a new section (and optional snippet) from a user spec, following project conventions.
9
+
10
+ ## Rules to Apply
11
+
12
+ Before creating any section or snippet, read and apply (in order):
13
+
14
+ 1. `.cursor/rules/00-rule-index.mdc` — rule index
15
+ 2. `.cursor/rules/sections.mdc` — section structure, schema requirement, performance
16
+ 3. `.cursor/rules/snippets.mdc` — snippet patterns, LiquidDoc, parameter handling
17
+ 4. `.cursor/rules/schemas.mdc` — minimal settings, no redundancy, translation keys, max 5 settings
18
+ 5. `.cursor/rules/liquid.mdc` — Liquid syntax
19
+ 6. `.cursor/rules/liquid-doc-rules.mdc` — required `{% doc %}` block format for snippets
20
+
21
+ ## Workflow
22
+
23
+ 1. **Clarify scope** — Section only, or section + snippet(s)? Which template(s) will use it?
24
+ 2. **Naming** — Use project convention: `section-name--variant.liquid` or `snippets/prefix--name.liquid`. Check existing `sections/` and `snippets/` for patterns.
25
+ 3. **Schema** — Minimal settings only. Prefer translation keys over schema text inputs. Max 5 settings per section (excluding headers). No redundant toggles.
26
+ 4. **Section file** — Semantic HTML, section-scoped CSS classes, `{% schema %}` with valid JSON. Include translation keys for all user-facing text.
27
+ 5. **Snippet(s)** — If needed: LiquidDoc at top (`{%- doc -%}`), parameter defaults and validation, one clear responsibility per snippet.
28
+ 6. **Templates** — If the user specified a template (e.g. product, collection), add the section to the appropriate JSON template in `templates/` if requested.
29
+
30
+ ## Output
31
+
32
+ - Create or edit files under `sections/` and optionally `snippets/`.
33
+ - Summarize what was created and where (file paths, schema settings, snippet params).
34
+ - Note any translation keys added that need entries in `locales/`.
35
+
36
+ ## Example Trigger
37
+
38
+ User: "Add a section that shows a heading and a grid of 4 product cards, with a setting for the collection."
39
+ → Create `sections/s--product-grid.liquid` with minimal schema (e.g. collection picker, heading key), optional snippet for the card if it doesn’t exist.
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: theme-check-fix
3
+ description: Runs Theme Check (or similar) and suggests fixes using project Liquid and section rules. Use when the user says "theme check", "run theme check", "fix theme errors", or "lint theme". Follows liquid and section rules.
4
+ ---
5
+
6
+ # Theme Check + Fix
7
+
8
+ Runs theme linting (e.g. Shopify Theme Check) and maps each finding to project rules, then suggests concrete fixes.
9
+
10
+ ## Rules to Apply
11
+
12
+ When interpreting results and suggesting fixes, read and apply:
13
+
14
+ 1. `.cursor/rules/00-rule-index.mdc` — rule index
15
+ 2. `.cursor/rules/liquid.mdc` — Liquid syntax and usage
16
+ 3. `.cursor/rules/sections.mdc` — section structure and schema
17
+ 4. `.cursor/rules/snippets.mdc` — snippet patterns
18
+
19
+ ## Workflow
20
+
21
+ 1. **Run Theme Check** — Execute the project’s theme check command (e.g. `theme check`, or `shopify theme check`). If no command is known, suggest the user run it and paste the output, or run a generic check if available.
22
+ 2. **Parse output** — List each issue: file, line (if any), rule/code, message.
23
+ 3. **Map to project rules** — For each issue, determine which project rule applies (Liquid, sections, snippets) and load that rule file if not already in context.
24
+ 4. **Suggest fixes** — For each finding, provide:
25
+ - Short explanation (why it’s flagged)
26
+ - Exact edit (or step) to fix it, consistent with project rules
27
+ - File and location
28
+ 5. **Prioritize** — Errors first, then warnings. Security and correctness before style.
29
+
30
+ ## Output Format
31
+
32
+ ```markdown
33
+ ## Theme Check results
34
+
35
+ ### Errors
36
+ - **[file:line]** [rule] — [message]. **Fix:** [concrete suggestion]
37
+
38
+ ### Warnings
39
+ - ...
40
+ ```
41
+
42
+ If the user wants fixes applied, make the edits; otherwise output the list and let them choose.
43
+
44
+ ## Example Trigger
45
+
46
+ User: "Run theme check and fix what you can."
47
+ → Run (or ask for) theme check output, then go through each item with rule-based fix suggestions and apply edits where appropriate.
package/src/index.js CHANGED
@@ -65,8 +65,9 @@ export function createProgram(version = '0.0.0', packageDir = '') {
65
65
  .action(setupCommitlintCommand);
66
66
 
67
67
  program
68
- .command('add-cursor-skill')
69
- .description('Add only the Cursor commit skill to this project (.cursor/skills/commit)')
68
+ .command('add-cursor')
69
+ .alias('add-cursor-skill')
70
+ .description('Install Electric Maybe Cursor rules + skills (.cursor/rules, .cursor/skills)')
70
71
  .action(addCursorSkillCommand);
71
72
 
72
73
  return program;
@@ -32,35 +32,6 @@ export PATH="/usr/local/bin:/opt/homebrew/bin:$PATH"
32
32
  npx --no-install commitlint --edit "$1"
33
33
  `;
34
34
 
35
- const CURSOR_COMMIT_SKILL = `---
36
- name: commit
37
- description: Groups working-tree changes into logical commits and commits them using conventional commit rules (type, optional scope, subject; commitlint). Use when the user asks to commit, group commits, stage and commit, or write conventional commits.
38
- ---
39
-
40
- # Commit (group + conventional)
41
-
42
- Group changes by purpose, then commit each group. A conventional message is optional; when the user provides or wants one, use the format below so commitlint and semantic-release stay happy.
43
-
44
- ## Workflow
45
-
46
- 1. **Inspect** — Get full picture of changes (git status, git diff).
47
- 2. **Group** — Partition by type: feat, fix, docs, style, refactor, perf, test, build, ci, chore.
48
- 3. **Commit each group** — If the user wants a message: type(scope): subject, imperative, lowercase, no period, ≤100 chars. If they don't, commit without message or with a minimal one (e.g. chore: wip).
49
- 4. **Validate** — commit-msg hook may reject invalid messages when a message is used.
50
-
51
- ## Message rules (commitlint, when a message is used)
52
-
53
- - **Types:** feat, fix, docs, style, refactor, perf, test, build, ci, chore.
54
- - **Header:** type(scope): subject — subject optional; max 100 chars when present. Body lines max 200.
55
- - **Imperative, present tense:** "add feature" not "added feature".
56
-
57
- ## Examples
58
-
59
- feat(init): add store alias prompt
60
- fix(sync): prevent overwrite of unchanged files
61
- docs: add conventional commit section to CONTRIBUTING
62
- `;
63
-
64
35
  /**
65
36
  * Scaffold commitlint config, Husky commit-msg hook, and add deps to package.json.
66
37
  * Runs npm install so husky prepare runs and hooks are installed (unless options.skipInstall).
@@ -98,18 +69,3 @@ export function scaffoldCommitlint(cwd = process.cwd(), options = {}) {
98
69
  }
99
70
  return true;
100
71
  }
101
-
102
- /**
103
- * Scaffold Cursor commit skill into .cursor/skills/commit/SKILL.md.
104
- * @param {string} [cwd] - Working directory (default process.cwd())
105
- * @returns {boolean} - true if written
106
- */
107
- export function scaffoldCursorCommitSkill(cwd = process.cwd()) {
108
- const skillDir = join(cwd, '.cursor', 'skills', 'commit');
109
- if (!existsSync(skillDir)) {
110
- mkdirSync(skillDir, { recursive: true });
111
- }
112
- const skillPath = join(skillDir, 'SKILL.md');
113
- writeFileSync(skillPath, CURSOR_COMMIT_SKILL, 'utf-8');
114
- return true;
115
- }
package/src/lib/config.js CHANGED
@@ -106,7 +106,7 @@ export function isCommitlintEnabled(cwd = process.cwd()) {
106
106
  }
107
107
 
108
108
  /**
109
- * Whether Cursor commit skill was added at init.
109
+ * Whether bundled Cursor rules + skills were installed (init or add-cursor).
110
110
  */
111
111
  export function isCursorSkillsEnabled(cwd = process.cwd()) {
112
112
  const config = readConfig(cwd);
@@ -0,0 +1,47 @@
1
+ import { existsSync, mkdirSync, readdirSync, statSync, copyFileSync } from 'node:fs';
2
+ import { join, dirname } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+
7
+ /** Bundled Electric Maybe Cursor rules + skills (shipped under src/cursor/). */
8
+ const BUNDLE_ROOT = join(__dirname, '..', 'cursor');
9
+
10
+ const SKIP_NAMES = new Set(['.DS_Store']);
11
+
12
+ /**
13
+ * Recursively copy directory tree; skips junk files (e.g. .DS_Store).
14
+ * @param {string} src
15
+ * @param {string} dest
16
+ */
17
+ function copyTree(src, dest) {
18
+ if (!existsSync(src)) return;
19
+ mkdirSync(dest, { recursive: true });
20
+ for (const name of readdirSync(src)) {
21
+ if (SKIP_NAMES.has(name)) continue;
22
+ const from = join(src, name);
23
+ const to = join(dest, name);
24
+ if (statSync(from).isDirectory()) {
25
+ copyTree(from, to);
26
+ } else {
27
+ copyFileSync(from, to);
28
+ }
29
+ }
30
+ }
31
+
32
+ /**
33
+ * Install bundled `.cursor/rules` and `.cursor/skills` into the target repo.
34
+ * @param {string} [cwd] - Working directory (default process.cwd())
35
+ * @returns {boolean} - false if bundle source is missing (broken install)
36
+ */
37
+ export function scaffoldCursorBundle(cwd = process.cwd()) {
38
+ const rulesSrc = join(BUNDLE_ROOT, 'rules');
39
+ const skillsSrc = join(BUNDLE_ROOT, 'skills');
40
+ if (!existsSync(rulesSrc) || !existsSync(skillsSrc)) {
41
+ return false;
42
+ }
43
+ const cursorRoot = join(cwd, '.cursor');
44
+ copyTree(rulesSrc, join(cursorRoot, 'rules'));
45
+ copyTree(skillsSrc, join(cursorRoot, 'skills'));
46
+ return true;
47
+ }
@@ -163,13 +163,14 @@ export async function promptCommitlint() {
163
163
  }
164
164
 
165
165
  /**
166
- * Ask whether to add Cursor commit skill to the project (.cursor/skills/commit).
166
+ * Ask whether to install bundled Cursor rules + skills (.cursor/rules, .cursor/skills).
167
167
  */
168
168
  export async function promptCursorSkills() {
169
169
  const { enableCursorSkills } = await prompts({
170
170
  type: 'confirm',
171
171
  name: 'enableCursorSkills',
172
- message: 'Add Cursor commit skill to this project? (AI-assisted conventional commits)',
172
+ message:
173
+ 'Install Electric Maybe Cursor rules + skills? (Liquid/JS/a11y conventions + AI skills in .cursor/)',
173
174
  initial: true,
174
175
  });
175
176
 
@@ -133,7 +133,11 @@ jobs:
133
133
  echo "No package.json found, skipping."
134
134
  fi
135
135
 
136
+ # Changelog must be env, not ${{ }} inside the script: multiline markdown breaks the shell
137
+ # (lines starting with "-" run as commands; words like "markdown" become bogus invocations).
136
138
  - name: Commit and tag
139
+ env:
140
+ CHANGELOG: ${{ inputs.changelog }}
137
141
  run: |
138
142
  NEW_VERSION="${{ steps.bump.outputs.new_version }}"
139
143
  TAG_CREATED="false"
@@ -152,9 +156,8 @@ jobs:
152
156
  elif git rev-parse -q --verify "refs/tags/${NEW_VERSION}" >/dev/null; then
153
157
  echo "Tag ${NEW_VERSION} already exists locally, reusing."
154
158
  else
155
- CHANGELOG="${{ inputs.changelog }}"
156
159
  if [ -n "$CHANGELOG" ]; then
157
- git tag -a "$NEW_VERSION" -m "$CHANGELOG"
160
+ printf '%s\n' "$CHANGELOG" | git tag -a "$NEW_VERSION" -F -
158
161
  else
159
162
  git tag -a "$NEW_VERSION" -m "Release ${NEW_VERSION}"
160
163
  fi