ctask agents check [workspace] validates that a workspace's agent
configuration can be launched without launching it: agent type known,
command resolvable on PATH, launch_dir valid, AGENTS.md present,
CLAUDE.md shim present (WARN only, claude type only). agent.env keys
are displayed informationally, with a WARN line when any key shadows a
ctask-exported CTASK_* var. Returns non-zero when any check FAILs.
ctask doctor includes the same sweep when a workspace context is
resolvable — the most-recently-active workspace via
workspace.MostRecentActive. When no active workspace exists, doctor
shows "Agent check: skipped (no workspace context)" without bumping
the failure counter. runAgentsCheckOnWorkspace is shared between the
standalone command and the doctor integration.
TestCompletionSubcommandViaExecute is made order-independent: cobra's
default completion command captures the root output writer on the first
Execute() in the process, and the new agents-check tests now run an
Execute() earlier in the suite.
Adds a new ── Settings ── block at the bottom of `ctask doctor` (after
the existing tmux INFO line, before the summary). The block reports
every user-level default tracked by the resolver — ctask_root,
project_root, seed_dir, default_agent, default_category, session_mode,
editor — together with the source it was drawn from.
Implementation:
- runDoctor calls config.LoadResolver() once and passes the resolver
into checkSettings; no setting is re-resolved mid-block (the user's
correction: "new doctor/info code should load the resolver once and
reuse it").
- checkSettings prints the config-file lifecycle line first
(`Config file: <path>` / `Config file: not found — using built-in
defaults` / `[FAIL] unknown key: "..."` per the resolver's
ConfigErr state), then iterates the resolver's ResolvedSetting
accessors and feeds each one through printSettingLine.
- printSettingLine renders the key + value pair plus a `source: …`
child line. When the resolver chains an Override, the source line
embeds the overridden source + value in parens. For the
PlatformOverride session_mode case, an additional
`configured: <value>` line surfaces what the user asked for.
- formatSettingSource centralises the "EnvVar → CTASK_X env var" /
"PlatformOverride → ... (persistent mode requires tmux; not
available on native Windows)" / override-chain wording so doctor
and info can share the same labels in commit 4.
- Only the invalid-config-file branch increments the failed counter.
Missing file is INFO. The valid-file branch is purely informational.
Tests (cmd/doctor_settings_test.go, 6 cases):
- TestDoctorShowsSettingsSection — header present + all keys appear
- TestDoctorShowsSourceAttribution — every line has source: + at
least one "built-in default"
- TestDoctorShowsOverrides — env vs config override chain rendered
- TestDoctorConfigNotFound — INFO, no failed bump
- TestDoctorConfigInvalid — FAIL bump + unknown key named
- TestDoctorSessionModePlatformOverrideRendered — direct value +
"platform override" label + "configured: persistent" row
Smoke-verified end-to-end against the installed binary:
- no config + no env → all "built-in default"
- env CTASK_AGENT=aider + config default_agent=opencode →
"CTASK_AGENT env var (overrides config file: opencode)"
- config session_mode=persistent on native Windows → "platform
override (...)" plus "configured: persistent"
- config with typo "default_agnet: foo" → [FAIL] line names the key
and the "settings not applied" advisory
Three independent v0.5.3 polish items surfaced during manual WSL smoke testing,
bundled into one commit since they're all string/UX touches with no behavior change.
1. v0.4 lease-prompt tightening (`internal/session/{lease,run,run_preflight}.go`,
`cmd/entry.go`): when ctask is about to enter direct mode on a workspace that
already has a live tmux session, the "Continue anyway?" prompt now suggests
`ctask attach <slug>` as the reattach path. Threaded via
`PreflightOpts.ActiveLeaseHint` / `LaunchOpts.ActiveLeaseHint`; computed in
`cmd/entry.go::directModeTmuxHint` (best-effort: silent when no tmux on PATH
or no session for the workspace). Closes the footgun where a user forgot to
`export CTASK_SESSION_MODE=persistent` in a second terminal and hit the v0.4
coexistence prompt without realizing tmux passive-reattach was the intended
path.
2. Invocation-name in user-facing command hints (`cmd/invocation.go` new,
`cmd/{persistent,entry,resume,doctor}.go`): the binary name printed in
bypass / restore / "create one with" suggestions now reflects
`filepath.Base(os.Args[0])` instead of a hard-coded "ctask". Local-build
PowerShell users running `.\ctask.exe` see `ctask.exe new <ws> --direct`,
matching what they need to type. Installed contexts continue to see `ctask`.
Test seam (`invocationNameOverride`) pins the name to "ctask" in unit tests
so substring assertions stay stable across Go test binary names. Descriptive
prose ("ctask persistent mode requires...") and the ssh-remote hint
(`ssh -t <host> ctask <subcmd>`) intentionally keep the literal "ctask" —
they refer to the program identity / remote invocation, not the local
command form. Affected tests: `cmd/{persistent,resume}_test.go` tightened to
check the full `"<binary> <subcmd> <workspace> --direct"` form.
3. Smoke-checklist fixes (`docs/.../2026-05-08-v0.5.3-smoke-test-checklist.md`):
six issues caught during the run -- S2 now exports CTASK_SESSION_MODE in
both terminals (previously only WSL-A had it, which routed WSL-B's
secondary resume through direct mode instead of passive reattach); O3/A2
tmux-ls expectations corrected (tmux doesn't emit a literal "(detached)"
token); P2 expected behavior rewritten (passive reattach detach returns to
prompt immediately -- AttachExisting calls only shell.AttachSession with
no PollSessionEnd, the owner is responsible for finalize); A1 no longer
asks for Ctrl-C in WSL-B; A6 path now uses a glob (was hardcoded to the
checklist's authoring date, broke on v0.5.1 local-time directory naming);
M1 PATH-hide rewritten to `$HOME/.local/bin` only (was `:/bin` which is a
symlink to /usr/bin on usrmerge systems, did not hide tmux) and uses
`command -v` instead of `which` (which is itself in /usr/bin, unreachable
under the minimal PATH); M3/M4 reordered so the no-workspace verification
runs after PATH is restored (was silently failing under minimal PATH);
T1 wording made "substring match" explicit; T2 wording made N/A
unambiguous; section 10 split into 10a-10f, each a separate input, to
work around PSReadLine multi-line paste parsing.
Three-state check matching the seed-dir pattern: INFO when unset
(points at the default discovery location), INFO with user-scope
advisory when set and present, FAIL when set but the directory
doesn't exist. Advisory wording is recommendatory, not prescriptive
(per spec amendment).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces the always-informational seed-dir block with three-state checks:
INFO when the env var is unset (defaults will be used), PASS when set and
the path exists, FAIL when set but the directory is missing. Only the
configured-but-missing state counts as a failed check and raises the
doctor exit code.
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>
Adds two [INFO] lines after the existing pass/fail checks
reporting whether the resolved general and project seed
directories exist. These are read-only and do not contribute to
the pass/fail counters, so users with no seed directories still
see "5 checks passed, 0 failed".
When the status-line helper is found but Claude settings are misconfigured,
the fix suggestion now shows the real path (e.g. /c/Users/Warren/...) instead
of a <you> placeholder. Always suggests the .sh variant even if only .ps1
was found, since Claude Code runs statusLine through bash.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds the canonical install location as the primary search path on Windows,
before falling back to GOPATH/bin. Updates the Claude config guidance message
to reference the new path.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Checks: workspace root, agent on PATH, status line helper, Claude settings, existing workspaces. Actionable fix guidance for each failure.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>