* feat(updater): add web self-update endpoint and updater package * feat(selfupgrade): when url empty, using GetTestReleaseAPIURL for test . * feat(selfupgrade): only GetTestReleaseAPIURL . * feat(upgrade): cli $0 update work well! * fix(ci): fix ci err * fix(test): fix ci test * fix(ci): fix ci lint fmt err * test(updater): add test for updater * fix(ci): fix ci lint var copy err * fix(ci): retry ci * updater: require checksum verification, prefer API digest, verify SHA256, fix zip extraction, update tests * fix(lint): lint fixed * fix(lint): lint fixed2 * updater: stream download and verify sha256; add http client timeout and progress Avoid double-download by streaming asset into temp file while computing SHA256 and verifying against checksum; replace http.Get with shared httpClient (2m timeout) to prevent hangs; add simple stderr progress display; remove unused helpers.
75 lines
2.9 KiB
Go
75 lines
2.9 KiB
Go
// PicoClaw - Ultra-lightweight personal AI agent
|
|
// Inspired by and based on nanobot: https://github.com/HKUDS/nanobot
|
|
// License: MIT
|
|
//
|
|
// Copyright (c) 2026 PicoClaw contributors
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal"
|
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/agent"
|
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/auth"
|
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/cron"
|
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/gateway"
|
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/migrate"
|
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/model"
|
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/onboard"
|
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/skills"
|
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/status"
|
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/version"
|
|
"github.com/sipeed/picoclaw/pkg/config"
|
|
"github.com/sipeed/picoclaw/pkg/updater"
|
|
)
|
|
|
|
func NewPicoclawCommand() *cobra.Command {
|
|
short := fmt.Sprintf("%s picoclaw - Personal AI Assistant v%s\n\n", internal.Logo, config.GetVersion())
|
|
|
|
cmd := &cobra.Command{
|
|
Use: "picoclaw",
|
|
Short: short,
|
|
Example: "picoclaw version",
|
|
}
|
|
|
|
cmd.AddCommand(
|
|
onboard.NewOnboardCommand(),
|
|
agent.NewAgentCommand(),
|
|
auth.NewAuthCommand(),
|
|
gateway.NewGatewayCommand(),
|
|
status.NewStatusCommand(),
|
|
cron.NewCronCommand(),
|
|
migrate.NewMigrateCommand(),
|
|
skills.NewSkillsCommand(),
|
|
model.NewModelCommand(),
|
|
updater.NewUpdateCommand("picoclaw"),
|
|
version.NewVersionCommand(),
|
|
)
|
|
|
|
return cmd
|
|
}
|
|
|
|
const (
|
|
colorBlue = "\033[1;38;2;62;93;185m"
|
|
colorRed = "\033[1;38;2;213;70;70m"
|
|
banner = "\r\n" +
|
|
colorBlue + "██████╗ ██╗ ██████╗ ██████╗ " + colorRed + " ██████╗██╗ █████╗ ██╗ ██╗\n" +
|
|
colorBlue + "██╔══██╗██║██╔════╝██╔═══██╗" + colorRed + "██╔════╝██║ ██╔══██╗██║ ██║\n" +
|
|
colorBlue + "██████╔╝██║██║ ██║ ██║" + colorRed + "██║ ██║ ███████║██║ █╗ ██║\n" +
|
|
colorBlue + "██╔═══╝ ██║██║ ██║ ██║" + colorRed + "██║ ██║ ██╔══██║██║███╗██║\n" +
|
|
colorBlue + "██║ ██║╚██████╗╚██████╔╝" + colorRed + "╚██████╗███████╗██║ ██║╚███╔███╔╝\n" +
|
|
colorBlue + "╚═╝ ╚═╝ ╚═════╝ ╚═════╝ " + colorRed + " ╚═════╝╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝\n " +
|
|
"\033[0m\r\n"
|
|
)
|
|
|
|
func main() {
|
|
fmt.Printf("%s", banner)
|
|
cmd := NewPicoclawCommand()
|
|
if err := cmd.Execute(); err != nil {
|
|
os.Exit(1)
|
|
}
|
|
}
|