feat(v0.5.4): info Session block
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.
This commit is contained in:
@@ -81,6 +81,12 @@ func currentHostname() string {
|
||||
return h
|
||||
}
|
||||
|
||||
// CurrentHostname is the exported form of currentHostname for callers in
|
||||
// cmd/ that need to compare a lease's recorded hostname against the local
|
||||
// machine (e.g., info's Owner-line "omit when local" rule). Keeps a
|
||||
// single source of truth for the unknown-fallback semantics.
|
||||
func CurrentHostname() string { return currentHostname() }
|
||||
|
||||
// currentTerminal is a best-effort terminal identifier based on common env vars.
|
||||
// Returns "unknown" if none are set.
|
||||
func currentTerminal() string {
|
||||
|
||||
Reference in New Issue
Block a user