Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 0 additions & 69 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/fs"
"net/url"
"os"
"path/filepath"
Expand Down Expand Up @@ -997,74 +996,6 @@ func registerCustomerContextCommands(configDir string) {
cli.Root.AddCommand(cmd)
}

// installSkill copies embedded skill files into targetDir/skills/dci-cli/.
func installSkill(targetDir string) error {
const srcRoot = "skills/dci-cli"
destRoot := filepath.Join(targetDir, "skills", "dci-cli")

return fs.WalkDir(skillFS, srcRoot, func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
rel, err := filepath.Rel(srcRoot, path)
if err != nil {
return err
}
dest := filepath.Join(destRoot, rel)

if d.IsDir() {
return os.MkdirAll(dest, 0o755)
}
data, err := skillFS.ReadFile(path)
if err != nil {
return err
}
return os.WriteFile(dest, data, 0o644)
})
}

func registerSkillCommands() {
agents := []struct {
name string
dir string
}{
{"claude", ".claude"},
{"codex", ".codex"},
{"kiro", ".kiro"},
{"gemini", ".gemini"},
{"opencode", ".config/opencode"}, // OpenCode uses XDG config dir (~/.config), not a dotfile
}

cmd := &cobra.Command{
Use: "skill",
Short: "Install the dci skill for an AI agent",
}

for _, a := range agents {
agentName := a.name
agentDir := a.dir
cmd.AddCommand(&cobra.Command{
Use: agentName,
Short: fmt.Sprintf("Install skill into ~/%s/skills/dci-cli/", agentDir),
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
home, err := os.UserHomeDir()
if err != nil {
return fmt.Errorf("cannot determine home directory: %w", err)
}
targetDir := filepath.Join(home, agentDir)
if err := installSkill(targetDir); err != nil {
return fmt.Errorf("failed to install skill: %w", err)
}
fmt.Fprintf(os.Stdout, "Skill installed to %s\n", filepath.Join(targetDir, "skills", "dci-cli"))
return nil
},
})
}

cli.Root.AddCommand(cmd)
}

func brandDCIRootCommand() {
applyCommandBranding(findDCICommand(), "DoiT Cloud Intelligence API CLI", apiExamples)
}
Expand Down
Loading
Loading