MCPcopy Create free account
hub / github.com/diillson/chatcli / showConfigSession

Method showConfigSession

cli/config_sections.go:799–872  ·  view source on GitHub ↗

─── Section: SESSION ────────────────────────────────────────── showConfigSession renders session identity, cost, budget, attached contexts, and memory state — everything scoped to the running session.

()

Source from the content-addressed store, hash-verified

797// showConfigSession renders session identity, cost, budget, attached
798// contexts, and memory state — everything scoped to the running session.
799func (cli *ChatCLI) showConfigSession() {
800 sectionHeader("📋", "cfg.section.session.title", ColorBlue)
801 p := uiPrefix(ColorBlue)
802
803 // Identity
804 name := cli.currentSessionName
805 if name == "" {
806 name = i18n.T("cfg.val.unnamed")
807 }
808 kv(p, i18n.T("cfg.kv.name"), name)
809 kv(p, i18n.T("cfg.kv.messages"), fmt.Sprintf("%d", len(cli.history)))
810 if !cli.sessionStartTime.IsZero() {
811 kv(p, i18n.T("cfg.kv.started"), cli.sessionStartTime.Format(time.RFC3339))
812 kv(p, i18n.T("cfg.kv.duration"), humanDuration(time.Since(cli.sessionStartTime)))
813 }
814
815 fmt.Println(p)
816 subheader(p, "cfg.sub.session.cost")
817 if cli.costTracker != nil {
818 kv(p, i18n.T("cfg.kv.total_cost_usd"), fmt.Sprintf("$%.4f", cli.costTracker.TotalCost()))
819 kv(p, i18n.T("cfg.kv.total_tokens"), fmt.Sprintf("%d", cli.costTracker.TotalTokens()))
820 kv(p, i18n.T("cfg.kv.budget_status"), budgetLevelString(cli.costTracker.CheckBudget()))
821 } else {
822 kv(p, i18n.T("cfg.kv.cost_tracker"), i18n.T("cfg.val.not_initialized"))
823 }
824 kv(p, "CHATCLI_SESSION_BUDGET_USD", envOr("CHATCLI_SESSION_BUDGET_USD"))
825 kv(p, "CHATCLI_BUDGET_WARNING_PCT", envOr("CHATCLI_BUDGET_WARNING_PCT"))
826 kv(p, "CHATCLI_SESSION_TTL", envOr("CHATCLI_SESSION_TTL"))
827 kv(p, "CHATCLI_DISABLE_HISTORY", envBool("CHATCLI_DISABLE_HISTORY"))
828
829 fmt.Println(p)
830 subheader(p, "cfg.sub.session.attached")
831 attachedCount := 0
832 if cli.contextHandler != nil {
833 sessionID := cli.currentSessionName
834 if sessionID == "" {
835 sessionID = "default"
836 }
837 if mgr := cli.contextHandler.GetManager(); mgr != nil {
838 if ctxs, err := mgr.GetAttachedContexts(sessionID); err == nil {
839 attachedCount = len(ctxs)
840 for _, c := range ctxs {
841 desc := fmt.Sprintf("mode=%s, %d files, %.1f KB",
842 c.Mode, c.FileCount, float64(c.TotalSize)/1024.0)
843 kv(p, "· "+c.Name, desc)
844 }
845 }
846 }
847 }
848 if attachedCount == 0 {
849 kv(p, i18n.T("cfg.kv.attached"), i18n.T("cfg.msg.no_contexts_attached"))
850 }
851
852 fmt.Println(p)
853 subheader(p, "cfg.sub.session.memory")
854 kv(p, "CHATCLI_MEMORY_ENABLED", envBool("CHATCLI_MEMORY_ENABLED"))
855 kv(p, "CHATCLI_MEMORY_MODE", envOr("CHATCLI_MEMORY_MODE"))
856 kv(p, "CHATCLI_BOOTSTRAP_ENABLED", envBool("CHATCLI_BOOTSTRAP_ENABLED"))

Callers 3

routeConfigCommandMethod · 0.95
showConfigAllMethod · 0.95

Calls 15

TFunction · 0.92
sectionHeaderFunction · 0.85
uiPrefixFunction · 0.85
humanDurationFunction · 0.85
subheaderFunction · 0.85
budgetLevelStringFunction · 0.85
envOrFunction · 0.85
envBoolFunction · 0.85
shortenFunction · 0.85
sectionEndFunction · 0.85
IsZeroMethod · 0.80
TotalCostMethod · 0.80

Tested by 1