mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
Phase 1 of caller migration: - projectRuntime: registry → skillsStore + agentsStore - globalInstallContext: reg → store - ReconcileGlobalSkills/ProjectSkills/ProjectAgents: take *MetadataStore - Server struct: registry → skillsStore + agentsStore - handler_install, handler_skills, handler_uninstall: use MetadataStore - install.go, search.go: post-install reconciliation via MetadataStore
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"skillshare/internal/config"
|
|
"skillshare/internal/install"
|
|
)
|
|
|
|
type projectRuntime struct {
|
|
root string
|
|
config *config.ProjectConfig
|
|
skillsStore *install.MetadataStore
|
|
agentsStore *install.MetadataStore
|
|
sourcePath string
|
|
agentsSourcePath string
|
|
targets map[string]config.TargetConfig
|
|
}
|
|
|
|
func loadProjectRuntime(root string) (*projectRuntime, error) {
|
|
cfg, err := config.LoadProject(root)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
targets, err := config.ResolveProjectTargets(root, cfg)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
skillsDir := filepath.Join(root, ".skillshare", "skills")
|
|
agentsDir := filepath.Join(root, ".skillshare", "agents")
|
|
|
|
skillsStore, err := install.LoadMetadataWithMigration(skillsDir, "")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
agentsStore, err := install.LoadMetadataWithMigration(agentsDir, "agent")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &projectRuntime{
|
|
root: root,
|
|
config: cfg,
|
|
skillsStore: skillsStore,
|
|
agentsStore: agentsStore,
|
|
sourcePath: skillsDir,
|
|
agentsSourcePath: agentsDir,
|
|
targets: targets,
|
|
}, nil
|
|
}
|