diff --git a/scripts/ctask-statusline.ps1 b/scripts/ctask-statusline.ps1 index 495b8cb..9554625 100644 --- a/scripts/ctask-statusline.ps1 +++ b/scripts/ctask-statusline.ps1 @@ -1,13 +1,26 @@ # ctask status line helper for Claude Code # Reads ctask environment variables and prints a formatted context string. # Output (task): (ctask:|) -# Output (project): (ctask:||project) -# Outputs nothing when not in a ctask session. +# Output (project): (ctask:||project) +# Output (project with distinct launch dir): +# (ctask:||project:) +# The displayed path is the effective launch path (workspace + launch_dir +# when set), so the status line reflects the directory the user is actually +# working in. Outputs nothing when not in a ctask session. if (-not $env:CTASK_TASK) { exit 0 } -if ($env:CTASK_TYPE -eq 'project') { - Write-Output "(ctask:$($env:CTASK_TASK)|$($env:CTASK_MODE)|project) $($env:CTASK_WORKSPACE)" -} else { - Write-Output "(ctask:$($env:CTASK_TASK)|$($env:CTASK_MODE)) $($env:CTASK_WORKSPACE)" +$displayPath = $env:CTASK_WORKSPACE +if ($env:CTASK_LAUNCH_DIR) { + $displayPath = Join-Path $env:CTASK_WORKSPACE $env:CTASK_LAUNCH_DIR +} + +if ($env:CTASK_TYPE -eq 'project') { + if ($env:CTASK_LAUNCH_DIR -and $env:CTASK_LAUNCH_DIR -ne $env:CTASK_TASK) { + Write-Output "(ctask:$($env:CTASK_TASK)|$($env:CTASK_MODE)|project:$($env:CTASK_LAUNCH_DIR)) $displayPath" + } else { + Write-Output "(ctask:$($env:CTASK_TASK)|$($env:CTASK_MODE)|project) $displayPath" + } +} else { + Write-Output "(ctask:$($env:CTASK_TASK)|$($env:CTASK_MODE)) $displayPath" } diff --git a/scripts/ctask-statusline.sh b/scripts/ctask-statusline.sh index d0d87b8..9dd5ed4 100644 --- a/scripts/ctask-statusline.sh +++ b/scripts/ctask-statusline.sh @@ -2,13 +2,29 @@ # ctask status line helper for Claude Code # Reads ctask environment variables and prints a formatted context string. # Output (task): (ctask:|) -# Output (project): (ctask:||project) -# Outputs nothing when not in a ctask session. +# Output (project): (ctask:||project) +# Output (project with distinct launch dir): +# (ctask:||project:) +# The displayed path is the effective launch path (workspace + launch_dir +# when set), so the status line reflects the directory the user is actually +# working in. Outputs nothing when not in a ctask session. [ -z "$CTASK_TASK" ] && exit 0 -if [ "$CTASK_TYPE" = "project" ]; then - echo "(ctask:${CTASK_TASK}|${CTASK_MODE}|project) ${CTASK_WORKSPACE}" -else - echo "(ctask:${CTASK_TASK}|${CTASK_MODE}) ${CTASK_WORKSPACE}" +# Effective path: workspace root, plus launch_dir when set. +DISPLAY_PATH="$CTASK_WORKSPACE" +if [ -n "$CTASK_LAUNCH_DIR" ]; then + DISPLAY_PATH="$CTASK_WORKSPACE/$CTASK_LAUNCH_DIR" +fi + +if [ "$CTASK_TYPE" = "project" ]; then + # Include the launch dir in the tag only when it differs from the slug + # (so the default case stays terse). + if [ -n "$CTASK_LAUNCH_DIR" ] && [ "$CTASK_LAUNCH_DIR" != "$CTASK_TASK" ]; then + echo "(ctask:${CTASK_TASK}|${CTASK_MODE}|project:${CTASK_LAUNCH_DIR}) ${DISPLAY_PATH}" + else + echo "(ctask:${CTASK_TASK}|${CTASK_MODE}|project) ${DISPLAY_PATH}" + fi +else + echo "(ctask:${CTASK_TASK}|${CTASK_MODE}) ${DISPLAY_PATH}" fi