climaybe 3.4.7 → 3.4.8

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 (34) hide show
  1. package/README.md +82 -31
  2. package/bin/version.txt +1 -1
  3. package/package.json +3 -3
  4. package/src/commands/add-cursor-skill.js +11 -12
  5. package/src/commands/add-store.js +15 -0
  6. package/src/commands/app-init.js +8 -12
  7. package/src/commands/create-entrypoints.js +13 -3
  8. package/src/commands/ensure-branches.js +11 -0
  9. package/src/commands/init.js +114 -17
  10. package/src/commands/update-workflows.js +3 -2
  11. package/src/cursor/rules/00-rule-index.mdc +1 -1
  12. package/src/cursor/rules/cursor-rule-template.mdc +8 -7
  13. package/src/cursor/rules/figma-design-system.mdc +8 -8
  14. package/src/cursor/rules/global-rules-reference.mdc +1 -1
  15. package/src/cursor/rules/snippets.mdc +1 -1
  16. package/src/cursor/skills/accessibility-pass/SKILL.md +2 -2
  17. package/src/cursor/skills/changelog-release/SKILL.md +2 -2
  18. package/src/cursor/skills/commit-in-groups/SKILL.md +2 -2
  19. package/src/cursor/skills/linear-create-task/SKILL.md +1 -1
  20. package/src/cursor/skills/liquid-doc-comments/SKILL.md +2 -2
  21. package/src/cursor/skills/locale-translation-prep/SKILL.md +2 -2
  22. package/src/cursor/skills/schema-section-change/SKILL.md +3 -3
  23. package/src/cursor/skills/section-from-spec/SKILL.md +6 -6
  24. package/src/cursor/skills/theme-check-fix/SKILL.md +4 -4
  25. package/src/index.js +3 -3
  26. package/src/lib/branch-protection.js +205 -0
  27. package/src/lib/config.js +11 -1
  28. package/src/lib/cursor-bundle.js +150 -12
  29. package/src/lib/git.js +12 -0
  30. package/src/lib/prompts.js +98 -4
  31. package/src/lib/theme-dev-kit.js +4 -0
  32. package/src/workflows/build/build-pipeline.yml +14 -0
  33. package/src/workflows/multi/pr-to-live.yml +1 -1
  34. package/src/workflows/preview/reusable-comment-on-pr.yml +6 -3
package/README.md CHANGED
@@ -4,16 +4,16 @@ Shopify CLI for **theme CI/CD** (GitHub Actions, branches, multi-store config) a
4
4
 
