Skip to content
GitHub

DevelopCore & contracts

@holtkeeper/api

The HTTP contract between the server and its clients (web UI, CLI): request and response types for every endpoint, plus small pure helpers both sides use. It contains no server code and is safe to bundle for browsers.

  • emptySeverities() — severity counts with every severity at zero.
  • mcpToolsetCatalog, mcpToolsetNames, defaultMcpToolsets, isMcpToolsetName (mcp.ts) — the MCP toolsets a token can be given or denied (McpToolsetName), with labels, descriptions and whether new tokens get them (McpToolsetInfo.defaultOn; Assets, QA tasks and Releases are off). The server resolves tokens against it and the web app draws the choice from it.
  • sourceInfo(source) — which package manager and language a finding’s file belongs to (pnpm-lock.yaml → pnpm / JavaScript, go.mod → Go modules / Go, uv.lock → uv / Python, …). This is what makes reports look the same for every ecosystem.
  • Re-exported from @holtkeeper/access so clients need no second import: the path helpers of @holtkeeper/access/paths (splitPattern, hasWildcard, isExactPattern, globMatches, patternMatches, patternWithin, pathAncestors, parentFolder, commonFolder, folderPattern, sharedShape; all pure JavaScript, so they run in the browser), TEAM_KEY_PATTERN with the TeamMember and TeamRole types of @holtkeeper/access/teams, and roleOf / Role. The old group helpers (GROUP_KEY_PATTERN, groupLineage, isSubgroup, leafGroups, parentGroup, rootGroup, GroupMatch) are gone: folders replace subgroups.

The types of the Settings endpoints sit in one file per area, each exported from index.ts: settings-people.ts (PeopleSummary), settings-ai.ts (Settings › AI and Integrations: AiBudgetOverview, AgentToolList, IntegrationForgeList), settings-analyzers.ts (AnalyzerHealthList of GET /api/jobs/analyzers/health, PolicyDraftInput/PolicyDraftResult of POST /api/settings/draft, CommitConventionsCheckInput/CommitConventionsCheckResult of POST /api/commit-conventions/check) and settings-system.ts (SystemHealth of GET /api/system/health, HistorySummary of GET /api/history/summary, AuditVerifyLast of GET /api/audit/verify/last). Fields shared views gain for Settings (MeResponse.version/publicUrl, UserView.lastSeenAt/invite/teams/creator, CredentialView.usedBy/lastUsedAt) are optional, so a server that does not fill them yet still matches. InboxBudgetItem (kind: 'budget') is the weekly AI budget warning.

GET /api/config/<collection>, GET /api/config/<collection>/:id and PUT /api/config/<collection>/:id serve the panel’s config documents; the collections are forges, teams, repo-traits, schedules and triggers (ConfigEntryList, ConfigEntryDetail, ConfigEntryView, ConfigViewData, PutConfigInput). A team (TeamConfigView, the store’s TeamDocumentData) has a flat key (TEAM_KEY_PATTERN), an optional title, the path patterns it owns minus exclude, the patterns it consumes and its members (TeamMember { id, role }); PutConfigInput.team may leave exclude, consumes and members out. Forge entries carry the fleet’s include / exclude path globs; schedules and triggers target teams and repos (path patterns). See Teams and paths.

