Skip to content

Commit 81c1d4f

Browse files
author
James Rappazzo
committed
change skills installing interface to stl skills
1 parent c20c87a commit 81c1d4f

3 files changed

Lines changed: 18 additions & 37 deletions

File tree

pkg/cmd/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ stl builds create --branch <branch>`,
181181

182182
&initCommand,
183183

184-
&installCommand,
184+
&skillsCommand,
185185

186186
&mcpCommand,
187187

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,14 @@ import (
1515
//go:embed skill
1616
var embeddedSkill embed.FS
1717

18-
var installCommand = cli.Command{
19-
Name: "install",
20-
Usage: "Install Stainless development tools",
21-
Flags: []cli.Flag{
22-
&cli.BoolFlag{
23-
Name: "skills",
24-
Usage: "Install coding agent skills for the Stainless CLI",
25-
},
26-
},
27-
Action: handleInstall,
18+
var skillsCommand = cli.Command{
19+
Name: "skills",
20+
Usage: "Install coding agent skills for the Stainless CLI",
21+
Action: handleSkills,
2822
HideHelpCommand: true,
2923
}
3024

31-
func handleInstall(ctx context.Context, cmd *cli.Command) error {
32-
if !cmd.Bool("skills") {
33-
return fmt.Errorf("specify what to install, e.g.: stl install --skills")
34-
}
35-
25+
func handleSkills(ctx context.Context, cmd *cli.Command) error {
3626
cwd, err := os.Getwd()
3727
if err != nil {
3828
return fmt.Errorf("failed to get working directory: %w", err)
Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,12 @@ func chdir(t *testing.T, dir string) {
1818
t.Cleanup(func() { os.Chdir(oldWd) })
1919
}
2020

21-
func TestInstall(t *testing.T) {
22-
t.Run("no flags returns error", func(t *testing.T) {
23-
tmpDir := t.TempDir()
24-
chdir(t, tmpDir)
25-
26-
err := Command.Run(context.Background(), []string{"stl", "install"})
27-
assert.Error(t, err)
28-
assert.Contains(t, err.Error(), "--skills")
29-
})
30-
21+
func TestSkills(t *testing.T) {
3122
t.Run("neither dir exists defaults to .agents", func(t *testing.T) {
3223
tmpDir := t.TempDir()
3324
chdir(t, tmpDir)
3425

35-
err := Command.Run(context.Background(), []string{"stl", "install", "--skills"})
26+
err := Command.Run(context.Background(), []string{"stl", "skills"})
3627
require.NoError(t, err)
3728
require.FileExists(t,filepath.Join(tmpDir, ".agents", "skills", "stl-cli", "SKILL.md"))
3829
assert.NoDirExists(t, filepath.Join(tmpDir, ".claude"))
@@ -43,7 +34,7 @@ func TestInstall(t *testing.T) {
4334
chdir(t, tmpDir)
4435
require.NoError(t, os.Mkdir(filepath.Join(tmpDir, ".claude"), 0755))
4536

46-
err := Command.Run(context.Background(), []string{"stl", "install", "--skills"})
37+
err := Command.Run(context.Background(), []string{"stl", "skills"})
4738
require.NoError(t, err)
4839
require.FileExists(t,filepath.Join(tmpDir, ".claude", "skills", "stl-cli", "SKILL.md"))
4940
assert.NoDirExists(t, filepath.Join(tmpDir, ".agents"))
@@ -54,7 +45,7 @@ func TestInstall(t *testing.T) {
5445
chdir(t, tmpDir)
5546
require.NoError(t, os.Mkdir(filepath.Join(tmpDir, ".agents"), 0755))
5647

57-
err := Command.Run(context.Background(), []string{"stl", "install", "--skills"})
48+
err := Command.Run(context.Background(), []string{"stl", "skills"})
5849
require.NoError(t, err)
5950
require.FileExists(t,filepath.Join(tmpDir, ".agents", "skills", "stl-cli", "SKILL.md"))
6051
assert.NoDirExists(t, filepath.Join(tmpDir, ".claude"))
@@ -66,7 +57,7 @@ func TestInstall(t *testing.T) {
6657
require.NoError(t, os.Mkdir(filepath.Join(tmpDir, ".claude"), 0755))
6758
require.NoError(t, os.Mkdir(filepath.Join(tmpDir, ".agents"), 0755))
6859

69-
err := Command.Run(context.Background(), []string{"stl", "install", "--skills"})
60+
err := Command.Run(context.Background(), []string{"stl", "skills"})
7061
require.NoError(t, err)
7162

7263
// Primary install goes to .agents
@@ -87,9 +78,9 @@ func TestInstall(t *testing.T) {
8778
chdir(t, tmpDir)
8879
require.NoError(t, os.Mkdir(filepath.Join(tmpDir, ".claude"), 0755))
8980

90-
err := Command.Run(context.Background(), []string{"stl", "install", "--skills"})
81+
err := Command.Run(context.Background(), []string{"stl", "skills"})
9182
require.NoError(t, err)
92-
err = Command.Run(context.Background(), []string{"stl", "install", "--skills"})
83+
err = Command.Run(context.Background(), []string{"stl", "skills"})
9384
require.NoError(t, err)
9485
require.FileExists(t,filepath.Join(tmpDir, ".claude", "skills", "stl-cli", "SKILL.md"))
9586
})
@@ -100,9 +91,9 @@ func TestInstall(t *testing.T) {
10091
require.NoError(t, os.Mkdir(filepath.Join(tmpDir, ".claude"), 0755))
10192
require.NoError(t, os.Mkdir(filepath.Join(tmpDir, ".agents"), 0755))
10293

103-
err := Command.Run(context.Background(), []string{"stl", "install", "--skills"})
94+
err := Command.Run(context.Background(), []string{"stl", "skills"})
10495
require.NoError(t, err)
105-
err = Command.Run(context.Background(), []string{"stl", "install", "--skills"})
96+
err = Command.Run(context.Background(), []string{"stl", "skills"})
10697
require.NoError(t, err)
10798

10899
require.FileExists(t,filepath.Join(tmpDir, ".agents", "skills", "stl-cli", "SKILL.md"))
@@ -118,15 +109,15 @@ func TestInstall(t *testing.T) {
118109
require.NoError(t, os.Mkdir(filepath.Join(tmpDir, ".claude"), 0755))
119110

120111
// First install: only .claude exists → real directory
121-
err := Command.Run(context.Background(), []string{"stl", "install", "--skills"})
112+
err := Command.Run(context.Background(), []string{"stl", "skills"})
122113
require.NoError(t, err)
123114
info, err := os.Lstat(filepath.Join(tmpDir, ".claude", "skills", "stl-cli"))
124115
require.NoError(t, err)
125116
assert.True(t, info.IsDir(), "should be a real directory before upgrade")
126117

127118
// Now add .agents and re-run → should replace with symlink
128119
require.NoError(t, os.Mkdir(filepath.Join(tmpDir, ".agents"), 0755))
129-
err = Command.Run(context.Background(), []string{"stl", "install", "--skills"})
120+
err = Command.Run(context.Background(), []string{"stl", "skills"})
130121
require.NoError(t, err)
131122

132123
info, err = os.Lstat(filepath.Join(tmpDir, ".claude", "skills", "stl-cli"))
@@ -143,7 +134,7 @@ func TestInstall(t *testing.T) {
143134
require.NoError(t, os.Mkdir(filepath.Join(tmpDir, ".agents"), 0755))
144135
require.NoError(t, os.Symlink(".agents", filepath.Join(tmpDir, ".claude")))
145136

146-
err := Command.Run(context.Background(), []string{"stl", "install", "--skills"})
137+
err := Command.Run(context.Background(), []string{"stl", "skills"})
147138
require.NoError(t, err)
148139

149140
// Files should be in .agents

0 commit comments

Comments
 (0)