Files
Ed Zynda c5e6ca6e4d feat: Add kit install command for git-based extension distribution
Add comprehensive extension installation system for Kit:

Features:
- kit install <git-url> - Install extensions from git repos
- kit install <url> --local - Install to project .kit/git/ directory
- kit install <url> --select - Interactive selection for multi-extension repos
- kit install <url> --update - Update installed extensions
- kit install <url> --uninstall - Remove installed extensions
- Version pinning via @ref (tags, branches, commits)
- Support multiple URL formats (shorthand, git:, https, ssh)

Implementation:
- internal/extensions/installer.go - Git clone, checkout, validation
- internal/extensions/manifest.go - Package tracking with Include filtering
- internal/extensions/loader.go - Respect Include field when loading
- cmd/install.go - Cobra command with interactive prompts
- PromptMultiSelectConfig API - Multi-select prompts for extensions

Storage:
- Global: ~/.local/share/kit/git/<host>/<owner>/<repo>/
- Project: .kit/git/<host>/<owner>/<repo>/
- Manifests: packages.json tracking installed packages

Examples:
- Reorganized examples/extensions/ with README.md
- Added status-tools/ multi-file extension example
- Created comprehensive install guide in SKILL.md

Testing:
- Added installer_test.go with 15+ test cases
- All tests pass, build clean

Closes #extension-distribution
2026-03-18 16:21:31 +03:00

50 lines
1.1 KiB
Go

//go:build ignore
package main
import (
"fmt"
"time"
"kit/ext"
)
// Init registers the status tools extension.
// This extension provides multiple status-related utilities as a
// multi-file extension example.
func Init(api ext.API) {
// Register a status bar widget that shows time
api.OnSessionStart(func(_ ext.SessionStartEvent, ctx ext.Context) {
go func() {
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
for range ticker.C {
ctx.SetStatus("clock", time.Now().Format("15:04:05"), 5)
}
}()
})
// Register a /status command
api.RegisterCommand(ext.CommandDef{
Name: "status",
Description: "Show system status information",
Execute: func(args string, ctx ext.Context) (string, error) {
stats := ctx.GetContextStats()
info := fmt.Sprintf(
"Model: %s\nTokens: %d/%d (%.1f%%)\nMessages: %d",
ctx.Model,
stats.EstimatedTokens,
stats.ContextLimit,
stats.UsagePercent*100,
stats.MessageCount,
)
ctx.PrintBlock(ext.PrintBlockOpts{
Text: info,
BorderColor: "#89b4fa",
Subtitle: "System Status",
})
return "", nil
},
})
}