MCPcopy Create free account

hub / github.com/PerpetualSoftware/pad / functions

Functions8,091 in github.com/PerpetualSoftware/pad

↓ 4 callersMethodCheckUserLimit
CheckUserLimit checks a user-level limit (not workspace-scoped), such as total workspace count or total API tokens.
internal/store/limits.go:139
↓ 4 callersFunctionCleanup
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 callersFunctionCopyCommitted
CopyCommitted reports whether err is a post-commit reporting failure — the copy happened, only its result was lost. Callers must not present these as
internal/cli/client_items_copy.go:305
↓ 4 callersMethodCopyItemPreflight
CopyItemPreflight runs the DRY RUN. It mutates nothing in the copy's own domain, so it is safe to call repeatedly and safe to retry. Returns the deco
internal/cli/client_items_copy.go:251
↓ 4 callersMethodCreateAuthorizationCode
============================================================ Authorization codes (handler/oauth2/storage.go AuthorizeCodeStorage) ====================
internal/store/oauth.go:261
↓ 4 callersFunctionCreatePatch
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 callersFunctionCreateReversePatch
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 callersMethodCreateView
CreateView adds a new saved view.
internal/store/views.go:11
↓ 4 callersMethodEncryptWebhookSecretsAtRest
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 callersFunctionExtractItemDecisionLog
(fieldsJSON string)
internal/models/item.go:426
↓ 4 callersFunctionExtractWorkspaceContext
(raw string)
internal/models/workspace_settings.go:118
↓ 4 callersMethodFTSRank
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 callersFunctionFindAgent
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 callersFunctionGenerateUsername
--- 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 callersMethodGetAgentRole
(workspaceID, idOrSlug string)
internal/store/agent_roles.go:39
↓ 4 callersMethodGetChildItemsForParents
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:4238
↓ 4 callersMethodGetCollectionAnyState
GetCollectionAnyState is GetCollection without the `deleted_at IS NULL` filter — used by the open-children guard (IDEA-1494 R3 P3) so a child still at
internal/store/collections.go:188
↓ 4 callersMethodGetDeletedWorkspaceBySlug
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 callersMethodGetInvitationByCode
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 callersFunctionGetLibraryPlaybook
GetLibraryPlaybook finds a playbook in the library by its title. Returns nil if no playbook with the given title exists.
internal/collections/playbook_library.go:80
↓ 4 callersMethodGetUserByUsername
GetUserByUsername retrieves a user by username (case-insensitive).
internal/store/users.go:146
↓ 4 callersMethodGetView
GetView returns a single view by ID.
internal/store/views.go:47
↓ 4 callersMethodGetWebhook
GetWebhook retrieves a single webhook by ID.
internal/store/webhooks.go:40
↓ 4 callersFunctionGroupTemplatesByCategory
GroupTemplatesByCategory returns the visible workspace templates grouped by category in the canonical CategoryOrder. Categories with no visible templa
internal/collections/templates.go:66
↓ 4 callersMethodHasEncryptionKey
HasEncryptionKey reports whether an encryption key is configured.
internal/store/encryption.go:24
↓ 4 callersFunctionIsDiffSmaller
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 callersMethodListAgentRoles
(workspaceID string)
internal/store/agent_roles.go:63
↓ 4 callersMethodListAgentRoles
--- Agent Roles --- ListAgentRoles returns all agent roles for a workspace.
internal/cli/client.go:811
↓ 4 callersMethodListCollectionsMinimal
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:218
↓ 4 callersMethodListItemsChangesSince
ListItemsChangesSince returns the skinny-projection of items that have mutated (create / update / soft-delete / restore) since the given seq cursor, i
internal/store/items.go:1424
↓ 4 callersMethodListVersions
(documentID string)
internal/store/versions.go:73
↓ 4 callersMethodListWebhooks
(workspaceID string)
internal/webhooks/dispatcher.go:61
↓ 4 callersMethodListWorkspaceMembers
--- Workspace Members --- ListWorkspaceMembers returns all members of a workspace.
internal/cli/client.go:798
↓ 4 callersMethodLookupEmailVerification
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 callersFunctionMCPTokenIdentityFromContext
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 callersFunctionMetricsMiddleware
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 callersFunctionNewInstrumentedBus
NewInstrumentedBus wraps an EventBus with Prometheus instrumentation.
internal/metrics/instrumented_bus.go:22
↓ 4 callersFunctionNewPostgres
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 callersFunctionNewSharedWorkspaceState
NewSharedWorkspaceState returns a state for a multi-user process (the cloud /mcp transport). It records Set/Get like any other state, but ResolveDefau
internal/mcp/workspace.go:66
↓ 4 callersMethodNewWatchEventsStreamRequest
NewWatchEventsStreamRequest builds an authenticated GET request for GET /api/v1/events/stream (TASK-2533), used by `pad watch --stream --for-session`.
internal/cli/client.go:401
↓ 4 callersFunctionNormalizeAudience
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 callersMethodPing
Ping verifies the database connection is alive.
internal/store/store.go:270
↓ 4 callersMethodPublicLinkBaseURL
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 callersFunctionRemovePadEntry
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 callersMethodResize
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 callersMethodResolveUserPermission
ResolveUserPermission resolves the effective permission for a user on a specific item, following the permission resolution order from DOC-406: 1. Owne
internal/store/grants.go:279
↓ 4 callersMethodRevokeAccessToken
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 callersMethodRevokeUserOAuthConnection
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 callersMethodRotateAPIToken
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 callersMethodSetImageProcessor
SetImageProcessor wires the image processor that the upload handler uses to derive thumbnail variants (TASK-878). Optional — without it uploads still
internal/server/server.go:823
↓ 4 callersMethodSetOAuthServer
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 callersMethodSetRestoreBoundary
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 callersMethodSetSSELimits
SetSSELimits configures global and per-workspace SSE connection limits. A value of 0 means unlimited.
internal/server/server.go:977
↓ 4 callersMethodSetTokenReaperConfig
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 callersMethodSetToolSurfaceHandler
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 callersMethodStartTokenReaper
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 callersFunctionStatusColor
StatusColor returns a *color.Color appropriate for the given status string.
internal/cli/format.go:28
↓ 4 callersFunctionToItemSummaries
ToItemSummaries projects a slice of items into summary shape, preserving order. A nil input yields a non-nil empty slice so the JSON encodes as `[]`.
internal/cli/item_summary.go:120
↓ 4 callersFunctionTokenScopesFromContext
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 callersMethodUninstall
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 callersMethodValidate
(string)
cmd/pad/cmd_server.go:1065
↓ 4 callersFunctionValidateWebhookURL
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 callersFunctionWithMCPTokenIdentity
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 callersMethodWorkspaceID
WorkspaceID is a nil-safe accessor for the resolved workspace's ID.
internal/server/authz_cross_workspace.go:171
↓ 4 callersMethodWorkspaceSlug
WorkspaceSlug is a nil-safe accessor for the resolved workspace's canonical slug — the value the token allow-list was tested against.
internal/server/authz_cross_workspace.go:180
↓ 4 callersMethodaddConn
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 callersFunctionasOpenChildrenGuardError
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 callersFunctionassertAttachmentDisposition
(t *testing.T, rr *httptest.ResponseRecorder, wantPrefix string)
internal/server/handlers_attachments_download_mime_test.go:112
↓ 4 callersFunctionassertDisclosesNothing
assertDisclosesNothing checks a refusal body for anything that would confirm the source item exists or reveal the destination schema.
internal/server/handlers_items_copy_preflight_test.go:819
↓ 4 callersFunctionassertItemContent
(t *testing.T, srv *Server, itemID, want string)
internal/server/handlers_items_collab_versions_test.go:631
↓ 4 callersFunctionassertNoWatchEventForRef
assertNoWatchEvent drains ch for `d` and fails if a "notification" event with the given item_ref shows up — used to assert an unwatched item's mutatio
internal/server/handlers_watch_events_test.go:103
↓ 4 callersMethodattachmentCallerIsRestricted
attachmentCallerIsRestricted reports whether the caller's access to the workspace is narrowed to specific collections or items rather than being full
internal/server/attachments_authz.go:118
↓ 4 callersFunctionattachmentItemID
attachmentItemID reads back the persisted item_id for an attachment, returning "" for a NULL association.
internal/server/handlers_attachments_test.go:350
↓ 4 callersFunctionauditedMCPServer
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 callersFunctionauthHeaders
(fixture: SuiteFixture)
web/e2e/pane-full-page-host.spec.ts:25
↓ 4 callersMethodautoCreateWorkspace
--- 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 callersFunctionbuild
(html: string)
web/src/lib/attachments/editorOwnedImage.svelte.test.ts:21
↓ 4 callersFunctionbuildBootstrapURL
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 callersMethodbuildChildrenDoneExpr
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:3835
↓ 4 callersMethodbuildDashboardResponse
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 callersFunctionbuildReconcileFindings
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 callersMethodbumpStructuralLinkSourceTx
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:3477
↓ 4 callersFunctionbytes32
===================================================================== Helpers ===================================================================== by
internal/oauth/server_test.go:922
↓ 4 callersFunctionbytes32ForTest
()
internal/server/handlers_oauth_test.go:77
↓ 4 callersFunctioncallWorkspaceViaOAuth
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:1794
↓ 4 callersFunctionchdir
(t *testing.T, dir string)
internal/cli/agent_identity_test.go:80
↓ 4 callersFunctionclearCSRFCookie
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 callersMethodcomputeSSEVisibility
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 callersMethodconnect
()
web/src/lib/collab/wsProvider.svelte.ts:653
↓ 4 callersFunctioncontainsWorkspace
(list []models.Workspace, id string)
internal/server/handlers_workspaces_test.go:134
↓ 4 callersFunctioncounterValue
counterValue is a tiny helper that pulls the float value out of a Prometheus counter.
internal/server/middleware_mcp_metrics_test.go:205
↓ 4 callersFunctioncreateChildItem
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 callersFunctioncreateCmd
--- create ---
cmd/pad/cmd_item.go:169
↓ 4 callersFunctioncurrentPaneState
Current pane depth+ownership, read from SvelteKit `page.state`.
web/src/lib/collections/paneHostController.ts:119
↓ 4 callersFunctioncursorAsNum
* 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 callersFunctiondecodeAttributionBody
(t *testing.T, rr *httptest.ResponseRecorder, out any)
internal/server/handlers_items_attribution_test.go:127
↓ 4 callersFunctiondialWSSince
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 callersFunctiondispatch
( api: Api, wsSlug: string, _isReadOnlyAction: (toolName: string, action: string) => boolean | undefined,
web/src/lib/webmcp/dispatch.ts:611
↓ 4 callersFunctiondisplayFilename
(filename: string | null | undefined)
web/src/lib/attachments/display.ts:41
↓ 4 callersFunctiondoAuthedDeleteWithCSRF
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
← previousnext →901–1,000 of 8,091, ranked by callers