Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/PerpetualSoftware/pad
/ functions
Functions
6,412 in github.com/PerpetualSoftware/pad
⨍
Functions
6,412
◇
Types & classes
799
↓ 5 callers
Function
tick
()
web/src/lib/components/editor/block-drag-handle.ts:709
↓ 5 callers
Function
tokenAllowedWorkspaceMatches
tokenAllowedWorkspaceMatches reports whether the OAuth token's workspace allow-list (set at consent time, TASK-952) permits the given workspace slug.
internal/server/middleware_auth.go:1106
↓ 5 callers
Function
tokenScopeAllows
tokenScopeAllows checks if the token's scopes permit the given HTTP method and path. Scopes are stored as a JSON array of strings. Supported scopes (
internal/server/middleware_auth.go:1155
↓ 5 callers
Method
uniqueSlug
uniqueSlug generates a unique slug within a scope by appending -2, -3, etc.
internal/store/store.go:1127
↓ 5 callers
Method
waitForUpdate
()
internal/webhooks/dispatcher_test.go:55
↓ 5 callers
Function
withLocalFetcher
withLocalFetcher replaces the package-level fetcher with one that allows loopback dials so httptest.NewServer addresses (127.0.0.1) can be reached. Re
internal/server/handlers_import_test.go:17
↓ 4 callers
Method
CheckUserLimit
CheckUserLimit checks a user-level limit (not workspace-scoped), such as total workspace count or total API tokens.
internal/store/limits.go:114
↓ 4 callers
Function
Cleanup
Cleanup removes the process-wide template database, if one was built. Call it from TestMain after m.Run() so a lazily-built template file doesn't ling
internal/store/storetest/storetest.go:113
↓ 4 callers
Method
CreateAuthorizationCode
============================================================ Authorization codes (handler/oauth2/storage.go AuthorizeCodeStorage) ====================
internal/store/oauth.go:261
↓ 4 callers
Function
CreatePatch
CreatePatch computes a compact patch that transforms oldText into newText. The patch can be applied with ApplyPatch to recover newText from oldText.
internal/diff/diff.go:16
↓ 4 callers
Function
CreateReversePatch
CreateReversePatch computes a patch that transforms newText back into oldText. Used for reverse-diff version storage: current doc has latest content,
internal/diff/diff.go:55
↓ 4 callers
Method
CreateView
CreateView adds a new saved view.
internal/store/views.go:11
↓ 4 callers
Method
EncryptWebhookSecretsAtRest
EncryptWebhookSecretsAtRest encrypts plaintext webhook HMAC secrets (BUG-2057). Called on startup when an encryption key is configured. It handles two
internal/store/encryption.go:165
↓ 4 callers
Method
ExportWorkspace
ExportWorkspace exports all data for a workspace into a portable format.
internal/store/export.go:66
↓ 4 callers
Function
ExtractItemDecisionLog
(fieldsJSON string)
internal/models/item.go:348
↓ 4 callers
Function
ExtractWorkspaceContext
(raw string)
internal/models/workspace_settings.go:118
↓ 4 callers
Method
FTSRank
FTSRank returns the column/expression for full-text relevance ranking. SQLite: rank (built-in FTS5 column) — consumes ZERO args. PostgreSQL: ts_rank b
internal/store/dialect.go:99
↓ 4 callers
Function
FindAgent
FindAgent returns the matching Agent for a name or alias. Names are case-insensitive (Claude / claude / CLAUDE all resolve).
internal/mcp/install.go:118
↓ 4 callers
Function
GenerateUsername
--- Username backfill --- GenerateUsername derives a URL-safe username from a display name. Falls back to the email local part if the name produces an
internal/store/users.go:1053
↓ 4 callers
Method
GetChildItemsForParents
GetChildItemsForParents returns the live child items for each of the given parent item IDs, grouped by parent ID, in ONE query — collapsing the per-pa
internal/store/items.go:3984
↓ 4 callers
Method
GetDeletedWorkspaceBySlug
GetDeletedWorkspaceBySlug returns a SOFT-DELETED workspace by slug (deleted_at IS NOT NULL), including its owner_id, or nil when no such row exists (l
internal/store/workspaces.go:307
↓ 4 callers
Method
GetInvitationByCode
GetInvitationByCode retrieves a pending invitation by its join code. Looks up by SHA-256 hash first (new invitations), then falls back to plaintext lo
internal/store/workspace_members.go:688
↓ 4 callers
Method
GetUserByUsername
GetUserByUsername retrieves a user by username (case-insensitive).
internal/store/users.go:146
↓ 4 callers
Method
GetView
GetView returns a single view by ID.
internal/store/views.go:47
↓ 4 callers
Method
GetWebhook
GetWebhook retrieves a single webhook by ID.
internal/store/webhooks.go:40
↓ 4 callers
Function
GroupTemplatesByCategory
GroupTemplatesByCategory returns the visible workspace templates grouped by category in the canonical CategoryOrder. Categories with no visible templa
internal/collections/templates.go:66
↓ 4 callers
Method
HasEncryptionKey
HasEncryptionKey reports whether an encryption key is configured.
internal/store/encryption.go:24
↓ 4 callers
Function
IsDiffSmaller
IsDiffSmaller returns true if storing a diff would be meaningfully smaller than storing the full content. Returns false for near-complete rewrites whe
internal/diff/diff.go:45
↓ 4 callers
Method
IsWorkspaceMember
IsWorkspaceMember checks if a user is a member of a workspace.
internal/store/workspace_members.go:593
↓ 4 callers
Method
ListAgentRoles
(workspaceID string)
internal/store/agent_roles.go:63
↓ 4 callers
Method
ListAgentRoles
--- Agent Roles --- ListAgentRoles returns all agent roles for a workspace.
internal/cli/client.go:660
↓ 4 callers
Method
ListCollectionsMinimal
ListCollectionsMinimal returns collection rows populated with just the fields needed for done-detection context and slug lookups: ID, Slug, Schema, Se
internal/store/collections.go:176
↓ 4 callers
Method
ListVersions
(documentID string)
internal/store/versions.go:73
↓ 4 callers
Method
ListWebhooks
(workspaceID string)
internal/webhooks/dispatcher.go:61
↓ 4 callers
Method
ListWorkspaceActivity
(workspaceID string, params models.ActivityListParams)
internal/store/activities.go:359
↓ 4 callers
Method
ListWorkspaceMembers
--- Workspace Members --- ListWorkspaceMembers returns all members of a workspace.
internal/cli/client.go:647
↓ 4 callers
Method
LookupEmailVerification
LookupEmailVerification performs a read-only validation of a verification token and returns the associated user WITHOUT consuming the token. Mirrors L
internal/store/email_verification.go:62
↓ 4 callers
Function
LookupMIME
LookupMIME returns the entry for a MIME type if it is on the allowlist, or (zero, false) if rejected.
internal/attachments/mime.go:135
↓ 4 callers
Function
MCPTokenIdentityFromContext
MCPTokenIdentityFromContext returns (kind, ref) attached by WithMCPTokenIdentity, or ("", "") if none was set. The audit middleware uses this to popul
internal/server/context.go:180
↓ 4 callers
Function
MetricsMiddleware
MetricsMiddleware returns a chi middleware that records Prometheus metrics for every HTTP request: count, duration, and response size. Path labels us
internal/server/middleware_metrics.go:19
↓ 4 callers
Function
NewInstrumentedBus
NewInstrumentedBus wraps an EventBus with Prometheus instrumentation.
internal/metrics/instrumented_bus.go:22
↓ 4 callers
Function
NewPostgres
NewPostgres creates a Store backed by PostgreSQL. The connStr should be a PostgreSQL connection string (e.g. "postgres://user:pass@host/db").
internal/store/store.go:232
↓ 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:732
↓ 4 callers
Method
SetEventBus
SetEventBus attaches an event bus for real-time SSE streaming.
internal/server/server.go:675
↓ 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
SetRestoreBoundary
SetRestoreBoundary records a restore boundary for itemID, keeping the stored value monotonically non-decreasing (a later restore always has a higher o
internal/collab/manager.go:151
↓ 4 callers
Method
SetSSELimits
SetSSELimits configures global and per-workspace SSE connection limits. A value of 0 means unlimited.
internal/server/server.go:896
↓ 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
Function
TokenScopesFromContext
TokenScopesFromContext returns the JSON-encoded scopes attached by WithTokenScopes, or "" if none. Empty maps to "unrestricted" in TokenScopeAllows (t
internal/server/context.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:1880
↓ 4 callers
Method
Validate
(string)
cmd/pad/cmd_server.go:1046
↓ 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
Method
addConn
addConn registers a freshly-built roomConn with the room. Cancels any pending grace timer (a reconnect within the window keeps the Room alive) and ret
internal/collab/room.go:282
↓ 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:366
↓ 4 callers
Function
assertItemContent
(t *testing.T, srv *Server, itemID, want string)
internal/server/handlers_items_collab_versions_test.go:631
↓ 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
Function
authHeaders
(fixture: SuiteFixture)
web/e2e/pane-full-page-host.spec.ts:25
↓ 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:3581
↓ 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
Method
bumpStructuralLinkSourceTx
bumpStructuralLinkSourceTx advances the source row whenever a parent or implements edge changes. Callers must already hold the workspace seq lock on P
internal/store/items.go:3223
↓ 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:476
↓ 4 callers
Function
containsWorkspace
(list []models.Workspace, id string)
internal/server/handlers_workspaces_test.go:134
↓ 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
currentPaneState
Current pane depth+ownership, read from SvelteKit `page.state`.
web/src/lib/collections/paneHostController.ts:119
↓ 4 callers
Function
cursorAsNum
* Cursors are decimal-encoded `seq` values as opaque strings — but * "monotonic forward" needs a numeric compare, not lexicographic. * Treat empty /
web/src/lib/stores/localIndex.svelte.ts:197
↓ 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:333
↓ 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:1732
↓ 4 callers
Function
ensureState
(ws: string)
web/src/lib/stores/localIndex.svelte.ts:143
↓ 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
← previous
next →
701–800 of 6,412, ranked by callers