mirror of
https://github.com/prdlk/gh-commit.git
synced 2026-09-16 23:16:25 +00:00
feat: rewrite gh-commit in Go with local Ollama backend
Replaces the Python/Crush/DuckDB implementation with a CGO-free Go binary: cobra CLI, modernc.org/sqlite storage, huh/lipgloss UI, and speed-tuned raw /api/generate calls (think:false, keep_alive, capped num_predict) against a local qwen3.5:2b. Ships as a gh extension via cli/gh-extension-precompile.
This commit is contained in:
+62
@@ -0,0 +1,62 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/prdlk/gh-commit/internal/db"
|
||||
"github.com/prdlk/gh-commit/internal/ui"
|
||||
)
|
||||
|
||||
var removeCmd = &cobra.Command{
|
||||
Use: "remove",
|
||||
Short: "Remove the current repository from the database",
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(_ *cobra.Command, _ []string) error {
|
||||
repoPath, err := requireGit()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
hasScopes, err := store.HasScopes(repoPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !hasScopes {
|
||||
ui.Dimf("Repository not in database: %s", filepath.Base(repoPath))
|
||||
return nil
|
||||
}
|
||||
if ui.Confirm(fmt.Sprintf("Remove %s from database?", filepath.Base(repoPath))) {
|
||||
if err := store.DeleteRepo(repoPath); err != nil {
|
||||
return err
|
||||
}
|
||||
ui.Successf("✓ Removed %s", filepath.Base(repoPath))
|
||||
} else {
|
||||
ui.Dimf("Cancelled")
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var dbPathCmd = &cobra.Command{
|
||||
Use: "db-path",
|
||||
Short: "Print the database file path",
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(_ *cobra.Command, _ []string) {
|
||||
fmt.Println(db.Path())
|
||||
},
|
||||
}
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print the version",
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(_ *cobra.Command, _ []string) {
|
||||
fmt.Printf("gh-commit %s\n", version)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(removeCmd, dbPathCmd, versionCmd)
|
||||
}
|
||||
Reference in New Issue
Block a user