@codigodoleo/wp-kit 5.0.2 → 5.2.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 (62) hide show
  1. package/lib/commands/init.js +87 -78
  2. package/lib/config/versions.js +45 -45
  3. package/lib/core/infer-ci-capabilities.js +39 -26
  4. package/lib/prompts/index.js +118 -92
  5. package/modules/blank-theme/index.js +23 -34
  6. package/modules/blank-theme/prompts.js +9 -25
  7. package/modules/blank-theme/templates/.lando.yml.hbs +5 -8
  8. package/modules/blank-theme/templates/package.json.hbs +1 -1
  9. package/modules/deploy/index.js +51 -61
  10. package/modules/deploy/prompts.js +36 -12
  11. package/modules/deploy/templates/.github/workflows/ci.yml.hbs +356 -63
  12. package/modules/deploy/templates/.gitlab/ci/lint-blank-theme.yml.hbs +4 -4
  13. package/modules/deploy/templates/.gitlab/ci/lint-mu-plugin.yml.hbs +3 -2
  14. package/modules/deploy/templates/.gitlab/ci/lint-plugin.yml.hbs +3 -2
  15. package/modules/deploy/templates/.gitlab/ci/lint-sage.yml.hbs +17 -14
  16. package/modules/docs/templates/docs/Infraestrutura.md.hbs +24 -0
  17. package/modules/docs/templates/docs/Troubleshooting.md.hbs +17 -0
  18. package/modules/git/.lintstagedrc.json +2 -5
  19. package/modules/lint/.oxlintrc.json +19 -0
  20. package/modules/lint/.prettierignore +16 -1
  21. package/modules/lint/index.js +32 -40
  22. package/modules/lint/templates/mago.toml.hbs +83 -0
  23. package/modules/lint/templates/package.json.hbs +6 -10
  24. package/modules/lint/templates/workspace.json.hbs +2 -36
  25. package/modules/mu-plugin/index.js +39 -51
  26. package/modules/mu-plugin/prompts.js +10 -28
  27. package/modules/mu-plugin/templates/.lando.yml.hbs +8 -10
  28. package/modules/mu-plugin/templates/acorn/composer.json.hbs +6 -5
  29. package/modules/mu-plugin/templates/composer.json.hbs +4 -2
  30. package/modules/php/templates/.lando.yml.hbs +13 -8
  31. package/modules/php/templates/composer.json.hbs +15 -7
  32. package/modules/php/templates/workspace.json.hbs +22 -19
  33. package/modules/plugin/index.js +10 -18
  34. package/modules/plugin/prompts.js +5 -19
  35. package/modules/plugin/templates/.lando.yml.hbs +8 -10
  36. package/modules/plugin/templates/composer.json.hbs +4 -2
  37. package/modules/sage/index.js +78 -88
  38. package/modules/sage/prompts.js +10 -24
  39. package/modules/sage/templates/.lando.yml.hbs +17 -7
  40. package/modules/sage/templates/theme/composer.json.hbs +36 -23
  41. package/modules/sage/templates/theme/package.json.hbs +24 -13
  42. package/modules/test/templates/composer.json.hbs +1 -1
  43. package/package.json +30 -35
  44. package/templates/.devcontainer/devcontainer.json.hbs +2 -2
  45. package/templates/.env.hbs +5 -0
  46. package/templates/.gitignore.hbs +1 -0
  47. package/templates/auth.json.hbs +8 -0
  48. package/templates/composer.json.hbs +13 -5
  49. package/templates/package.json.hbs +2 -4
  50. package/templates/workspace.json.hbs +3 -4
  51. package/wp-config.php +5 -0
  52. package/modules/blank-theme/lint/eslint.config.mjs +0 -30
  53. package/modules/blank-theme/lint/pint.json +0 -11
  54. package/modules/deploy/.github/workflows/deploy-docker.yml +0 -104
  55. package/modules/deploy/.github/workflows/deploy-ssh.yml +0 -128
  56. package/modules/deploy/.github/workflows/release.yml +0 -57
  57. package/modules/mu-plugin/lint/eslint.config.mjs +0 -30
  58. package/modules/mu-plugin/lint/pint.json +0 -11
  59. package/modules/plugin/lint/eslint.config.mjs +0 -30
  60. package/modules/plugin/lint/pint.json +0 -11
  61. package/modules/sage/lint/eslint.config.mjs +0 -30
  62. package/modules/sage/lint/pint.json +0 -11