Endpoint Types
GET /api/me MeResponse
GET /api/repos RepoList
GET /api/dependencies DependencyTable
GET /api/dependencies/library?ecosystem=&name= DependencyDetail
GET /api/dependencies/upgrade?ecosystem=&name=&from=&to= DependencyUpgrade
GET /api/dependencies/docs?q=&ecosystem=&name= LibrarySearchResult
GET /api/dependencies/api?ecosystem=&name= DependencyApi
GET /api/stack StackOverview (StackTeamView, StackTool, StackCycle, StackUse, StackConventionResult)
GET /api/audits/findings FindingsResponse (FindingGroup, FindingRepo, FindingStatus)
GET /api/audits/fixes?ids=&repos= AuditFixesResponse (AuditRepoFixes)
GET /api/licenses LicensesOverview (LicenseViolation, LicensesRepoRow, LicensePolicySummary, LicenseVerdictName)
GET /api/api-surface/packages?q=&repo=&kind=, GET /api/api-surface/search?q=&package=&kind=&repo=&subpath=&match=&limit= PublicApiPackageList, PublicApiSearchResult (PublicApiSymbolHit, PublicApiFacets, PublicApiMatch)
GET /api/api-surface/symbol?package=&name=&subpath=&version=&repo=&limit= PublicApiSymbol (PublicApiSymbolChange)
GET /api/system/library-index, POST /api/system/library-index/reindex LibraryIndexStatus, LibraryReindexResult
GET /api/system/library-index/github GitHubTokenUsage
GET /api/ci CiOverview
GET /api/repos/overview?repo= RepoOverview (RepoOverviewCard, RepoReviewTotals, RepoWorkSummary, RepoAccessSummary)
GET /api/repos/updates?repo=, POST /api/repos/updates/poll, POST/DELETE /api/repos/updates/webhook RepoUpdatesView (WebhookDeliveryView, PollAttemptView), RepoPollResult, RepoWebhookInput
GET /api/repos/updates/fleet/:forge, POST /api/repos/updates/fleet/:forge/list FleetListingView (ListingAttemptView)
POST /api/forges/:id/repositories/access RepoAccessBatchInput → RepoAccessBatch (RepoAccessResult, RepoAccessStatus)
GET /api/ci/repo?repo= CiRepoView
GET /api/ci/jobs?repo= CiJobsView (CiJobRow, CiJobOutcomes)
GET /api/bundles BundlesOverview (BundlesRepoRow, BundleTargetRow, BundleSizePoint)
GET /api/assets?team=&repo=&status=&kind=&problem=&format=&sort=&cursor=&limit= AssetsQuery → AssetsOverview (AssetsRepoSummary, AssetsOverviewRow, AssetsStatusFilter, AssetsSort)
GET /api/reviews?repo=&team=&verdict=&since=&before=&limit=, GET /api/reviews/:id ReviewQuery → ReviewList (ReviewRow, ReviewFindingCounts), ReviewDetail (ReviewFindingView)
GET /api/branches BranchesOverview (BranchesRepoRow, BranchAuthorRow, BranchRow, BranchCleanupReason)
GET /api/analyses/:id?compare= AnalysisDetail (AnalysisJobSummary)
POST /api/media/variants MediaVariantsInput → MediaVariantsResult
GET/POST /api/credentials, PATCH/DELETE /api/credentials/:id, POST /api/credentials/:id/rotate CredentialList, CreateCredentialInput, UpdateCredentialInput, CredentialView
GET/PUT /api/settings, DELETE /api/settings/:id, GET /api/settings/resolve?repo=|team= SettingList (SettingDefinitionView), PutSettingInput, SettingView, ResolvedSettings (ResolvedSettingRow, SettingSource, SettingLayer)
GET /api/history, GET /api/history/scope HistoryList, HistoryScope, PersonView
/auth/users/admin/users..., /auth/users/link/:token UserList, InviteUserInput, UpdateUserInput, LinkResponse, LinkInfo
GET /api/home HomeView (HomeAttentionItem, HomeChange, HomeSpend, HomeAttentionAction)
GET /api/inbox, GET /api/inbox/count InboxFeed (InboxItem, InboxKind), InboxCount
GET/POST/DELETE /api/me/snoozes SnoozeList, SnoozeInput (Snooze)
GET /api/qa/tasks?days=&team=, GET /api/qa/task?key=, POST /api/qa/summary QaTaskList (QaTaskRow, QaChangeCounts), QaTaskView (QaChangeView, QaSummaryView), QaSummaryInput → QaSummaryView
POST /api/releases/dismiss, POST /api/audits/allowlist/renew ReleaseDismissInput, AllowlistRenewInput → SettingView
GET /api/ai/overview?period=&teams=, GET /api/ai/week?week=&teams= AiUsageOverview (AiUsagePeriod, AiBudgetStatus, AiSpendForecast), AiWeekBreakdown
POST /api/credentials/:id/test CredentialTestInput → CredentialTestResult
GET /api/jobs, GET /api/jobs/failures, GET /api/jobs/targets JobList, JobFailureList, JobTargetList
GET /api/jobs/count JobCountView
GET /api/jobs/:id/why, GET /api/jobs/:id/log, GET /api/jobs/:id/runs JobWhy, JobLog, JobRunList
GET /api/jobs/:id/transcripts/:ref, GET /api/chat/messages/:id/transcript AgentTranscriptView
GET/POST /api/chat/threads, GET/PATCH /api/chat/threads/:id ChatThreadList, ChatThreadInput, ChatThreadPatchInput, ChatThreadView
GET /api/chat/threads/:id/people ChatPeopleView
GET/POST /api/chat/threads/:id/messages ChatMessageList, ChatPostInput → ChatPostResult
POST /api/chat/threads/:id/read, GET /api/chat/unread ChatReadInput, ChatUnreadView
GET /api/chat/threads/:id/context, GET /api/chat/threads/:id/export (text/markdown) ChatThreadContextView (ChatContextParticipantView)
GET /api/rules?team=&repo=&text=, GET /api/rules/:id RuleList (RuleView, canCreate), RuleDetail (history: RuleRevision[])
POST /api/rules, PUT /api/rules/:id, DELETE /api/rules/:id RuleInputBody (RuleContent plus version on PUT) → RuleView; 409 when version is stale
GET /api/rules/effective?repo=&agent=&files= EffectiveRules (ResolvedRules: RuleBlock, RequestedRule, RuleBudget)
GET /api/learnings?status=&origin=&repo=&text= LearningList (LearningView with canEdit, expiresAt; people)
POST /api/learnings, PATCH /api/learnings/:id LearningCreateBody → LearningCreateResult, LearningPatch → LearningView
POST /api/learnings/:id/approve, POST /api/learnings/:id/reject, DELETE /api/learnings/:id LearningView; delete answers 204
GET /api/learnings/reactions?repo= ReactionTotalsList

