@codigodoleo/wp-kit 3.0.1 → 3.1.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.
- package/lib/commands/init.js +7 -0
- package/lib/utils/git.js +43 -1
- package/package.json +1 -1
- package/templates/CLAUDE.md.hbs +28 -0
package/lib/commands/init.js
CHANGED
|
@@ -9,6 +9,7 @@ import { Generator } from '../core/generator.js';
|
|
|
9
9
|
import { log, color } from '../utils/logger.js';
|
|
10
10
|
import { inferCiCapabilities } from '../core/infer-ci-capabilities.js';
|
|
11
11
|
import { validateVersionCompatibility } from '../config/versions.js';
|
|
12
|
+
import { installSuperpowersSage } from '../utils/git.js';
|
|
12
13
|
|
|
13
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
14
15
|
const __dirname = path.dirname(__filename);
|
|
@@ -150,5 +151,11 @@ export const initCommand = new Command('init')
|
|
|
150
151
|
log(color.blue, '🔗 Executing post-setup hooks...');
|
|
151
152
|
generator.hooks.doAction('after_setup_complete', context, generator);
|
|
152
153
|
|
|
154
|
+
// Gera CLAUDE.md com overview do projeto e referência ao AI Co-Pilot
|
|
155
|
+
await generator.generateFile('CLAUDE.md', context);
|
|
156
|
+
|
|
157
|
+
// Instala superpowers-sage em .claude/ do projeto gerado
|
|
158
|
+
await installSuperpowersSage(target);
|
|
159
|
+
|
|
153
160
|
log(color.green, '✅ Project initialized with templates.');
|
|
154
161
|
});
|
package/lib/utils/git.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
1
|
+
import { execSync, spawnSync } from 'child_process';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
|
|
7
|
+
import { log, color } from './logger.js';
|
|
2
8
|
|
|
3
9
|
export function getGitUserDefaults() {
|
|
4
10
|
const exec = (cmd) => {
|
|
@@ -15,3 +21,39 @@ export function getGitUserDefaults() {
|
|
|
15
21
|
gitRepository: exec('git config --get remote.origin.url') || '',
|
|
16
22
|
};
|
|
17
23
|
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Clona codigodoleo/superpowers-sage e copia seu conteúdo para <targetDir>/.claude
|
|
27
|
+
* Requer git instalado no host.
|
|
28
|
+
* @param {string} targetDir - Caminho absoluto do projeto gerado
|
|
29
|
+
*/
|
|
30
|
+
export async function installSuperpowersSage(targetDir) {
|
|
31
|
+
const repo = 'https://github.com/codigodoleo/superpowers-sage.git';
|
|
32
|
+
const tmpDir = path.join(os.tmpdir(), `superpowers-sage-${Date.now()}`);
|
|
33
|
+
const claudeDir = path.join(targetDir, '.claude');
|
|
34
|
+
|
|
35
|
+
log(color.blue, '🔌 Installing superpowers-sage...');
|
|
36
|
+
|
|
37
|
+
const result = spawnSync('git', ['clone', '--depth=1', repo, tmpDir], {
|
|
38
|
+
stdio: 'inherit',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
if (result.status !== 0) {
|
|
42
|
+
log(
|
|
43
|
+
color.orange,
|
|
44
|
+
'⚠️ Could not clone superpowers-sage (no network or git unavailable). Skipping.'
|
|
45
|
+
);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Copia o conteúdo completo do clone (exceto .git) para .claude do projeto
|
|
50
|
+
await fs.ensureDir(claudeDir);
|
|
51
|
+
await fs.copy(tmpDir, claudeDir, {
|
|
52
|
+
overwrite: true,
|
|
53
|
+
filter: (src) => !src.includes(`${path.sep}.git`),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
await fs.remove(tmpDir);
|
|
57
|
+
|
|
58
|
+
log(color.green, '✅ superpowers-sage installed at .claude/');
|
|
59
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#
|
|
2
|
+
{{projectName}}
|
|
3
|
+
|
|
4
|
+
> WordPress project scaffolded by [wp-kit](https://github.com/codigodoleo/wp-kit), using the
|
|
5
|
+
[Roots](https://roots.io/) ecosystem: Bedrock, Sage, Acorn, and Lando. ## Stack - PHP
|
|
6
|
+
{{phpVersion}}
|
|
7
|
+
- Node.js
|
|
8
|
+
{{nodeVersion}}
|
|
9
|
+
- WordPress
|
|
10
|
+
{{wpCoreVersion}}
|
|
11
|
+
{{#if useSage}}- Sage
|
|
12
|
+
{{sageVersion}}
|
|
13
|
+
+ Acorn
|
|
14
|
+
{{/if}}- Lando (local development) ## Local Development ```bash lando start lando vite # HMR dev
|
|
15
|
+
server lando vite-build # Production build ``` ## AI Co-Pilot This project includes
|
|
16
|
+
[superpowers-sage](https://github.com/codigodoleo/superpowers-sage) skills in `.claude/`. Start a
|
|
17
|
+
session with: ``` /sage-onboard ``` Available commands: | Command | Purpose | |---|---| |
|
|
18
|
+
`/sage-onboard` | Project analysis and overview | | `/sage-plan` | Architecture decision for a new
|
|
19
|
+
feature | | `/sage-scaffold` | Run generators and create stubs | | `/sage-review` | Review code
|
|
20
|
+
against conventions | | `/sage-debug` | Guided troubleshooting | ## Theme
|
|
21
|
+
|
|
22
|
+
{{#if useSage}}
|
|
23
|
+
Theme located at `content/themes/{{themeName}}/`. ```bash lando theme-composer require
|
|
24
|
+
vendor/package lando theme-yarn add package-name lando acorn make:component ComponentName lando
|
|
25
|
+
acorn acf:block BlockName ```
|
|
26
|
+
{{else}}
|
|
27
|
+
No Sage theme configured.
|
|
28
|
+
{{/if}}
|