fix(v0.4.1): route all workspace commands through SearchRoots

Every resolver, lister, and most-recent caller now passes
config.SearchRoots() so CTASK_PROJECT_ROOT is searched alongside
CTASK_ROOT. Commands use ws.Root when rendering relative paths or
session env vars so displays and CTASK_ROOT exports are correct for
workspaces living under CTASK_PROJECT_ROOT.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 17:54:58 -04:00
parent 075000497f
commit 0c1f03ba3a
9 changed files with 26 additions and 24 deletions
+4 -4
View File
@@ -32,8 +32,8 @@ func init() {
}
func runDelete(cmd *cobra.Command, args []string) error {
root := config.ResolveRoot()
ws := resolveOne(root, args[0], deleteAll)
roots := config.SearchRoots()
ws := resolveOne(roots, args[0], deleteAll)
// Active workspace protection — two checks, BOTH run before any mutation.
//
@@ -61,7 +61,7 @@ func runDelete(cmd *cobra.Command, args []string) error {
// --- Past this point, we are confident no session is active. ---
relPath := workspace.RelativePath(root, ws.Path)
relPath := workspace.RelativePath(ws.Root, ws.Path)
// Gather contents summary (best-effort, read-only)
fileCount, totalSize := summarizeContents(ws.Path)
@@ -72,7 +72,7 @@ func runDelete(cmd *cobra.Command, args []string) error {
// Check if this is the most recently updated workspace across both
// tasks and projects.
if best, _ := workspace.MostRecentActive(root); best != nil {
if best, _ := workspace.MostRecentActive(roots); best != nil {
absBest, _ := filepath.Abs(best.Path)
if strings.EqualFold(absTarget, absBest) {
fmt.Println()