RepoSummary carries the repository’s health: health (RepoHealthStatus: healthy, warnings, failing or not-analysed, over the cells the caller may read), cells (RepoHealthCells, each a RepoHealthCell { value, sub, tone } with HealthTone ok, warn, bad, info or none; security needs audits:read, release releases:read, the rest analyses:read, and a cell the caller may not read is absent), freshness (RepoFreshness { current, total }) and lastAnalysedAt with analyses:read, updates (RepoUpdatesSummary { via, intervalMs?, lastPolledAt?, lastError? }) with settings:read on the repository, latestAudit (SecuritySummary: the headline numbers of the newest audit record) with audits:read, and configurable with settings:write. DependencyTable has one row per library the caller’s catalog reach uses (direct dependencies of the newest depgraph records and imports of the newest usages records), with versions per repository, latest, how far behind, advisories, licenses and Renovate state, plus the repositories with their owner teams; repositories are named forge:path. MeResponse.crossTeam is the access.crossTeam level, so clients know whether any read grant reaches the catalog. MeResponse.teamTitles maps team keys to their display titles (only titled teams the principal may know about: all with global settings:read, otherwise those its grants name, those it is a member of and the owner teams of its listed repositories; empty when signed out); clients show the title wherever a team appears and keep the key as its identity. TeamDocumentData.title is that optional display name. UserPreferences.homeTeams (GET/PUT /api/me/preferences) are the team keys the My teams scope shows, a UI default and never a permission; homeTeamsFromMembership says they come from membership and grants because the principal never picked any (homeTeams: null in UserPreferencesInput goes back to that).

Supply chain endpoints answer from stored metrics of the newest records and only for repositories the caller may read. FindingsResponse groups the newest audit of each repository by advisory and package: a FindingGroup lists its repos (FindingRepo with versions, sources and its own FindingStatus), fixedIn, firstSeenAt (when an audit first reported it, or the record time where no first sighting was stored) and a group status that is open while any repository has it open, else fixing (with taskId) while an approved, queued, running or mr-open dependency-upgrade task upgrades that package, else allowlisted while an unexpired allowlist entry hides it; severities counts groups of every status. LicensesOverview has kpi totals (package and internal counts and the license mix add up each repository’s counts, so a package used by two repositories counts twice; verdict and license counts are distinct across the fleet), the license mix, violations (worst verdict across repositories: denied, unlisted meaning needs review, or unknown), one LicensesRepoRow per repository with counts per LicenseVerdictName, the organization-wide policy with the number of narrower overrides (only for callers who may read the organization’s analyzers.licenses entry). DependencyApi says where an internal package is defined (definedIn) and counts its exports and documented ones; DependencyDetail also answers for an internal package only the public API catalog knows, with empty lists, and leaves upgrade readiness to GET /api/dependencies/upgrade. StackTool.cycles lists the component’s release lines (StackCycle) when its lifecycle is known.

