MCPcopy Create free account

hub / github.com/Facets-cloud/flow / functions

Functions972 in github.com/Facets-cloud/flow

↓ 3 callersFunctionintOrEmpty
intOrEmpty stringifies n unless it's zero, in which case it returns "" — useful for TSV cells where 0 means "no data" rather than literal zero.
internal/app/list.go:435
↓ 3 callersFunctionisAccessibilityDenied
isAccessibilityDenied reports whether an osascript failure looks like a missing-Accessibility-permission error. Patterns are the standard error fragme
internal/terminal/terminal.go:119
↓ 3 callersFunctionisNoBindingErr
isNoBindingErr is a small predicate for the dispatch-session case. Callers use it to differentiate "no current binding" from real scan errors when rev
internal/app/helpers.go:40
↓ 3 callersFunctionkbFiles
kbFiles returns the absolute paths of all existing KB files under the given flow root, in the canonical order (user, org, products, processes, busines
internal/app/init.go:185
↓ 3 callersFunctionlistUpdateFiles
listUpdateFiles returns absolute paths to all *.md files under dir, sorted ascending. Missing dir yields an empty slice, not an error.
internal/app/show.go:591
↓ 3 callersFunctionliveSessionsForTasks
liveSessionsForTasks returns a merged id→count map across every unique harness referenced by the given task slice. Calls each harness's LiveSessionIDs
internal/app/harness.go:149
↓ 3 callersFunctionloadOwnerArg
loadOwnerArg parses a single owner-slug argument, opens the DB, and loads the owner. On any error it reports to stderr, closes the DB, and returns a n
internal/app/owner.go:61
↓ 3 callersFunctionmustExec
(t *testing.T, db *sql.DB, q string, args ...any)
internal/stats/report_test.go:174
↓ 3 callersFunctionownerTickManual
ownerTickManual implements `flow owner tick <slug>`: a hand-triggered, on-demand tick (wake the owner now, regardless of schedule). Interactive by def
internal/app/owner_tick.go:103
↓ 3 callersFunctionownerTickStale
ownerTickStale reports whether a recorded tick has been "running" longer than ownerTickStaleAfter (so its pid should not be trusted).
internal/app/owner_tick.go:384
↓ 3 callersFunctionparseBackgroundAgents
parseBackgroundAgents decodes `claude agents --json` into the harness's normalized BackgroundAgent slice. Only `kind:"background"` entries are returne
internal/harness/claude/background.go:97
↓ 3 callersFunctionprintOwnerTaskSection
(label string, tasks []*flowdb.Task)
internal/app/owner.go:185
↓ 3 callersFunctionprintUsage
()
internal/app/app.go:89
↓ 3 callersFunctionprojectCell
(slug string)
internal/app/list.go:426
↓ 3 callersFunctionreadSkillVersion
readSkillVersion returns the version string recorded in the harness's skill-version sidecar, or "" if missing/unreadable.
internal/app/skill.go:28
↓ 3 callersFunctionrecordOwnerTick
recordOwnerTick stamps last_tick_at + last_tick_status and clears the running-tick bookkeeping (the tick is over). Targeted update — it never touches
internal/app/owner_tick.go:454
↓ 3 callersFunctionrenderCardPNG
renderCardPNG draws the flow-branded share card and returns the image.
internal/app/card_png.go:90
↓ 3 callersFunctionrunSlugExists
runSlugExists returns true iff a tasks row with the given slug exists. Checks all tasks (any kind) since slug is the primary key.
internal/app/run.go:235
↓ 3 callersFunctionstatusAbbrev
(status string)
internal/app/list.go:964
↓ 3 callersFunctionstubAutoRunner
stubAutoRunner replaces autoRunner with fn.
internal/app/auto_test.go:175
↓ 3 callersFunctionstubNewUUID
stubNewUUID pins claude.NewUUID to a fixed value for the duration of the test.
internal/app/do_test.go:34
↓ 3 callersFunctionvisibleWidth
visibleWidth returns the number of terminal cells s occupies, after stripping ANSI SGR escape sequences. Known wide runes count as 2 cells.
internal/listfmt/listfmt.go:38
↓ 3 callersFunctionwriteSkillVersion
writeSkillVersion records `v` as the version of the binary that installed the current skill content. Errors are non-fatal — failing to write the sidec
internal/app/skill.go:44
↓ 2 callersFunctionActivateOwner
ActivateOwner marks an owner active, schedules its next wake, and CLEARS archived_at — so `flow owner start` un-retires a retired owner (otherwise Due
internal/flowdb/owners.go:162
↓ 2 callersFunctionComputeSavings
ComputeSavings applies the counterfactual model. TotalHours sums only the two time-valued levers (automation + context-switch); ContextTokens (tokens)
internal/stats/model.go:78
↓ 2 callersFunctionGetTaskTagsBatch
GetTaskTagsBatch returns tags for many tasks in one query, keyed by task slug. Used by list output to avoid N+1 queries.
internal/flowdb/db.go:1022
↓ 2 callersMethodInstallUserPromptSubmitHook
InstallUserPromptSubmitHook idempotently registers `command` as a UserPromptSubmit hook (no matcher). Fires on every user prompt; the command itself n
internal/harness/harness.go:273
↓ 2 callersFunctionListAllTags
ListAllTags returns every distinct tag in use, with the number of non-archived tasks that carry it. Sorted by count descending, then tag ascending — m
internal/flowdb/db.go:1057
↓ 2 callersFunctionListPlaybooks
(db *sql.DB, filter PlaybookFilter)
internal/flowdb/db.go:922
↓ 2 callersFunctionListWorkdirs
(db *sql.DB)
internal/flowdb/db.go:850
↓ 2 callersMethodNewSessionID
Session allocation ----------------------------------------------- NewSessionID returns the session id flow should claim before spawning. Implementati
internal/harness/harness.go:142
↓ 2 callersFunctionPauseOwner
PauseOwner marks an owner paused (targeted; preserves every other column, including any in-flight tick bookkeeping).
internal/flowdb/owners.go:172
↓ 2 callersMethodPrune
Prune drops cache entries whose path was not seen in the latest run.
internal/stats/cache.go:69
↓ 2 callersFunctionRenderJSON
RenderJSON encodes v as indented JSON. Callers should pass a slice of concrete structs (or maps) — json.Marshal handles key ordering for structs based
internal/listfmt/listfmt.go:187
↓ 2 callersFunctionRenderJSONL
RenderJSONL renders a claude session jsonl byte-stream to w. Exposed (not just used by RenderTranscript) so tests can exercise the decoder against fix
internal/harness/claude/transcript.go:88
↓ 2 callersFunctionResolveTaskProjectOrPlaybook
ResolveTaskProjectOrPlaybook resolves a ref that could be a task, project, or playbook. Supports task/, project/, playbook/ prefixes. On bare refs, tr
internal/app/resolve.go:80
↓ 2 callersMethodResumeBackground
ResumeBackground brings a no-longer-tracked background session's conversation back as a fresh background agent, seeded from the prior session's transc
internal/harness/harness.go:105
↓ 2 callersMethodSave
Save writes the cache as JSON.
internal/stats/cache.go:36
↓ 2 callersFunctionScanJSONL
ScanJSONL reads a Claude session jsonl byte-stream and extracts a FileRollup. ownSlug is the slug of the task that owns this transcript, used to disti
internal/stats/scan.go:85
↓ 2 callersFunctionScanPlaybook
(row interface{ Scan(dest ...any) error })
internal/flowdb/db.go:908
↓ 2 callersFunctionScanProject
(row interface{ Scan(dest ...any) error })
internal/flowdb/db.go:682
↓ 2 callersFunctionScanWorkdir
(row interface{ Scan(dest ...any) error })
internal/flowdb/db.go:836
↓ 2 callersFunctionSetOwnerNextWake
SetOwnerNextWake sets ONLY next_wake_at (targeted column write). Used by `flow owner next` and a tick's self-pacing. It deliberately does not load+rew
internal/flowdb/owners.go:149
↓ 2 callersFunctionShellQuote
ShellQuote wraps s in single quotes with proper escaping. Same implementation as iterm.ShellQuote / terminal.ShellQuote / zellij.ShellQuote.
internal/kitty/kitty.go:211
↓ 2 callersMethodSkillVersionPath
SkillVersionPath returns the sidecar file recording which flow binary version wrote the current skill content. Used by the auto-upgrade gate.
internal/harness/harness.go:247
↓ 2 callersMethodSkipPermissionsRun
SkipPermissionsRun executes a non-interactive prompt against the harness with per-tool approvals auto-allowed (used by `flow done`'s close-out sweep).
internal/harness/harness.go:186
↓ 2 callersFunctionTruncate
Truncate shortens s to maxRunes runes, appending an ellipsis when the string was actually shortened. maxRunes <= 0 disables truncation.
internal/listfmt/listfmt.go:208
↓ 2 callersFunctionUpdateOwner
UpdateOwner persists an owner's mutable fields (name, work_dir, project_slug, status, every, scheduling, last-tick bookkeeping, harness) by slug and r
internal/flowdb/owners.go:96
↓ 2 callersMethodValidateSession
ValidateSession verifies that the on-disk state for (workDir, sessionID) is consistent with what a future `flow do <slug>` resume would expect — for c
internal/harness/harness.go:166
↓ 2 callersFunctionbgStateLabel
bgStateLabel renders a background agent's coarse condition for user messages, e.g. "busy/working" while live or just "stopped" once exited.
internal/app/do.go:568
↓ 2 callersFunctionbuildAutoBootstrapPrompt
buildAutoBootstrapPrompt is the bootstrap prompt for a headless, unattended run. It differs from the interactive prompt in two load- bearing ways: (1)
internal/app/auto.go:300
↓ 2 callersFunctionbuildBootstrapPrompt
buildBootstrapPrompt is a backwards-compat shim for old callers that pass only a slug. Now points at the regular-task variant. Tests still call this t
internal/app/do.go:819
↓ 2 callersFunctionbuildTabTitle
buildTabTitle returns a short iTerm tab title. Project-scoped tasks get "<project-slug>/<task-slug>"; floating tasks get just "<task-slug>". Titles lo
internal/app/do.go:826
↓ 2 callersFunctionbuildTaskBootstrapPrompt
buildTaskBootstrapPrompt is the prompt for regular tasks.
internal/app/do.go:760
↓ 2 callersFunctionbumpWorkdirUsed
bumpWorkdirUsed updates workdirs.last_used_at, best-effort.
internal/app/do.go:719
↓ 2 callersFunctioncontainsPair
(ss []string, flag, val string)
internal/harness/claude/background_test.go:279
↓ 2 callersFunctioncountFiles
countFiles counts files ending in ext inside <base>/*/<sub>/.
internal/stats/report.go:274
↓ 2 callersFunctioncountMatchingHookEntries
(entries []any, command string)
internal/app/skill_test.go:29
↓ 2 callersFunctiondaysInStatus
daysInStatus returns the number of days the task has been in its current status. Uses status_changed_at if set, else falls back to created_at.
internal/app/show.go:653
↓ 2 callersFunctiondaysUntilDue
daysUntilDue returns the number of days until the due date. Negative means overdue. Returns (0, false) if no due date is set.
internal/app/show.go:667
↓ 2 callersFunctionemitHookContext
emitHookContext marshals a hookSpecificOutput payload for the given Claude Code hook event name. Used by both SessionStart and UserPromptSubmit hook h
internal/app/hook.go:206
↓ 2 callersFunctionemitSessionStartContext
emitSessionStartContext is a thin wrapper around emitHookContext for the SessionStart event.
internal/app/hook.go:199
↓ 2 callersFunctionescapeAppleScriptString
(s string)
internal/iterm/iterm.go:197
↓ 2 callersFunctionescapeAppleScriptString
escapeAppleScriptString escapes a string for safe embedding in a double-quoted AppleScript string literal. Same implementation as the sibling packages
internal/warp/warp.go:281
↓ 2 callersFunctionextractWorkdirStringFlag
extractWorkdirStringFlag pulls a `--flag val` or `--flag=val` pair out of args, returning (value, remaining, error). Returns ("", args, nil) if absent
internal/app/workdir.go:222
↓ 2 callersFunctioninsertTask
(t *testing.T, db *sql.DB, slug, name, status, priority, wd string, project any)
internal/flowdb/db_test.go:31
↓ 2 callersFunctioninstallHook
installHook idempotently adds a hook entry for `event` to ~/.claude/settings.json. matcher may be empty — some events don't use one and the field is o
internal/harness/claude/claude.go:356
↓ 2 callersFunctionkbSeeds
kbSeeds returns the five canonical KB files. Kept as a function (not a package-level var) so tests can call it directly without sharing state. The ski
internal/app/init.go:140
↓ 2 callersMethodlaunchAndCapture
launchAndCapture runs a `claude --bg …` command in workDir, parses the short id from its banner, and resolves the full session id by matching that sho
internal/harness/claude/background.go:139
↓ 2 callersFunctionloadInjectionText
loadInjectionText resolves --with / --with-file into the text that will be injected as the session's first user message. For --with-file we don't embe
internal/app/do.go:23
↓ 2 callersFunctionlookupBoundTask
lookupBoundTask returns the task whose session_id matches $CLAUDE_CODE_SESSION_ID, or nil if no such task exists, the env var is unset, or the DB look
internal/app/hook.go:124
↓ 2 callersFunctionnewUUID
newUUID generates a v4 UUID in the 8-4-4-4-12 hex format that `claude --session-id` accepts.
internal/harness/claude/claude.go:116
↓ 2 callersFunctionownerDirFor
ownerDirFor returns the absolute on-disk directory for an owner ($FLOW_ROOT/owners/<slug>) — where its charter and journal live. Tick prompts use this
internal/app/owner_tick.go:399
↓ 2 callersFunctionownerList
ownerList implements `flow owner list` — one row per owner with its status, interval, and next scheduled tick.
internal/app/owner.go:386
↓ 2 callersFunctionownerNextTickLabel
ownerNextTickLabel renders the "next tick" column: the scheduled next_wake_at with a relative hint, or a parenthetical status when the owner isn't act
internal/app/owner.go:430
↓ 2 callersFunctionownerShow
ownerShow renders the owner's accountability surface: metadata, next tick, and a live list of what it owns (tasks tagged owner:<slug>), split into in-
internal/app/owner.go:98
↓ 2 callersFunctionpairArg
(ss []string, flag, val string)
internal/app/background_test.go:413
↓ 2 callersFunctionparseBackgroundBanner
parseBackgroundBanner extracts the short id from `claude --bg`'s banner (`backgrounded · <shortId> · <name>`). Reads only the first line — the help li
internal/harness/claude/background.go:67
↓ 2 callersFunctionparseSince
parseSince converts "today" / "monday" / "7d" / "YYYY-MM-DD" / "Nd" into an absolute time lower bound, interpreted in local time. `now` is passed in f
internal/app/list.go:991
↓ 2 callersFunctionpriorityColor
(pri string)
internal/app/list.go:103
↓ 2 callersFunctionpriorityShort
(p string)
internal/app/list.go:976
↓ 2 callersFunctionquoteAppleScriptString
quoteAppleScriptString returns an AppleScript expression that evaluates to s. Lines are emitted as separate quoted strings joined with `& linefeed &`,
internal/iterm/iterm.go:208
↓ 2 callersFunctionresolveTaskRef
---------- resolution helpers ---------- resolveTaskRef resolves a ref to a task. Includes archived rows so `show task` can display them.
internal/app/show.go:202
↓ 2 callersFunctionroundDur
(d time.Duration)
internal/app/owner.go:461
↓ 2 callersFunctionscanForGitRepos
scanForGitRepos walks root up to maxDepth levels, recording parent directories of any `.git` subdirectory it finds. maxDepth of 3 means root/a/b/c/.gi
internal/app/workdir.go:392
↓ 2 callersFunctionsetArchivedAt
setArchivedAt is the shared mutation: archive=true sets archived_at to now, archive=false clears it.
internal/app/archive.go:21
↓ 2 callersFunctionsettingsPath
---------- hooks ---------- settingsPath returns ~/.claude/settings.json.
internal/harness/claude/claude.go:322
↓ 2 callersFunctionskillInstall
(args []string, forceDefault bool)
internal/app/skill.go:116
↓ 2 callersFunctionstatsWithAutomation
statsWithAutomation returns a Stats value with non-zero automation counters.
internal/app/card_png_test.go:13
↓ 2 callersFunctionstatusColor
Color palette. Red is reserved for anomaly signals (overdue / stale). "high" priority is the dominant active state for daily users, so coloring it red
internal/app/list.go:91
↓ 2 callersFunctionstubClaudeStatMissing
stubClaudeStatMissing makes claude.ValidateSession refuse every pair as "file not found." Models the chained-cd cheat and any other case where the on-
internal/app/do_test.go:114
↓ 2 callersFunctiontaskStaleness
taskStaleness returns (daysSinceLastTouch, stale) for an in-progress task. "Last touch" is max(updated_at, newest update file mtime). Staleness thresh
internal/app/show.go:624
↓ 2 callersFunctionuninstallHook
uninstallHook removes any entry under hooks.<event> whose inner hook list contains a command matching `command`. Returns (removed=true) iff the file c
internal/harness/claude/claude.go:431
↓ 2 callersFunctionweekStart
weekStart returns Monday 00:00 UTC of t's ISO week (zero in → zero out).
internal/stats/report.go:250
↓ 2 callersFunctionwriteCard
writeCard renders the HTML card to a file.
internal/app/card.go:90
↓ 2 callersFunctionwriteCardPNG
writeCardPNG renders the PNG card and writes it to path.
internal/app/card_png.go:266
↓ 1 callersMethodBackgroundAgents
BackgroundAgents runs `claude agents --json --all` and decodes the registry. --all includes exited / failed / completed sessions (not just live ones)
internal/harness/claude/background.go:125
↓ 1 callersFunctionClearTaskTags
ClearTaskTags removes all tags from a task.
internal/flowdb/db.go:994
↓ 1 callersFunctionRemoveTaskTag
RemoveTaskTag detaches a tag from a task. No error if the pair doesn't exist; caller can pre-check via GetTaskTags.
internal/flowdb/db.go:981
↓ 1 callersMethodRenderTranscript
Transcripts ------------------------------------------------------ RenderTranscript reads the harness's on-disk transcript for (cwd, sessionID) and wr
internal/harness/harness.go:236
← previousnext →201–300 of 972, ranked by callers