happyskills 0.4.2 → 0.4.3
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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/config/paths.js +10 -9
- package/src/config/paths.test.js +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.3] - 2026-03-05
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Fix `find_project_root()` still treating the home directory as a project root via `~/skills-lock.json`; the home directory is now fully excluded from all project root detection checks
|
|
14
|
+
|
|
10
15
|
## [0.4.2] - 2026-03-05
|
|
11
16
|
|
|
12
17
|
### Fixed
|
package/package.json
CHANGED
package/src/config/paths.js
CHANGED
|
@@ -37,20 +37,21 @@ const skill_install_dir = (base_skills_dir, name) => path.join(base_skills_dir,
|
|
|
37
37
|
const find_project_root = (start_dir = process.cwd()) => {
|
|
38
38
|
let dir = path.resolve(start_dir)
|
|
39
39
|
while (true) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
// Never treat the home directory as a project root —
|
|
41
|
+
// ~/.claude/skills is the global skills dir, not a project,
|
|
42
|
+
// and ~/skills-lock.json is an artifact of old buggy behaviour.
|
|
43
|
+
if (dir !== home_dir) {
|
|
44
|
+
const skills = path.join(dir, '.claude', 'skills')
|
|
45
|
+
const lock = path.join(dir, 'skills-lock.json')
|
|
45
46
|
try {
|
|
46
47
|
fs.statSync(skills)
|
|
47
48
|
return dir
|
|
48
49
|
} catch {}
|
|
50
|
+
try {
|
|
51
|
+
fs.statSync(lock)
|
|
52
|
+
return dir
|
|
53
|
+
} catch {}
|
|
49
54
|
}
|
|
50
|
-
try {
|
|
51
|
-
fs.statSync(lock)
|
|
52
|
-
return dir
|
|
53
|
-
} catch {}
|
|
54
55
|
const parent = path.dirname(dir)
|
|
55
56
|
if (parent === dir) break
|
|
56
57
|
dir = parent
|
package/src/config/paths.test.js
CHANGED
|
@@ -157,5 +157,20 @@ describe('paths', () => {
|
|
|
157
157
|
fs.rmSync(tmp, { recursive: true })
|
|
158
158
|
}
|
|
159
159
|
})
|
|
160
|
+
|
|
161
|
+
it('does not treat ~/skills-lock.json as a project marker', () => {
|
|
162
|
+
// The home directory itself must never be returned as project root,
|
|
163
|
+
// even if a stale skills-lock.json exists there from old buggy behaviour.
|
|
164
|
+
// We verify this by running from a temp dir that has no project markers
|
|
165
|
+
// of its own — the result must be the temp dir, not the home dir.
|
|
166
|
+
const tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'hs-test-')))
|
|
167
|
+
try {
|
|
168
|
+
const result = paths.find_project_root(tmp)
|
|
169
|
+
assert.notStrictEqual(result, os.homedir())
|
|
170
|
+
assert.strictEqual(result, tmp)
|
|
171
|
+
} finally {
|
|
172
|
+
fs.rmSync(tmp, { recursive: true })
|
|
173
|
+
}
|
|
174
|
+
})
|
|
160
175
|
})
|
|
161
176
|
})
|