Skip to content

Commit 5d21edf

Browse files
aitools: lint nits + Windows-safe acceptance script
- libs/aitools/installer/installer.go: alternateVariantKey uses strings.CutSuffix (modernize lint hint). - libs/aitools/installer/uninstall.go: drop the redundant `name := raw` copy of the loop variable (copyloopvar lint hint; Go 1.22+ semantics). - acceptance/experimental/aitools/skills/*/script: stub the Claude Code install dir under "${USERPROFILE:-$HOME}/.claude". On Windows the acceptance harness sets USERPROFILE (Go's os.UserHomeDir backing var on that platform), not HOME, so the previous `$HOME/.claude` wrote to the wrong path and the cli reported "No supported coding agents detected." The fallback keeps Linux/macOS behavior unchanged. Co-authored-by: Isaac
1 parent 2994859 commit 5d21edf

5 files changed

Lines changed: 19 additions & 9 deletions

File tree

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
mkdir -p "$HOME/.claude"
1+
# Stub a Claude Code install under the harness-set home dir so agent
2+
# detection picks it up. On Windows the harness sets USERPROFILE (Go's
3+
# os.UserHomeDir backing var on that platform), not HOME — use USERPROFILE
4+
# when set, fall back to HOME for Linux/macOS.
5+
mkdir -p "${USERPROFILE:-$HOME}/.claude"
26

37
title "--experimental against a manifest with no experimental skills logs a nudge"
48
trace $CLI experimental aitools install --global --experimental

acceptance/experimental/aitools/skills/install-specific/script

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
mkdir -p "$HOME/.claude"
1+
# Stub a Claude Code install under the harness-set home dir so agent
2+
# detection picks it up. On Windows the harness sets USERPROFILE (Go's
3+
# os.UserHomeDir backing var on that platform), not HOME — use USERPROFILE
4+
# when set, fall back to HOME for Linux/macOS.
5+
mkdir -p "${USERPROFILE:-$HOME}/.claude"
26

37
title "install only one specific stable skill via --skills"
48
trace $CLI experimental aitools install --global --skills test-stable-a

acceptance/experimental/aitools/skills/install/script

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# Fake a Claude Code installation so agent detection picks it up.
2-
mkdir -p "$HOME/.claude"
1+
# Stub a Claude Code install under the harness-set home dir so agent
2+
# detection picks it up. On Windows the harness sets USERPROFILE (Go's
3+
# os.UserHomeDir backing var on that platform), not HOME — use USERPROFILE
4+
# when set, fall back to HOME for Linux/macOS.
5+
mkdir -p "${USERPROFILE:-$HOME}/.claude"
36

47
title "stable-only install (no --experimental flag) installs 1 skill"
58
trace $CLI experimental aitools install --global

libs/aitools/installer/installer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ func manifestHasExperimental(m *Manifest) bool {
4949
// variant when a skill transitions between experimental and stable
5050
// upstream.
5151
func alternateVariantKey(key string) string {
52-
if strings.HasSuffix(key, experimentalSuffix) {
53-
return strings.TrimSuffix(key, experimentalSuffix)
52+
if base, ok := strings.CutSuffix(key, experimentalSuffix); ok {
53+
return base
5454
}
5555
return key + experimentalSuffix
5656
}

libs/aitools/installer/uninstall.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,15 @@ func UninstallSkillsOpts(ctx context.Context, opts UninstallOptions) error {
6363
var toRemove []string
6464
if len(opts.Skills) > 0 {
6565
seen := make(map[string]bool)
66-
for _, raw := range opts.Skills {
66+
for _, name := range opts.Skills {
6767
// Accept either variant: if the literal name isn't installed but
6868
// the alternate variant is, use the alternate. This makes uninstall
6969
// resilient to the experimental↔stable transition.
70-
name := raw
7170
if _, ok := state.Skills[name]; !ok {
7271
if alt := alternateVariantKey(name); state.Skills[alt] != "" {
7372
name = alt
7473
} else {
75-
return fmt.Errorf("skill %q is not installed", raw)
74+
return fmt.Errorf("skill %q is not installed", name)
7675
}
7776
}
7877
if seen[name] {

0 commit comments

Comments
 (0)