summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-02-22 09:28:52 +0200
committerPaul Buetow <paul@buetow.org>2026-02-22 09:28:52 +0200
commit7ae8855a075773c50ab8db8ee65bbfa9710f140e (patch)
tree590496d0883dfeb928e660345325e9a725688b79
parentdc2d267244d6dd9d991207fe193e987b6477c415 (diff)
Add Go project scaffold (task 352)
- go.mod with module codeberg.org/snonux/geheim (go 1.22, mage dep) - Magefile.go with Build, Test, Install, Uninstall targets - cmd/geheim/main.go delegating to internal/cli - Stub packages: cli, version, config, crypto, git, store, clipboard, shell - go.sum generated; binary confirmed to build via mage build Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rw-r--r--Magefile.go59
-rw-r--r--cmd/geheim/main.go13
-rw-r--r--go.mod5
-rw-r--r--go.sum2
-rw-r--r--internal/cli/cli.go9
-rw-r--r--internal/clipboard/clipboard.go2
-rw-r--r--internal/config/config.go5
-rw-r--r--internal/crypto/crypto.go2
-rw-r--r--internal/git/git.go2
-rw-r--r--internal/shell/shell.go2
-rw-r--r--internal/store/data.go2
-rw-r--r--internal/store/index.go2
-rw-r--r--internal/store/store.go2
-rw-r--r--internal/version/version.go5
14 files changed, 112 insertions, 0 deletions
diff --git a/Magefile.go b/Magefile.go
new file mode 100644
index 0000000..ee80721
--- /dev/null
+++ b/Magefile.go
@@ -0,0 +1,59 @@
+//go:build mage
+
+// Magefile provides build targets for the geheim project.
+// Targets: Build, Test, Install, Uninstall
+package main
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/magefile/mage/mg"
+ "github.com/magefile/mage/sh"
+)
+
+const (
+ binary = "./bin/geheim"
+ mainPkg = "./cmd/geheim"
+)
+
+// Build compiles the binary to ./bin/geheim.
+func Build() error {
+ mg.Deps(createBinDir)
+ fmt.Println("Building", binary)
+ return sh.RunV("go", "build", "-o", binary, mainPkg)
+}
+
+// Test runs all tests in the module.
+func Test() error {
+ fmt.Println("Running tests")
+ return sh.RunV("go", "test", "./...")
+}
+
+// Install builds the binary and copies it to ~/.local/bin/geheim.
+func Install() error {
+ mg.Deps(Build)
+ home, err := os.UserHomeDir()
+ if err != nil {
+ return fmt.Errorf("cannot determine home directory: %w", err)
+ }
+ dest := home + "/.local/bin/geheim"
+ fmt.Println("Installing to", dest)
+ return sh.Copy(dest, binary)
+}
+
+// Uninstall removes the installed binary from ~/.local/bin/geheim.
+func Uninstall() error {
+ home, err := os.UserHomeDir()
+ if err != nil {
+ return fmt.Errorf("cannot determine home directory: %w", err)
+ }
+ dest := home + "/.local/bin/geheim"
+ fmt.Println("Uninstalling", dest)
+ return os.Remove(dest)
+}
+
+// createBinDir ensures ./bin exists before the build step writes the binary.
+func createBinDir() error {
+ return os.MkdirAll("./bin", 0755)
+}
diff --git a/cmd/geheim/main.go b/cmd/geheim/main.go
new file mode 100644
index 0000000..4032f53
--- /dev/null
+++ b/cmd/geheim/main.go
@@ -0,0 +1,13 @@
+// main is the entry point for the geheim binary.
+// It delegates all logic to the cli package and exits with the returned code.
+package main
+
+import (
+ "os"
+
+ "codeberg.org/snonux/geheim/internal/cli"
+)
+
+func main() {
+ os.Exit(cli.Run())
+}
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..a8bd639
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,5 @@
+module codeberg.org/snonux/geheim
+
+go 1.22
+
+require github.com/magefile/mage v1.15.0
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..4ee1b87
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,2 @@
+github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg=
+github.com/magefile/mage v1.15.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
diff --git a/internal/cli/cli.go b/internal/cli/cli.go
new file mode 100644
index 0000000..4b4e8c5
--- /dev/null
+++ b/internal/cli/cli.go
@@ -0,0 +1,9 @@
+// Package cli implements the command-line interface for geheim.
+// Run() is called by main and returns an exit code.
+package cli
+
+// Run is the top-level entry point for the CLI.
+// Returns 0 on success, non-zero on error.
+func Run() int {
+ return 0
+}
diff --git a/internal/clipboard/clipboard.go b/internal/clipboard/clipboard.go
new file mode 100644
index 0000000..6635537
--- /dev/null
+++ b/internal/clipboard/clipboard.go
@@ -0,0 +1,2 @@
+// Package clipboard provides clipboard read/write access for geheim.
+package clipboard
diff --git a/internal/config/config.go b/internal/config/config.go
new file mode 100644
index 0000000..3474b73
--- /dev/null
+++ b/internal/config/config.go
@@ -0,0 +1,5 @@
+// Package config handles loading and storing geheim configuration.
+package config
+
+// Config holds application-wide configuration values.
+type Config struct{}
diff --git a/internal/crypto/crypto.go b/internal/crypto/crypto.go
new file mode 100644
index 0000000..0e985f4
--- /dev/null
+++ b/internal/crypto/crypto.go
@@ -0,0 +1,2 @@
+// Package crypto provides encryption and decryption primitives for geheim.
+package crypto
diff --git a/internal/git/git.go b/internal/git/git.go
new file mode 100644
index 0000000..6d29fda
--- /dev/null
+++ b/internal/git/git.go
@@ -0,0 +1,2 @@
+// Package git wraps git operations used by geheim to manage the secret store.
+package git
diff --git a/internal/shell/shell.go b/internal/shell/shell.go
new file mode 100644
index 0000000..2c8739b
--- /dev/null
+++ b/internal/shell/shell.go
@@ -0,0 +1,2 @@
+// Package shell provides interactive shell and readline integration for geheim.
+package shell
diff --git a/internal/store/data.go b/internal/store/data.go
new file mode 100644
index 0000000..fb5547d
--- /dev/null
+++ b/internal/store/data.go
@@ -0,0 +1,2 @@
+// data.go handles reading and writing individual secret data blobs.
+package store
diff --git a/internal/store/index.go b/internal/store/index.go
new file mode 100644
index 0000000..cd80dc5
--- /dev/null
+++ b/internal/store/index.go
@@ -0,0 +1,2 @@
+// index.go manages the index of entries within the secret store.
+package store
diff --git a/internal/store/store.go b/internal/store/store.go
new file mode 100644
index 0000000..3ebde40
--- /dev/null
+++ b/internal/store/store.go
@@ -0,0 +1,2 @@
+// Package store manages the geheim secret store on disk.
+package store
diff --git a/internal/version/version.go b/internal/version/version.go
new file mode 100644
index 0000000..c7defb0
--- /dev/null
+++ b/internal/version/version.go
@@ -0,0 +1,5 @@
+// Package version holds the application version string.
+package version
+
+// Version is the current release version of geheim.
+const Version = "0.0.0"