feat(v0.5.2): direct lookup includes archived; resume hint for archived

Apply the v0.5.2 lookup policy to the existing commands and wire
ValidArgsFunction hooks across the workspace-accepting surface.

info: drop the --all/-a flag entirely. Direct lookup is now
archived-inclusive by default — the user typed a name, so we find
the workspace and surface its status in the output. The Status
line already distinguishes active vs archived clearly.

resume: when targeting an archived workspace, fail with a useful
hint instead of letting the resolver report "not found":

  [ctask] error: workspace "X" is archived

  To restore it:
    ctask restore X

This is implemented by resolving archived-inclusive and rejecting
status==archived before any session-launch logic runs. Genuine
not-found and ambiguous-match behavior are unchanged.

Adds ValidArgsFunction hooks to archive (active), delete (active),
open (active), info (any), resume (active). Restore/notes/path
already have hooks from the previous commit. Shell completion now
covers the full direct-lookup surface.
This commit is contained in:
2026-05-07 19:47:24 -04:00
parent 176e788f67
commit b923ae8892
7 changed files with 142 additions and 9 deletions
+6 -4
View File
@@ -17,16 +17,18 @@ var infoCmd = &cobra.Command{
RunE: runInfo,
}
var infoAll bool
func init() {
infoCmd.Flags().BoolVarP(&infoAll, "all", "a", false, "Include archived workspaces in query resolution")
infoCmd.ValidArgsFunction = completeWorkspaces(completionAny)
rootCmd.AddCommand(infoCmd)
}
func runInfo(cmd *cobra.Command, args []string) error {
// v0.5.2: info is a read-only direct lookup. Always include archived
// workspaces — if the user types a name, they want to find it whether
// or not it's archived. The status field in the output makes the state
// obvious.
roots := config.SearchRoots()
ws := resolveOne(roots, args[0], infoAll)
ws := resolveOne(roots, args[0], true)
m := ws.Meta
fmt.Printf("Task: %s\n", m.Slug)