happyskills 0.4.0 → 0.4.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/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.4.2] - 2026-03-05
11
+
12
+ ### Fixed
13
+ - Fix `list`, `install`, `uninstall`, `update`, `setup`, and `convert` incorrectly treating the home directory as a project root when `~/.claude/skills/` exists; `find_project_root()` now excludes the global skills directory from its upward search
14
+
15
+ ## [0.4.1] - 2026-03-05
16
+
17
+ ### Fixed
18
+ - Fix `setup` command still installing globally on npm-published v0.4.0 (re-release of the project-level default and `-g` flag)
19
+
10
20
  ## [0.4.0] - 2026-03-05
11
21
 
12
22
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "happyskills",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Package manager for AI agent skills",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Nicolas Dao <nic@cloudlesslabs.com> (https://cloudlesslabs.com)",
@@ -39,10 +39,14 @@ const find_project_root = (start_dir = process.cwd()) => {
39
39
  while (true) {
40
40
  const skills = path.join(dir, '.claude', 'skills')
41
41
  const lock = path.join(dir, 'skills-lock.json')
42
- try {
43
- fs.statSync(skills)
44
- return dir
45
- } catch {}
42
+ // Skip if this would match the global skills dir (~/.claude/skills)
43
+ // to avoid treating the home directory as a project root
44
+ if (skills !== global_skills_dir()) {
45
+ try {
46
+ fs.statSync(skills)
47
+ return dir
48
+ } catch {}
49
+ }
46
50
  try {
47
51
  fs.statSync(lock)
48
52
  return dir
@@ -1,5 +1,6 @@
1
1
  const { describe, it, beforeEach, afterEach } = require('node:test')
2
2
  const assert = require('node:assert')
3
+ const fs = require('fs')
3
4
  const path = require('path')
4
5
  const os = require('os')
5
6
 
@@ -97,4 +98,64 @@ describe('paths', () => {
97
98
  assert.strictEqual(result, path.join('/base/skills', '.install.lock'))
98
99
  })
99
100
  })
101
+
102
+ describe('find_project_root', () => {
103
+ it('finds project root by .claude/skills dir', () => {
104
+ const tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'hs-test-')))
105
+ try {
106
+ fs.mkdirSync(path.join(tmp, '.claude', 'skills'), { recursive: true })
107
+ assert.strictEqual(paths.find_project_root(tmp), tmp)
108
+ } finally {
109
+ fs.rmSync(tmp, { recursive: true })
110
+ }
111
+ })
112
+
113
+ it('finds project root by skills-lock.json', () => {
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', () => {
124
+ const tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'hs-test-')))
125
+ try {
126
+ fs.mkdirSync(path.join(tmp, '.claude', 'skills'), { recursive: true })
127
+ const sub = path.join(tmp, 'src', 'deep')
128
+ fs.mkdirSync(sub, { recursive: true })
129
+ assert.strictEqual(paths.find_project_root(sub), tmp)
130
+ } finally {
131
+ fs.rmSync(tmp, { recursive: true })
132
+ }
133
+ })
134
+
135
+ it('falls back to start_dir when no project markers found', () => {
136
+ const tmp = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'hs-test-')))
137
+ try {
138
+ const sub = path.join(tmp, 'sub')
139
+ fs.mkdirSync(sub, { recursive: true })
140
+ assert.strictEqual(paths.find_project_root(sub), sub)
141
+ } finally {
142
+ fs.rmSync(tmp, { recursive: true })
143
+ }
144
+ })
145
+
146
+ it('does not treat ~/.claude/skills as a project marker', () => {
147
+ const global_skills = path.join(os.homedir(), '.claude', 'skills')
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
+ }
159
+ })
160
+ })
100
161
  })