vunor 0.1.1 → 0.1.2
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 +1 -1
- package/scripts/setup-skills.js +20 -8
package/package.json
CHANGED
package/scripts/setup-skills.js
CHANGED
|
@@ -28,14 +28,13 @@ const args = process.argv.slice(2)
|
|
|
28
28
|
const isGlobal = args.includes('--global') || args.includes('-g')
|
|
29
29
|
const isPostinstall = args.includes('--postinstall')
|
|
30
30
|
let installed = 0, skipped = 0
|
|
31
|
+
const installedDirs = []
|
|
31
32
|
|
|
32
33
|
for (const [agentName, cfg] of Object.entries(AGENTS)) {
|
|
33
34
|
const targetBase = isGlobal ? cfg.global : path.join(process.cwd(), cfg.dir)
|
|
34
|
-
const agentRootDir =
|
|
35
|
-
? path.dirname(cfg.global)
|
|
36
|
-
: path.join(process.cwd(), path.dirname(cfg.dir))
|
|
35
|
+
const agentRootDir = path.dirname(cfg.global) // Check if the agent has ever been installed globally
|
|
37
36
|
|
|
38
|
-
// In postinstall mode: silently skip agents that aren't set up
|
|
37
|
+
// In postinstall mode: silently skip agents that aren't set up globally
|
|
39
38
|
if (isPostinstall || isGlobal) {
|
|
40
39
|
if (!fs.existsSync(agentRootDir)) { skipped++; continue }
|
|
41
40
|
}
|
|
@@ -46,11 +45,28 @@ for (const [agentName, cfg] of Object.entries(AGENTS)) {
|
|
|
46
45
|
fs.cpSync(SKILL_SRC, dest, { recursive: true })
|
|
47
46
|
console.log(`✅ ${agentName}: installed to ${dest}`)
|
|
48
47
|
installed++
|
|
48
|
+
if (!isGlobal) installedDirs.push(cfg.dir + '/' + SKILL_NAME)
|
|
49
49
|
} catch (err) {
|
|
50
50
|
console.warn(`⚠️ ${agentName}: failed — ${err.message}`)
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
// Add locally-installed skill dirs to .gitignore
|
|
55
|
+
if (!isGlobal && installedDirs.length > 0) {
|
|
56
|
+
const gitignorePath = path.join(process.cwd(), '.gitignore')
|
|
57
|
+
let gitignoreContent = ''
|
|
58
|
+
try { gitignoreContent = fs.readFileSync(gitignorePath, 'utf8') } catch {}
|
|
59
|
+
const linesToAdd = installedDirs.filter(d => !gitignoreContent.includes(d))
|
|
60
|
+
if (linesToAdd.length > 0) {
|
|
61
|
+
const hasHeader = gitignoreContent.includes('# AI agent skills')
|
|
62
|
+
const block = (gitignoreContent && !gitignoreContent.endsWith('\n') ? '\n' : '')
|
|
63
|
+
+ (hasHeader ? '' : '\n# AI agent skills (auto-generated by setup-skills)\n')
|
|
64
|
+
+ linesToAdd.join('\n') + '\n'
|
|
65
|
+
fs.appendFileSync(gitignorePath, block)
|
|
66
|
+
console.log(`📝 Added ${linesToAdd.length} entries to .gitignore`)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
54
70
|
if (installed === 0 && isPostinstall) {
|
|
55
71
|
// Silence is fine — no agents present, nothing to do
|
|
56
72
|
} else if (installed === 0 && skipped === Object.keys(AGENTS).length) {
|
|
@@ -59,8 +75,4 @@ if (installed === 0 && isPostinstall) {
|
|
|
59
75
|
console.log('Nothing installed. Run without --global to install project-locally.')
|
|
60
76
|
} else {
|
|
61
77
|
console.log(`\n✨ Done! Restart your AI agent to pick up the "${SKILL_NAME}" skill.`)
|
|
62
|
-
if (!isGlobal) {
|
|
63
|
-
console.log('Tip: commit the .*/skills/ directories to share with your team,')
|
|
64
|
-
console.log(' or add them to .gitignore if you prefer each developer to opt in.')
|
|
65
|
-
}
|
|
66
78
|
}
|