happyskills 0.3.1 → 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 +18 -0
- package/package.json +1 -1
- package/src/commands/setup.js +7 -5
- package/src/config/paths.js +8 -4
- package/src/config/paths.test.js +61 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,24 @@ 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
|
+
|
|
20
|
+
## [0.4.0] - 2026-03-05
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- Add `-g` / `--global` flag to `setup` command to opt into installing `happyskillsai/happyskills-cli` globally (`~/.claude/skills/`)
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- Change `setup` default install scope from global to project-level (`.claude/skills/`); pass `-g` to restore the previous global behaviour
|
|
27
|
+
|
|
10
28
|
## [0.3.1] - 2026-03-04
|
|
11
29
|
|
|
12
30
|
### Fixed
|
package/package.json
CHANGED
package/src/commands/setup.js
CHANGED
|
@@ -7,18 +7,20 @@ const { EXIT_CODES } = require('../constants')
|
|
|
7
7
|
|
|
8
8
|
const SKILL_NAME = 'happyskillsai/happyskills-cli'
|
|
9
9
|
|
|
10
|
-
const HELP_TEXT = `Usage: happyskills setup
|
|
10
|
+
const HELP_TEXT = `Usage: happyskills setup [options]
|
|
11
11
|
|
|
12
|
-
Install (or update) the official HappySkills CLI skill
|
|
12
|
+
Install (or update) the official HappySkills CLI skill.
|
|
13
13
|
|
|
14
|
-
Installs happyskillsai/happyskills-cli into
|
|
14
|
+
Installs happyskillsai/happyskills-cli into .claude/skills/ so AI agents
|
|
15
15
|
(Claude Code, etc.) can interact with HappySkills using natural language.
|
|
16
16
|
|
|
17
17
|
Options:
|
|
18
|
+
-g, --global Install globally (~/.claude/skills/) instead of project-level
|
|
18
19
|
--json Output as JSON
|
|
19
20
|
|
|
20
21
|
Examples:
|
|
21
|
-
happyskills setup
|
|
22
|
+
happyskills setup
|
|
23
|
+
happyskills setup -g`
|
|
22
24
|
|
|
23
25
|
const run = (args) => catch_errors('Setup failed', async () => {
|
|
24
26
|
if (args.flags._show_help) {
|
|
@@ -27,7 +29,7 @@ const run = (args) => catch_errors('Setup failed', async () => {
|
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
const options = {
|
|
30
|
-
global:
|
|
32
|
+
global: args.flags.global || false,
|
|
31
33
|
yes: true,
|
|
32
34
|
version: 'latest',
|
|
33
35
|
project_root: find_project_root()
|
package/src/config/paths.js
CHANGED
|
@@ -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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
package/src/config/paths.test.js
CHANGED
|
@@ -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
|
})
|