aawp-ai 1.6.4 → 1.6.5
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/bin/install.js +30 -27
- package/package.json +1 -1
package/bin/install.js
CHANGED
|
@@ -34,24 +34,22 @@ function dirExists(p) {
|
|
|
34
34
|
try { return fs.statSync(p).isDirectory(); } catch { return false; }
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
// ──
|
|
37
|
+
// ── Git clone / pull ──────────────────────────────────────────────────────────
|
|
38
38
|
function install(dest) {
|
|
39
39
|
const absDest = path.resolve(dest);
|
|
40
40
|
|
|
41
|
-
// Already installed — pull latest
|
|
42
41
|
if (dirExists(path.join(absDest, '.git'))) {
|
|
43
42
|
info('Updating existing install...');
|
|
44
43
|
const r = spawnSync('git', ['-C', absDest, 'pull', '--ff-only'], { stdio: 'inherit' });
|
|
45
44
|
if (r.status !== 0) { warn('git pull failed'); return false; }
|
|
46
45
|
} else {
|
|
47
|
-
// Fresh clone
|
|
48
46
|
if (dirExists(absDest)) fs.rmSync(absDest, { recursive: true, force: true });
|
|
49
47
|
fs.mkdirSync(path.dirname(absDest), { recursive: true });
|
|
50
48
|
const r = spawnSync('git', ['clone', '--depth', '1', REPO_URL, absDest], { stdio: 'inherit' });
|
|
51
49
|
if (r.status !== 0) { fail('git clone failed'); return false; }
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
//
|
|
52
|
+
// Bootstrap (download binary if missing)
|
|
55
53
|
const bootstrap = path.join(absDest, 'scripts', 'bootstrap.sh');
|
|
56
54
|
if (fs.existsSync(bootstrap)) {
|
|
57
55
|
const r = spawnSync('bash', [bootstrap], { stdio: 'inherit', cwd: absDest });
|
|
@@ -61,33 +59,40 @@ function install(dest) {
|
|
|
61
59
|
return true;
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
// ── Detect
|
|
62
|
+
// ── Detect install location (same conventions as clawhub / each AI client) ───
|
|
65
63
|
function detectInstallDir() {
|
|
66
|
-
// OpenClaw workspace
|
|
67
|
-
|
|
68
|
-
path.join(HOME, '
|
|
69
|
-
path.join(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
64
|
+
// 1. OpenClaw: ~/.openclaw/workspace/skills/ (new default), or cwd/skills/ (legacy/custom)
|
|
65
|
+
if (hasCmd('openclaw')) {
|
|
66
|
+
const ocSkills = path.join(HOME, '.openclaw', 'workspace', 'skills');
|
|
67
|
+
const cwdSkills = path.join(process.cwd(), 'skills');
|
|
68
|
+
// Prefer ~/.openclaw/workspace/skills if the workspace exists
|
|
69
|
+
if (dirExists(path.join(HOME, '.openclaw', 'workspace'))) {
|
|
70
|
+
return { dir: path.join(ocSkills, SKILL_NAME), client: 'OpenClaw' };
|
|
71
|
+
}
|
|
72
|
+
if (dirExists(cwdSkills)) {
|
|
73
|
+
return { dir: path.join(cwdSkills, SKILL_NAME), client: 'OpenClaw' };
|
|
74
|
+
}
|
|
75
|
+
// OpenClaw detected but no workspace yet — use default
|
|
76
|
+
return { dir: path.join(ocSkills, SKILL_NAME), client: 'OpenClaw' };
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
//
|
|
79
|
+
// 2. Known AI clients — each has a standard skills directory
|
|
79
80
|
const clients = [
|
|
80
|
-
{ name: 'Cursor',
|
|
81
|
-
{ name: 'Claude Code',
|
|
82
|
-
{ name: 'Gemini CLI',
|
|
83
|
-
{ name: '
|
|
84
|
-
{ name: '
|
|
81
|
+
{ name: 'Cursor', detect: () => hasCmd('cursor') || dirExists(path.join(HOME, '.cursor')), dirs: [path.join(HOME, '.cursor', 'skills')] },
|
|
82
|
+
{ name: 'Claude Code', detect: () => hasCmd('claude') || dirExists(path.join(HOME, '.claude')), dirs: [path.join(HOME, '.claude', 'skills')] },
|
|
83
|
+
{ name: 'Gemini CLI', detect: () => hasCmd('gemini') || dirExists(path.join(HOME, '.gemini')), dirs: [path.join(HOME, '.gemini', 'skills')] },
|
|
84
|
+
{ name: 'Windsurf', detect: () => hasCmd('windsurf') || dirExists(path.join(HOME, '.windsurf')), dirs: [path.join(HOME, '.windsurf', 'skills')] },
|
|
85
|
+
{ name: 'OpenCode', detect: () => hasCmd('opencode') || dirExists(path.join(HOME, '.config', 'opencode')), dirs: [path.join(HOME, '.config', 'opencode', 'skills')] },
|
|
86
|
+
{ name: 'Goose', detect: () => hasCmd('goose') || dirExists(path.join(HOME, '.config', 'goose')), dirs: [path.join(HOME, '.config', 'goose', 'skills')] },
|
|
85
87
|
];
|
|
88
|
+
|
|
86
89
|
for (const c of clients) {
|
|
87
|
-
if (c.detect())
|
|
90
|
+
if (c.detect()) {
|
|
91
|
+
return { dir: path.join(c.dirs[0], SKILL_NAME), client: c.name };
|
|
92
|
+
}
|
|
88
93
|
}
|
|
89
94
|
|
|
90
|
-
// Fallback: universal
|
|
95
|
+
// 3. Fallback: universal agentskills.io convention
|
|
91
96
|
return { dir: path.join(HOME, '.agents', 'skills', SKILL_NAME), client: null };
|
|
92
97
|
}
|
|
93
98
|
|
|
@@ -106,9 +111,7 @@ function main() {
|
|
|
106
111
|
const { dir, client } = detectInstallDir();
|
|
107
112
|
const shortDir = dir.replace(HOME, '~');
|
|
108
113
|
|
|
109
|
-
if (client) {
|
|
110
|
-
info(`Detected ${client}`);
|
|
111
|
-
}
|
|
114
|
+
if (client) info(`Detected ${client}`);
|
|
112
115
|
info(`Installing to ${shortDir}`);
|
|
113
116
|
console.log('');
|
|
114
117
|
|
|
@@ -121,7 +124,7 @@ function main() {
|
|
|
121
124
|
} else {
|
|
122
125
|
console.log('');
|
|
123
126
|
fail('Installation failed.');
|
|
124
|
-
console.log(` ${dim('Try
|
|
127
|
+
console.log(` ${dim('Try: git clone ' + REPO_URL + ' ' + shortDir)}`);
|
|
125
128
|
}
|
|
126
129
|
console.log('');
|
|
127
130
|
}
|