summaryrefslogtreecommitdiff
path: root/internal/askcli
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-29 08:01:37 +0300
committerPaul Buetow <paul@buetow.org>2026-03-29 08:01:37 +0300
commitd600ea8c411d5f9962a64ea52bba6ec21ac661be (patch)
treef95443db2d7e277dc7fa3d8a14c0b0d969a0f306 /internal/askcli
parentaa6c7bfb84b95b3eb4ce64987210264b9521c9ad (diff)
feat: implicit add for na/no-agent scope prefix
Amp-Thread-ID: https://ampcode.com/threads/T-019d37f6-6549-7119-979a-88bc1225c594 Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'internal/askcli')
-rw-r--r--internal/askcli/dispatch.go5
-rw-r--r--internal/askcli/dispatch_test.go8
2 files changed, 12 insertions, 1 deletions
diff --git a/internal/askcli/dispatch.go b/internal/askcli/dispatch.go
index 974ceea..eab793b 100644
--- a/internal/askcli/dispatch.go
+++ b/internal/askcli/dispatch.go
@@ -53,6 +53,11 @@ func (d *Dispatcher) Dispatch(ctx context.Context, args []string, stdin io.Reade
}
subcommand := args[0]
entry, ok := commandRegistry.get(subcommand)
+ if !ok && scope != taskScopeAgent {
+ args = append([]string{"add"}, args...)
+ subcommand = "add"
+ entry, ok = commandRegistry.get(subcommand)
+ }
if !ok {
return d.unknownCommand(stderr, subcommand)
}
diff --git a/internal/askcli/dispatch_test.go b/internal/askcli/dispatch_test.go
index cc5854d..ebd7273 100644
--- a/internal/askcli/dispatch_test.go
+++ b/internal/askcli/dispatch_test.go
@@ -223,6 +223,11 @@ func TestDispatcher_NoAgentPrefix_StripsScopePrefix(t *testing.T) {
args: []string{"no-agent", "add", "new task description"},
wantCalls: [][]string{{"add", "rc.verbose=nothing", "rc.verbose=new-uuid", "new task description"}},
},
+ {
+ name: "na implicit add",
+ args: []string{"na", "description", "here"},
+ wantCalls: [][]string{{"add", "rc.verbose=nothing", "rc.verbose=new-uuid", "description here"}},
+ },
}
for _, tc := range tests {
@@ -235,7 +240,8 @@ func TestDispatcher_NoAgentPrefix_StripsScopePrefix(t *testing.T) {
_, _ = io.WriteString(stdout, taskJSONFor("test-uuid"))
case "uuid:test-uuid export":
_, _ = io.WriteString(stdout, taskJSONFor("test-uuid"))
- case "add rc.verbose=nothing rc.verbose=new-uuid new task description":
+ case "add rc.verbose=nothing rc.verbose=new-uuid new task description",
+ "add rc.verbose=nothing rc.verbose=new-uuid description here":
_, _ = io.WriteString(stdout, "Created task task-uuid-abc.\n")
default:
t.Fatalf("unexpected runner args: %v", args)