happyskills 0.4.3 → 0.4.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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/config/paths.js +1 -24
- package/src/config/paths.test.js +12 -42
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.4] - 2026-03-05
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Fix all commands (`install`, `list`, `setup`, `update`, `uninstall`, `check`, `bump`, `convert`) inheriting skills from a parent directory; `find_project_root()` now always uses the current working directory and never walks up the directory tree
|
|
14
|
+
|
|
10
15
|
## [0.4.3] - 2026-03-05
|
|
11
16
|
|
|
12
17
|
### Fixed
|
package/package.json
CHANGED
package/src/config/paths.js
CHANGED
|
@@ -34,30 +34,7 @@ const lock_file_path = (project_root = process.cwd()) => path.join(project_root,
|
|
|
34
34
|
|
|
35
35
|
const skill_install_dir = (base_skills_dir, name) => path.join(base_skills_dir, name)
|
|
36
36
|
|
|
37
|
-
const find_project_root = (start_dir = process.cwd()) =>
|
|
38
|
-
let dir = path.resolve(start_dir)
|
|
39
|
-
while (true) {
|
|
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')
|
|
46
|
-
try {
|
|
47
|
-
fs.statSync(skills)
|
|
48
|
-
return dir
|
|
49
|
-
} catch {}
|
|
50
|
-
try {
|
|
51
|
-
fs.statSync(lock)
|
|
52
|
-
return dir
|
|
53
|
-
} catch {}
|
|
54
|
-
}
|
|
55
|
-
const parent = path.dirname(dir)
|
|
56
|
-
if (parent === dir) break
|
|
57
|
-
dir = parent
|
|
58
|
-
}
|
|
59
|
-
return start_dir
|
|
60
|
-
}
|
|
37
|
+
const find_project_root = (start_dir = process.cwd()) => path.resolve(start_dir)
|
|
61
38
|
|
|
62
39
|
module.exports = {
|
|
63
40
|
home_dir,
|
package/src/config/paths.test.js
CHANGED
|
@@ -100,77 +100,47 @@ describe('paths', () => {
|
|
|
100
100
|
})
|
|
101
101
|
|
|
102
102
|
describe('find_project_root', () => {
|
|
103
|
-
it('
|
|
103
|
+
it('returns the given directory as-is', () => {
|
|
104
104
|
const tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'hs-test-')))
|
|
105
105
|
try {
|
|
106
|
-
fs.mkdirSync(path.join(tmp, '.claude', 'skills'), { recursive: true })
|
|
107
106
|
assert.strictEqual(paths.find_project_root(tmp), tmp)
|
|
108
107
|
} finally {
|
|
109
108
|
fs.rmSync(tmp, { recursive: true })
|
|
110
109
|
}
|
|
111
110
|
})
|
|
112
111
|
|
|
113
|
-
it('
|
|
114
|
-
const tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'hs-test-')))
|
|
115
|
-
try {
|
|
116
|
-
fs.writeFileSync(path.join(tmp, 'skills-lock.json'), '{}')
|
|
117
|
-
assert.strictEqual(paths.find_project_root(tmp), tmp)
|
|
118
|
-
} finally {
|
|
119
|
-
fs.rmSync(tmp, { recursive: true })
|
|
120
|
-
}
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
it('walks up to find project root from nested dir', () => {
|
|
112
|
+
it('does not walk up to a parent with .claude/skills', () => {
|
|
124
113
|
const tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'hs-test-')))
|
|
125
114
|
try {
|
|
126
115
|
fs.mkdirSync(path.join(tmp, '.claude', 'skills'), { recursive: true })
|
|
127
|
-
const sub = path.join(tmp, '
|
|
116
|
+
const sub = path.join(tmp, 'sub')
|
|
128
117
|
fs.mkdirSync(sub, { recursive: true })
|
|
129
|
-
|
|
118
|
+
// should return sub, not tmp
|
|
119
|
+
assert.strictEqual(paths.find_project_root(sub), sub)
|
|
130
120
|
} finally {
|
|
131
121
|
fs.rmSync(tmp, { recursive: true })
|
|
132
122
|
}
|
|
133
123
|
})
|
|
134
124
|
|
|
135
|
-
it('
|
|
125
|
+
it('does not walk up to a parent with skills-lock.json', () => {
|
|
136
126
|
const tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'hs-test-')))
|
|
137
127
|
try {
|
|
128
|
+
fs.writeFileSync(path.join(tmp, 'skills-lock.json'), '{}')
|
|
138
129
|
const sub = path.join(tmp, 'sub')
|
|
139
130
|
fs.mkdirSync(sub, { recursive: true })
|
|
131
|
+
// should return sub, not tmp
|
|
140
132
|
assert.strictEqual(paths.find_project_root(sub), sub)
|
|
141
133
|
} finally {
|
|
142
134
|
fs.rmSync(tmp, { recursive: true })
|
|
143
135
|
}
|
|
144
136
|
})
|
|
145
137
|
|
|
146
|
-
it('
|
|
147
|
-
|
|
148
|
-
let global_exists = false
|
|
149
|
-
try { fs.statSync(global_skills); global_exists = true } catch {}
|
|
150
|
-
if (!global_exists) return // skip if global dir not present on this machine
|
|
151
|
-
|
|
152
|
-
const tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'hs-test-')))
|
|
153
|
-
try {
|
|
154
|
-
// tmp has no project markers — should fall back to tmp, not home dir
|
|
155
|
-
assert.strictEqual(paths.find_project_root(tmp), tmp)
|
|
156
|
-
} finally {
|
|
157
|
-
fs.rmSync(tmp, { recursive: true })
|
|
158
|
-
}
|
|
138
|
+
it('returns home dir only when explicitly called with it', () => {
|
|
139
|
+
assert.strictEqual(paths.find_project_root(os.homedir()), os.homedir())
|
|
159
140
|
})
|
|
160
141
|
|
|
161
|
-
it('
|
|
162
|
-
|
|
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
|
-
}
|
|
142
|
+
it('defaults to cwd when no argument given', () => {
|
|
143
|
+
assert.strictEqual(paths.find_project_root(), path.resolve(process.cwd()))
|
|
174
144
|
})
|
|
175
145
|
})
|
|
176
146
|
})
|