kungeskill 0.4.0 → 0.4.1
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/src/commands/shared.js +20 -9
package/package.json
CHANGED
package/src/commands/shared.js
CHANGED
|
@@ -5,7 +5,8 @@ const path = require('path');
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Find the project's .claude/skills/ directory.
|
|
8
|
-
* Walks up from cwd until it finds
|
|
8
|
+
* Walks up from cwd until it finds a .git boundary or existing .claude/skills/.
|
|
9
|
+
* Will not cross project boundaries (stops at .git root).
|
|
9
10
|
*
|
|
10
11
|
* @param {string} [cwd] - Starting directory (defaults to process.cwd())
|
|
11
12
|
* @returns {string} Absolute path to .claude/skills/
|
|
@@ -15,17 +16,27 @@ function findProjectSkillsDir(cwd) {
|
|
|
15
16
|
let dir = path.resolve(cwd);
|
|
16
17
|
const root = path.parse(dir).root;
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
// First pass: find the project root (directory with .git)
|
|
20
|
+
let projectRoot = null;
|
|
21
|
+
let searchDir = dir;
|
|
22
|
+
while (searchDir !== root) {
|
|
23
|
+
if (fs.existsSync(path.join(searchDir, '.git'))) {
|
|
24
|
+
projectRoot = searchDir;
|
|
25
|
+
break;
|
|
22
26
|
}
|
|
23
|
-
|
|
27
|
+
searchDir = path.dirname(searchDir);
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
// If no .git found, use cwd as project root
|
|
31
|
+
if (!projectRoot) {
|
|
32
|
+
projectRoot = cwd;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Use .claude/skills/ at the project root
|
|
36
|
+
const skillsDir = path.join(projectRoot, '.claude', 'skills');
|
|
37
|
+
if (!fs.existsSync(skillsDir)) {
|
|
38
|
+
fs.mkdirSync(skillsDir, { recursive: true });
|
|
39
|
+
}
|
|
29
40
|
return skillsDir;
|
|
30
41
|
}
|
|
31
42
|
|