feat(v0.5): status line helpers show effective launch path
Both .sh and .ps1 now build an effective display path by joining CTASK_WORKSPACE with CTASK_LAUNCH_DIR when that variable is set. When launch_dir is present and differs from the slug, the project tag also carries ':<launch_dir>' so the display reflects user-overridden launches. Tasks and pre-v0.5 projects are unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,13 +1,26 @@
|
||||
# ctask status line helper for Claude Code
|
||||
# Reads ctask environment variables and prints a formatted context string.
|
||||
# Output (task): (ctask:<slug>|<mode>) <workspace_path>
|
||||
# Output (project): (ctask:<slug>|<mode>|project) <workspace_path>
|
||||
# Outputs nothing when not in a ctask session.
|
||||
# Output (project): (ctask:<slug>|<mode>|project) <effective_launch_path>
|
||||
# Output (project with distinct launch dir):
|
||||
# (ctask:<slug>|<mode>|project:<launch_dir>) <effective_launch_path>
|
||||
# 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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user