@@ -1,15 +1,23 @@
1
1
  {
2
2
  "require-dev": {
3
- "laravel/pint": "^1.29",
4
- "phpunit/phpunit": "^12.5",
5
- "phpstan/phpstan": "^2.1",
6
- "phpstan/extension-installer": "^1.4",
7
- "szepeviktor/phpstan-wordpress": "^2.0",
8
- "php-stubs/wordpress-stubs": "^6.8"
3
+ "carthage-software/mago": "^1.0",
4
+ "phpstan/phpstan": "2.1",
5
+ "phpstan/extension-installer": "1.4.3",
6
+ "szepeviktor/phpstan-wordpress": "^2.1",
7
+ "php-stubs/wordpress-stubs": "7.0.0",
8
+ "pestphp/pest": "4.7"
9
9
  },
10
10
  "config": {
11
11
  "allow-plugins": {
12
- "phpstan/extension-installer": true
12
+ "phpstan/extension-installer": true,
13
+ "pestphp/pest-plugin": true
13
14
  }
15
+ },
16
+ "scripts": {
17
+ "format": "vendor/bin/mago format",
18
+ "format:check": "vendor/bin/mago format --check",
19
+ "lint": "vendor/bin/mago lint",
20
+ "test": "pest",
21
+ "test:coverage": "pest --coverage"
14
22
  }
15
23
  }
@@ -17,24 +17,24 @@
17
17
  "wordpress"
18
18
  ],
19
19
  "[php]": {
20
- "editor.defaultFormatter": "open-southeners.laravel-pint",
21
- "editor.formatOnSave": true,
20
+ "editor.defaultFormatter": "carthage-software.mago",
21
+ "editor.formatOnSave": false,
22
22
  "editor.insertSpaces": true,
23
23
  "editor.tabSize": 4
24
24
  }
25
25
  },
26
26
  "extensions": {
27
27
  "recommendations": [
28
- "open-southeners.laravel-pint"
28
+ "carthage-software.mago"
29
29
  ]
30
30
  },
