Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
45 lines
1.6 KiB
Go
45 lines
1.6 KiB
Go
package runtimeprep
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
func prepareClaudePersonalSkillDirectory(runtimeRoot string, personalSkillRoot string) (string, error) {
|
|
personalSkillRoot = filepath.Clean(strings.TrimSpace(personalSkillRoot))
|
|
if personalSkillRoot == "." {
|
|
return "", nil
|
|
}
|
|
if !filepath.IsAbs(personalSkillRoot) || personalSkillRoot == string(filepath.Separator) {
|
|
return "", fmt.Errorf("claude personal skill root must be an absolute non-root path")
|
|
}
|
|
personalInfo, err := os.Lstat(personalSkillRoot)
|
|
if err != nil {
|
|
return "", fmt.Errorf("inspect Claude personal skill root: %w", err)
|
|
}
|
|
if personalInfo.Mode()&os.ModeSymlink != 0 || !personalInfo.IsDir() {
|
|
return "", fmt.Errorf("claude personal skill root must be a real directory: %s", personalSkillRoot)
|
|
}
|
|
|
|
additionalDirectory := filepath.Join(runtimeRoot, "claude-personal-skills")
|
|
claudeDirectory := filepath.Join(additionalDirectory, ".claude")
|
|
if err := os.MkdirAll(claudeDirectory, 0o700); err != nil {
|
|
return "", fmt.Errorf("create Claude personal skill projection: %w", err)
|
|
}
|
|
target := filepath.Join(claudeDirectory, "skills")
|
|
if targetInfo, err := os.Stat(target); err == nil {
|
|
if os.SameFile(targetInfo, personalInfo) {
|
|
return additionalDirectory, nil
|
|
}
|
|
return "", fmt.Errorf("claude personal skill projection targets a different directory: %s", target)
|
|
} else if !os.IsNotExist(err) {
|
|
return "", fmt.Errorf("inspect Claude personal skill projection: %w", err)
|
|
}
|
|
if err := exposeCodexSharedDirectory(personalSkillRoot, target); err != nil {
|
|
return "", fmt.Errorf("expose Claude personal skill root: %w", err)
|
|
}
|
|
return additionalDirectory, nil
|
|
}
|