Adds source-attribution rendering to `ctask info` for the two Phase 1
settings whose effective value depends on user-level defaults: the
agent recorded in task.yaml and the configured launch session mode.
cmd/info.go:
- runInfo loads the resolver once (config.LoadResolver) and reuses
it across the rendering — matches the user's correction that "new
doctor/info code should load the resolver once and reuse it".
- Agent line now reads `Agent: <value> (workspace)` when task.yaml
has a non-empty agent (the common case), or `Agent: <value>
(default)` / `Agent: <value> (default — <source label>)` when the
field is empty and the value comes from the resolver fallback
chain. The fallback path is informational only: every workspace
created by recent ctask versions writes the resolved default into
task.yaml at Create time, so the (workspace) branch is what users
normally see.
- New "Launch session mode:" line lives immediately after Agent and
before Created — outside the v0.5.4 Session block per the user's
placement decision ("Keep it outside the Session block because it
represents the configured launch default, not the current session
lease mode"). Format: `Launch session mode: <value> (<source>)`.
- Two small helpers added: agentLineWithSource composes the agent
payload + label; infoSourceLabel renders a single-row source
string (CTASK_X env var / config file / built-in default /
platform override). infoSourceLabel intentionally omits the
override-chain suffix used by doctor — info's row layout has no
room for the extra parenthetical.
cmd/info_attribution_test.go (5 cases):
- TestInfoAgentSourceWorkspace — task.yaml with agent set → "(workspace)"
- TestInfoAgentSourceDefaultForLegacy — empty agent → "(default)"
- TestInfoLaunchSessionModeFromConfig — config session_mode value +
"config file" source label
- TestInfoLaunchSessionModeBuiltinDefault — no config, no env →
"direct (built-in default)"
- TestInfoLaunchSessionModeAfterAgentBeforeCreated — placement check:
Agent < Launch session mode < Created in the rendered output
Smoke-verified against an existing v0.5.x workspace on the installed
binary; render order and source labels match the spec example.
Add a Session block to ctask info output, surfacing the workspace
session lease state derived from SessionStatus. Inserted between Path
and any launch-dir fields so the new content is visually distinct
from both blocks.
Format: state on the header line, then indented Mode / Owner / Attach
/ Note rows aligned at column 14. The Owner line omits the hostname
when it matches the local machine. The Attach hint surfaces only for
active+persistent sessions and uses invocationName() so the suggested
command reflects the user's actual invocation. Malformed leases
render as stale with a single-line diagnostic and no Mode/Owner/Attach
rows so we never display fields parsed from a broken file.
Exposes session.CurrentHostname() so the cmd layer has a single
source of truth for the local-vs-remote hostname check.
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.
Workspace directory names (YYYY-MM-DD_slug) and the YYYYMMDD-HHMMSS ID
field now use local time so users see their wall-clock date rather
than UTC — the prior behavior caused evening-EST creations to appear
under tomorrow's date for several hours every day. ctask info's
Created/Updated/Archived lines also convert to local for display.
Stored timestamps in task.yaml, session logs, the lease, the manifest,
and the session summary all continue to use UTC. Only user-facing
surfaces change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
For project workspaces with launch_dir set, info prints three extra
lines after Path: Launch dir, Launch path, and Dir exists (yes/no
from a direct os.Stat of the intended path). Tasks and pre-v0.5
projects still omit these lines.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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>
Exit 2 for missing required arguments, exit 127 for agent not found. SilenceUsage on all commands to avoid dumping usage on runtime errors.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Complete command implementations with all flags per spec. Shared query resolution helper.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>