31
31
  "tasks": {
32
32
  "tasks": [
33
33
  {
34
- "label": "🔧 PHP: Fix Code Style (Pint)",
34
+ "label": "🔧 PHP: Format (Mago)",
35
35
  "type": "shell",
36
36
  "command": "lando",
37
- "args": ["pint"],
37
+ "args": ["mago"],
38
38
  "group": "build",
39
39
  "presentation": {
40
40
  "echo": true,
@@ -45,10 +45,10 @@
45
45
  "problemMatcher": []
46
46
  },
47
47
  {
48
- "label": "🔍 PHP: Check Code Style (Pint)",
48
+ "label": "🔍 PHP: Check Format (Mago)",
49
49
  "type": "shell",
50
50
  "command": "lando",
51
- "args": ["pint", "--test"],
51
+ "args": ["mago-check"],
52
52
  "group": "test",
53
53
  "presentation": {
54
54
  "echo": true,
@@ -56,18 +56,21 @@
56
56
  "focus": false,
57
57
  "panel": "shared"
58
58
  },
59
- "problemMatcher": {
60
- "owner": "pint",
61
- "fileLocation": "absolute",
62
- "pattern": {
63
- "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error)\\s+-\\s+(.*)$",
64
- "file": 1,
65
- "line": 2,
66
- "column": 3,
67
- "severity": 4,
68
- "message": 5
69
- }
70
- }
59
+ "problemMatcher": []
60
+ },
61
+ {
62
+ "label": "🔬 PHP: Lint (Mago)",
63
+ "type": "shell",
64
+ "command": "lando",
65
+ "args": ["mago-lint"],
66
+ "group": "test",
67
+ "presentation": {
68
+ "echo": true,
69
+ "reveal": "always",
70
+ "focus": false,
71
+ "panel": "shared"
72
+ },
73
+ "problemMatcher": []
71
74
  }
72
75
  ]
73
76
  }
@@ -1,8 +1,8 @@
1
- import path from 'path';
1
+ import path from "path";
2
2
 
3
- import fs from 'fs-extra';
3
+ import fs from "fs-extra";
4
4
 
5
- import { log, color } from '../../lib/utils/logger.js';
5
+ import { log, color } from "../../lib/utils/logger.js";
6
6
 
7
7
  export async function setupModule(context, generator) {
8
8
  const pluginName = context.plugin_name || `${context.projectName}-plugin`;
@@ -16,30 +16,22 @@ export async function setupModule(context, generator) {
16
16
 
17
17
  // 2. Generate main plugin entry file
18
18
  await generator.generateFile(
19
- 'plugin.php',
19
+ "plugin.php",
20
20
  { ...context, plugin_name: pluginName },
21
- 'plugin',
22
- `${pluginDir}/${pluginName}.php`
21
+ "plugin",
22
+ `${pluginDir}/${pluginName}.php`,
23
23
  );
24
24
 
25
25
  // 3. Generate composer.json
26
26
  await generator.generateFile(
27
- 'composer.json',
27
+ "composer.json",
28
28
  { ...context, plugin_name: pluginName },
29
- 'plugin',
30
- `${pluginDir}/composer.json`
29
+ "plugin",
30
+ `${pluginDir}/composer.json`,
31
31
  );
32
32
 
33
33
  // 4. Create src/ scaffold
34
- await fs.ensureFile(path.join(absolutePluginDir, 'src', '.gitkeep'));
35
-
36
- // 5. Lint configs co-located in plugin — always installed (IDE/editor support)
37
- log(color.blue, '[plugin] 🔧 Installing lint configurations...');
38
- await generator.copyFile('lint/.prettierrc.json', 'plugin', `${pluginDir}/.prettierrc.json`);
39
- await generator.copyFile('lint/pint.json', 'plugin', `${pluginDir}/pint.json`);
40
- if (context.plugin_lint_eslint === true) {
41
- await generator.copyFile('lint/eslint.config.mjs', 'plugin', `${pluginDir}/eslint.config.mjs`);
42
- }
34
+ await fs.ensureFile(path.join(absolutePluginDir, "src", ".gitkeep"));
43
35
 
44
36
  log(color.green, `[plugin] ✅ Plugin scaffolded: ${pluginDir}`);
45
37
  }
@@ -1,23 +1,9 @@
1
1
  export default [
2
2
  {
3
- type: 'input',
4
- name: 'plugin_name',
5
- message: 'Plugin slug (used as directory name):',
6
- default: (answers) => `${answers.projectName || 'wordpress'}-plugin`,
7
- when: (answers) => answers.selectedContentModules?.includes('plugin'),
8
- },
9
- {
10
- type: 'confirm',
11
- name: 'plugin_lint_pint',
12
- message: 'Plugin: enable Pint for PHP?',
13
- default: true,
14
- when: (answers) => answers.selectedContentModules?.includes('plugin') && answers.enable_lint,
15
- },
16
- {
17
- type: 'confirm',
18
- name: 'plugin_lint_eslint',
19
- message: 'Plugin: enable ESLint for JS/TS?',
20
- default: false,
21
- when: (answers) => answers.selectedContentModules?.includes('plugin') && answers.enable_lint,
3
+ type: "input",
4
+ name: "plugin_name",
5
+ message: "Plugin slug (used as directory name):",
6
+ default: (answers) => `${answers.projectName || "wordpress"}-plugin`,
7
+ when: (answers) => answers.selectedContentModules?.includes("plugin"),
22
8
  },
23
9
  ];
@@ -1,15 +1,13 @@
1
1
  tooling:
2
2
  {{#if enable_lint}}
3
- plugin-pint:
3
+ plugin-mago:
4
+ service: appserver
5
+ description: Format PHP in the plugin
6
+ dir: /app
7
+ cmd: vendor/bin/mago format content/plugins/{{plugin_name}}/
8
+ plugin-mago-lint:
4
9
  service: appserver
5
10
  description: Lint PHP in the plugin
6
- dir: /app/content/plugins/{{plugin_name}}
7
- cmd: ./vendor/bin/pint
8
- {{#if plugin_lint_eslint}}
9
- plugin-eslint:
10
- service: build
11
- description: Lint JS/TS in the plugin
12
- dir: /app/content/plugins/{{plugin_name}}
13
- cmd: npx eslint --fix resources/
14
- {{/if}}
11
+ dir: /app
12
+ cmd: vendor/bin/mago lint content/plugins/{{plugin_name}}/
15
13
  {{/if}}
@@ -6,9 +6,11 @@
6
6
  }
7
7
  },
8
8
  "require-dev": {
9
- "laravel/pint": "^1.21"
9
+ "carthage-software/mago": "^1.0"
10
10
  },
11
11
  "scripts": {
12
- "lint": ["./vendor/bin/pint --test"]
12
+ "format": ["vendor/bin/mago format"],
13
+ "format:check": ["vendor/bin/mago format --check"],
14
+ "lint": ["vendor/bin/mago lint"]
13
15
  }
14
16
  }
@@ -1,10 +1,10 @@
1
- import path from 'path';
2
- import { execSync } from 'child_process';
1
+ import path from "path";
2
+ import { execSync } from "child_process";
3
3
 
4
- import fs from 'fs-extra';
4
+ import fs from "fs-extra";
5
5
 
6
- import { log, color } from '../../lib/utils/logger.js';
7
- import { VERSION_REGISTRY, validateVersionCompatibility } from '../../lib/config/versions.js';
6
+ import { log, color } from "../../lib/utils/logger.js";
7
+ import { VERSION_REGISTRY, validateVersionCompatibility } from "../../lib/config/versions.js";
8
8
 
9
9
  /**
10
10
  * Install Sage theme with enhanced error handling and validation
@@ -14,9 +14,9 @@ import { VERSION_REGISTRY, validateVersionCompatibility } from '../../lib/config
14
14
  * - Better logging and progress tracking
15
15
  */
16
16
  export async function setupModule(context, generator) {
17
- const themeDir = path.join(context.cwd, 'content', 'themes', context.projectName);
17
+ const themeDir = path.join(context.cwd, "content", "themes", context.projectName);
18
18
  const relativeThemeDir = `content/themes/${context.projectName}`;
19
- const relativeDevcontainerDir = '.devcontainer';
19
+ const relativeDevcontainerDir = ".devcontainer";
20
20
 
21
21
  try {
22
22
  // 1. Validate version compatibility
@@ -24,17 +24,17 @@ export async function setupModule(context, generator) {
24
24
  context.sageVersion,
25
25
  context.phpVersion,
26
26
  context.nodeVersion,
27
- context.wpCoreVersion
27
+ context.wpCoreVersion,
28
28
  );
29
29
 
30
30
  if (validation.errors.length > 0) {
31
- log(color.red, '❌ Version compatibility errors:');
31
+ log(color.red, "❌ Version compatibility errors:");
32
32
  validation.errors.forEach((err) => log(color.red, ` - ${err}`));
33
- throw new Error('Version compatibility check failed');
33
+ throw new Error("Version compatibility check failed");
34
34
  }
35
35
 
36
36
  if (validation.warnings.length > 0) {
37
- log(color.orange, '⚠️ Version compatibility warnings:');
37
+ log(color.orange, "⚠️ Version compatibility warnings:");
38
38
  validation.warnings.forEach((warn) => log(color.orange, ` - ${warn}`));
39
39
  }
40
40
 
@@ -53,7 +53,7 @@ export async function setupModule(context, generator) {
53
53
  const alreadyInstalled = await isSageThemeInstalled(themeDir);
54
54
  if (alreadyInstalled) {
55
55
  shouldInstallSage = false;
56
- log(color.blue, '[sage] ♻️ Existing Sage theme detected. Reusing installation.');
56
+ log(color.blue, "[sage] ♻️ Existing Sage theme detected. Reusing installation.");
57
57
  } else {
58
58
  log(color.orange, `⚠️ ${themeDir} has stale files. Cleaning before installation.`);
59
59
  await fs.emptyDir(themeDir);
@@ -62,18 +62,18 @@ export async function setupModule(context, generator) {
62
62
 
63
63
  // 4. Build composer command with proper error handling
64
64
  const cmd = [
65
- 'composer create-project',
66
- 'roots/sage',
65
+ "composer create-project",
66
+ "roots/sage",
67
67
  `"${themeDir}"`,
68
68
  sageConfig.tag,
69
- '--no-interaction',
70
- '--ignore-platform-reqs',
71
- ].join(' ');
69
+ "--no-interaction",
70
+ "--ignore-platform-reqs",
71
+ ].join(" ");
72
72
 
73
73
  if (shouldInstallSage) {
74
74
  log(color.blue, `[sage] 📦 Installing Sage ${context.sageVersion} (${sageConfig.tag})...`);
75
75
  log(color.blue, `[sage] 📍 Location: ${relativeThemeDir}`);
76
- execSync(cmd, { stdio: 'inherit', cwd: context.cwd });
76
+ execSync(cmd, { stdio: "inherit", cwd: context.cwd });
77
77
  }
78
78
 
79
79
  // 6. Validate theme installation
@@ -81,128 +81,118 @@ export async function setupModule(context, generator) {
81
81
  log(color.green, `[sage] ✅ Theme installation verified`);
82
82
 
83
83
  // 7. Generate customizations
84
- log(color.blue, '[sage] 🛠️ Applying advanced Sage DX customizations...');
85
- if (context.sageVersion === '11') {
84
+ log(color.blue, "[sage] 🛠️ Applying advanced Sage DX customizations...");
85
+ if (context.sageVersion === "11") {
86
86
  await generator.generateFile(
87
- 'theme/vite.config.js',
87
+ "theme/vite.config.js",
88
88
  context,
89
- 'sage',
90
- `${relativeThemeDir}/vite.config.js`
89
+ "sage",
90
+ `${relativeThemeDir}/vite.config.js`,
91
91
  );
92
92
  } else {
93
- log(color.blue, '[sage] ℹ️ Keeping default Vite config for Sage 10 compatibility.');
93
+ log(color.blue, "[sage] ℹ️ Keeping default Vite config for Sage 10 compatibility.");
94
94
  }
95
95
  await generator.generateFile(
96
- 'theme/style.css',
96
+ "theme/style.css",
97
97
  context,
98
- 'sage',
99
- `${relativeThemeDir}/style.css`
98
+ "sage",
99
+ `${relativeThemeDir}/style.css`,
100
100
  );
101
101
 
102
102
  await generator.generateFile(
103
- 'theme/app/Blocks/.gitkeep',
103
+ "theme/app/Blocks/.gitkeep",
104
104
  context,
105
- 'sage',
106
- `${relativeThemeDir}/app/Blocks/.gitkeep`
105
+ "sage",
106
+ `${relativeThemeDir}/app/Blocks/.gitkeep`,
107
107
  );
108
108
  await generator.generateFile(
109
- 'theme/app/Fields/.gitkeep',
109
+ "theme/app/Fields/.gitkeep",
110
110
  context,
111
- 'sage',
112
- `${relativeThemeDir}/app/Fields/.gitkeep`
111
+ "sage",
112
+ `${relativeThemeDir}/app/Fields/.gitkeep`,
113
113
  );
114
114
  await generator.generateFile(
115
- 'theme/resources/views/blocks/.gitkeep',
115
+ "theme/resources/views/blocks/.gitkeep",
116
116
  context,
117
- 'sage',
118
- `${relativeThemeDir}/resources/views/blocks/.gitkeep`
117
+ "sage",
118
+ `${relativeThemeDir}/resources/views/blocks/.gitkeep`,
119
119
  );
120
120
 
121
121
  await generator.mergeWithExistingFile({
122
122
  existingFile: `${relativeThemeDir}/package.json`,
123
- moduleTemplatePath: 'theme/package.json',
123
+ moduleTemplatePath: "theme/package.json",
124
124
  context,
125
- format: 'json',
126
- moduleName: 'sage',
127
- mergeStrategy: 'replace',
125
+ format: "json",
126
+ moduleName: "sage",
127
+ mergeStrategy: "replace",
128
128
  });
129
129
 
130
130
  await generator.mergeWithExistingFile({
131
131
  existingFile: `${relativeThemeDir}/composer.json`,
132
- moduleTemplatePath: 'theme/composer.json',
132
+ moduleTemplatePath: "theme/composer.json",
133
133
  context,
134
- format: 'json',
135
- moduleName: 'sage',
136
- mergeStrategy: 'replace',
134
+ format: "json",
135
+ moduleName: "sage",
136
+ mergeStrategy: "replace",
137
137
  });
138
138
 
139
139
  await generator.generateFile(
140
- '.devcontainer/docker-compose.override.yml',
140
+ ".devcontainer/docker-compose.override.yml",
141
141
  context,
142
- 'sage',
143
- `${relativeDevcontainerDir}/docker-compose.override.yml`
142
+ "sage",
143
+ `${relativeDevcontainerDir}/docker-compose.override.yml`,
144
144
  );
145
145
  await generator.generateFile(
146
- '.devcontainer/post-create.sh',
146
+ ".devcontainer/post-create.sh",
147
147
  context,
148
- 'sage',
149
- `${relativeDevcontainerDir}/post-create.sh`
148
+ "sage",
149
+ `${relativeDevcontainerDir}/post-create.sh`,
150
150
  );
151
- await fs.chmod(path.join(context.cwd, relativeDevcontainerDir, 'post-create.sh'), 0o755);
151
+ await fs.chmod(path.join(context.cwd, relativeDevcontainerDir, "post-create.sh"), 0o755);
152
152
 
153
153
  // Unified setup scripts for Sage — shared between Lando, devcontainer and CI/CD
154
154
  await generator.generateFile(
155
- 'server/cmd/setup-sage-php.sh',
155
+ "server/cmd/setup-sage-php.sh",
156
156
  context,
157
- 'sage',
158
- 'server/cmd/setup-sage-php.sh'
157
+ "sage",
158
+ "server/cmd/setup-sage-php.sh",
159
159
  );
160
160
  await generator.generateFile(
161
- 'server/cmd/setup-sage-node.sh',
161
+ "server/cmd/setup-sage-node.sh",
162
162
  context,
163
- 'sage',
164
- 'server/cmd/setup-sage-node.sh'
163
+ "sage",
164
+ "server/cmd/setup-sage-node.sh",
165
165
  );
166
- await fs.chmod(path.join(context.cwd, 'server/cmd/setup-sage-php.sh'), 0o755);
167
- await fs.chmod(path.join(context.cwd, 'server/cmd/setup-sage-node.sh'), 0o755);
166
+ await fs.chmod(path.join(context.cwd, "server/cmd/setup-sage-php.sh"), 0o755);
167
+ await fs.chmod(path.join(context.cwd, "server/cmd/setup-sage-node.sh"), 0o755);
168
168
 
169
169
  await generator.mergeWithExistingFile({
170
170
  existingFile: `${relativeDevcontainerDir}/devcontainer.json`,
171
- moduleTemplatePath: '.devcontainer/devcontainer.json',
171
+ moduleTemplatePath: ".devcontainer/devcontainer.json",
172
172
  context,
173
- format: 'json',
174
- moduleName: 'sage',
175
- mergeStrategy: 'replace',
173
+ format: "json",
174
+ moduleName: "sage",
175
+ mergeStrategy: "replace",
176
176
  });
177
177
 
178
178
  // 8. Lint configs co-located in theme — always installed (IDE/editor support)
179
- log(color.blue, '[sage] 🔧 Installing lint configurations...');
179
+ log(color.blue, "[sage] 🔧 Installing lint configurations...");
180
180
  await generator.copyFile(
181
- 'lint/.prettierrc.json',
182
- 'sage',
183
- `${relativeThemeDir}/.prettierrc.json`
181
+ "lint/.prettierrc.json",
182
+ "sage",
183
+ `${relativeThemeDir}/.prettierrc.json`,
184
184
  );
185
- if (context.sage_lint_eslint !== false) {
186
- await generator.copyFile(
187
- 'lint/eslint.config.mjs',
188
- 'sage',
189
- `${relativeThemeDir}/eslint.config.mjs`
190
- );
191
- }
192
- if (context.sage_lint_pint !== false) {
193
- await generator.copyFile('lint/pint.json', 'sage', `${relativeThemeDir}/pint.json`);
194
- }
195
185
  if (context.sage_lint_stylelint !== false) {
196
186
  await generator.copyFile(
197
- 'lint/.stylelintrc.json',
198
- 'sage',
199
- `${relativeThemeDir}/.stylelintrc.json`
187
+ "lint/.stylelintrc.json",
188
+ "sage",
189
+ `${relativeThemeDir}/.stylelintrc.json`,
200
190
  );
201
191
  }
202
192
 
203
- log(color.green, '[sage] ✅ Advanced Sage setup completed successfully');
193
+ log(color.green, "[sage] ✅ Advanced Sage setup completed successfully");
204
194
  log(color.green, `[sage] ✅ Theme directory: ${relativeThemeDir}`);
205
- log(color.green, '[sage] ✅ Lando + Devcontainer command parity enabled');
195
+ log(color.green, "[sage] ✅ Lando + Devcontainer command parity enabled");
206
196
  } catch (error) {
207
197
  log(color.red, `[sage] ❌ Installation failed: ${error.message}`);
208
198
  throw error;
@@ -213,7 +203,7 @@ export async function setupModule(context, generator) {
213
203
  * Validate that Sage theme installation was successful
214
204
  */
215
205
  async function validateThemeInstallation(themeDir, sageConfig) {
216
- const requiredFiles = ['package.json', 'composer.json', 'theme.json'];
206
+ const requiredFiles = ["package.json", "composer.json", "theme.json"];
217
207
  const missingFiles = [];
218
208
 
219
209
  for (const file of requiredFiles) {
@@ -224,25 +214,25 @@ async function validateThemeInstallation(themeDir, sageConfig) {
224
214
  }
225
215
 
226
216
  if (missingFiles.length > 0) {
227
- throw new Error(`Theme installation incomplete. Missing files: ${missingFiles.join(', ')}`);
217
+ throw new Error(`Theme installation incomplete. Missing files: ${missingFiles.join(", ")}`);
228
218
  }
229
219
 
230
220
  // Additional validation: check if package.json has correct structure
231
- const packageJsonPath = path.join(themeDir, 'package.json');
221
+ const packageJsonPath = path.join(themeDir, "package.json");
232
222
  const packageJson = await fs.readJson(packageJsonPath);
233
223
 
234
224
  // Sage packages typically have devDependencies (which is valid)
235
225
  const hasDeps = packageJson.dependencies || packageJson.devDependencies;
236
226
 
237
227
  if (!hasDeps) {
238
- throw new Error('Theme package.json is missing dependency sections');
228
+ throw new Error("Theme package.json is missing dependency sections");
239
229
  }
240
230
 
241
- log(color.blue, `[sage] ℹ️ Theme info: ${packageJson.name} v${packageJson.version || '1.0.0'}`);
231
+ log(color.blue, `[sage] ℹ️ Theme info: ${packageJson.name} v${packageJson.version || "1.0.0"}`);
242
232
  }
243
233
 
244
234
  async function isSageThemeInstalled(themeDir) {
245
- const requiredFiles = ['package.json', 'composer.json', 'theme.json'];
235
+ const requiredFiles = ["package.json", "composer.json", "theme.json"];
246
236
  for (const file of requiredFiles) {
247
237
  if (!(await fs.pathExists(path.join(themeDir, file)))) {
248
238
  return false;
@@ -1,31 +1,17 @@
1
1
  export default [
2
2
  {
3
- type: 'list',
4
- name: 'sageVersion',
5
- message: 'Sage version:',
6
- choices: ['11', '10'],
7
- default: '11',
8
- when: (answers) => answers.selectedContentModules?.includes('sage'),
3
+ type: "list",
4
+ name: "sageVersion",
5
+ message: "Sage version:",
6
+ choices: ["11", "10"],
7
+ default: "11",
8
+ when: (answers) => answers.selectedContentModules?.includes("sage"),
9
9
  },
10
10
  {
11
- type: 'confirm',
12
- name: 'sage_lint_eslint',
13
- message: 'Sage: enable ESLint for JS/TS/Vue?',
11
+ type: "confirm",
12
+ name: "sage_lint_stylelint",
13
+ message: "Sage: enable Stylelint for CSS/SCSS?",
14
14
  default: true,
15
- when: (answers) => answers.selectedContentModules?.includes('sage') && answers.enable_lint,
16
- },
17
- {
18
- type: 'confirm',
19
- name: 'sage_lint_stylelint',
20
- message: 'Sage: enable Stylelint for CSS/SCSS?',
21
- default: true,
22
- when: (answers) => answers.selectedContentModules?.includes('sage') && answers.enable_lint,
23
- },
24
- {
25
- type: 'confirm',
26
- name: 'sage_lint_pint',
27
- message: 'Sage: enable Pint for PHP?',
28
- default: true,
29
- when: (answers) => answers.selectedContentModules?.includes('sage') && answers.enable_lint,
15
+ when: (answers) => answers.selectedContentModules?.includes("sage") && answers.enable_lint,
30
16
  },
31
17
  ];
@@ -42,15 +42,25 @@ tooling:
42
42
  description: Build the Sage theme
43
43
  cmd: npm run build --prefix /app/content/themes/{{projectName}}
44
44
  {{#if enable_lint}}
45
+ mago:
46
+ service: appserver
47
+ description: Format PHP (theme + tests)
48
+ dir: /app
49
+ cmd: vendor/bin/mago format
50
+ mago-check:
51
+ service: appserver
52
+ description: Check PHP formatting without modifying files
53
+ dir: /app
54
+ cmd: vendor/bin/mago format --check
55
+ mago-lint:
56
+ service: appserver
57
+ description: Lint PHP (theme + tests)
58
+ dir: /app
59
+ cmd: vendor/bin/mago lint
45
60
  theme-lint:
46
61
  service: build
47
- description: Lint the Sage theme (JS/TS/Vue)
48
- cmd: npm run lint --prefix /app/content/themes/{{projectName}}
49
- pint:
50
- service: appserver
51
- description: Lint PHP in the Sage theme
52
- dir: /app/content/themes/{{projectName}}
53
- cmd: ./vendor/bin/pint
62
+ description: Lint JS/TS/Vue in the Sage theme (oxlint)
63
+ cmd: npx oxlint --fix content/themes/{{projectName}}/resources/
54
64
  stylelint:
55
65
  service: build
56
66
  description: Lint CSS/SCSS in the Sage theme