Skip to content
Merged
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
6 changes: 3 additions & 3 deletions cmd/init_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,9 @@ func writeWorkflows(dir string) error {
}

files := map[string]string{
filepath.Join(dir, ".github", "docker", "Dockerfile.ci"): dockerfileCI,
filepath.Join(dir, ".github", "workflows", "ci.yml"): workflowCI,
filepath.Join(dir, ".github", "workflows", "publish.yml"): workflowPublish,
filepath.Join(dir, ".github", "docker", "Dockerfile.ci"): dockerfileCI,
filepath.Join(dir, ".github", "workflows", "ci.yml"): workflowCI,
filepath.Join(dir, ".github", "workflows", "publish.yml"): workflowPublish,
}

for path, content := range files {
Expand Down
32 changes: 16 additions & 16 deletions cmd/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (

func TestInitCmd(t *testing.T) {
tests := []struct {
name string
args []string
template string
wantErr bool
name string
args []string
template string
wantErr bool
checkFiles []string
}{
{
Expand All @@ -28,8 +28,8 @@ func TestInitCmd(t *testing.T) {
},
},
{
name: "prompt-only template",
args: []string{"prompt-skill"},
name: "prompt-only template",
args: []string{"prompt-skill"},
template: "prompt-only",
checkFiles: []string{
"prompt-skill/cognitive.json",
Expand All @@ -40,8 +40,8 @@ func TestInitCmd(t *testing.T) {
},
},
{
name: "mcp-bridge template",
args: []string{"bridge-skill"},
name: "mcp-bridge template",
args: []string{"bridge-skill"},
template: "mcp-bridge",
checkFiles: []string{
"bridge-skill/cognitive.json",
Expand All @@ -52,8 +52,8 @@ func TestInitCmd(t *testing.T) {
},
},
{
name: "gguf-model template",
args: []string{"model-skill"},
name: "gguf-model template",
args: []string{"model-skill"},
template: "gguf-model",
checkFiles: []string{
"model-skill/cognitive.json",
Expand All @@ -63,8 +63,8 @@ func TestInitCmd(t *testing.T) {
},
},
{
name: "firmware template",
args: []string{"firmware-skill"},
name: "firmware template",
args: []string{"firmware-skill"},
template: "firmware",
checkFiles: []string{
"firmware-skill/cognitive.json",
Expand All @@ -74,8 +74,8 @@ func TestInitCmd(t *testing.T) {
},
},
{
name: "full template",
args: []string{"full-skill"},
name: "full template",
args: []string{"full-skill"},
template: "full",
checkFiles: []string{
"full-skill/cognitive.json",
Expand All @@ -89,8 +89,8 @@ func TestInitCmd(t *testing.T) {
},
},
{
name: "directory already exists",
args: []string{"existing-dir"},
name: "directory already exists",
args: []string{"existing-dir"},
wantErr: true,
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/install_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var installDepsCmd = &cobra.Command{
_ = queue.MarkInstalled(root, stage, entry.Filename)
continue
}

if err := queue.MarkInstalled(root, stage, entry.Filename); err != nil {
return fmt.Errorf("failed to mark %s as installed: %w", entry.Dependency.Name, err)
}
Expand Down
7 changes: 3 additions & 4 deletions cmd/pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ After packing, the archive is automatically verified for integrity.`,
// Convert typedManifest back to map[string]interface{} to keep compatibility with loadAndMergeManifests' return type
// although we could just change the return type of loadAndMergeManifests to *archive.Manifest.
// For now, let's just marshal and unmarshal.
data, _ := json.Marshal(typedManifest)
manifest = make(map[string]interface{})
_ = json.Unmarshal(data, &manifest)
data, _ := json.Marshal(typedManifest)
manifest = make(map[string]interface{})
_ = json.Unmarshal(data, &manifest)
}

manifestData, err := json.MarshalIndent(manifest, "", " ")
Expand Down Expand Up @@ -163,7 +163,6 @@ After packing, the archive is automatically verified for integrity.`,
fmt.Println(msg)
return nil
},

}

func collectManifestRefs(m *archive.Manifest) []string {
Expand Down
8 changes: 4 additions & 4 deletions cmd/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ const maxCGPSize = 32 << 20 // 32 MB Cloud Run request limit

var (
publishDownloadURL string
publishTags []string
publishScope string
publishVisibility string
publishKeyPath string
publishTags []string
publishScope string
publishVisibility string
publishKeyPath string
)

var registryClient registry.Registry
Expand Down
6 changes: 3 additions & 3 deletions cmd/register_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
var registerDepsCmd = &cobra.Command{
Use: "register-dependencies <package>",
Short: "Register system-level dependencies for an installed patch in the queue",
Args: cobra.ExactArgs(1),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
packageName := args[0]

// Resolve root from global flag
root := "/"
if rootDir != "/" {
Expand All @@ -29,7 +29,7 @@ var registerDepsCmd = &cobra.Command{
if root != "/" {
installPath = fmt.Sprintf("%s/%s", root, installPath)
}

manifest, err := archive.LoadManifest(installPath)
if err != nil {
return fmt.Errorf("could not load manifest for %s: %w", packageName, err)
Expand Down
12 changes: 6 additions & 6 deletions cmd/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ var searchCmd = &cobra.Command{

rc := registry.New(regURL)
opts := registry.SearchOptions{
License: searchLicense,
MinRAM: searchMinRAM,
Page: searchPage,
PerPage: 20,
Capability: searchCapability,
Exact: searchExact,
License: searchLicense,
MinRAM: searchMinRAM,
Page: searchPage,
PerPage: 20,
Capability: searchCapability,
Exact: searchExact,
}
results, err := rc.Search(query, opts)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions cmd/tune.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ the designated training tool via the system daemon.`,
if tuneFinalize {
// Finalize/Quantize
payload := map[string]interface{}{
"package": pkgName,
"quantize": tuneQuantize,
"finalize": true,
"package": pkgName,
"quantize": tuneQuantize,
"finalize": true,
}
if err := daemon.SendMessage("cpm_tune", payload); err != nil {
return fmt.Errorf("ERROR:T104: failed to trigger finalization: %w", err)
Expand All @@ -69,7 +69,7 @@ the designated training tool via the system daemon.`,
}

if m.Training.DataRequirements != nil && samples < m.Training.DataRequirements.MinSamples {
return fmt.Errorf("ERROR:T105: insufficient data for tuning (%d/%d samples)",
return fmt.Errorf("ERROR:T105: insufficient data for tuning (%d/%d samples)",
samples, m.Training.DataRequirements.MinSamples)
}

Expand All @@ -82,7 +82,7 @@ the designated training tool via the system daemon.`,
if err := daemon.SendMessage("cpm_tune", payload); err != nil {
return fmt.Errorf("ERROR:T106: failed to trigger tuning: %w", err)
}
fmt.Printf("✓ Tuning triggered for %s (background: %v, epochs: %d)\n",
fmt.Printf("✓ Tuning triggered for %s (background: %v, epochs: %d)\n",
pkgName, tuneBackground, tuneEpochs)
}

Expand Down
56 changes: 28 additions & 28 deletions internal/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ type HardwareDependencies struct {
}

type Manifest struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author,omitempty"`
License string `json:"license,omitempty"`
Source *SourceInfo `json:"source,omitempty"`
Dependencies map[string]string `json:"dependencies,omitempty"`
HardwareRequirements *HardwareReq `json:"hardware_requirements,omitempty"`
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author,omitempty"`
License string `json:"license,omitempty"`
Source *SourceInfo `json:"source,omitempty"`
Dependencies map[string]string `json:"dependencies,omitempty"`
HardwareRequirements *HardwareReq `json:"hardware_requirements,omitempty"`
HardwareDependencies *HardwareDependencies `json:"hardware_dependencies,omitempty"`
Brain *BrainConfig `json:"brain,omitempty"`
Runtime *RuntimeConfig `json:"runtime,omitempty"`
Training *TrainingConfig `json:"training,omitempty"`
Checksum *ChecksumInfo `json:"checksum,omitempty"`
UnlockCodes []string `json:"unlock_codes,omitempty"`
Brain *BrainConfig `json:"brain,omitempty"`
Runtime *RuntimeConfig `json:"runtime,omitempty"`
Training *TrainingConfig `json:"training,omitempty"`
Checksum *ChecksumInfo `json:"checksum,omitempty"`
UnlockCodes []string `json:"unlock_codes,omitempty"`
}

type ChecksumInfo struct {
Expand All @@ -60,18 +60,18 @@ type HardwareReq struct {
}

type BrainConfig struct {
BaseModel string `json:"base_model,omitempty"`
Adapter string `json:"adapter,omitempty"`
RawModel *ModelConfig `json:"raw_model,omitempty"`
WideModel *ModelConfig `json:"wide_model,omitempty"`
BaseModel string `json:"base_model,omitempty"`
Adapter string `json:"adapter,omitempty"`
RawModel *ModelConfig `json:"raw_model,omitempty"`
WideModel *ModelConfig `json:"wide_model,omitempty"`
}

type ModelConfig struct {
BaseModel string `json:"base_model,omitempty"`
Adapter string `json:"adapter,omitempty"`
Weights *WeightsConfig `json:"weights,omitempty"`
Parameters *BrainParameters `json:"parameters,omitempty"`
Routing []RoutingHint `json:"routing,omitempty"`
BaseModel string `json:"base_model,omitempty"`
Adapter string `json:"adapter,omitempty"`
Weights *WeightsConfig `json:"weights,omitempty"`
Parameters *BrainParameters `json:"parameters,omitempty"`
Routing []RoutingHint `json:"routing,omitempty"`
}

type WeightsConfig struct {
Expand Down Expand Up @@ -113,11 +113,11 @@ type RoutingHint struct {
}

type RuntimeConfig struct {
SystemPrompt string `json:"system_prompt,omitempty"`
ToolsRoot string `json:"tools_root,omitempty"`
MCPServers []MCPServer `json:"mcp_servers,omitempty"`
Background bool `json:"background,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
SystemPrompt string `json:"system_prompt,omitempty"`
ToolsRoot string `json:"tools_root,omitempty"`
MCPServers []MCPServer `json:"mcp_servers,omitempty"`
Background bool `json:"background,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
}

type TrainingConfig struct {
Expand Down Expand Up @@ -152,7 +152,7 @@ func ReadManifest(r io.Reader) (*Manifest, error) {
return nil, fmt.Errorf("gzip: %w", err)
}
defer gzr.Close()

tr := tar.NewReader(gzr)
for {
hdr, err := tr.Next()
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func Load(path string) (*Registries, error) {
}

var file struct {
Official struct {
Official struct {
Primary string `toml:"primary"`
Mirrors map[string]string `toml:"mirrors"`
} `toml:"official"`
Expand Down
8 changes: 4 additions & 4 deletions internal/config/secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ func TestLoadReturnsEmptyWhenNotExist(t *testing.T) {

func TestMergeSecrets(t *testing.T) {
global := &Secrets{Secrets: map[string]string{
"GLOBAL_KEY": "global-val",
"SHARED_KEY": "global-shared",
"GLOBAL_KEY": "global-val",
"SHARED_KEY": "global-shared",
}}
patch := &Secrets{Secrets: map[string]string{
"PATCH_KEY": "patch-val",
"SHARED_KEY": "patch-shared",
"PATCH_KEY": "patch-val",
"SHARED_KEY": "patch-shared",
}}

merged := MergeSecrets(global, patch)
Expand Down
Loading
Loading