Skip to content

Commit bc6a751

Browse files
committed
test message
1 parent eecd6d8 commit bc6a751

4 files changed

Lines changed: 59 additions & 2 deletions

File tree

cmd/iterate/repl.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ var (
3838
// replRepoPath is the repo path used in the current REPL session (for prompt display).
3939
var replRepoPath string
4040

41+
// replRegistry is the shared command registry (initialized once, reused across calls).
42+
var replRegistry = commands.DefaultRegistry()
43+
4144
// iterateVersion is the current version string.
4245
const iterateVersion = "dev"
4346

@@ -394,7 +397,7 @@ func handleCommand(ctx context.Context, line string, a *iteragent.Agent, p itera
394397
// Try modular command registry first
395398
cmdCtx := buildCommandContext(repoPath, line, parts, p, a, thinking)
396399

397-
if result := commands.DefaultRegistry().Execute(cmd, cmdCtx); result.Handled {
400+
if result := replRegistry.Execute(cmd, cmdCtx); result.Handled {
398401
return result.Done
399402
}
400403

@@ -413,6 +416,7 @@ func buildCommandContext(repoPath, line string, parts []string, p iteragent.Prov
413416
Agent: a,
414417
Thinking: thinking,
415418
SafeMode: &cfg.SafeMode,
419+
Registry: replRegistry,
416420
AutoCommitEnabled: &cfg.AutoCommitEnabled,
417421
DeniedTools: nil,
418422
SessionInputTokens: &sess.InputTokens,

internal/commands/mode.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66
"os/exec"
77
"path/filepath"
8+
"sort"
89
"strings"
910
)
1011

@@ -79,6 +80,54 @@ func registerDisplayNavCommands(r *Registry) {
7980
}
8081

8182
func cmdHelp(ctx Context) Result {
83+
// /help <command> — show description for a specific command.
84+
if ctx.HasArg(1) && ctx.Registry != nil {
85+
name := ctx.Arg(1)
86+
if !strings.HasPrefix(name, "/") {
87+
name = "/" + name
88+
}
89+
cmd, ok := ctx.Registry.Lookup(name)
90+
if !ok {
91+
fmt.Printf("Unknown command: %s\n", name)
92+
return Result{Handled: true}
93+
}
94+
fmt.Printf("%s%s%s — %s\n", ColorBold, cmd.Name, ColorReset, cmd.Description)
95+
if len(cmd.Aliases) > 0 {
96+
fmt.Printf(" aliases: %s\n", strings.Join(cmd.Aliases, ", "))
97+
}
98+
fmt.Println()
99+
return Result{Handled: true}
100+
}
101+
102+
// Dynamic help generated from the registry when available.
103+
if ctx.Registry != nil {
104+
byCategory := ctx.Registry.ByCategory()
105+
// Sort categories for stable output.
106+
cats := make([]string, 0, len(byCategory))
107+
for c := range byCategory {
108+
cats = append(cats, c)
109+
}
110+
sort.Strings(cats)
111+
112+
fmt.Printf("\n%sAvailable commands%s\n\n", ColorBold, ColorReset)
113+
for _, cat := range cats {
114+
cmds := byCategory[cat]
115+
sort.Slice(cmds, func(i, j int) bool { return cmds[i].Name < cmds[j].Name })
116+
fmt.Printf("%s%s%s\n", ColorDim, strings.ToUpper(cat), ColorReset)
117+
for _, cmd := range cmds {
118+
alias := ""
119+
if len(cmd.Aliases) > 0 {
120+
alias = fmt.Sprintf(" %s(%s)%s", ColorDim, strings.Join(cmd.Aliases, ", "), ColorReset)
121+
}
122+
fmt.Printf(" %-22s %s%s\n", cmd.Name, cmd.Description, alias)
123+
}
124+
fmt.Println()
125+
}
126+
fmt.Printf("Tip: %s/help <command>%s for details on any command.\n\n", ColorDim, ColorReset)
127+
return Result{Handled: true}
128+
}
129+
130+
// Fallback static help when registry is unavailable (e.g., in tests).
82131
fmt.Print(`
83132
Available commands:
84133
/help — show this help

internal/commands/registry.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ type Context struct {
8989
SafeMode *bool
9090
DeniedTools map[string]bool
9191

92+
// Registry is the command registry — used by /help to generate dynamic output.
93+
Registry *Registry
94+
9295
// Session state
9396
SessionInputTokens *int
9497
SessionOutputTokens *int

memory/ACTIVE_LEARNINGS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Active Learnings
2-
*Last synthesized: 2026-03-26T04:59:43.064832*
2+
3+
*Last synthesized: 2026-03-26T11:41:25Z*
34

45
### Recent (Full Detail)
56

0 commit comments

Comments
 (0)