@wooksjs/event-wf 0.6.3 → 0.6.4
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/package.json +5 -5
- package/scripts/setup-skills.js +59 -52
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wooksjs/event-wf",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "@wooksjs/event-wf",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"typescript": "^5.9.3",
|
|
49
49
|
"vitest": "^3.2.4",
|
|
50
|
-
"@wooksjs/event-core": "^0.6.
|
|
51
|
-
"wooks": "^0.6.
|
|
50
|
+
"@wooksjs/event-core": "^0.6.4",
|
|
51
|
+
"wooks": "^0.6.4"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@prostojs/logger": "^0.4.3",
|
|
55
|
-
"@wooksjs/event-core": "^0.6.
|
|
56
|
-
"wooks": "^0.6.
|
|
55
|
+
"@wooksjs/event-core": "^0.6.4",
|
|
56
|
+
"wooks": "^0.6.4"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "rolldown -c ../../rolldown.config.mjs",
|
package/scripts/setup-skills.js
CHANGED
|
@@ -1,70 +1,77 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Copies the event-wf skill files into the consuming project's
|
|
5
|
-
* agent-skills directory so that AI coding agents (Claude Code, Cursor,
|
|
6
|
-
* Windsurf, Codex, etc.) can discover and load them.
|
|
7
|
-
*
|
|
8
|
-
* Runs automatically on `postinstall` or manually via:
|
|
9
|
-
* npx @wooksjs/event-wf setup-skills
|
|
10
|
-
*/
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
'use strict'
|
|
11
4
|
|
|
12
5
|
const fs = require('fs')
|
|
13
6
|
const path = require('path')
|
|
7
|
+
const os = require('os')
|
|
14
8
|
|
|
15
9
|
const SKILL_NAME = 'wooksjs-event-wf'
|
|
10
|
+
const SKILL_SRC = path.join(__dirname, '..', 'skills', SKILL_NAME)
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
dir = path.dirname(dir)
|
|
22
|
-
if (path.basename(dir) === 'node_modules') {
|
|
23
|
-
return path.dirname(dir)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return process.cwd()
|
|
12
|
+
if (!fs.existsSync(SKILL_SRC)) {
|
|
13
|
+
console.error(`No skills found at ${SKILL_SRC}`)
|
|
14
|
+
console.error('Add your SKILL.md files to the skills/' + SKILL_NAME + '/ directory first.')
|
|
15
|
+
process.exit(1)
|
|
27
16
|
}
|
|
28
17
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{ dir: '.
|
|
33
|
-
{ dir: '.
|
|
34
|
-
{ dir: '.
|
|
35
|
-
|
|
36
|
-
]
|
|
18
|
+
const AGENTS = {
|
|
19
|
+
'Claude Code': { dir: '.claude/skills', global: path.join(os.homedir(), '.claude', 'skills') },
|
|
20
|
+
'Cursor': { dir: '.cursor/skills', global: path.join(os.homedir(), '.cursor', 'skills') },
|
|
21
|
+
'Windsurf': { dir: '.windsurf/skills', global: path.join(os.homedir(), '.windsurf', 'skills') },
|
|
22
|
+
'Codex': { dir: '.codex/skills', global: path.join(os.homedir(), '.codex', 'skills') },
|
|
23
|
+
'OpenCode': { dir: '.opencode/skills', global: path.join(os.homedir(), '.opencode', 'skills') },
|
|
24
|
+
}
|
|
37
25
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
26
|
+
const args = process.argv.slice(2)
|
|
27
|
+
const isGlobal = args.includes('--global') || args.includes('-g')
|
|
28
|
+
const isPostinstall = args.includes('--postinstall')
|
|
29
|
+
let installed = 0, skipped = 0
|
|
30
|
+
const installedDirs = []
|
|
44
31
|
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
for (const [agentName, cfg] of Object.entries(AGENTS)) {
|
|
33
|
+
const targetBase = isGlobal ? cfg.global : path.join(process.cwd(), cfg.dir)
|
|
34
|
+
const agentRootDir = path.dirname(cfg.global) // Check if the agent has ever been installed globally
|
|
47
35
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
fs.
|
|
36
|
+
// In postinstall mode: silently skip agents that aren't set up globally
|
|
37
|
+
if (isPostinstall || isGlobal) {
|
|
38
|
+
if (!fs.existsSync(agentRootDir)) { skipped++; continue }
|
|
39
|
+
}
|
|
51
40
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
const dest = path.join(targetBase, SKILL_NAME)
|
|
42
|
+
try {
|
|
43
|
+
fs.mkdirSync(dest, { recursive: true })
|
|
44
|
+
fs.cpSync(SKILL_SRC, dest, { recursive: true })
|
|
45
|
+
console.log(`✅ ${agentName}: installed to ${dest}`)
|
|
46
|
+
installed++
|
|
47
|
+
if (!isGlobal) installedDirs.push(cfg.dir + '/' + SKILL_NAME)
|
|
48
|
+
} catch (err) {
|
|
49
|
+
console.warn(`⚠️ ${agentName}: failed — ${err.message}`)
|
|
60
50
|
}
|
|
51
|
+
}
|
|
61
52
|
|
|
62
|
-
|
|
53
|
+
// Add locally-installed skill dirs to .gitignore
|
|
54
|
+
if (!isGlobal && installedDirs.length > 0) {
|
|
55
|
+
const gitignorePath = path.join(process.cwd(), '.gitignore')
|
|
56
|
+
let gitignoreContent = ''
|
|
57
|
+
try { gitignoreContent = fs.readFileSync(gitignorePath, 'utf8') } catch {}
|
|
58
|
+
const linesToAdd = installedDirs.filter(d => !gitignoreContent.includes(d))
|
|
59
|
+
if (linesToAdd.length > 0) {
|
|
60
|
+
const hasHeader = gitignoreContent.includes('# AI agent skills')
|
|
61
|
+
const block = (gitignoreContent && !gitignoreContent.endsWith('\n') ? '\n' : '')
|
|
62
|
+
+ (hasHeader ? '' : '\n# AI agent skills (auto-generated by setup-skills)\n')
|
|
63
|
+
+ linesToAdd.join('\n') + '\n'
|
|
64
|
+
fs.appendFileSync(gitignorePath, block)
|
|
65
|
+
console.log(`📝 Added ${linesToAdd.length} entries to .gitignore`)
|
|
66
|
+
}
|
|
63
67
|
}
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
if (installed === 0 && isPostinstall) {
|
|
70
|
+
// Silence is fine — no agents present, nothing to do
|
|
71
|
+
} else if (installed === 0 && skipped === Object.keys(AGENTS).length) {
|
|
72
|
+
console.log('No agent directories detected. Try --global or run without it for project-local install.')
|
|
73
|
+
} else if (installed === 0) {
|
|
74
|
+
console.log('Nothing installed. Run without --global to install project-locally.')
|
|
75
|
+
} else {
|
|
76
|
+
console.log(`\n✨ Done! Restart your AI agent to pick up the "${SKILL_NAME}" skill.`)
|
|
70
77
|
}
|