Skip to content

Commit 95bef66

Browse files
committed
fix: lint fixes
1 parent 9afe605 commit 95bef66

5 files changed

Lines changed: 18 additions & 18 deletions

File tree

internal/ai/skills/fs_util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func mergeDir(src, dst string) error {
2222
if err != nil {
2323
return err
2424
}
25-
// os.Symlink is not idempotent (returns EEXIST). Remove any existing
25+
// Os.Symlink is not idempotent (returns EEXIST). Remove any existing
2626
// entry so the call is safe under concurrent writes or repeated merges.
2727
_ = os.Remove(dstPath)
2828
if err := os.Symlink(target, dstPath); err != nil {

internal/ai/skills/symlink.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
var stderrWriter io.Writer = os.Stderr
1414

1515
// CreateSkillLink installs skillName from sourceSkillDir into agentSkillsDir.
16-
// useCopy=true copies files recursively; useCopy=false creates a symlink.
16+
// When useCopy is true the directory is copied recursively; otherwise a symlink is created.
1717
// The operation is idempotent: a correct existing symlink or copy is left unchanged.
1818
func CreateSkillLink(sourceSkillDir, agentSkillsDir, skillName string, useCopy bool) error {
1919
if err := os.MkdirAll(agentSkillsDir, 0o755); err != nil {
@@ -24,7 +24,8 @@ func CreateSkillLink(sourceSkillDir, agentSkillsDir, skillName string, useCopy b
2424

2525
info, err := os.Lstat(linkPath)
2626
if err == nil {
27-
if info.Mode()&os.ModeSymlink != 0 {
27+
switch {
28+
case info.Mode()&os.ModeSymlink != 0:
2829
// For useCopy=false: skip if already pointing to the right place.
2930
// For useCopy=true: remove the symlink so we can replace it with a copy.
3031
if !useCopy && isSymlinkCorrect(linkPath, sourceSkillDir) {
@@ -33,15 +34,15 @@ func CreateSkillLink(sourceSkillDir, agentSkillsDir, skillName string, useCopy b
3334
if rmErr := os.Remove(linkPath); rmErr != nil {
3435
return fmt.Errorf("remove existing symlink %s: %w", linkPath, rmErr)
3536
}
36-
} else if info.IsDir() {
37+
case info.IsDir():
3738
if !useCopy {
3839
fmt.Fprintf(stderrWriter,
3940
"warning: %s is a copied directory; remove it manually to switch to symlink mode\n",
4041
linkPath)
4142
return nil
4243
}
43-
// useCopy=true: fall through to re-copy with replace semantics.
44-
} else {
44+
// UseCopy=true: fall through to re-copy with replace semantics.
45+
default:
4546
return fmt.Errorf("%s exists as a regular file; remove it before installing skill %q", linkPath, skillName)
4647
}
4748
} else if !os.IsNotExist(err) {
@@ -55,11 +56,11 @@ func CreateSkillLink(sourceSkillDir, agentSkillsDir, skillName string, useCopy b
5556
}
5657

5758
// isSymlinkCorrect returns true if linkPath is a non-broken symlink resolving to sourceSkillDir.
58-
// os.SameFile is used instead of string comparison to handle case-insensitive filesystems (e.g. macOS APFS).
59+
// Uses os.SameFile instead of string comparison to handle case-insensitive filesystems (e.g. macOS APFS).
5960
func isSymlinkCorrect(linkPath, sourceSkillDir string) bool {
6061
linkInfo, err := os.Stat(linkPath)
6162
if err != nil {
62-
return false // broken symlink
63+
return false // Broken symlink.
6364
}
6465
srcInfo, err := os.Stat(sourceSkillDir)
6566
if err != nil {
@@ -123,7 +124,7 @@ func copyDir(src, dst string) error {
123124
return mergeErr
124125
}
125126
} else {
126-
tmpRemoved = true // rename succeeded; temp dir is now dst
127+
tmpRemoved = true // Rename succeeded; temp dir is now dst.
127128
}
128129
return nil
129130
}

internal/ai/skills/symlink_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func makeSkillSource(t *testing.T) string {
3030
return dir
3131
}
3232

33-
// --- CheckSkillLink ---
33+
// --- CheckSkillLink ---.
3434

3535
func TestCheckSkillLink(t *testing.T) {
3636
if runtime.GOOS == "windows" {
@@ -102,7 +102,7 @@ func TestCheckSkillLink(t *testing.T) {
102102
})
103103
}
104104

105-
// --- CreateSkillLink ---
105+
// --- CreateSkillLink ---.
106106

107107
func TestCreateSkillLink(t *testing.T) {
108108
if runtime.GOOS == "windows" {
@@ -265,10 +265,9 @@ func TestCreateSkillLink(t *testing.T) {
265265
require.NoError(t, err)
266266
assert.Equal(t, "# skill", string(data))
267267
})
268-
269268
}
270269

271-
// --- RemoveSkillLink ---
270+
// --- RemoveSkillLink ---.
272271

273272
func TestRemoveSkillLink(t *testing.T) {
274273
if runtime.GOOS == "windows" {

internal/ai/skills/validate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ type SkillInstallStatus struct {
1111
SkillName string
1212
AgentID string
1313
LinkPath string
14-
Status string // "ok" | "missing" | "broken_symlink" | "invalid_skill" | "copy" | "unknown"
14+
Status string // "ok" | "missing" | "broken_symlink" | "invalid_skill" | "copy" | "unknown".
1515
Error string
1616
}
1717

18-
// ValidateInstall checks each skill in skills for the given agent.
19-
// sourcePluginDir is the directory containing skill subdirectories (pluginDir/skills/).
18+
// ValidateInstall checks the installation state of each skill in agentSkillsDir.
19+
// The sourcePluginDir parameter is the directory containing skill subdirectories (pluginDir/skills/).
2020
func ValidateInstall(agentID, agentSkillsDir, sourcePluginDir string, skills []string) []SkillInstallStatus {
2121
out := make([]SkillInstallStatus, 0, len(skills))
2222
for _, skillName := range skills {

internal/ai/skills/validate_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func TestValidateInstall_MultipleSkills(t *testing.T) {
196196
if err := CreateSkillLink(filepath.Join(sourcePluginDir, "skill-a"), agentSkillsDir, "skill-a", false); err != nil {
197197
t.Fatal(err)
198198
}
199-
// skill-b intentionally not installed.
199+
// Skill-b intentionally not installed.
200200

201201
statuses := ValidateInstall("claude-code", agentSkillsDir, sourcePluginDir, []string{"skill-a", "skill-b"})
202202
if len(statuses) != 2 {
@@ -240,7 +240,7 @@ func TestValidateInstall_EmptySkillsList(t *testing.T) {
240240
func TestValidateInstall_AbsentAgentSkillsDir(t *testing.T) {
241241
tmp := t.TempDir()
242242
sourcePluginDir := filepath.Join(tmp, "plugins")
243-
// agentSkillsDir does not exist — all requested skills should return "missing".
243+
// AgentSkillsDir does not exist — all requested skills should return "missing".
244244
agentSkillsDir := filepath.Join(tmp, "nonexistent", "agent", "skills")
245245

246246
statuses := ValidateInstall("claude-code", agentSkillsDir, sourcePluginDir, []string{"auth0-react", "auth0-nextjs"})

0 commit comments

Comments
 (0)