Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/PerpetualSoftware/pad
/ functions
Functions
6,005 in github.com/PerpetualSoftware/pad
⨍
Functions
6,005
◇
Types & classes
763
↓ 4 callers
Function
NormalizeAudience
RFC 8707 ("Resource Indicators for OAuth 2.0") audience-binding hook for pad's authorization server (PLAN-943 TASK-951 sub-PR B). fosite has no nativ
internal/oauth/audience.go:72
↓ 4 callers
Function
NormalizeMIME
NormalizeMIME strips parameters and lowercases the type/subtype. We match strictly against the allowlist after normalization so callers can pass an ht
internal/attachments/mime.go:145
↓ 4 callers
Method
Ping
Ping verifies the database connection is alive.
internal/store/store.go:270
↓ 4 callers
Method
PublicLinkBaseURL
PublicLinkBaseURL returns the URL the server should embed in emailed links (password reset, invites, share links, admin invitations). Resolution order
internal/config/config.go:386
↓ 4 callers
Function
RemovePadEntry
RemovePadEntry deletes mcpServers.pad while leaving other servers + top-level keys intact. Returns (true, nil) when an entry was removed, (false, nil)
internal/mcp/install.go:263
↓ 4 callers
Method
Resize
Resize returns a new image with the longer edge fitted to maxLong, preserving aspect ratio. Images already within maxLong are returned unchanged so ca
internal/attachments/processor.go:41
↓ 4 callers
Method
RevokeAccessToken
RevokeAccessToken mirrors RevokeRefreshToken for access tokens. fosite calls these in pairs when revoking a grant (the unified "revoke the whole famil
internal/oauth/storage.go:382
↓ 4 callers
Method
RevokeUserOAuthConnection
RevokeUserOAuthConnection invalidates every token in the OAuth grant chain identified by requestID, after verifying the chain belongs to userID. Impl
internal/store/connected_apps.go:297
↓ 4 callers
Method
RotateAPIToken
RotateAPIToken generates a new secret for an existing token, preserving all metadata (name, scopes, workspace, user, expiry). The old token is invalid
internal/store/api_tokens.go:87
↓ 4 callers
Method
SetAttachments
SetAttachments wires the attachment storage Registry that the upload and download handlers use. Pass maxBytes = 0 to keep the defaultAttachmentMaxByte
internal/server/server.go:724
↓ 4 callers
Method
SetOAuthServer
OAuth 2.1 authorization-server HTTP handlers (PLAN-943 TASK-951). Sub-PR C built the /register, /authorize, /authorize/decide and token endpoints + th
internal/server/handlers_oauth.go:79
↓ 4 callers
Method
SetSSELimits
SetSSELimits configures global and per-workspace SSE connection limits. A value of 0 means unlimited.
internal/server/server.go:888
↓ 4 callers
Method
SetTokenReaperConfig
SetTokenReaperConfig overrides the default sweep interval (1h). Pass 0 to keep the package default. Must be called before StartTokenReaper; calling af
internal/server/token_reaper.go:31
↓ 4 callers
Method
SetToolSurfaceHandler
SetToolSurfaceHandler wires the MCP catalog→JSON serializer onto the server (PLAN-1888 / TASK-1891). Called once at startup by cmd/pad/main.go with mc
internal/server/handlers_mcp.go:103
↓ 4 callers
Method
SetUserRole
SetUserRole updates a user's role (admin or member). When demoting an admin to member, the update is conditional: it only proceeds if at least one oth
internal/store/users.go:908
↓ 4 callers
Method
StartTokenReaper
StartTokenReaper kicks off the periodic sweep that deletes expired/used email-verification tokens, password-reset tokens, sessions, and CLI-auth sessi
internal/server/token_reaper.go:48
↓ 4 callers
Function
StatusColor
StatusColor returns a *color.Color appropriate for the given status string.
internal/cli/format.go:28
↓ 4 callers
Method
Subscribe
Subscribe registers a subscriber for the given item and returns a buffered channel of OpEvents. Caller is responsible for calling Unsubscribe (typical
internal/collab/bus.go:98
↓ 4 callers
Method
Uninstall
Uninstall removes the pad entry from the named agent's config. Idempotent: a missing file or missing entry is not an error and returns (path, false, n
internal/mcp/install.go:658
↓ 4 callers
Method
UpdateItemWithParentLink
UpdateItemWithParentLink is UpdateItemWithPreCheck plus an OPTIONAL parent-link mutation applied inside the same transaction (BUG-2013). When parentLi
internal/store/items.go:1839
↓ 4 callers
Method
UserHasGrantsInWorkspace
UserHasGrantsInWorkspace checks if a user has any active collection or item grants in a workspace (even though they are not a member). Used to detect
internal/store/grants.go:352
↓ 4 callers
Method
Validate
(string)
cmd/pad/cmd_server.go:1029
↓ 4 callers
Function
ValidateWebhookURL
ValidateWebhookURL checks that a webhook URL is safe to call. It rejects non-HTTP(S) schemes, URLs with credentials, private/reserved IPs (loopback, l
internal/webhooks/validate.go:13
↓ 4 callers
Function
WithMCPTokenIdentity
WithMCPTokenIdentity stashes the bearer-token identity so the MCP audit middleware can record which connection drove the call. kind is the discrimina
internal/server/context.go:171
↓ 4 callers
Function
asOpenChildrenGuardError
asOpenChildrenGuardError unwraps a store-layer error that may carry an openChildrenGuardError sentinel. Returns the sanitized details and true when th
internal/server/handlers_items_open_children_guard.go:347
↓ 4 callers
Function
auditedMCPServer
MCP audit middleware tests (PLAN-943 TASK-960). What's covered: - A successful tool call writes one audit row with the right tool_name + args_hash +
internal/server/middleware_mcp_audit_test.go:33
↓ 4 callers
Method
autoCreateWorkspace
--- Auto-create Workspace (TASK-432) --- autoCreateWorkspace creates a default workspace for a new user in cloud mode. Called after user creation in r
internal/server/handlers_cloud.go:1193
↓ 4 callers
Function
buildBootstrapURL
buildBootstrapURL constructs the /setup URL the operator should open. setup_method dispatch (kept in sync with handleSessionCheck in internal/server/
internal/cli/bootstrap.go:153
↓ 4 callers
Method
buildChildrenDoneExpr
buildChildrenDoneExpr compiles a set of per-collection done filters into a single SQL boolean expression plus ordered args. `itemAlias` is the item-ta
internal/store/items.go:3420
↓ 4 callers
Method
buildDashboardResponse
buildDashboardResponse is the canonical dashboard-assembly path. The HTTP handler (handleGetDashboard) is now a thin wrapper around it, and the bootst
internal/server/handlers_dashboard.go:278
↓ 4 callers
Function
buildReconcileFindings
buildReconcileFindings returns the reconcile findings for the given item. The item argument MUST be non-nil — the production caller (reconcileItem) an
cmd/pad/reconcile.go:281
↓ 4 callers
Function
bytes32
===================================================================== Helpers ===================================================================== by
internal/oauth/server_test.go:922
↓ 4 callers
Function
bytes32ForTest
()
internal/server/handlers_oauth_test.go:77
↓ 4 callers
Function
callWorkspaceViaOAuth
callWorkspaceViaOAuth simulates an MCP-driven workspace API call by going through MCPBearerAuth's OAuth path. The MCP transport stub the test harness
internal/server/handlers_mcp_test.go:1687
↓ 4 callers
Function
canPromptForConfig
()
cmd/pad/configure.go:357
↓ 4 callers
Function
clearCSRFCookie
clearCSRFCookie removes the CSRF cookie (e.g. on logout). Must clear both prefixed and unprefixed names to handle upgrades cleanly.
internal/server/middleware_csrf.go:314
↓ 4 callers
Method
computeSSEVisibility
computeSSEVisibility resolves the caller's current visibility snapshot. Safe to call repeatedly on a live SSE connection — each call fetches the lates
internal/server/handlers_events.go:395
↓ 4 callers
Method
countRows
(t *testing.T, query string, args ...interface{})
internal/store/workspace_purge_test.go:47
↓ 4 callers
Function
counterValue
counterValue is a tiny helper that pulls the float value out of a Prometheus counter.
internal/server/middleware_mcp_metrics_test.go:205
↓ 4 callers
Function
createChildItem
createChildItem creates a test item and wires it as a child of parentID via SetParentLink — the same path the HTTP handler takes in production (handle
internal/store/wiki_links_test.go:1257
↓ 4 callers
Function
dialWSSince
dialWSSince is the resume-cursor variant: appends `?since=<id>` to the WS URL so the test exercises the TASK-1319 force_refresh path.
internal/collab/manager_test.go:272
↓ 4 callers
Function
doAuthedDeleteWithCSRF
doAuthedDeleteWithCSRF issues a DELETE with both the session cookie + the CSRF double-submit pair. The session-cookie code path requires CSRF on every
internal/server/handlers_connected_apps_test.go:21
↓ 4 callers
Method
doClaimCodeGet
()
internal/server/handlers_claim_code_test.go:95
↓ 4 callers
Function
doHeadlessBootstrap
doHeadlessBootstrap is the shared core of the non-interactive (agent) admin bootstrap introduced by BUG-988. Both setupCmd and padInitCmd funnel throu
cmd/pad/cmd_auth.go:240
↓ 4 callers
Method
emailUnverifiedBlocked
emailUnverifiedBlocked is the central predicate for PLAN-1933 DR-4's email-verification gate. It reports whether a request carrying `user` must be rej
internal/server/middleware_verified_email.go:41
↓ 4 callers
Method
enforcePlanLimit
--- Plan Limit Enforcement --- enforcePlanLimit checks a workspace-scoped plan limit and writes a 403 error if the limit is exceeded. Returns true if
internal/server/handlers_cloud.go:1078
↓ 4 callers
Method
ensureRouter
ensureRouter lazily initializes the router on first use, so all Set* configuration is applied before the middleware chain is built.
internal/server/server.go:1724
↓ 4 callers
Method
evict
evict removes an entry. No-op on empty id or unknown id. Fires onChange only when an entry was actually removed. See touch's comment for why onChange
internal/server/middleware_mcp_session.go:128
↓ 4 callers
Function
flush
( ctx: CollabFlushContext, markdown: string, keepalive: boolean, )
web/src/lib/collab/collabFlush.svelte.ts:171
↓ 4 callers
Function
forcePlainColor
forcePlainColor disables ANSI so width/content assertions are deterministic regardless of whether the test binary's stdout happens to be a TTY.
internal/cli/format_test.go:15
↓ 4 callers
Function
getCSRFToken
()
web/src/lib/api/client.ts:366
↓ 4 callers
Function
getNaturalBoundsPx
()
web/src/lib/components/editor/attachment-crop-modal.ts:297
↓ 4 callers
Function
guardSchemaAhead
guardSchemaAhead refuses to start when the database contains migrations this binary doesn't ship — i.e. the DB is AHEAD of the binary, the tell-tale o
internal/store/migration_guard.go:62
↓ 4 callers
Function
handleCmdhelpCapabilitiesFallback
handleCmdhelpCapabilitiesFallback scans args for the --cmdhelp-capabilities flag (cmdhelp v0.1 §8 fallback form). If found, it writes the capability b
cmd/pad/main.go:70
↓ 4 callers
Function
head
(s string, lines int)
internal/cmdhelp/md_test.go:371
↓ 4 callers
Function
headlessTestServer
headlessTestServer builds an httptest.Server that speaks the minimal subset of the Pad API that the headless bootstrap path touches: - GET /api/v1/a
cmd/pad/setup_headless_test.go:31
↓ 4 callers
Method
insertOAuthRequestRow
============================================================ Helpers — shared by the three "request-row" tables ======================================
internal/store/oauth.go:575
↓ 4 callers
Function
isSupportedOAuthProvider
isSupportedOAuthProvider reports whether provider is one pad accepts.
internal/server/handlers_cloud.go:34
↓ 4 callers
Function
isUUID
(s string)
internal/server/handlers_items.go:2453
↓ 4 callers
Function
itemDisplayLabel
(item *models.Item)
cmd/pad/lineage.go:205
↓ 4 callers
Method
itemLock
itemLock returns the lazily-allocated mutex guarding setup-phase operations on itemID. Locks live in the manager for the lifetime of the process — for
internal/collab/manager.go:104
↓ 4 callers
Function
itemRefOrSlug
itemRefOrSlug formats an item's issue ref (e.g. "TASK-5") when its collection prefix + item number are populated, falling back to its slug. Avoids pul
internal/server/handlers_items_open_children_guard.go:99
↓ 4 callers
Function
itoa
itoa is strconv.Itoa renamed to keep test bodies readable when they're already heavy on ref-formatting.
internal/store/wiki_links_test.go:1698
↓ 4 callers
Function
mapRoleUpdate
mapRoleUpdate dispatches `pad role update <slug> [--name ...] [--slug ...] [--description ...] [--icon ...] [--tools ...] [--sort-order ...]`. PATCH
internal/mcp/dispatch_http_routes.go:797
↓ 4 callers
Function
marshalItemFields
(fieldsMap map[string]any)
internal/models/item.go:461
↓ 4 callers
Function
mkAdminCookieReq
mkAdminCookieReq is the same shape minus the Authorization header. Simulates the cookie-session path where isBearerAuth must return false and the admi
internal/server/handlers_admin_bearer_gate_test.go:47
↓ 4 callers
Function
mustCreatePATForTest
mustCreatePATForTest creates a real PAT against a fresh user + workspace. Returns the raw token string suitable for the Authorization: Bearer header.
internal/server/handlers_mcp_test.go:1724
↓ 4 callers
Function
mustWorkspaceID
mustWorkspaceID resolves a workspace slug to its internal ID via the store. Tests use it because they don't have access to the request context that ge
internal/server/handlers_attachments_test.go:353
↓ 4 callers
Function
newBearerGateItemFixture
(t *testing.T)
internal/server/handlers_items_test.go:2558
↓ 4 callers
Function
normalizeCollectionSlug
normalizeCollectionSlug maps common singular/short forms to actual collection slugs. Thin wrapper around the shared collections.NormalizeSlug so the C
cmd/pad/cmd_collection.go:493
↓ 4 callers
Function
normalizeServerURL
normalizeServerURL canonicalizes a server URL for use as a credential key. Trailing slash and surrounding whitespace are stripped; nothing else is tou
internal/cli/credentials.go:256
↓ 4 callers
Function
normalizeWebhookEvents
normalizeWebhookEvents canonicalizes a webhook's event filter to the JSON-array string the store + dispatcher expect. Returns (value, true) when a no
internal/mcp/dispatch_http_routes.go:926
↓ 4 callers
Function
numericInput
numericInput pulls an int64 out of a JSON-typed input value. JSON decoders deliver numbers as float64 (or json.Number when UseNumber()); we accept bot
internal/mcp/dispatch_http_routes.go:1246
↓ 4 callers
Method
oauthRequestToFositeRequest
oauthRequestToFositeRequest hydrates a stored row into a fresh fosite.Request, fetching the client by ID and unmarshalling the session bytes into the
internal/oauth/storage.go:495
↓ 4 callers
Method
onError
Surface an upload failure to the user.
web/src/lib/utils/commentAttachments.ts:99
↓ 4 callers
Method
openBootstrapEnabled
openBootstrapEnabled reports whether open-bootstrap is active for this server: bypass flag is set AND we're not in cloud mode. Cloud mode always wins
internal/server/bootstrap.go:199
↓ 4 callers
Function
parseCollectionFieldsDSL
parseCollectionFieldsDSL parses the CLI's --fields DSL into a {fields: [...]} map ready for json.Marshal. Empty input returns an empty Fields slice (t
internal/mcp/dispatch_http_routes.go:569
↓ 4 callers
Function
parseItemFields
(fieldsJSON string)
internal/models/item.go:439
↓ 4 callers
Function
parseMutableItemFields
(fieldsJSON string)
internal/models/item.go:450
↓ 4 callers
Function
parseWorkspaceSettingsMap
(raw string)
internal/models/workspace_settings.go:148
↓ 4 callers
Method
patch
(path string, body interface{}, result interface{})
internal/cli/client.go:1554
↓ 4 callers
Function
prStateColor
(state string)
cmd/pad/cmd_github.go:406
↓ 4 callers
Method
publishCommentEvent
publishCommentEvent publishes a real-time event for comment changes.
internal/server/handlers_comments.go:443
↓ 4 callers
Method
queryOAuthRequestRow
queryOAuthRequestRow reads a row by signature from the named table and returns (request, active, err). - For oauth_pkce_requests, active is always tr
internal/store/oauth.go:671
↓ 4 callers
Function
rawPeerAddr
rawPeerAddr returns the untampered TCP peer address captured by CapturePeerAddr, falling back to the current r.RemoteAddr if the middleware wasn't ins
internal/server/middleware_realip.go:32
↓ 4 callers
Method
readItem
readItem handles pad://workspace/{ws}/items/{ref}. Why JSON-then-format instead of `--format markdown`: pad's CLI `--format markdown` for `item show`
internal/mcp/resources.go:231
↓ 4 callers
Function
readMigrationNames
readMigrationNames returns sorted .sql filenames from an embedded FS directory.
internal/store/store.go:275
↓ 4 callers
Function
readTOML
Helpers ------------------------------------------------------------------
internal/mcp/install_test.go:792
↓ 4 callers
Method
recordMCPAuthzDenial
recordMCPAuthzDenial bumps the pad_mcp_authz_denials_total counter when the request originated from the MCP surface. The discriminator is the presence
internal/server/middleware_auth.go:726
↓ 4 callers
Method
recordMCPCallMetrics
recordMCPCallMetrics fans the audit-row data out to Prometheus. No-op when metrics aren't wired (selfhost / tests). Kept separate from MCPAuditLog so
internal/server/middleware_mcp_audit.go:349
↓ 4 callers
Method
recoverSweeper
recoverSweeper is the panic firewall for the long-running background sweeper loops (orphan GC, op-log GC, token reaper, workspace purge). Each of thos
internal/server/server.go:291
↓ 4 callers
Function
registerNonAdmin
--- helpers --- registerNonAdmin inserts a member-role user directly into the store and mints a session token for them. Bypasses the admin-registratio
internal/server/handlers_admin_billing_test.go:334
↓ 4 callers
Function
renderRect
()
web/src/lib/components/editor/attachment-crop-modal.ts:301
↓ 4 callers
Method
replaceWikiLinks
replaceWikiLinks deletes prior wiki-link rows for `sourceItemID` and inserts fresh ones extracted from `content`. Resolution against the workspace's i
internal/store/wiki_links.go:31
↓ 4 callers
Function
requestIsLoopback
(r *http.Request)
internal/server/handlers_auth.go:236
↓ 4 callers
Method
requireConnectionOwner
requireConnectionOwner is the per-mutation prologue. Returns the (currentUser, requestID, ok) triple. On `ok=false` the response has already been writ
internal/server/handlers_connected_apps.go:267
↓ 4 callers
Function
requirePostgresForConcurrency
requirePostgresForConcurrency skips a test unless a real PostgreSQL backend is configured. The parent-link TOCTOU races (BUG-2073) are Postgres-only:
internal/store/parent_link_concurrency_test.go:19
↓ 4 callers
Method
respondWithConnection
respondWithConnection re-fetches + writes the connection DTO post- mutation so the page can re-render without a separate list refresh. Stats lookup is
internal/server/handlers_connected_apps.go:293
↓ 4 callers
Function
rootFlagsToArgs
rootFlagsToArgs converts a startup root-flags map into the pre-formatted CLI token list every fetch should append. Empty values are skipped (matching
internal/mcp/resources.go:449
↓ 4 callers
Method
run
run executes fn on the injected spawner, or a plain goroutine if none is set.
internal/webhooks/dispatcher.go:98
← previous
next →
701–800 of 6,005, ranked by callers