Public API lists carry facets (PublicApiFacets: kinds, packages and repositories, plus subpaths and match kinds for search) counted before the facet filters apply. Every search hit says how it matched (PublicApiMatch: exact, prefix, part, doc), whether the symbol is deprecated, whether its package was removed and the release ref it was read from; a package summary has match when the list was filtered by q. PublicApiSymbol is one symbol in full with a history capped at limit versions (default 20, at most 100) of the recorded versions where it was added, changed, deprecated or removed (capped says older versions were left out).

SettingDefinitionView.default is what applies where no entry covers a repository (null when nothing applies until someone sets the key). ResolvedSettings is for one focus, a repository (repo) or a team (team, standing for an owned repository no narrower entry names), and keeps settings (winner per key with an entry) and cascade (every covering entry per key) and adds rows: one ResolvedSettingRow { key, label, section, value, source, replaces?, entry?, overrides } per defined key, in definition order. source is a SettingSource { layer, teams?, entry? } with SettingLayer default, org (an entry for everything), team (teams names the focus’s teams the entry matched) or repo (a path pattern matched); replaces is the next broader source with its value, the default when nothing broader covers the focus, absent when the default wins; overrides counts the broader entries the winner beats. Retired keys, keys without a definition, secret settings and releases.notify get no row, a global key only shows org or default, and analyzers.<kind> is one row whose entry applies as a whole, never merged field by field. It needs settings:read on the repository or the team.

InboxItem is a union on kind (task, learning, release, allowlist, budget); every item has a stable id (<kind>:<source id>, also what a snooze names), scope as people read it, repos, href, createdAt, snoozed and the ids a decision needs (groupId, learningId with origin and activeAt for a pending learning, repo with head and can, settingId with the allowlist entry and expires). InboxFeed.mine holds what the caller may decide in their home teams and teams the rest; without home teams everything is in mine. InboxCount leaves snoozed items out. Inbox decisions are not available through MCP.

ReleaseCard.can is computed per caller (accept and run need releases:run; Accept is offered only with can.accept), head is the commit a dismissal names and dismissed holds until a new commit arrives. HomeAttentionItem.snoozed marks items the caller snoozed.

Comparing two refs of a repository: ReleaseCompareRefs (GET /api/releases/refs) lists what a comparison can name (version tags newest first as ReleaseCompareVersion, the target and source branches); ReleaseCompareView (GET /api/releases/compare) is RangeChanges of @holtkeeper/release with the resolved from/to, plus dependencies (DependencyDiff of @holtkeeper/dep-diff, whose types are re-exported here so the web app needs no other import; null with dependenciesUnavailable when they could not be read) and summaryAvailable; ReleaseCompareSummaryInput starts or joins the AI description (POST /api/releases/compare/summary), which runs in the background; ReleaseCompareSummaryState is where it stands (GET and POST: none, running, done with the Markdown, failed with the error) and ReleaseCompareSummary a finished description. ReleaseCompareApi (GET /api/releases/compare/api) is how the public API of the repository’s own packages changed between the two ends, one ReleaseCompareApiPackage per changed package (PackageDiff of @holtkeeper/api-surface, its Markdown and the uses in other repositories it touches), with packages lacking a record at one end in missing, recorded, whether the caller may backfill and the snapshots (ReleaseCompareSnapshot: the queued, running or recently failed api-surface job of each ref to snapshot); ReleaseComparePackage (GET /api/releases/compare/package) is what changed in one dependency between two versions, as the package_changes MCP tool renders it. ReleaseCompareCheck (GET /api/releases/compare/check) is where the AI breaking-change check of the range stands (none, queued, running, failed, done, with the job, the analysis and its UpgradeCheckData); ReleaseCompareCheckInput and ReleaseCompareCheckStart queue one (POST /api/releases/compare/check). UpgradeCheckData, UpgradeFinding, UpgradeSeverity and UpgradeVerdict are re-exported from @holtkeeper/upgrade-check.

