Step 7: Remaining commands — remove, verify, list, diff.

Remove: untrack files, remove manifest entries, save. 2 tests.
Verify: check blobs against manifest hashes, report ok/mismatch/missing. 3 tests.
List: return all tracked entries, CLI formats by type. 2 tests.
Diff: compare stored blob vs current file, simple line diff. 3 tests.

Each command in its own file (garden/<cmd>.go) for parallel development.
Remove, verify, list implemented by parallel worktree agents; diff manual.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 21:55:37 -07:00
parent d03378c9c1
commit 08e24b44e0
5 changed files with 232 additions and 8 deletions

37
cmd/sgard/diff.go Normal file
View File

@@ -0,0 +1,37 @@
package main
import (
"fmt"
"github.com/kisom/sgard/garden"
"github.com/spf13/cobra"
)
var diffCmd = &cobra.Command{
Use: "diff <path>",
Short: "Show differences between stored and current file",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
g, err := garden.Open(repoFlag)
if err != nil {
return err
}
d, err := g.Diff(args[0])
if err != nil {
return err
}
if d == "" {
fmt.Println("No changes.")
} else {
fmt.Print(d)
}
return nil
},
}
func init() {
rootCmd.AddCommand(diffCmd)
}