MCPcopy Create free account

hub / github.com/codehamr/codehamr / functions

Functions622 in github.com/codehamr/codehamr

↓ 1 callersMethodfireQueued
fireQueued auto-submits a prompt the user queued mid-turn, once the turn has wound down to idle. Reached only from the natural finish path (here, afte
internal/tui/model.go:981
↓ 1 callersFunctionfirstLine
(s string)
internal/llm/llm.go:632
↓ 1 callersMethodhandleChipKey
handleChipKey gives chips atomic-token semantics: Backspace/Delete at a boundary removes the whole chip, ←/→ jumps across it, and a cursor inside a ch
internal/tui/prompt.go:221
↓ 1 callersMethodhandleCtrlC
handleCtrlC implements Ctrl+C's three-level precedence: in-flight cancel > popover close > quit arming. Each level fully handles the key, no fallthrou
internal/tui/keys.go:111
↓ 1 callersMethodhandleEnter
handleEnter implements the three-way Enter dispatch. Alt+Enter inserts a newline; command-level Enter on an args-taking command advances to the arg po
internal/tui/keys.go:213
↓ 1 callersMethodhandleEscInPopover
handleEscInPopover implements Esc inside the popover: arg level steps back to the command menu; command level closes the popover and clears the textar
internal/tui/keys.go:197
↓ 1 callersMethodhandleKey
(msg tea.KeyMsg)
internal/tui/keys.go:19
↓ 1 callersMethodhandlePageKey
handlePageKey implements PgUp/PgDn. textarea disables its viewport keymap, so page keys aren't wired, so we translate them to N×CursorUp/CursorDown (o
internal/tui/prompt.go:127
↓ 1 callersMethodhandleResizeSettle
handleResizeSettle fires once the post-resize debounce expires for the matching gen. Wipes the terminal (so previous-width rows can't soft-wrap into s
internal/tui/model.go:548
↓ 1 callersMethodhandleTab
handleTab implements the three Tab behaviours: seed "/" on an empty prompt (opens the command popover), complete a unique match when the popover is op
internal/tui/keys.go:172
↓ 1 callersMethodhandleWindowSize
handleWindowSize tracks new dimensions, rebuilds the glamour renderer on a wrap-width change, emits the splash on the first frame, and on a true width
internal/tui/model.go:513
↓ 1 callersFunctionhashFile
hashFile streams a file through sha256.
internal/update/update.go:103
↓ 1 callersMethodhistoryDown
historyDown walks one step toward newer entries; -1 is the live draft sentinel and restores an empty textarea.
internal/tui/keys.go:155
↓ 1 callersMethodhistoryUp
historyUp walks one step toward older entries; caller gates on cursor-on- first-line and popover closed. Empty history is a no-op.
internal/tui/keys.go:138
↓ 1 callersMethodinsertChip
insertChip splices a chip label in at the cursor, recording the new span at the right ORDER position so the following reconcile() walks the labels lef
internal/tui/prompt.go:256
↓ 1 callersFunctionisEnvName
isEnvName reports whether s is a POSIX environment variable name ([A-Za-z_][A-Za-z0-9_]*), the only content ${...} expands.
internal/config/config.go:246
↓ 1 callersMethodlabel
()
internal/tui/model.go:45
↓ 1 callersFunctionlooksLikePaste
looksLikePaste recognises paste-like key events. Primary signal: the bracketed-paste Paste flag (terminal wraps content in \x1b[200~...\x1b[201~). Som
internal/tui/prompt.go:183
↓ 1 callersMethodmarker
marker is the status-bar glyph for the frozen finish: ✓ for a clean finish, ✗ for an abort (cancel, error, or a stalled/leaked end). "" suppresses the
internal/tui/model.go:71
↓ 1 callersFunctionmaybeSelfUpdate
maybeSelfUpdate runs the pre-launch auto-update. No-op for local builds, an already-current hash, an unsupported platform (see update.assetName), or a
cmd/codehamr/main.go:163
↓ 1 callersFunctionmustCwd
mustCwd returns the working directory or exits 1, called only where there's nothing sensible to recover to.
cmd/codehamr/main.go:204
↓ 1 callersFunctionnewestAssistantUnverified
newestAssistantUnverified reports whether the turn's final assistant message already carries an "unverified" marker, the honest self-assessment the fi
internal/tui/model.go:1010
↓ 1 callersFunctionnewestToolGroup
newestToolGroup returns the assistant that issued the newest tool result together with every tool result answering it, chronologically: the minimal we
internal/ctx/ctx.go:242
↓ 1 callersFunctionnewestToolIndex
newestToolIndex returns the index of the newest tool-result message in history, or -1. Everything after it can only be non-tool (a system nudge, an as
internal/ctx/ctx.go:287
↓ 1 callersFunctiononlyNonSubstantive
onlyNonSubstantive reports whether kept carries no substantive conversation: only system-role notes (soft nudges) and empty assistant messages (no tex
internal/ctx/ctx.go:300
↓ 1 callersMethodpreGrowTextarea
preGrowTextarea inflates Height to the cap *before* a KeyMsg is processed. bubbles/textarea's repositionView() scrolls the viewport down when the curs
internal/tui/render.go:153
↓ 1 callersMethodprintHamrpassStatus
printHamrpassStatus emits the status + how-to block (the no-args path).
internal/tui/slash.go:300
↓ 1 callersFunctionprintHelp
()
cmd/codehamr/main.go:100
↓ 1 callersMethodprintModelList
printModelList writes the "▸ active, name, llm @ url" rollup to scroll.
internal/tui/slash.go:155
↓ 1 callersFunctionprobeErrorMessage
probeErrorMessage maps cloud sentinel errors to human hints for the activation line. Falls back to the raw error string for anything else.
internal/tui/probe.go:110
↓ 1 callersMethodqueuePrompt
queuePrompt stashes the textarea contents to auto-submit when the running turn finishes (see fireQueued), then clears the input so the next prompt can
internal/tui/keys.go:267
↓ 1 callersMethodqueuedHeight
queuedHeight is the rows renderQueued occupies in View(), 0 when nothing is queued. Subtracted from the textarea cap so a tall queued box can't crowd
internal/tui/render.go:113
↓ 1 callersFunctionreExec
reExec replaces the process image via execve(2). Same PID, so the parent shell waits on one process throughout, one continuous session. Success never
cmd/codehamr/reexec_unix.go:12
↓ 1 callersFunctionreadSSE
readSSE reads OpenAI SSE frames until [DONE] or EOF, forwarding content/reasoning/tool-call events to out. Returns the final assistant message (conten
internal/llm/llm.go:468
↓ 1 callersMethodresolve
()
internal/llm/llm.go:594
↓ 1 callersMethodrun
(parent context.Context, msgs []chmctx.Message, tools []Tool, out chan<- Event)
internal/llm/llm.go:292
↓ 1 callersFunctionruneBoundaryDown
runeBoundaryDown walks i left to a rune start so out[:i] never ends mid-sequence. Safe for i == len(out).
internal/ctx/ctx.go:100
↓ 1 callersFunctionruneBoundaryUp
runeBoundaryUp walks i right to a rune start so out[i:] never starts mid-sequence. Safe for i <= 0.
internal/ctx/ctx.go:112
↓ 1 callersFunctionruneCount
runeCount is the counting counterpart of runeIndex: non-overlapping occurrences of needle in haystack. Exact for chip labels, which cannot self-overla
internal/tui/prompt.go:350
↓ 1 callersFunctionruneOffsetToRowCol
runeOffsetToRowCol converts an absolute rune offset into (row, col).
internal/tui/prompt.go:447
↓ 1 callersFunctionselectInitialIdx
selectInitialIdx picks the starting row: the current row (e.g. active profile), else the first.
internal/tui/popover.go:93
↓ 1 callersMethodsendChat
sendChat POSTs the request and returns the response on 200. On failure it returns the Event the caller forwards, populated with Kind/Err/Budget. The b
internal/llm/llm.go:355
↓ 1 callersFunctionsetProcessGroup
setProcessGroup gives the shell its own process group and a Cancel that SIGKILLs the whole group. Without it, backgrounded children (`cmd &`) outlive
internal/tools/bash_unix.go:14
↓ 1 callersFunctionshouldChip
shouldChip collapses a paste when either its line count or char count clears the threshold: lines catch multi-line pastes, chars catch single-line blo
internal/tui/prompt.go:200
↓ 1 callersMethodtotalBytes
totalBytes is the full combined output size as written, kept or not.
internal/tools/bash.go:275
↓ 1 callersMethodunqueuePrompt
unqueuePrompt pulls the queued prompt back into the textarea and clears the slot, so a queued follow-up can be edited or dropped with one Backspace. R
internal/tui/keys.go:303
↓ 1 callersFunctionwaitForPID
waitForPID blocks until pidFile contains a parseable PID, then returns it. Fails the test if the file never appears within a short deadline.
internal/tools/bash_procgroup_unix_test.go:67
MethodInit
()
internal/tui/model.go:359
FunctionTestActiveContextSizePrefersLiveValue
TestActiveContextSizePrefersLiveValue: packing reads liveContextSize first, then Profile.ContextSize, then the floor. Cloud profiles ship ContextSize=
internal/tui/tui_test.go:1342
FunctionTestActiveProfileResolvesByName
TestActiveProfileResolvesByName: the helper returns the right struct.
internal/config/config_test.go:465
FunctionTestAltEnterInsertsNewline
TestAltEnterInsertsNewline: Alt+Enter composes a multi-line prompt. The alt-flagged KeyEnter ("alt+enter") matches no textarea binding, so the flag mu
internal/tui/tui_test.go:1530
FunctionTestApplyAcceptsMatchingChecksum
TestApplyAcceptsMatchingChecksum: positive case, a download whose hash equals the manifest entry promotes the binary into place.
internal/update/update_test.go:185
FunctionTestApplyCleansTempOnFailure
TestApplyCleansTempOnFailure: a failed download (server returns 500) must not leave a half-written temp file in the install directory.
internal/update/update_test.go:247
FunctionTestApplyKeepsPreviousBinaryAsOld
TestApplyKeepsPreviousBinaryAsOld is the cross-platform-parity guard: Apply must rename execPath aside to execPath+".old" before moving the new downlo
internal/update/update_test.go:393
FunctionTestApplyRejectsChecksumMismatch
TestApplyRejectsChecksumMismatch: a binary whose hash doesn't match the manifest must NOT replace the local executable, else a corrupted CDN response
internal/update/update_test.go:80
FunctionTestApplyRejectsMissingManifestEntry
TestApplyRejectsMissingManifestEntry: a manifest that exists but doesn't list our asset (a bad release) must make Apply abort, not skip verification a
internal/update/update_test.go:221
FunctionTestApplyReportsRestoreFailure
TestApplyReportsRestoreFailure covers the doubly-bad path: the promote rename fails AND the restore of the moved-aside binary also fails. Apply must s
internal/update/update_test.go:154
FunctionTestApplyRespectsContextCancel
TestApplyRespectsContextCancel: a cancelled ctx aborts the download and the local exec stays untouched.
internal/update/update_test.go:491
FunctionTestApplyRestoresBinaryWhenPromoteFails
TestApplyRestoresBinaryWhenPromoteFails covers the most dangerous failure: the running binary is moved aside to execPath+".old", then the promote rena
internal/update/update_test.go:114
FunctionTestArgPopoverOpensForModels
TestArgPopoverOpensForModels: "/models " shows the profile names (no synthetic "next", Tab cycles instead) with the active profile preselected.
internal/tui/tui_test.go:461
FunctionTestArgPopoverReloadsCfgOnEntry
TestArgPopoverReloadsCfgOnEntry: the arg popover builds its list from m.cfg.Models. Without the cmd→arg reload in refreshSuggest, the first "/models "
internal/tui/tui_test.go:872
FunctionTestArgPopoverSkipsConfigReloadMidTurn
TestArgPopoverSkipsConfigReloadMidTurn: typing is allowed mid-turn, but the cmd→arg popover transition must not reload config then: a reload can rebui
internal/tui/tui_test.go:907
FunctionTestAssetNameCoversEveryReleasedPlatform
TestAssetNameCoversEveryReleasedPlatform: every goos/goarch goreleaser publishes a binary for MUST be reachable from assetName. A missing case silentl
internal/update/update_test.go:307
FunctionTestAssetNameMatchesGoreleaserMatrix
TestAssetNameMatchesGoreleaserMatrix asserts the set of platforms assetName resolves is EXACTLY the set goreleaser builds: no more, no less. Derived f
internal/update/drift_test.go:85
FunctionTestAssetNameRejectsUnreleasedPlatform
TestAssetNameRejectsUnreleasedPlatform: the inverse, anything goreleaser doesn't build for must return ok=false so Check short-circuits before the net
internal/update/update_test.go:333
FunctionTestAuthHeader
(t *testing.T)
internal/cloud/cloud_test.go:150
FunctionTestBackendLabelReflectsConnectedState
TestBackendLabelReflectsConnectedState asserts the backend label renders differently when connected vs not: the user's at-a-glance "are we talking to
internal/tui/tui_test.go:1420
FunctionTestBackendLabelShowsActiveProfile
TestBackendLabelShowsActiveProfile: the label echoes the currently-active profile name. Default Bootstrap ships one profile called "local". No bracket
internal/tui/tui_test.go:561
FunctionTestBackspaceAtChipEndRemovesWholeChip
TestBackspaceAtChipEndRemovesWholeChip: Backspace with the cursor right after the label deletes the whole chip and leaves surrounding text intact.
internal/tui/prompt_test.go:93
FunctionTestBackspaceImmediatelyAfterChipRemovesIt
TestBackspaceImmediatelyAfterChipRemovesIt: atomic-delete regression guard, after a paste the cursor sits at chip.end, so one Backspace deletes the ch
internal/tui/prompt_test.go:473
FunctionTestBackspaceNotAtChipBoundaryFallsThrough
TestBackspaceNotAtChipBoundaryFallsThrough: Backspace away from a chip boundary deletes one char normally, chip untouched.
internal/tui/prompt_test.go:353
FunctionTestBashBackgroundedChildDoesNotBlock
(t *testing.T)
internal/tools/bash_test.go:203
FunctionTestBashBackgroundedChildReturnsCleanOutput
TestBashBackgroundedChildReturnsCleanOutput: backgrounding a child that holds the pipes open trips exec.ErrWaitDelay (shell already exited 0), not an
internal/tools/bash_test.go:218
FunctionTestBashBoundsRunawayOutput
TestBashBoundsRunawayOutput: a firehose command must not grow an unbounded buffer (the old CombinedOutput OOM-killed the whole TUI on `cat big.iso` we
internal/tools/bash_test.go:52
FunctionTestBashCustomTimeoutHonored
(t *testing.T)
internal/tools/bash_test.go:127
FunctionTestBashEchoesStdout
(t *testing.T)
internal/tools/bash_test.go:14
FunctionTestBashEmptyCommand
(t *testing.T)
internal/tools/bash_test.go:41
FunctionTestBashExactExitMarkerFormat
TestBashExactExitMarkerFormat pins the exact non-zero-exit shape: output, then a single "\n(exit: ...)" marker. The model parses these, and the other
internal/tools/bash_test.go:33
FunctionTestBashHonorsAlreadyCancelledParent
TestBashHonorsAlreadyCancelledParent: a pre-cancelled parent (Ctrl+C raced the dispatch) must report "(cancelled)", not "(empty command)" or, worse, s
internal/tools/bash_test.go:109
FunctionTestBashKillsBackgroundedChildOnCancel
TestBashKillsBackgroundedChildOnCancel proves bash's process-group kill reaches backgrounded grandchildren. A naked `cmd &` outlives /bin/sh; without
internal/tools/bash_procgroup_unix_test.go:21
FunctionTestBashNonZeroExitNotFatal
(t *testing.T)
internal/tools/bash_test.go:21
FunctionTestBashParentCancelMidRun
TestBashParentCancelMidRun: parent cancel mid-sleep returns "(cancelled)", not a misleading "(timeout after Xs)" or stale exit code. Parent cancel alw
internal/tools/bash_test.go:183
FunctionTestBashTimeout
(t *testing.T)
internal/tools/bash_test.go:120
FunctionTestBashTimeoutCappedAtOneHour
(t *testing.T)
internal/tools/bash_test.go:146
FunctionTestBashTimeoutOverflowClamped
TestBashTimeoutOverflowClamped: extreme floats must be clamped BEFORE the Duration multiply. `time.Duration(1e18) * time.Second` overflows int64 to a
internal/tools/bash_test.go:166
FunctionTestBootstrapCoercesBogusContextSize
TestBootstrapCoercesBogusContextSize: context_size 0 (or missing) is coerced to the default rather than degrading Pack() to "newest message only".
internal/config/config_test.go:552
FunctionTestBootstrapCoercesUnknownActive
TestBootstrapCoercesUnknownActive: an unknown `active:` is coerced to the first profile in sorted order so ActiveProfile never returns nil.
internal/config/config_test.go:480
FunctionTestBootstrapCreatesLayout
(t *testing.T)
internal/config/config_test.go:31
FunctionTestBootstrapDoesNotRestoreDeletedHamrpass
TestBootstrapDoesNotRestoreDeletedHamrpass: once config.yaml exists the user owns its profile list. A removed hamrpass stays gone across restarts (re-
internal/config/config_test.go:109
FunctionTestBootstrapDoesNotRestoreRenamedLocal
TestBootstrapDoesNotRestoreRenamedLocal: renaming `local` (e.g. to `ollama`) must not resurrect a duplicate `local` on next start. Same invariant as t
internal/config/config_test.go:167
FunctionTestBootstrapHamrpassHasNoContextSizeOnDisk
TestBootstrapHamrpassHasNoContextSizeOnDisk: a fresh config.yaml must carry no context_size for hamrpass: that field is server-authoritative via X-Con
internal/config/config_test.go:72
FunctionTestBootstrapLoadsMultipleProfiles
TestBootstrapLoadsMultipleProfiles: a two-profile config round-trips and Bootstrap picks the declared `active`.
internal/config/config_test.go:261
FunctionTestBootstrapPreservesExistingHamrpassKey
TestBootstrapPreservesExistingHamrpassKey: a user-supplied hamrpass key must round-trip untouched. Guards against any future "tidy on read" that would
internal/config/config_test.go:228
FunctionTestBootstrapRefusesNonDirectoryAtCodehamrPath
(t *testing.T)
internal/config/config_test.go:648
FunctionTestBootstrapRefusesSymlinkedConfigYAML
(t *testing.T)
internal/config/config_test.go:626
FunctionTestBootstrapRefusesSymlinkedDir
TestBootstrapRefusesSymlinkedDir: a co-tenant could plant .codehamr → an attacker-controlled dir before first run. Bootstrap must Lstat (not Stat) and
internal/config/config_test.go:606
FunctionTestBootstrapRejectsEmptyModels
TestBootstrapRejectsEmptyModels: an empty `models:` block leaves Active nothing to point at; Bootstrap must error readably (how to recover) rather tha
internal/config/config_test.go:514
FunctionTestBootstrapRejectsNilProfile
TestBootstrapRejectsNilProfile: `models: { local: ~ }` decodes to a nil *Profile the ContextSize coercion loop would deref-panic on. Bootstrap must re
internal/config/config_test.go:582
FunctionTestBootstrapTightensLooseDirPerms
TestBootstrapTightensLooseDirPerms: a .codehamr/ created loose (older release, or by hand at 0o755) must be tightened on the next Bootstrap, the direc
internal/config/config_test.go:351
FunctionTestBootstrapWritesSandboxHintHeader
TestBootstrapWritesSandboxHintHeader pins the comment header writeYAML re-prepends on every write. yaml.Marshal drops comments, so this is the only pl
internal/config/config_test.go:15
← previousnext →201–300 of 622, ranked by callers