AiUsageOverview reports one period (week, month or 30d): current from its start to now and comparison over the same elapsed span of the previous period. Spend forecasts (AiSpendForecast, AiBudgetStatus.forecastUsd, HomeSpend.forecastUsd) are this week so far plus the mean of the rest of the week over the last 4 full weeks, never a linear projection; automaticStopsAt is when automatic work is expected to reach the budget minus its reserve.

Phase-19 views state their guarantees in TSDoc. ChatThreadView.contextRepos and ChatMessageView.refs only carry repositories the caller may read; ChatThreadContextView.costUsd is present only with ai:read, and the repositories the caller may not read are only counted (hiddenRepoCount). ChatThreadList.archivedCount counts visible archived threads matching q. Task cards in ChatMessageView.card leave out the steps and merge requests of repositories the caller may not read, and a task in none of the caller’s repositories reads as a neutral line. ChatThreadPatchInput.muted is per caller. RuleView.canEdit and LearningView.canEdit say whether the caller holds knowledge:write over the scope; lists only carry rules and learnings whose scope the caller may read. LearningView.status is brought up to the time of the request (a learning past its approval delay reads active), and expiresAt is set for active ones. EffectiveRules is exactly what the resolver hands an agent run of agent on repo: every block considered in prompt order with chars, fullChars and cut, the rules offered by description (requested), warnings and the budget used. Rule, RuleContent, RuleRevision, RuleAgent, Learning, LearningSource, LearningStatus and LearningOrigin come from @holtkeeper/store, ResolvedRules, RuleBlock, RequestedRule, RuleBudget, RuleLayer, RuleActivation, RepoRuleFile and RepoRuleKind from @holtkeeper/rules.

ChatMessageList.cursor is the after of the next poll and serverTime its changedSince; a client advances the cursor only from message pages, never from a message it posted, and expects repeated messages because serverTime trails the clock.

RepoUpdatesView.webhook keeps the repository webhook’s last 50 deliveries, newest first (a rejected one has error and queued nothing), deliveries24h counts those of the last day and how many failed, and createdBy names who issued the URL. FleetListingView is the fleet listing of one forge: patterns are the fleet’s path globs there (fleetPatterns of @holtkeeper/core: forge includes plus team owns and consumes), repos the fleet repositories of the last successful listing. matched is what the patterns matched in that listing before exclude patterns, so a page can preview unsaved patterns; it is sent only to callers with global settings:write; nextAt is when the next scheduled listing is due.

Quality endpoints answer for repositories the caller may read, from stored metrics of a bounded number of the newest records; record data is read only for one repository or record. CiRepoCard carries the owner teams, status (CiStatus), flakyJobs, queueMedian and, only with releases:read on the repository while releases are on, releaseGate (CiReleaseGate). CiJobsView returns at most a fixed number of job rows over a bounded range; total and outcomes cover every job of the range. BundleTargetRow judges budget and verdict against the current analyzers.bundle options and carries the target’s series over the records read (BundlesRepoRow.records, about 20). AssetsOverview pages files: items is one page, total counts every match, nextCursor is present exactly when more pages follow, and repos ignores every filter but team and repo. ReviewList pages by nextBefore; ReviewRow.model and durationMs are absent and ruleSources empty for records made before they were stored. BranchesRepoRow.delta compares with the previous record’s metrics and is absent without one. AnalysisDetail.job names the job that produced the record, absent for uploads. MediaVariantsResult.exists says for every variant path whether it already exists at the ref.

Errors are ApiError { error } with status 400, 401, 403, 404, 410 or 500.

Every 403 is a ForbiddenError { error, missing: { action, target? } }: the Action the request needed and, when it was about one repository, target as the repo key (forge:path) the client sent. It never names teams or grants, and it reads the same whether that repository exists or the caller may not see it. MCP tool refusals carry the same body as structuredContent.

LinkInfo describes a live, unused setup or recovery link before sign-in: purpose, userName, expiresAt and grants: { count, role }, where LinkRole is the broadest preset the grants reach (viewer, developer, maintainer, admin); scopes, team names and who issued the link are never included. A used or expired link answers 410 with LinkGone { error, state: 'used' | 'expired', at }.