5
5
  Built by [Electric Maybe](https://electricmaybe.com) — a Shopify-focused product and development studio.
6
6
 
7
- **Commit linting and Cursor bundle (optional in both flows):**
7
+ **Commit linting and AI ruleset (optional in both flows):**
8
8
 
9
9
  - **Conventional commit linting:** During `climaybe theme init` or `climaybe app init`, you can install [commitlint](https://commitlint.js.org/) and [Husky](https://typicode.github.io/husky) for [Conventional Commits](https://www.conventionalcommits.org/).
10
- - **Cursor bundle (rules + skills + subagents):** Opt in to Electric Maybe’s bundled [Cursor](https://cursor.com/) files under `.cursor/rules/`, `.cursor/skills/`, and `.cursor/agents/` (themes, JS, a11y, commits, changelog, Linear, **theme-translator** for locale sync, etc.).
10
+ - **AI ruleset (rules + skills + subagents):** Opt in to Electric Maybe’s bundled rules, skills, and subagents (themes, JS, a11y, commits, changelog, Linear, **theme-translator** for locale sync, etc.). They install into a single `.config/ai/` source of truth and are bridged to the editors you pick (Cursor, Claude, Copilot, Windsurf, Cline, …). See [AI ruleset](#ai-ruleset).
11
11
 
12
12
  ## Command layout (Shopify CLI–style)
13
13
 
14
14
  - **`climaybe theme <command>`** — canonical commands for theme repos (workflows, stores, branches).
15
15
  - **Same commands at the top level** — `climaybe init` is the same as `climaybe theme init` (backward compatible).
16
- - **`climaybe app init`** — app repos only: writes `project_type: "app"` in `climaybe.config.json`, optional commitlint + Cursor bundle. Does **not** install theme GitHub Actions or store/branch setup.
16
+ - **`climaybe app init`** — app repos only: writes `project_type: "app"` in `climaybe.config.json`, optional commitlint + AI ruleset. Does **not** install theme GitHub Actions or store/branch setup.
17
17
  - **`climaybe setup-commitlint`** and **`climaybe add-cursor`** — always at the top level (stack-agnostic).
18
18
 
19
19
  Theme-only commands refuse to run when `climaybe.config.json` → `project_type` is **`app`**.
@@ -48,30 +48,32 @@ npm install -D climaybe
48
48
  npx climaybe app init
49
49
  ```
50
50
 
51
- Installs optional commitlint/Husky and the Cursor bundle (rules, skills, agents). Use [Shopify CLI](https://shopify.dev/docs/api/shopify-cli) for app development and deployment.
51
+ Installs optional commitlint/Husky and the [AI ruleset](#ai-ruleset) (rules, skills, agents). Use [Shopify CLI](https://shopify.dev/docs/api/shopify-cli) for app development and deployment.
52
52
 
53
53
  ## Commands
54
54
 
55
55
  ### `climaybe init` / `climaybe theme init`
56
56
 
57
- Interactive setup that configures your repo for CI/CD.
57
+ Interactive setup that configures your repo for CI/CD. Each question shows a one-line
58
+ hint (and a docs link where it helps) so you know what you're choosing. Defaults are
59
+ shown in the prompt; press Enter to accept.
58
60
 
59
61
  1. Prompts for your store URL (e.g., `voldt-staging.myshopify.com`)
60
62
  2. Extracts subdomain as alias, lets you override
61
- 3. Asks if you want to add more stores
62
- 4. Asks whether to enable optional **preview + cleanup** workflows (default: yes)
63
- 5. Asks whether to enable optional **build + Lighthouse** workflows (default: yes)
64
- 6. Asks whether to enable **commitlint + Husky** (enforce [conventional commits](https://www.conventionalcommits.org/) on `git commit`)
65
- 7. Asks whether to install the **Cursor bundle** (`.cursor/rules/`, `.cursor/skills/`, `.cursor/agents/`) Electric Maybe conventions for themes and AI workflows
66
- 8. Based on store count, sets up **single-store** or **multi-store** mode
67
- 9. Writes `climaybe.config.json`
68
- 10. Scaffolds GitHub Actions workflows
69
- 11. Creates git branches and store directories (multi-store)
70
- 12. Optionally installs commitlint, Husky, and the Cursor bundle (rules, skills, agents)
63
+ 3. Asks if you want to add more stores (two or more → multi-store mode)
64
+ 4. Asks whether to enable **[preview + cleanup workflows](#preview-and-cleanup-workflows)** (default: yes)
65
+ 5. Asks whether to enable **[build workflows](#build-and-lighthouse-workflows)** (default: yes)
66
+ 6. If build is on, asks separately whether to run **[Lighthouse CI](#build-and-lighthouse-workflows)** on staging (default: yes)
67
+ 7. Asks whether to install the **[theme dev kit](#theme-dev-kit)** (default: yes), and if so whether to add VS Code tasks
68
+ 8. Asks whether to enable **commitlint + Husky** (enforce [conventional commits](https://www.conventionalcommits.org/) on `git commit`)
69
+ 9. Asks whether to set up **[branch protection](#branch-protection)** (default: yes)
70
+ 10. Asks whether to install the **[AI ruleset](#ai-ruleset)**, and if so which editors to bridge
71
+ 11. Writes `climaybe.config.json`, scaffolds workflows, and creates branches/store directories
72
+ 12. Optionally configures CI secrets (and can add a GitHub/GitLab remote if the folder has none)
71
73
 
72
74
  ### `climaybe app init`
73
75
 
74
- Interactive setup for a **Shopify app** repository: optional commitlint + Husky, optional Cursor bundle, and `project_type: "app"` in `package.json` `config`. No theme workflows, stores, or staging/live branches.
76
+ Interactive setup for a **Shopify app** repository: optional commitlint + Husky, optional [AI ruleset](#ai-ruleset), and `project_type: "app"` in `package.json` `config`. No theme workflows, stores, or staging/live branches.
75
77
 
76
78
  ### `climaybe add-store` / `climaybe theme add-store`
77
79
 
@@ -114,6 +116,10 @@ If no alias is given, syncs to the default store.
114
116
 
115
117
  Create missing branches from your current branch (usually `main`). In single-store mode, this creates `staging` only. In multi-store mode, this creates `staging` plus per-store branches (`staging-<alias>`, `live-<alias>`). Use when the repo only has `main` (e.g. after a fresh clone) so the configured sync flow can run.
116
118
 
119
+ When a GitHub remote and authenticated `gh` CLI are available, this command also reconciles branch protection to match current mode:
120
+ - single-store: protect `main` (PR required)
121
+ - multi-store: protect `live-<alias>` (PR required; bypass users: `shopify[bot]`, `github-actions[bot]`, `actions-user`)
122
+
117
123
  ```bash
118
124
  npx climaybe ensure-branches
119
125
  git push origin --all
@@ -127,7 +133,7 @@ Refresh all climaybe-managed project files from your installed CLI version:
127
133
  - `package.json` managed deps (`climaybe`, `tailwindcss`)
128
134
  - optional `.vscode/tasks.json` (if enabled)
129
135
  - optional commitlint + Husky files (if enabled)
130
- - optional Cursor bundle files (if enabled)
136
+ - optional AI ruleset in `.config/ai/` + editor bridges (if enabled)
131
137
 
132
138
  ```bash
133
139
  npx climaybe update
@@ -145,13 +151,13 @@ npx climaybe setup-commitlint
145
151
 
146
152
  ### `climaybe add-cursor`
147
153
 
148
- Install Electric Maybe **Cursor rules, skills, and subagents** into `.cursor/rules/`, `.cursor/skills/`, and `.cursor/agents/` (including **theme-translator** for `theme/locales/`). Use this if you skipped the bundle at init or want to refresh from the version of climaybe you have installed.
154
+ Install the Electric Maybe **AI ruleset** (rules, skills, and subagents including **theme-translator** for `theme/locales/`) into `.config/ai/`, then bridge it to the editors you select. Use this if you skipped it at init or want to refresh from the version of climaybe you have installed. See [AI ruleset](#ai-ruleset) for the layout and editor bridges.
149
155
 
150
156
  ```bash
151
157
  npx climaybe add-cursor
152
158
  ```
153
159
 
154
- The previous command name `add-cursor-skill` still works as an alias. Re-running replaces the bundled rules, skills, and subagent files with the copies shipped by your installed climaybe version (same idea as `update`).
160
+ The previous command name `add-cursor-skill` still works as an alias. Re-running replaces the bundled rules, skills, and subagent files (and refreshes editor bridges) with the copies shipped by your installed climaybe version (same idea as `update`).
155
161
 
156
162
  ## Configuration
157
163
 
@@ -163,8 +169,10 @@ The CLI writes config into `climaybe.config.json`:
163
169
  "default_store": "voldt-staging.myshopify.com",
164
170
  "preview_workflows": true,
165
171
  "build_workflows": true,
172
+ "lighthouse_workflows": true,
166
173
  "commitlint": true,
167
174
  "cursor_skills": true,
175
+ "ai_editors": ["cursor", "claude"],
168
176
  "stores": {
169
177
  "voldt-staging": "voldt-staging.myshopify.com",
170
178
  "voldt-norway": "voldt-norway.myshopify.com"
@@ -172,6 +180,8 @@ The CLI writes config into `climaybe.config.json`:
172
180
  }
173
181
  ```
174
182
 
183
+ `lighthouse_workflows` gates Lighthouse CI inside the build pipeline (it still only runs on `staging` with the right secrets). `ai_editors` records which editors are bridged to `.config/ai/`. Older configs without these keys keep working: Lighthouse defaults to on when build workflows exist.
184
+
175
185
  Workflows read this config at runtime — no hardcoded values in YAML files.
176
186
 
177
187
  ## Branch Strategy
@@ -184,6 +194,7 @@ staging → main
184
194
 
185
195
  - `staging` — development branch
186
196
  - `main` — production branch
197
+ - branch protection: `main` requires PR (no direct pushes)
187
198
 
188
199
  ### Multi-store
189
200
 
@@ -195,9 +206,20 @@ staging → main → staging-<store> → live-<store>
195
206
  - `main` — shared codebase (not live)
196
207
  - `staging-<store>` — per-store staging with store-specific JSON data
197
208
  - `live-<store>` — per-store production
209
+ - branch protection: each `live-<store>` requires PR; bypass users: `shopify[bot]`, `github-actions[bot]`, `actions-user`
198
210
 
199
211
  Direct pushes to `staging-<store>` or `live-<store>` are automatically synced back to `main` (no PR; multistore-hotfix-to-main merges the branch into main).
200
212
 
213
+ ### Branch protection
214
+
215
+ `init` (with the prompt accepted, default **yes**), `add-store`, and `ensure-branches` reconcile GitHub branch protection to match your mode:
216
+
217
+ - **single-store:** protect `main` — pull requests required, no direct pushes.
218
+ - **multi-store:** protect each `live-<alias>` — PRs required, with bypass for the automation users `shopify[bot]`, `github-actions[bot]`, and `actions-user`; `main` is left unprotected so the sync workflows can push to it.
219
+ - switching single → multi removes the old `main` protection and applies `live-<alias>` protection instead.
220
+
221
+ It is **best-effort**: it only runs when `origin` is GitHub and the `gh` CLI is installed and authenticated. Otherwise it skips cleanly and prints why — it never fails the command.
222
+
201
223
  ## Workflows
202
224
 
203
225
  ### Shared (both modes)
@@ -225,9 +247,9 @@ Direct pushes to `staging-<store>` or `live-<store>` are automatically synced ba
225
247
  | `root-to-stores.yml` | Push to `live-*` | From main merge: stores→root. From elsewhere: root→stores (same as stores-to-root on staging-*) |
226
248
  | `multistore-hotfix-to-main.yml` | Push to `staging-*` or `live-*` (and after root-to-stores) | Merges store branch into main (no PR). Skips when push is a merge from main (avoids loop) and skips no-op backports when source and main trees are identical |
227
249
 
228
- ### Optional preview + cleanup package
250
+ ### Preview and cleanup workflows
229
251
 
230
- Enabled via `climaybe init` prompt (`Enable preview + cleanup workflows?`; default: yes).
252
+ Optional package, enabled via the `climaybe init` prompt (`Enable preview + cleanup workflows?`; default: yes). These publish a per-PR preview theme, post preview/customize links, and clean the theme up when the PR closes.
231
253
 
232
254
  | Workflow | Trigger | What it does |
233
255
  |----------|---------|-------------|
@@ -241,9 +263,9 @@ Enabled via `climaybe init` prompt (`Enable preview + cleanup workflows?`; defau
241
263
  | `reusable-cleanup-themes.yml` | workflow_call | `cleanup_mode: by_pr` deletes names ending with `-PR{padded}`; `orphan_pr` deletes `-PR<n>` when PR `n` is not open. Optional `result_artifact_prefix` for matrix fan-in on `pr-close` |
242
264
  | `reusable-extract-pr-number.yml` | workflow_call | Extracts padded/unpadded PR number outputs for naming and API-safe usage |
243
265
 
244
- ### Optional build + Lighthouse package
266
+ ### Build and Lighthouse workflows
245
267
 
246
- Enabled via `climaybe init` prompt (`Enable build + Lighthouse workflows?`; default: yes).
268
+ Optional package. `climaybe init` asks two separate questions: **build workflows** (bundle `_scripts` JS + compile Tailwind in CI; default: yes) and, if build is on, **Lighthouse CI** (performance + a11y budget on the `staging` branch; default: yes, stored as `lighthouse_workflows`). Lighthouse runs inside the build pipeline, so it requires build workflows.
247
269
 
248
270
  When enabled, builds are **resilient**:
249
271
  - If `_scripts/*.js` or `_styles/main.css` are missing, the build workflow **skips** those steps and continues.
@@ -262,21 +284,50 @@ Build workflows install deps with `npm ci` and run `npx --no-install climaybe bu
262
284
  | `reusable-build.yml` | workflow_call | Path-filtered `build-scripts` / Tailwind (`climaybe build`), then commits compiled assets when changed |
263
285
  | `create-release.yml` | Push tag `v*`, or **workflow_run** after Post-Merge Tag / Nightly Hotfix Tag succeed on `main` | Builds release archive and creates GitHub Release notes from commits since the previous tag. It filters repetitive automation subjects (main→staging syncs, store/root sync chores, bot merge noise) before generating notes. If remaining subjects are low-signal and `GEMINI_API_KEY` exists, it uses Gemini to generate cleaner merchant-facing notes. Also covers tags created by workflows with `GITHUB_TOKEN`, which may not trigger tag-push workflows. |
264
286
 
265
- ### Optional theme dev kit package
287
+ ### Theme dev kit
288
+
289
+ Optional local-development bundle, enabled during `climaybe init` (default: yes). It installs the config files that make local theme work and CI consistent:
266
290
 
267
- During `climaybe init`, you can enable the Electric Maybe theme dev kit (default: yes). This installs local
268
- dev config defaults (`.theme-check.yml`, `.shopifyignore`, `.prettierrc`,
269
- `.lighthouserc.js`), writes `climaybe.config.json`, appends a managed `.gitignore` block, and optionally adds
270
- `.vscode/tasks.json` (default: yes) wired to run `climaybe` dev commands.
291
+ | File | What it's for |
292
+ |------|---------------|
293
+ | `.theme-check.yml` | Theme Check defaults (`theme-check:recommended`); ignores `node_modules/` and generated `_styles/` output |
294
+ | `.shopifyignore` | Keeps dev-only files out of theme uploads (`_scripts`, `_styles`, `stores`, editor/AI config, docs, package files, …) |
295
+ | `.prettierrc` | Prettier with the Shopify Liquid plugin |
296
+ | `.lighthouserc.js` | Lighthouse CI config: local URL, start command, and score thresholds |
297
+ | `.vscode/tasks.json` *(optional)* | One background task that runs `climaybe serve` (added only if you opt in) |
298
+ | `.gitignore` | A managed block is merged in (editor dirs, `node_modules`, generated `assets/index.js` + `assets/style.css`, `.shopify`, `.vercel`) |
299
+ | `package.json` | Ensures the `climaybe` dependency and `tailwindcss` devDependency exist; fills default name/description/author if missing |
300
+ | `climaybe.config.json` | The local source-of-truth config (`port`, `default_store`, `dev_kit`, `vscode_tasks`, `project_type`) |
301
+
302
+ Existing files are reported before they're replaced. Install or refresh later with `climaybe add-dev-kit` (or `climaybe theme add-dev-kit`).
271
303
 
272
304
  Local serve commands keep Theme Check disabled by default for faster startup. Enable it explicitly with
273
305
  `climaybe serve --theme-check` or `climaybe serve:assets --theme-check`.
274
306
 
275
- You can create optional build entrypoints later with:
307
+ You can create optional build entrypoints later with `climaybe create-entrypoints`. The scaffolded `_scripts/main.js` and `_styles/main.css` include a commented sample import showing how to pull in other files (`import './foo.js';` and `@import "./foo.css";`).
308
+
309
+ ### AI ruleset
310
+
311
+ Optional. Electric Maybe ships a bundle of editor rules, skills, and subagents (themes, JS, a11y, commits, changelog, Linear task creation, **theme-translator** for locale sync, …). To avoid duplicating prompt content per editor, it installs into **one** source of truth and bridges every editor to it:
312
+
313
+ ```
314
+ your-repo/
315
+ ├── .config/
316
+ │ └── ai/ <-- the only real files (rules/, skills/, agents/, rules.md)
317
+ ├── .cursor --> bridge to .config/ai (Cursor)
318
+ ├── .windsurf --> bridge to .config/ai (Windsurf)
319
+ ├── .clinerules --> bridge to .config/ai (Cline / Roo Code)
320
+ ├── AGENTS.md --> bridge to .config/ai/rules.md (generic / other editors)
321
+ ├── CLAUDE.md --> bridge to .config/ai/rules.md (Claude Code)
322
+ └── .github/
323
+ └── copilot-instructions.md --> bridge to .config/ai/rules.md (Copilot / VS Code)
324
+ ```
276
325
 
277
- `climaybe create-entrypoints`
326
+ - `climaybe init` (and `add-cursor` / `app init`) asks **which editors** to bridge. Only the bridges you pick are created.
327
+ - Bridges are **symlinks** where the OS allows (relative symlinks on macOS/Linux, directory junctions on Windows), so there is zero duplication — edit a rule once under `.config/ai/` and every editor sees it. If a platform blocks symlinks, climaybe falls back to copying the file so the bridge still works.
328
+ - The chosen editors are recorded as `ai_editors` in `climaybe.config.json`. `.config/ai/` and the bridges are kept out of theme uploads via `.shopifyignore`.
278
329
 
279
- If these files already exist, `init` warns that they will be replaced.
330
+ Install or refresh anytime with `climaybe add-cursor` (alias `add-cursor-skill`).
280
331
 
281
332
  ### Section schema builder
282
333
 
package/bin/version.txt CHANGED
@@ -1 +1 @@
1
- 3.4.7
1
+ 3.4.8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "climaybe",
3
- "version": "3.4.7",
3
+ "version": "3.4.8",
4
4
  "description": "Shopify CLI by Electric Maybe for theme CI/CD workflows, branch orchestration, app setup, and dev tooling",
5
5
  "type": "module",
6
6
  "bin": {
@@ -81,7 +81,7 @@
81
81
  "@shopify/prettier-plugin-liquid": "^1.6.3",
82
82
  "@tailwindcss/cli": "^4.1.17",
83
83
  "@tailwindcss/typography": "^0.5.16",
84
- "commander": "^14.0.3",
84
+ "commander": "^15.0.0",
85
85
  "eslint": "^10.1.0",
86
86
  "picocolors": "^1.1.1",
87
87
  "prettier": "^3.4.2",
@@ -91,7 +91,7 @@
91
91
  "tailwindcss": "^4.1.18"
92
92
  },
93
93
  "devDependencies": {
94
- "@commitlint/cli": "^20.4.4",
94
+ "@commitlint/cli": "^21.0.2",
95
95
  "@commitlint/config-conventional": "^20.4.4",
96
96
  "@semantic-release/git": "^10.0.1",
97
97
  "@semantic-release/github": "^12.0.6",
@@ -1,24 +1,23 @@
1
1
  import pc from 'picocolors';
2
2
  import { writeConfig } from '../lib/config.js';
3
- import { scaffoldCursorBundle } from '../lib/cursor-bundle.js';
3
+ import { scaffoldAiConfig, logAiConfigResult } from '../lib/cursor-bundle.js';
4
+ import { promptAiEditors } from '../lib/prompts.js';
4
5
 
5
6
  /**
6
- * Install Electric Maybe Cursor bundle (.cursor/rules, .cursor/skills, .cursor/agents).
7
- * Can be run standalone or after init if Cursor bundle was skipped.
7
+ * Install the Electric Maybe AI ruleset into .config/ai/ and bridge it to the chosen editors.
8
+ * Can be run standalone or after init if the ruleset was skipped.
8
9
  */
9
10
  export async function addCursorSkillCommand() {
10
- console.log(pc.bold('\n climaybe — Add Cursor bundle\n'));
11
+ console.log(pc.bold('\n climaybe — Add AI ruleset\n'));
11
12
 
12
- writeConfig({ cursor_skills: true });
13
+ const editors = await promptAiEditors();
14
+ writeConfig({ cursor_skills: true, ai_editors: editors });
13
15
 
14
- const ok = scaffoldCursorBundle();
15
- if (ok) {
16
- console.log(
17
- pc.green(' Installed .cursor/rules, .cursor/skills, and .cursor/agents from climaybe bundle.'),
18
- );
19
- console.log(pc.dim(' See .cursor/rules/00-rule-index.mdc for which rules apply when.\n'));
16
+ const result = scaffoldAiConfig(process.cwd(), { editors });
17
+ logAiConfigResult(result, { pc });
18
+ if (result.ok) {
19
+ console.log(pc.dim(' See .config/ai/rules/00-rule-index.mdc for which rules apply when.\n'));
20
20
  } else {
21
- console.log(pc.red(' Cursor bundle not found in this climaybe install.'));
22
21
  console.log(pc.dim(' Reinstall climaybe or report an issue.\n'));
23
22
  }
24
23
  }
@@ -12,6 +12,7 @@ import { requireThemeProject } from '../lib/theme-guard.js';
12
12
  import { createStoreBranches } from '../lib/git.js';
13
13
  import { scaffoldWorkflows } from '../lib/workflows.js';
14
14
  import { createStoreDirectories } from '../lib/store-sync.js';
15
+ import { logBranchProtectionResult, syncBranchProtection } from '../lib/branch-protection.js';
15
16
  import {
16
17
  isGhAvailable,
17
18
  hasGitHubRemote,
@@ -74,6 +75,20 @@ export async function addStoreCommand() {
74
75
  scaffoldWorkflows('multi', { includePreview, includeBuild });
75
76
  }
76
77
 
78
+ const protection = syncBranchProtection({
79
+ mode: newMode,
80
+ aliases: getStoreAliases(),
81
+ cwd: process.cwd(),
82
+ });
83
+ logBranchProtectionResult(protection, newMode);
84
+ if (protection.applied.length > 0 || protection.removed.length > 0) {
85
+ console.log(
86
+ pc.dim(
87
+ ' Rule: PR required on protected branches; live-* bypass allowed for shopify[bot], github-actions[bot], actions-user.'
88
+ )
89
+ );
90
+ }
91
+
77
92
  console.log(pc.bold(pc.green('\n Store added successfully!\n')));
78
93
  console.log(pc.dim(` New branches: staging-${store.alias}, live-${store.alias}`));
79
94
  console.log(pc.dim(` Store dir: stores/${store.alias}/\n`));
@@ -1,6 +1,6 @@
1
1
  import prompts from 'prompts';
2
2
  import pc from 'picocolors';
3
- import { promptCommitlint, promptCursorSkills } from '../lib/prompts.js';
3
+ import { promptCommitlint, promptCursorSkills, promptAiEditors } from '../lib/prompts.js';
4
4
  import {
5
5
  readConfig,
6
6
  writeConfig,
@@ -9,20 +9,22 @@ import {
9
9
  } from '../lib/config.js';
10
10
  import { ensureGitRepo, ensureInitialCommit } from '../lib/git.js';
11
11
  import { scaffoldCommitlint } from '../lib/commit-tooling.js';
12
- import { scaffoldCursorBundle } from '../lib/cursor-bundle.js';
12
+ import { scaffoldAiConfig, logAiConfigResult } from '../lib/cursor-bundle.js';
13
13
 
14
14
  /**
15
- * Minimal Shopify app repo setup: commitlint, Cursor bundle, project_type in config.
15
+ * Minimal Shopify app repo setup: commitlint, AI ruleset, project_type in config.
16
16
  * No theme stores, branches, or GitHub Actions theme workflows.
17
17
  */
18
18
  async function runAppInitFlow() {
19
19
  const enableCommitlint = await promptCommitlint();
20
20
  const enableCursorSkills = await promptCursorSkills();
21
+ const aiEditors = enableCursorSkills ? await promptAiEditors() : [];
21
22
 
22
23
  const config = {
23
24
  project_type: 'app',
24
25
  commitlint: enableCommitlint,
25
26
  cursor_skills: enableCursorSkills,
27
+ ai_editors: enableCursorSkills ? aiEditors : undefined,
26
28
  };
27
29
 
28
30
  writeConfig(config, process.cwd(), { defaultPackageName: 'shopify-app' });
@@ -40,19 +42,13 @@ async function runAppInitFlow() {
40
42
  }
41
43
  }
42
44
  if (enableCursorSkills) {
43
- const cursorOk = scaffoldCursorBundle();
44
- if (cursorOk) {
45
- console.log(
46
- pc.green(' Electric Maybe Cursor bundle → .cursor/rules, .cursor/skills, .cursor/agents'),
47
- );
48
- } else {
49
- console.log(pc.yellow(' Cursor bundle not found in package (skipped).'));
50
- }
45
+ const aiResult = scaffoldAiConfig(process.cwd(), { editors: aiEditors });
46
+ logAiConfigResult(aiResult, { pc });
51
47
  }
52
48
 
53
49
  console.log(pc.bold(pc.green('\n App setup complete!\n')));
54
50
  console.log(pc.dim(' commitlint + Husky: ' + (enableCommitlint ? 'enabled' : 'disabled')));
55
- console.log(pc.dim(' Cursor bundle: ' + (enableCursorSkills ? 'installed' : 'skipped')));
51
+ console.log(pc.dim(' AI ruleset: ' + (enableCursorSkills ? 'installed' : 'skipped')));
56
52
  console.log(pc.dim('\n Next steps:'));
57
53
  console.log(pc.dim(' Use Shopify CLI (`shopify app dev`, etc.) for app development.'));
58
54
  console.log(pc.dim(' Theme CI/CD workflows are not installed; add your own deployment as needed.\n'));
@@ -3,12 +3,22 @@ import { join } from 'node:path';
3
3
  import pc from 'picocolors';
4
4
  import { requireThemeProject } from '../lib/theme-guard.js';
5
5
 
6
- const MAIN_JS = `// climaybe entrypoint: global theme JS
7
- // Add imports here for code you want on every page.
8
- // Top-level files in _scripts/ (besides main.js) are treated as separate bundles.
6
+ const MAIN_JS = `// climaybe entrypoint: global theme JS — bundled into assets/index.js, loaded on every page.
7
+ //
8
+ // Pull in other modules from _scripts/ by importing them here. They get inlined
9
+ // into this bundle, so this is how you split code across files:
10
+ //
11
+ // import './foo.js'; // run foo.js as part of the page bundle
12
+ // import { init } from './foo.js';
13
+ //
14
+ // Top-level files in _scripts/ (besides main.js) are emitted as their own bundles.
15
+ // Delete the example import once you add real modules.
9
16
  `;
10
17
 
11
18
  const MAIN_CSS = `@import "tailwindcss";
19
+
20
+ /* Import your own stylesheets from _styles/ the same way you import JS modules: */
21
+ /* @import "./foo.css"; */
12
22
  `;
13
23
 
14
24
  export async function createEntrypointsCommand() {
@@ -9,6 +9,7 @@ import {
9
9
  hasOriginRemote,
10
10
  pushBranchesToOrigin,
11
11
  } from '../lib/git.js';
12
+ import { logBranchProtectionResult, syncBranchProtection } from '../lib/branch-protection.js';
12
13
 
13
14
  /**
14
15
  * Create missing staging (single-store) or staging + per-store branches (multi-store) from current HEAD.
@@ -51,6 +52,16 @@ export async function ensureBranchesCommand() {
51
52
  try {
52
53
  pushBranchesToOrigin(branchesToPush);
53
54
  console.log(pc.green(' Pushed ensured branches to origin.\n'));
55
+ const protection = syncBranchProtection({ mode, aliases, cwd: process.cwd() });
56
+ logBranchProtectionResult(protection, mode);
57
+ if (protection.applied.length > 0 || protection.removed.length > 0) {
58
+ console.log(
59
+ pc.dim(
60
+ ' Rule: PR required on protected branches; live-* bypass allowed for shopify[bot], github-actions[bot], actions-user.'
61
+ )
62
+ );
63
+ }
64
+ console.log('');
54
65
  } catch (err) {
55
66
  console.log(pc.yellow(` Could not push branches automatically: ${err.message}`));
56
67
  console.log(pc.dim(' Push them manually so CI can run:'));