Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/codehamr/codehamr
/ functions
Functions
622 in github.com/codehamr/codehamr
⨍
Functions
622
◇
Types & classes
43
↓ 4 callers
Method
startChat
()
internal/tui/model.go:610
↓ 4 callers
Function
suggestNames
(m Model)
internal/tui/tui_test.go:239
↓ 3 callers
Function
CloseDebugLog
CloseDebugLog flushes and closes the log. Idempotent.
internal/tui/debuglog.go:47
↓ 3 callers
Function
ContextWindowFromHeaders
ContextWindowFromHeaders reads X-Context-Window. Returns 0 when missing, malformed, or out of sane range; the caller reads 0 as "use the fallback". Lo
internal/cloud/cloud.go:118
↓ 3 callers
Method
Entry
Entry snapshots state for the history buffer, cloning store and spans so later edits to the live promptInput don't mutate the recorded entry.
internal/tui/prompt.go:503
↓ 3 callers
Function
Reachable
Reachable GETs baseURL/v1/models with ctx as deadline; any HTTP response (even 401/404) counts as reachable, only transport errors/timeouts don't. Bac
internal/cloud/cloud.go:30
↓ 3 callers
Function
Truncate
Truncate collapses oversized tool outputs to first 2k + last 2k tokens; inputs at or under 6k pass through unchanged. Head/tail can't overlap: >6k tok
internal/ctx/ctx.go:85
↓ 3 callers
Function
chipLabel
chipLabel is the visible form inserted into the textarea. Plain text, no ANSI, since textarea doesn't render inline styling inside its value.
internal/tui/prompt.go:89
↓ 3 callers
Function
clearPromptHistory
clearPromptHistory removes the on-disk file so /clear also wipes recall. A missing file is not an error: the empty-history intent already holds.
internal/tui/history_store.go:132
↓ 3 callers
Function
countCmdLeaves
countCmdLeaves runs cmd, recurses into the slice-shaped []tea.Cmd payload of tea.BatchMsg / tea.sequenceMsg (both unexported), and counts leaves where
internal/tui/resize_test.go:218
↓ 3 callers
Function
drainFinal
drainFinal submits a prompt and pumps the whole turn to completion, returning the settled model. Centralises the submit+drain dance the empty-reply te
internal/tui/tui_test.go:3337
↓ 3 callers
Function
fetchHash
fetchHash downloads codehamr_checksums.txt and returns the hash for asset. The manifest is one line per asset, "<hex-sha256> <filename>"; we match th
internal/update/update.go:257
↓ 3 callers
Method
flushStreaming
flushStreaming ends the content phase: render the streaming buffer through glamour, queue it for tea.Println, reset. No-op on an empty buffer. Glamour
internal/tui/render.go:69
↓ 3 callers
Method
forwardToTextarea
forwardToTextarea passes msg to the textarea and refreshes the popover to match. The "let the textarea handle it" fallback shared by handleKey, handle
internal/tui/keys.go:93
↓ 3 callers
Function
hamrpassValidate
hamrpassValidate is the single source of truth for whether a key is acceptable and what the UI says about it. Shared by the inline /hamrpass handler a
internal/tui/slash.go:241
↓ 3 callers
Function
historyPath
(dir string)
internal/tui/history_store.go:29
↓ 3 callers
Function
humanRate
humanRate renders throughput: `25 tok/s`, `5.3 tok/s`. Returns "" on degenerate input (no tokens or zero elapsed) so the caller omits the segment. Sub
internal/tui/format.go:48
↓ 3 callers
Function
liveElapsed
liveElapsed renders a running wall-clock duration for the status bar: whole seconds under a minute (no sub-second decimal spinning at the spinner's re
internal/tui/format.go:33
↓ 3 callers
Function
mkfifo
mkfifo creates a FIFO in a temp dir; opening it for read OR write would block forever with no peer, which is exactly what the guards must prevent.
internal/tools/nonregular_unix_test.go:22
↓ 3 callers
Function
newPromptInput
newPromptInput builds the configured textarea and chip bookkeeping. All styling lives here so model.go never touches textarea internals directly.
internal/tui/prompt.go:58
↓ 3 callers
Method
rebuildClient
rebuildClient swaps in a fresh llm.Client for the now-active profile. Replacing the pointer (not mutating fields) drops the prior Client's sticky stat
internal/tui/slash.go:187
↓ 3 callers
Method
reconcile
reconcile re-finds each chip's label in the value (searching past the prior span's end) and updates offsets. A span whose label has vanished (e.g. par
internal/tui/prompt.go:312
↓ 3 callers
Function
timeoutC
timeoutC bounds the hang these tests exist to catch, well under go test's own package timeout so a regression fails fast with a named cause.
internal/tools/nonregular_unix_test.go:15
↓ 3 callers
Function
toWire
(msgs []chmctx.Message)
internal/llm/llm.go:607
↓ 3 callers
Function
toolTargetKey
toolTargetKey is the stable identity used to detect a repeated-failure loop: tool name + its target (the path for file tools, the command's first line
internal/tui/model.go:1086
↓ 3 callers
Method
update
(msg tea.Msg)
internal/tui/model.go:391
↓ 2 callers
Function
AuthHeader
AuthHeader returns the Bearer header a cloud-routed request needs.
internal/cloud/cloud.go:113
↓ 2 callers
Function
EditFileSchema
EditFileSchema is the OpenAI tool definition for edit_file. The description steers the model toward edit_file over write_file for small changes so it
internal/tools/edit.go:76
↓ 2 callers
Function
PrintHelp
PrintHelp writes the canonical human-readable command list. Used by --help.
internal/tui/slash.go:129
↓ 2 callers
Method
Probe
Probe sends a minimal hello chat just to harvest response headers in one round trip: status validates the URL/model/key combo, X-Context-Window gives
internal/llm/llm.go:264
↓ 2 callers
Function
ReadFileSchema
ReadFileSchema is the OpenAI tool definition for read_file. The description nudges the model toward read_file over `cat` so it stops piping source thr
internal/tools/read.go:35
↓ 2 callers
Function
ResponseReserve
ResponseReserve is the slice Budget keeps free for the model's response. Scales as ctxSize/8 so reasoning models get room (262k→32k, 1M→125k), floored
internal/ctx/ctx.go:74
↓ 2 callers
Method
abortTurn
abortTurn winds down a turn that did not complete normally: flush in-flight text so the partial block lands in scrollback, post the explanatory banner
internal/tui/model.go:849
↓ 2 callers
Function
assetNameSupported
assetNameSupported returns the set of platforms assetName resolves, with their names. It probes a generous candidate universe UNION the matrix's own v
internal/update/drift_test.go:63
↓ 2 callers
Method
buildTools
buildTools exposes the four local tools every turn: bash, read_file, write_file, edit_file. No loop/control tool; a turn ends when the model stops emi
internal/tui/model.go:686
↓ 2 callers
Function
cmdYieldsScrollbackErase
(cmd tea.Cmd)
internal/tui/resize_test.go:248
↓ 2 callers
Method
confirmActive
confirmActive emits the activation line for the active profile and returns its reachability cmd. Keyed profiles (cloud) probe: the success line is del
internal/tui/slash.go:173
↓ 2 callers
Function
countLines
countLines returns a paste's visual line count. Terminals disagree on separators (\n unix, \r old-mac, \r\n Windows); max of the \n and \r counts hand
internal/tui/prompt.go:210
↓ 2 callers
Function
countPrintlnLeaves
(cmd tea.Cmd)
internal/tui/resize_test.go:265
↓ 2 callers
Function
dbgWriteMessage
dbgWriteMessage records a chmctx.Message readably: content and tool calls each get a labeled section. No-op when logging is off, so callers needn't gu
internal/tui/debuglog.go:150
↓ 2 callers
Method
deleteSpan
deleteSpan removes the chip's label from the value and drops it from spans and store. Cursor lands at the vacated start; reconcile re-validates later
internal/tui/prompt.go:288
↓ 2 callers
Method
dispatchNextTool
dispatchNextTool pops the next pending tool call and runs it. Every tool flows through runToolCall; none are special-cased. lastToolKey records this c
internal/tui/model.go:1053
↓ 2 callers
Method
doPost
doPost performs one round-trip, mapping status into the typed cloud errors Probe and sendChat share. On 200 it returns the live response with body ope
internal/llm/llm.go:401
↓ 2 callers
Function
dropDanglingToolCalls
dropDanglingToolCalls removes any assistant message whose tool_calls include an id with no answering tool message in the kept slice: the mirror of dro
internal/ctx/ctx.go:360
↓ 2 callers
Function
dropOrphanTools
dropOrphanTools removes tool messages that are not part of the contiguous tool run answering the assistant directly before them: sending one alone 400
internal/ctx/ctx.go:324
↓ 2 callers
Method
droppedBytes
droppedBytes is how many middle bytes the ring discarded; 0 while the whole output still fits head+tail.
internal/tools/bash.go:267
↓ 2 callers
Function
firstLine
(s string)
internal/tools/bash.go:296
↓ 2 callers
Function
goreleaserMatrix
goreleaserMatrix is the source of truth: every os/arch goreleaser builds for.
internal/update/drift_test.go:35
↓ 2 callers
Function
humanInt
humanInt formats a non-negative integer with commas so a context window like 262144 reads as "262,144" rather than a wall of digits.
internal/tui/format.go:71
↓ 2 callers
Function
idleTimeoutFromEnv
idleTimeoutFromEnv resolves CODEHAMR_IDLE_TIMEOUT to a duration, falling back to streamIdleTimeout when unset or unparseable. Accepts a Go duration st
internal/llm/llm.go:192
↓ 2 callers
Function
isHex
isHex reports whether s is non-empty lowercase hex, the shape of a git abbreviated commit hash.
cmd/codehamr/main.go:146
↓ 2 callers
Function
isLocalBuild
isLocalBuild reports whether the binary came from a working tree rather than an official release. `go run` leaves version "dev"; `make install` inject
cmd/codehamr/main.go:132
↓ 2 callers
Function
isUnreachable
(err error)
internal/tui/commands.go:81
↓ 2 callers
Method
maybeFailureNudge
maybeFailureNudge appends one system-role note once the same target has failed maxToolFailStreak times running, then resets the streak so it fires at
internal/tui/model.go:1167
↓ 2 callers
Function
newestAssistantEmpty
newestAssistantEmpty reports whether the turn's final assistant message carried neither text nor a structured tool call. A clean finish always has a s
internal/tui/model.go:995
↓ 2 callers
Function
pingBackend
pingBackend issues a short GET to baseURL/v1/models via cloud.Reachable. Any HTTP response counts as reachable; transport errors and timeouts mean dis
internal/tui/model.go:1266
↓ 2 callers
Method
popoverHeight
popoverHeight is the rows the popover occupies in View(): 0 when closed, capped at popoverCap to leave the viewport breathing room.
internal/tui/popover.go:112
↓ 2 callers
Method
postChat
postChat dispatches via doPost; on a 400 rejecting reasoning it drops reasoning_effort for this Client's lifetime and retries once. Two wild flavours,
internal/llm/llm.go:379
↓ 2 callers
Function
probeBackend
probeBackend wraps llm.Client.Probe in a tea.Cmd, bounded by probeTimeout so a hung backend never freezes activation. silent=true (startup probe) skip
internal/tui/probe.go:34
↓ 2 callers
Method
recordToolOutcome
recordToolOutcome updates the failure streak from one finished tool result. A success (or a failure of a different target) resets the streak; a same-
internal/tui/model.go:1146
↓ 2 callers
Function
redactSlash
redactSlash strips the /hamrpass <key> bearer token before it lands in any log. A central hook covers any future secret-bearing command from one place
internal/tui/debuglog.go:67
↓ 2 callers
Method
refreshSuggest
refreshSuggest recomputes the popover from the textarea: command level before the first space, argument level after it.
internal/tui/popover.go:34
↓ 2 callers
Method
reloadConfigFromDisk
reloadConfigFromDisk re-runs config.Bootstrap and replaces m.cfg so hand-edits to config.yaml between slash commands take effect immediately. URLOverr
internal/tui/slash.go:107
↓ 2 callers
Method
renderQueued
renderQueued draws the pending-prompt box shown above the divider while a turn runs: a faint title line plus a rounded panel with the collapsed echo,
internal/tui/render.go:124
↓ 2 callers
Function
runRaw
(parent context.Context, call chmctx.ToolCall)
internal/tools/bash.go:135
↓ 2 callers
Function
runToolCall
runToolCall executes one tool call off the UI goroutine. parent is the per-turn root: Ctrl+C aborts the tool mid-run, and the toolResultMsg carries th
internal/tui/commands.go:57
↓ 2 callers
Function
runTurn
runTurn wires a model against handler, submits `text`, drains the command chain, and returns the Model. token, when non-empty, is installed on both th
internal/tui/tui_test.go:1186
↓ 2 callers
Function
runeIndex
runeIndex is a rune-level strings.Index: first occurrence of needle in haystack, or -1. promptInput works in runes throughout because textarea's curso
internal/tui/prompt.go:368
↓ 2 callers
Method
setPopover
setPopover swaps in a new suggestion set. Selection priority: the current row (e.g. active profile), else the first.
internal/tui/popover.go:79
↓ 2 callers
Method
splashLines
splashLines builds the identity block for tea.Println. Below wordmarkWidth the ASCII art soft-wraps into garbage, so collapse to plain text.
internal/tui/render.go:273
↓ 2 callers
Function
toolResultFailed
toolResultFailed reports whether a tool result is an error the model should react to. File tools wrap errors in parens ("(write error: ...)", "(not fo
internal/tui/model.go:1106
↓ 2 callers
Function
typeChars
typeChars feeds each rune of s as a separate KeyMsg, rendering View() after each. Non-cosmetic: the viewport only populates its `lines` slice (and thu
internal/tui/prompt_typing_test.go:16
↓ 2 callers
Function
wrapRows
wrapRows mirrors bubbles/textarea.wrap()'s row count so the prompt's auto-grow stays in lock step with what the textarea renders: word-boundary aware
internal/tui/render.go:190
↓ 2 callers
Function
writeYAML
(path string, v any)
internal/config/config.go:269
↓ 1 callers
Function
BashSchema
BashSchema is the OpenAI tool definition for bash, exposed by every profile.
internal/tools/bash.go:99
↓ 1 callers
Function
Default
()
internal/config/config.go:98
↓ 1 callers
Function
IsCloudProfile
IsCloudProfile reports whether a profile's context_size is server-managed.
internal/config/config.go:45
↓ 1 callers
Method
LineCount
()
internal/tui/prompt.go:543
↓ 1 callers
Function
WriteFileSchema
WriteFileSchema is the OpenAI tool definition for write_file. The description steers the model away from bash heredocs (shell-quoting failure mode) fo
internal/tools/write.go:39
↓ 1 callers
Method
activateHamrpass
activateHamrpass writes the key onto the hamrpass profile (seeding the entry if the user removed it from config.yaml), switches active, rebuilds the c
internal/tui/slash.go:334
↓ 1 callers
Function
anchorUserMessage
anchorUserMessage guarantees the packed window carries a user-role message whenever history has one. The newest-first walk drops oldest-first, so a lo
internal/ctx/ctx.go:201
↓ 1 callers
Method
appendUserTurn
appendUserTurn appends a user-role message to history and starts a turn. The only path that does so; used by submit.
internal/tui/model.go:640
↓ 1 callers
Method
applyContent
applyContent writes one streamed text chunk to the live buffer and promotes phase from thinking to streaming on the first chunk so the status bar show
internal/tui/model.go:757
↓ 1 callers
Function
applyEnvOverrides
applyEnvOverrides folds runtime env vars into cfg. CODEHAMR_URL overrides the active profile's URL (devcontainers / CI), held on a non-serialised fiel
cmd/codehamr/main.go:215
↓ 1 callers
Method
applyError
applyError unwinds the turn on a stream error: preserve content streamed before the error (so the user keeps failure context), emit the one-line hint,
internal/tui/model.go:833
↓ 1 callers
Method
applyToolCall
applyToolCall queues a streamed tool call for later dispatch. flushStreaming up front commits this round's text to scroll before the inline tool-call
internal/tui/model.go:775
↓ 1 callers
Method
beginTurn
beginTurn installs a fresh per-turn context, flips phase to thinking, and returns the chat stream-reader Cmd. Every path starting a new LLM round funn
internal/tui/model.go:630
↓ 1 callers
Method
buildMessages
()
internal/tui/model.go:672
↓ 1 callers
Function
buildSystem
buildSystem appends the working-directory anchor to the embedded system prompt so "hier" / "here" resolves to a concrete path.
internal/tui/model.go:1258
↓ 1 callers
Function
cmdYieldsPrintln
(cmd tea.Cmd)
internal/tui/resize_test.go:255
↓ 1 callers
Function
countHistoryLines
countHistoryLines tallies lines without parsing them: fast path for the trim decision in appendPromptHistory.
internal/tui/history_store.go:115
↓ 1 callers
Method
currentSuggestion
currentSuggestion returns the highlighted popover row, or false when the popover is closed or empty.
internal/tui/popover.go:16
↓ 1 callers
Method
cursorOnFirstLine
cursorOnFirstLine: true when ↑ should walk prompt history instead of moving the textarea's own cursor. cursorOnLastLine is the mirror for ↓.
internal/tui/model.go:1253
↓ 1 callers
Method
cursorOnLastLine
()
internal/tui/model.go:1254
↓ 1 callers
Function
dbgWriteRequest
dbgWriteRequest records, per LLM round, what newest-first packing actually sent: how much of history survived the budget and how many tool outputs are
internal/tui/debuglog.go:119
↓ 1 callers
Function
dbgWriteSession
dbgWriteSession records the active backend and context budget once at startup. Behaviour differs sharply by model (different model families fail in di
internal/tui/debuglog.go:107
↓ 1 callers
Function
demoteSystemMessages
demoteSystemMessages rewrites every system-role message in the packed history to a user message. buildMessages always prepends the embedded system pro
internal/ctx/ctx.go:227
↓ 1 callers
Function
differsOnlyInWhitespace
differsOnlyInWhitespace reports whether oldString matches content at exactly one spot once every whitespace run is collapsed: i.e. the sole mismatch i
internal/tools/edit.go:68
↓ 1 callers
Function
dispatchDelta
dispatchDelta forwards reasoning and content as events, then accumulates streamed tool-call fragments into index-keyed slots. Reasoning stays out of f
internal/llm/llm.go:544
↓ 1 callers
Function
errorMessageFromBody
errorMessageFromBody extracts the user-facing string from a non-2xx body. hamrpass wraps errors as `{"error":{"message":...,"provider_hint":...}}`; we
internal/llm/llm.go:445
← previous
next →
101–200 of 622, ranked by callers