MCPcopy Create free account
hub / github.com/compozy/agh / TestMemoryCommandTreeHardCutsLegacyVerbs

Function TestMemoryCommandTreeHardCutsLegacyVerbs

internal/cli/memory_test.go:18–80  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func TestMemoryCommandTreeHardCutsLegacyVerbs(t *testing.T) {
19 t.Parallel()
20
21 root := newRootCommand(commandDeps{})
22 expectedLeaves := [][]string{
23 {"memory", "list"},
24 {"memory", "show"},
25 {"memory", "write"},
26 {"memory", "edit"},
27 {"memory", "delete"},
28 {"memory", "search"},
29 {"memory", "reindex"},
30 {"memory", "history"},
31 {"memory", "health"},
32 {"memory", "promote"},
33 {"memory", "reset"},
34 {"memory", "reload"},
35 {"memory", "scope-show"},
36 {"memory", "decisions", "list"},
37 {"memory", "decisions", "show"},
38 {"memory", "decisions", "revert"},
39 {"memory", "recall", "trace"},
40 {"memory", "dream", "show"},
41 {"memory", "dream", "retry"},
42 {"memory", "dream", "trigger"},
43 {"memory", "dream", "status"},
44 {"memory", "daily", "ls"},
45 {"memory", "daily", "show"},
46 {"memory", "daily", "archive"},
47 {"memory", "daily", "restore"},
48 {"memory", "daily", "purge"},
49 {"memory", "extractor", "status"},
50 {"memory", "extractor", "list-pending"},
51 {"memory", "extractor", "replay"},
52 {"memory", "extractor", "drain"},
53 {"memory", "extractor", "disable"},
54 {"memory", "provider", "list"},
55 {"memory", "provider", "enable"},
56 {"memory", "provider", "disable"},
57 {"memory", "adhoc", "list"},
58 {"memory", "adhoc", "show"},
59 }
60 for _, args := range expectedLeaves {
61 cmd, remaining, err := root.Find(args)
62 if err != nil {
63 t.Fatalf("Find(%v) error = %v", args, err)
64 }
65 if len(remaining) != 0 {
66 t.Fatalf("Find(%v) remaining = %v, want none", args, remaining)
67 }
68 if got := strings.TrimSpace(cmd.CommandPath()); got != "agh "+strings.Join(args, " ") {
69 t.Fatalf("CommandPath(%v) = %q", args, got)
70 }
71 }
72
73 for _, legacy := range [][]string{{"memory", "read"}, {"memory", "consolidate"}} {
74 cmd, remaining, err := root.Find(legacy)
75 if err == nil && len(remaining) == 0 &&

Callers

nothing calls this directly

Calls 1

newRootCommandFunction · 0.85

Tested by

no test coverage detected