@theholocron/cli 5.0.0-alpha.55 → 5.0.0-alpha.551

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,697 +1,808 @@
1
- import { Analytics, Auth, AuthDescription, AuthEvent, AuthEventType, AuthIdentity, AuthUser, CARDINALITY, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, Ci, CiRun, CiRunFilter, CiRunStatus, ConnectionStringOptions, CreateAuthUserInput, DeployFunctionConfig, DeployFunctionResult, DeployScriptConfig, DeployScriptResult, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, Dns, DnsRecord, DnsRecordRequest, DnsRecordType, EnsureResult, Environment, EnvironmentReviewer, Environments, Errors, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, Logs, NormalizedAuthUser, Notifications, PagesConfig, ParseWebhookInput, ProviderApiError, ProviderIdentity, PullRequest, REQUIRED_CAPABILITIES, RepoRef, RepoSettings, ResolvedCapability, Ruleset, SecretScope, Secrets, Source, StatusCategory, Storage, StorageBranch, TeamEntry, TeamPermission, Tooling, ToolingDoctorReport, TrackerDoctorReport, TrackerUser, Vault, WebhookDashboardInfo, WebhookVerificationError, Wiki, WikiProvisionOpts, WikiProxyConfig, Workers, isMulti } from "./plugin/capabilities.mjs";
2
- import { AuthError, RequestOptions, ResolveTokenConfig as ResolveTokenConfig$1, ResolveTokenInput, RestClient, RestClientConfig, createRestClient } from "@theholocron/http-client";
3
- import { ConfigFileError } from "@theholocron/datapad";
4
- import { WorkspacePackage } from "@theholocron/astromech";
5
- import { LogLevel } from "@theholocron/observability/core";
6
- //#region src/auth/auth-resolver.d.ts
7
- type ResolveTokenConfig = Omit<ResolveTokenConfig$1, "getKeyringToken">;
8
- /** Wraps `createResolveToken` from `@theholocron/http` and injects the
9
- * system keyring so plugins stay at a one-liner call site. */
10
- declare function createResolveToken(config: ResolveTokenConfig): (input?: ResolveTokenInput) => string;
1
+ import { $ as CoverageUploadGroup, $i as ComposedPreset, $n as NotificationsDelivery, $r as Storage, $t as IssueCreateInput, A as Cache, Aa as RepoProperties, Ai as WikiProvisionOpts, An as MonitoringHeartbeatInput, Ar as RelaySourceMethods, At as EnsureWebhookResult, B as ConnectionStringOptions, Ba as ResolvedProvidersConfig, Bi as deriveStack, Bn as MonitoringIncidentUpdate, Br as Secrets, Bt as ErrorsOrgState, C as BoardState, Ca as OrgConfig, Ci as WebhookDashboardInfo, Cn as MonitoringAssertion, Cr as PullRequestChecksState, Ct as EnsureDiscussionInput, D as BoardTemplate, Da as RawProvidersConfig, Di as WikiNavigationState, Dn as MonitoringCheckInput, Dr as PullRequestPatch, Dt as EnsureRelaySourceResult, E as BoardSummary, Ea as RawProviderEntry, Ei as WikiInstanceState, En as MonitoringCheck, Er as PullRequestLink, Et as EnsureRelaySourceInput, F as CardinalityFor, Fa as RepoValidationConfig, Fi as Workers, Fn as MonitoringIncidentImpact, Fr as ResolvedCapability, Ft as EnvironmentEntry, G as CoverageConfigInput, Ga as TelemetryConfig, Gi as PackageJsonLike, Gn as MonitoringStatusPageResult, Gr as SourceCheckRunWrite, Gt as ImportOptions, H as Coverage, Ha as SingleEntry, Hi as readWorkspacePackageJsons, Hn as MonitoringIncidentWrite, Hr as Source, Ht as ExportInfo, I as Ci, Ia as RepoVariables, Ii as KNOWN_STACK_DEPS, In as MonitoringIncidentInput, Ir as Ruleset, It as EnvironmentReviewer, J as CoverageRepoReport, Ji as compose, Jn as NormalizedAuthUser, Jr as SourceRepoInfo, Jt as InspectRelayInput, K as CoverageExpectations, Ka as WorkflowWithConfig, Ki as StackName, Kn as MonitoringStatusPageState, Kr as SourceCommitStatus, Kt as ImportResult, L as CiRun, La as RepoVariablesSync, Li as deriveCapabilities, Ln as MonitoringIncidentQuery, Lr as SecretAccess, Lt as Environments, M as CapabilityImpls, Ma as RepoSecrets, Mi as WikiPublishedState, Mn as MonitoringHeartbeatUnit, Mr as RelayState, Mt as EnsuredResource, N as CapabilityKey, Na as RepoSecretsDeploy, Ni as WorkerDeploymentState, Nn as MonitoringHttpMethod, Nr as RepoRef, Nt as EnsuredTunnel, O as BoardTemplateFile, Oa as RepoConfig, Oi as WikiOrganizationState, On as MonitoringDashboardInput, Or as PullRequestResult, Ot as EnsureReport, P as Cardinality, Pa as RepoSecretsSync, Pi as WorkerScriptState, Pn as MonitoringIncident, Pr as RepoSettings, Pt as Environment, Q as CoverageUploadFlagResult, Qi as Capability, Qn as NotificationsChannelLayout, Qr as StatusCategory, Qt as IssueComment, R as CiRunFilter, Ra as ResolvedHolocronConfig, Ri as deriveCompliance, Rn as MonitoringIncidentResolveInput, Rr as SecretScope, Rt as Errors, S as BoardRule, Sa as MultiEntry, Si as Vault, Sn as MonitoringAlertSettings, Sr as PullRequestChecks, St as EmojiCheck, T as BoardStatusCategory, Ta as ProviderOptions, Ti as WikiInspection, Tn as MonitoringAssertionSource, Tr as PullRequestInput, Tt as EnsureRelayResult, U as CoverageConfigComponent, Ua as StorybookDeployProject, Ui as DeriveProfileInput, Un as MonitoringStatusComponentInput, Ur as SourceBranch, Ut as IdeaRecord, V as CoreIssueKind, Va as ResolvedTuple, Vi as missingCapabilities, Vn as MonitoringIncidentUpdateInput, Vr as ServerInspection, Vt as ErrorsProjectState, W as CoverageConfigDocumentation, Wa as TaskEntryConfig, Wi as HolocronProfile, Wn as MonitoringStatusPageInput, Wr as SourceCheckRun, Wt as Ideas, X as CoverageStatusInput, Xi as loadConfig, Xn as NotificationsAccess, Xr as SourceSecurity, Xt as Issue, Y as CoverageStatusContext, Yi as defineConfig, Yn as Notifications, Yr as SourceRulesetDetail, Yt as InspectRelaySourceInput, Z as CoverageTokenCheck, Zi as LoadedConfig, Zn as NotificationsApplicationLayout, Zr as SourceTeamMember, Zt as IssueClearable, _ as BoardFieldType, _a as EslintConfig, _i as ToolingWorkspaceState, _n as LogsDataset, _r as PagesConfig, _t as Dns, a as REQUIRED_CAPABILITIES, aa as resolvePluginPackage, ai as ToolingDoctorReport, an as IssuePriority, ar as NotificationsMonitoringFeed, at as DeployFunctionConfig, b as BoardPullRequest, ba as IdeasConfig, bi as TunnelRoute, bn as MonitoringAlertChannelResult, br as ProviderIdentity, bt as DnsRecordType, c as AddedItem, ca as AppConfig, ci as ToolingExportResult, cn as IssueSelector, cr as NotificationsPinnedLayout, ct as DeployScriptResult, d as AuthDescription, da as CredentialsConfig, di as ToolingOpenPlan, dn as IssueUpdateResult, dr as NotificationsRelaySource, dt as DeploymentProjectSettings, ea as TaskEntry, ei as StorageBranch, en as IssueEffort, er as NotificationsEveryoneLayout, et as CoverageUploadInput, f as AuthEvent, fa as DevConfig, fi as ToolingOpenWant, fn as Issues, fr as NotificationsServerLayout, ft as DeploymentRecord, g as BoardField, ga as EnvConfig, gi as ToolingWorkspaceSide, gn as Logs, gr as OrganizationSecretScope, gt as DiscussionPost, h as AuthUser, ha as DoctorConfig, hi as ToolingWorkspaceResult, hn as LifecycleSlot, hr as NotificationsWelcomeLayout, ht as DiscussionPatch, i as ProviderApiError, ia as resolveEntry, ii as Tooling, in as IssuePatch, ir as NotificationsMember, it as CredentialsInspection, j as CacheTokenCheck, ja as RepoProtection, ji as WikiProxyConfig, jn as MonitoringHeartbeatResult, jr as RelaySourceState, jt as EnsuredDiscussion, k as BoardView, ka as RepoLabels, ki as WikiProbe, kn as MonitoringDashboardState, kr as RelaySourceCapability, kt as EnsureResult, l as Analytics, la as CapabilityConfigPackage, li as ToolingOpenInput, ln as IssueTypeDeclaration, lr as NotificationsPrsFeed, lt as Deployment, m as AuthIdentity, ma as DocsConfig, mi as ToolingWorkspaceInput, mn as LifecycleResult, mr as NotificationsSignedIn, mt as DeploymentTrigger, n as ElevationRequiredError, na as credentialsEnvironment, ni as TeamEntry, nn as IssueKind, nr as NotificationsLayout, nt as CreateAuthUserInput, o as WebhookVerificationError, oa as AgentName, oi as ToolingExportInput, on as IssueRecord, or as NotificationsOnboardingLayout, ot as DeployFunctionResult, p as AuthEventType, pa as DevServeConfig, pi as ToolingWorkspaceFile, pn as LabelDef, pr as NotificationsSignIn, pt as DeploymentTarget, q as CoverageNameDiff, qa as EnvironmentLayer, qi as ConfigFileError, qn as MoveReport, qr as SourceFile, qt as InspectErrorsInput, r as MissingTokenError, ra as resolveConfig, ri as TeamPermission, rn as IssueOrder, rr as NotificationsLinksLayout, rt as Credentials, s as isMulti, sa as AgentOptions, si as ToolingExportIssue, sn as IssueSearchFilter, sr as NotificationsPicture, st as DeployScriptConfig, t as CARDINALITY, ta as ConfigError, ti as SyncResult, tn as IssueFields, tr as NotificationsForumTag, tt as CoverageUploadResult, u as Auth, ua as ChromaticProjectConfig, ui as ToolingOpenLaunch, un as IssueTypeInfo, ur as NotificationsReaction, ut as DeploymentProject, v as BoardItem, va as GitHubAppConfig, vi as TrackerDoctorReport, vn as Monitoring, vr as ParseWebhookInput, vt as DnsRecord, w as BoardStatus, wa as OrgIssueType, wi as Wiki, wn as MonitoringAssertionComparison, wr as PullRequestFields, wt as EnsureRelayInput, x as BoardPullRequestChecks, xa as LogConfig, xi as Tunnels, xn as MonitoringAlertChannelState, xr as PullRequest, xt as DuplicateDiscussion, y as BoardItemInput, ya as HolocronConfig, yi as TrackerUser, yn as MonitoringAlertChannelInput, yr as Projects, yt as DnsRecordRequest, z as CiRunStatus, za as ResolvedProviderEntry, zi as deriveProfile, zn as MonitoringIncidentStatus, zr as SecretVisibility, zt as ErrorsInspection } from "./index-jQQ8cGkA.mjs";
2
+ import { AuthError, ResolveTokenConfig as ResolveTokenConfig$1, ResolveTokenInput, ResolveTokenInput as ResolveTokenInput$1, resolveValue } from "@theholocron/kyber/secrets";
3
+ import { DocsCoverageMode } from "@theholocron/astromech";
4
+ import { CheckRow } from "@theholocron/kyber/ui";
5
+ import "@theholocron/env-utils/lookup";
6
+ import { RequestOptions, RestClient, RestClientConfig, createRestClient } from "@theholocron/http-client";
7
+ import "@theholocron/kyber/plugins";
8
+ import { GitExec } from "@theholocron/git-utils";
9
+ import { ConnectionProbeInput as ConnectionProbeInput$1 } from "@theholocron/kyber/checks";
10
+ import { Stats } from "node:fs";
11
+ import "@theholocron/observability/core";
12
+ import { ConfigDirArea } from "@theholocron/datapad";
13
+ /** A plugin's `verifyToken` result when the provider accepted the token. */
14
+ interface VerifyTokenSuccess {
15
+ /** Always `true` for an accepted token. */
16
+ ok: true;
17
+ /** "workplace: acme" / "user: cnewton@x" — surfaced in success output. */
18
+ subject: string;
19
+ /** When the token stops working, ISO 8601 in UTC, for a provider that reports it. Absent when unknown or never. */
20
+ expiresAt?: string;
21
+ }
22
+ /** A plugin's `verifyToken` result when the provider rejected the token. */
23
+ interface VerifyTokenFailure {
24
+ /** Always `false` for a rejected token. */
25
+ ok: false;
26
+ /** Reason the token was rejected. Surfaces to the operator. */
27
+ message: string;
28
+ }
29
+ /** What a plugin's `verifyToken` returns: the token was accepted, or it was rejected with a reason. */
30
+ type VerifyTokenResult = VerifyTokenSuccess | VerifyTokenFailure;
31
+ /** What a layer's token must do about a permission: `required` it must have it, `absent` it must not. */
32
+ type PermissionRule = "required" | "absent";
33
+ /**
34
+ * When a token is due for rotation (#2157). `maxAgeDays` is the longest a token may go unrotated; `warnDays` is how
35
+ * many days before an expiry the check starts to fail. Both default to `DEFAULT_TOKEN_ROTATION`.
36
+ */
37
+ interface TokenRotation {
38
+ /** The most days old a token may be, counted from when the provider says it was made (or became valid). */
39
+ maxAgeDays?: number;
40
+ /** Fail this many days before the token's own expiry, so it is rotated before it stops working. */
41
+ warnDays?: number;
42
+ }
43
+ /**
44
+ * What a token must carry, declared once next to the plugin's `tokens` list. The permission names are the plugin's own
45
+ * (Cloudflare: `pages`, `dns`); a layer's rules say which are `required` and which `absent`, so a laptop token might
46
+ * need everything while `ci` needs one permission and must have none of the rest.
47
+ */
48
+ interface TokenExpectation {
49
+ /**
50
+ * The layers that hold this token, for a token with no permission rules (a rotation-only check). Default: the layers
51
+ * `permissions` names. A layer in neither has no declared expectations.
52
+ */
53
+ layers?: readonly EnvironmentLayer[];
54
+ /** Per layer, each permission's rule. A layer named here holds the token. */
55
+ permissions?: Readonly<Partial<Record<EnvironmentLayer, Readonly<Record<string, PermissionRule>>>>>;
56
+ /** When the token is due for rotation, in every layer that holds it. Default: `DEFAULT_TOKEN_ROTATION`. */
57
+ rotation?: TokenRotation;
58
+ }
59
+ /** One token a plugin takes, and where it is looked up. */
60
+ interface PluginToken {
61
+ /** The plugin's own environment variable, e.g. `HOLOCRON_ADMIN_TOKEN`. */
62
+ envName: string;
63
+ /** The vendor's own environment variable, e.g. `CLOUDFLARE_API_TOKEN`; read after `envName` and before the keyring. */
64
+ vendorEnvName?: string;
65
+ /** The OS keyring entry, e.g. `github.admin`. */
66
+ keyringKey: string;
67
+ /**
68
+ * `false` when the plugin's `verifyToken` does not apply to this token (it checks a different credential, such as
69
+ * a webhook URL), so `holocron doctor secrets --verify` reports it as set without calling the plugin. Default `true`.
70
+ */
71
+ verifiable?: boolean;
72
+ /**
73
+ * How to check this token when the plugin's one `verifyToken` is for a different credential (the Discord bot token,
74
+ * where `verifyToken` checks a webhook). Wins over the plugin's `verifyToken`.
75
+ */
76
+ verify?: (token: string) => Promise<VerifyTokenResult>;
77
+ /**
78
+ * `true` when the plugin only falls back to this token: nothing needs it unless a call names no better source (the
79
+ * Discord webhook a post uses when it names no channel). The checks that expect every token a plugin lists, such as
80
+ * `holocron doctor secrets`, do not expect it, and `holocron export tokens` marks it as optional when it has none.
81
+ * Default `false`.
82
+ */
83
+ optional?: boolean;
84
+ /**
85
+ * Which layers hold this token and what it must and must not be able to do in each (#2149). One declaration that the
86
+ * token probes, the doctor and the docs check read through `tokenExpectations()`; see `TokenExpectation`.
87
+ */
88
+ expect?: TokenExpectation;
89
+ }
90
+ /** Options for a token resolver, without the keyring lookup, which the CLI supplies itself. */
91
+ type ResolveTokenConfig = Omit<ResolveTokenConfig$1, "keyring" | "orgEnvName">;
92
+ /** Settings for a feature-specific token resolver: which env var and keyring entry it reads. */
11
93
  interface FeatureResolverConfig {
12
94
  /** Env var name for this feature, e.g. `"HOLOCRON_ISSUES_TOKEN"`. */
13
95
  envName: string;
14
96
  /** Keyring account key, e.g. `"github.issues"`. */
15
97
  keyringKey: string;
98
+ /** The vendor named in the "no token" message. Default `GitHub`. */
99
+ vendor?: string;
16
100
  }
101
+ /** A resolver from `createFeatureResolver`: call it for the token, or read `token` to see where it looks. */
102
+ type FeatureResolver = ((input?: ResolveTokenInput$1) => string) & {
103
+ /** The environment variable and keyring entry this resolver reads, for `holocron doctor secrets --verify`. */
104
+ readonly token: PluginToken;
105
+ };
106
+ /** A resolver from `createResolveToken`: call it for the token, or read `token` to see where it looks. */
107
+ type TokenResolver = ((input?: ResolveTokenInput$1) => string) & {
108
+ /** The environment variables and keyring entry this resolver reads, for `holocron doctor secrets --verify`. */
109
+ readonly token: PluginToken;
110
+ };
17
111
  /**
18
- * Build a strict, single-feature token resolver.
19
- *
20
- * Resolution chain: `--token flag → envName env var → keyring(keyringKey)`.
21
- * No broad-token fallback — if the feature-specific token is absent the
22
- * operation fails with a message naming the exact env var to set.
112
+ * The holocron keyring: `get` answers `null` for "not stored" and for "keyring unavailable" alike, so callers fall
113
+ * through to env-var precedence, and remembers the answer for the process (`clearCache` forgets it); `set` and `delete`
114
+ * answer whether they did anything; `list` names the stored providers; `isAvailable` tells an outage from an empty keyring.
23
115
  */
24
- declare function createFeatureResolver(config: FeatureResolverConfig): (input?: ResolveTokenInput) => string;
25
- //#endregion
26
- //#region src/auth/keyring.d.ts
116
+ export declare const keyring: import("@theholocron/kyber/secrets").Keyring;
27
117
  /**
28
- * Keyring-backed bootstrap credential store.
29
- *
30
- * Every holocron plugin's bootstrap token (the one it needs before it
31
- * can talk to its vendor's API) can be stored in the OS keyring under
32
- * a single reverse-DNS service scope. Managed via `holocron auth`
33
- * subcommands; consulted at position 4 in every plugin's auth
34
- * precedence chain (after --token / HOLOCRON_<X>_TOKEN / <native>_TOKEN).
35
- *
36
- * See `docs/wiki/specifications/tech-auth-bootstrap.spec.md` for the design rationale.
37
- *
38
- * Failure model: keyring access is best-effort. Platforms without a
39
- * supported credential store (some Linux CI images, sandboxed
40
- * environments) will throw from the underlying library. Every export
41
- * here catches and returns a null/empty result rather than propagating
42
- * — the plugin's precedence chain then falls through to
43
- * env-var-only paths, which is exactly how CI is meant to work.
118
+ * Kyber's `createResolveToken` with the keyring, the `HOLOCRON_ORG` variable and the `token` description
119
+ * `holocron doctor secrets --verify` reads filled in, so a plugin stays at a one-liner call site. The chain is the flag, the
120
+ * plugin's variable, the vendor's variable, the `credentials` providers' variables, the keyring.
44
121
  */
122
+ export declare function createResolveToken(config: ResolveTokenConfig): TokenResolver;
45
123
  /**
46
- * Store or overwrite a bootstrap token for a provider. Returns true on
47
- * success, false when the underlying keyring is unsupported or errored.
124
+ * Kyber's `createFeatureResolver` for a strict, single-feature token: the flag, the feature's variable, the
125
+ * `credentials` providers' variable of that name, the keyring. No broad-token fallback; if the feature's token is absent
126
+ * the operation fails with a message naming the exact variable to set and `holocron new token`.
48
127
  */
49
- declare function setToken(provider: string, token: string): boolean;
128
+ export declare function createFeatureResolver(config: FeatureResolverConfig): FeatureResolver;
50
129
  /**
51
- * Read the bootstrap token for a provider. Returns `null` for both
52
- * "not stored" and "keyring unavailable" — callers can treat them the
53
- * same way (fall through to env-var precedence).
130
+ * The flags and components `holocron sync` writes to `codecov.yml` for the workspace at `repoRoot`: the same
131
+ * functions the generator uses, so a coverage provider's `checkRepo()` compares with exactly what is written. A flag per
132
+ * package (none for `docs`), plus `documentation` when `docsCoverage` is `warn` or `required`; a component per package.
133
+ * Both lists are sorted. Plugins call this instead of importing the task runner.
54
134
  */
55
- declare function getToken(provider: string): string | null;
135
+ export declare function coverageExpectations(repoRoot: string, docsCoverage?: DocsCoverageMode): CoverageExpectations;
56
136
  /**
57
- * Delete a stored token. Returns true when a token was removed, false
58
- * when there was nothing to delete or the keyring is unavailable.
59
- * Distinguishing the two cases isn't worth the surface area — the
60
- * command output makes the situation clear either way.
137
+ * Puts issue keys in creation order without asking the tracker: issue numbers (`#12`, `ENG-12`) rise with creation inside
138
+ * one repository or team, so the trailing number is the order. `oldest` is ascending, `newest` descending; keys with the
139
+ * same number keep their place. A key with no trailing number is an error, because nothing can be said of its age.
61
140
  */
62
- declare function deleteToken(provider: string): boolean;
141
+ export declare function orderKeys(keys: readonly string[], order: IssueOrder): string[];
63
142
  /**
64
- * List provider slugs with a stored token in this service scope.
65
- * Uses the library's `findCredentials(service)` — supported on all
66
- * platforms the underlying credential store supports.
143
+ * Keeps the first or last `limit` of a listing by creation time, returned oldest first. `createdAt` reads an item's
144
+ * ISO timestamp; items created in the same instant keep their listed order. The cut happens on what the listing already
145
+ * holds, so no request is spent on an item that is dropped.
67
146
  */
68
- declare function listStoredProviders(): string[];
69
- //#endregion
70
- //#region src/config/config.d.ts
71
- /** Structured-logging config. The Axiom **token** never lives here — only in
72
- * env vars or the OS keyring — but the non-secret dataset name may. */
73
- interface LogConfig {
74
- /**
75
- * Default log level. The lowest-priority level source: `--verbose` /
76
- * `--quiet` and `HOLOCRON_LOG_LEVEL` both outrank it.
77
- */
78
- level?: LogLevel;
79
- /**
80
- * Axiom log-shipping. Set `axiom.dataset` to opt local runs into Axiom
81
- * without exporting `HOLOCRON_AXIOM_DATASET` — the CLI then pairs it with
82
- * the token from `HOLOCRON_AXIOM_TOKEN` / `AXIOM_TOKEN` or the OS keyring
83
- * (`holocron auth set axiom[.<org>] <TOKEN>`). Env vars still win. In CI,
84
- * prefer the `HOLOCRON_AXIOM_DATASET` variable.
85
- */
86
- axiom?: {
87
- /** Target Axiom dataset, e.g. `"holocron-local"`. */
88
- dataset?: string;
89
- };
147
+ export declare function pickByCreation<T>(items: readonly T[], createdAt: (item: T) => string, order: IssueOrder, limit: number): T[];
148
+ /** What {@link readKeysLimited} needs. */
149
+ interface ReadKeysLimitedInput<T> {
150
+ /** The issue keys to choose from. */
151
+ keys: readonly string[];
152
+ /** Which end of the creation order to take first. */
153
+ order: IssueOrder;
154
+ /** How many items to keep. */
155
+ limit: number;
156
+ /** The most issues fetched at once. */
157
+ concurrency: number;
158
+ /** Fetches one issue by key. */
159
+ fetch: (key: string) => Promise<T>;
160
+ /** Whether a fetched issue counts against the limit; false skips it without using the budget. */
161
+ keep: (item: T) => boolean;
90
162
  }
91
163
  /**
92
- * CLI self-telemetry config — the committed, reviewable override layer over the
93
- * env-var + shipped-fallback activation (ADR-0007 / ADR-0008). No secret lives
94
- * here; the Sentry DSN and PostHog key come from env vars or ship as fallbacks.
164
+ * Reads an explicit list of issues in creation order until `limit` of them are kept. The keys are sorted by number first
165
+ * (see {@link orderKeys}), then fetched in small steps of at most `concurrency`, each step no bigger than the places
166
+ * still open, so an issue that is later skipped (a pull request, a closed one) is replaced by the next key and nothing
167
+ * beyond the budget is fetched unless a skip made room. Within a step the fetches run together; the results keep the key
168
+ * order. The kept items come back oldest first, whichever end was chosen.
169
+ */
170
+ export declare function readKeysLimited<T>(input: ReadKeysLimitedInput<T>): Promise<T[]>;
171
+ /**
172
+ * Calls a provider's optional `onProgress` hook with how many items are done of how many. A hook that throws is
173
+ * ignored, because a progress counter must never change or stop the read or write it reports on.
95
174
  *
96
- * Precedence: `HOLOCRON_TELEMETRY=false` (env) → `telemetry.enabled` (this) →
97
- * default on. `enabled` never *re-enables* what the env var turned off.
175
+ * @param onProgress - The hook from `ExportInfo` or `ImportOptions`; nothing happens when it is not given.
176
+ * @param done - How many items are finished.
177
+ * @param total - How many items there are.
98
178
  */
99
- interface TelemetryConfig {
179
+ export declare function reportProgress(onProgress: ((done: number, total: number) => void) | undefined, done: number, total: number): void;
180
+ /** One line a probe reports: `info` for a fact, `ok` / `fail` for a result, `heading` to title the rows that follow. */
181
+ interface ProbeRow {
182
+ /** `ok` or `fail` for a result, `info` for a fact, `heading` to title the rows that follow. */
183
+ status: "ok" | "fail" | "info" | "heading";
184
+ /** The row's short title. */
185
+ label: string;
186
+ /** Further detail, when there is some. */
187
+ detail?: string;
188
+ }
189
+ /** What a probe is handed. Everything it prints or changes goes through this, so the runner can enforce the rules. */
190
+ interface ProbeContext {
191
+ /** What the person typed after the probe name (`probe deps who vitest` hands `["vitest"]`). */
192
+ args?: readonly string[];
193
+ /**
194
+ * `--lcov <path>`: where a probe that measures coverage also writes an lcov report, on top of the rows it prints.
195
+ * Relative to the repo root. Unset when the flag was not given.
196
+ */
197
+ lcov?: string;
198
+ /** `--dry-run`: `write` calls are announced and skipped. */
199
+ dryRun: boolean;
200
+ /** Report one line. The text is scrubbed of secrets before it is printed. */
201
+ say(row: ProbeRow): void;
202
+ /**
203
+ * Change something on the provider. The only way to: on `--dry-run` it prints `would <label>` and does not call `fn`,
204
+ * and a probe that did not declare `writes: true` cannot call it.
205
+ */
206
+ write<T>(label: string, fn: () => Promise<T>): Promise<T | undefined>;
207
+ /** Register how to undo something this probe made. Runs in reverse order on success, failure and Ctrl-C. */
208
+ cleanup(label: string, fn: () => Promise<void>): void;
209
+ /** Mark a value (a token, a signing secret) as one that must never be printed. */
210
+ secret(value: string | undefined): void;
211
+ }
212
+ /** A named, on-demand poke at a live provider. */
213
+ interface Probe {
214
+ /** One sentence for `holocron probe`'s listing. */
215
+ summary: string;
216
+ /** Whether it creates or changes anything on the provider. Asked about first, and needs `--yes` without a terminal. */
217
+ writes: boolean;
100
218
  /**
101
- * Repo-level opt-out — the committed peer of `HOLOCRON_TELEMETRY=false`.
102
- * `false` installs the no-op sinks for the whole run. Default on.
219
+ * Where the probe's rows go. Unset, stdout. A probe whose own output is the data on stdout (a `NAME=value` stream
220
+ * for a pipe) sets `stderr`, so the rows never mix with it.
103
221
  */
104
- enabled?: boolean;
222
+ reportsTo?: "stderr";
105
223
  /**
106
- * Usage-analytics provider. `"none"` disables PostHog usage analytics while
107
- * leaving error reporting (Sentry) untouched. Default `"posthog"`.
224
+ * Whether the probe is about a token, so `holocron probe` may point it at a different one: `--token <provider>=<value>`,
225
+ * `--environment <layer or name>` (the provider's token from that vault Environment), or, on a terminal with neither,
226
+ * a question that asks which. Unset, the probe uses the token the provider normally resolves.
108
227
  */
109
- analytics?: "posthog" | "none";
228
+ acceptsToken?: boolean;
229
+ /** Runs the probe, reporting and changing things only through `ctx`. */
230
+ run(ctx: ProbeContext): Promise<void>;
110
231
  }
111
- type ProviderOptions = Record<string, unknown>;
232
+ /** A plugin's probes by name (kebab-case), as returned from `createPlugin` next to `capabilities`. */
233
+ type PluginProbes = Record<string, Probe>;
112
234
  /**
113
- * The shape a capability config package's default export must satisfy.
114
- * Config packages let teams share a pre-bundled provider + options across
115
- * repos (Level 1 of the shareable-configs story, issue #75).
116
- *
117
- * @example
118
- * // @acme/holocron-vault/index.ts
119
- * import type { CapabilityConfigPackage } from '@theholocron/cli'
120
- * export default {
121
- * provider: '1password',
122
- * options: { vault: 'acme-app' },
123
- * } satisfies CapabilityConfigPackage
124
- */
125
- interface CapabilityConfigPackage {
126
- provider: string;
127
- options?: ProviderOptions;
128
- }
129
- type SingleEntry = string | [provider: string, options: ProviderOptions];
130
- type MultiEntry = Array<string | [provider: string, options: ProviderOptions]>;
131
- type RawProviderEntry = SingleEntry | MultiEntry;
132
- type RawProvidersConfig = Partial<Record<CapabilityKey, RawProviderEntry>>;
133
- type RepoProtection = "balanced" | "strict" | "none";
134
- /**
135
- * Raw `docs` config as written by the user. `build` is optional so the
136
- * field can be declared without committing to a build type yet; setup
137
- * will error if `docs` is present but `build` is absent.
138
- */
139
- interface DocsConfig {
140
- /**
141
- * GitHub Pages build source.
142
- * "workflow" → GitHub Actions (PUT { build_type: "workflow" })
143
- * "branch" → classic gh-pages branch (PUT { build_type: "legacy", source: { branch: "gh-pages", path: "/" } })
144
- * When absent, Pages is not managed by `holocron setup`.
145
- */
146
- build?: "workflow" | "branch";
147
- /**
148
- * Custom domain / CNAME (e.g. "docs.theholocron.dev").
149
- * When set and `homepage` is not explicitly provided, setup derives
150
- * `homepage` as `https://{domain}/` for package.json and the repo website field.
151
- */
152
- domain?: string;
153
- /** Enforce HTTPS. Only effective once the custom domain is DNS-verified. */
154
- https?: boolean;
155
- }
156
- interface RepoProperties {
157
- lifecycle?: "active" | "experimental" | "deprecated";
158
- open_source?: boolean;
159
- runtime_environment?: "node" | "browser" | "universal" | "none";
160
- uses_external_packages?: boolean;
161
- }
162
- interface RepoConfig {
163
- /** "owner/name" — the GitHub repository coordinate. Derived from the git remote when absent. */
164
- name?: string;
165
- /**
166
- * Branch protection preset applied by `holocron setup`. When omitted,
167
- * no protection is applied and no `branch_protection_level` property is set.
168
- * Required-status-check contexts for `"strict"` are derived from the task
169
- * manifest — `{ required: true }` tasks + top-level `extraRequiredChecks`
170
- * (see `astromech.requiredChecks()`).
171
- */
172
- protection?: RepoProtection;
235
+ * One step of a provider's `setup` or `doctor`, in the shape the shared renderer prints (`printCheckRows`): an id, a
236
+ * title, `ok` / `fail` / `skip`, one line of detail and, for a failure, a line per problem.
237
+ */
238
+ type ProviderRow = CheckRow;
239
+ /** What a provider's `setup` and `doctor` are handed. */
240
+ interface ProviderActionContext {
173
241
  /**
174
- * GitHub teams granted repository access. Synced by `holocron setup`, which
175
- * also writes `.github/CODEOWNERS` for teams with write-or-higher permission.
176
- * String shorthand defaults to `push` (Write).
242
+ * `--dry-run`: `setup` reports what it would change as `ok` rows and changes nothing. `doctor` never changes
243
+ * anything, so it ignores this.
177
244
  */
178
- teams?: TeamEntry[];
179
- /** GitHub topics set on the repository. */
180
- topics?: string[];
181
- /** GitHub custom properties synced to the org dashboard. */
182
- properties?: RepoProperties;
245
+ dryRun: boolean;
246
+ }
247
+ /**
248
+ * Something only one provider has (a Linear team's automation, a Discord server's roles) and no provider-neutral
249
+ * command can express. It reports one row per step and does not stop at the first failure: a step that fails is a
250
+ * `fail` row and the next step still runs. It never prints a token.
251
+ */
252
+ type ProviderAction = (ctx: ProviderActionContext) => Promise<ProviderRow[]>;
253
+ /** A provider's `setup` and `doctor`, as `holocron provider <name> setup|doctor` finds them. */
254
+ interface ProviderActions {
255
+ /** Makes what the provider's own config block declares. Optional. */
256
+ setup?: ProviderAction;
257
+ /** Compares what the provider's own config block declares with what exists, read-only. Optional. */
258
+ doctor?: ProviderAction;
259
+ }
260
+ /** What a connection probe needs to check a provider's host and token: kyber's input, with the plugin's `verifyToken` as `verify`. */
261
+ export interface ConnectionProbeInput extends Omit<ConnectionProbeInput$1, "verify"> {
262
+ /** The plugin's `verifyToken`: asks the provider who the token belongs to. */
263
+ verify: (token: string) => Promise<VerifyTokenResult>;
183
264
  }
184
- interface AppConfig {
265
+ /**
266
+ * The `connection` probe every provider offers, for telling a network problem from a credential problem. The checks are
267
+ * kyber's `connectionProbe`; this types the result as the plugin system's {@link Probe} and `verify` as `VerifyTokenResult`.
268
+ */
269
+ export declare function connectionProbe(input: ConnectionProbeInput): Probe;
270
+ /**
271
+ * The first server emoji a layout gives two different pictures, or undefined. One name is one emoji, so it can be made
272
+ * from one file only; the same file written twice is fine.
273
+ */
274
+ export declare function emojiConflictProblem(layout: NotificationsLayout): string | undefined;
275
+ /** One server emoji a layout's reactions name. */
276
+ interface LayoutEmoji {
277
+ /** The emoji's name, without colons. */
185
278
  name: string;
186
- path: string;
187
- kind?: string;
279
+ /** The file in the repo it is made from when the server has none, as the layout wrote it. */
280
+ image?: string;
188
281
  }
189
- interface DoctorConfig {
190
- checks?: string[];
282
+ /**
283
+ * The server emoji a layout's forum reactions name (default and starter) and its `emojis` list, once each, in the order the layout first
284
+ * names them. A name that is given an `image` anywhere keeps it, so the picture can sit on any one of its uses.
285
+ */
286
+ export declare function layoutEmojis(layout: NotificationsLayout | undefined): LayoutEmoji[];
287
+ /**
288
+ * Every reaction a layout writes that can name a server emoji: each forum's default and starter reactions and its tags'
289
+ * `emoji` (a tag's is a string, Unicode or `:name:`), then the layout's own `emojis` (server emoji made with no reaction
290
+ * naming them), in that order.
291
+ */
292
+ export declare function layoutReactions(layout: NotificationsLayout | undefined): NotificationsReaction[];
293
+ /** Discord's limit for an emoji file ("256 KiB", its Emoji resource docs). */
294
+ export declare const MAX_EMOJI_BYTES: number;
295
+ /**
296
+ * Reads the picture an emoji is made from, a file in the repo, and returns it as a `data:` URI. The type comes from the
297
+ * first bytes, not the name, and a file Discord would refuse (larger than 256 KiB, or not a JPEG, PNG, GIF, WebP or
298
+ * AVIF image) is refused here, before anything is written. `read` is injected by tests.
299
+ */
300
+ export declare function loadEmojiImage(source: string, baseDir?: string, read?: (path: string) => Promise<Uint8Array>): Promise<string>;
301
+ /** A Unicode emoji, kept as written. */
302
+ interface UnicodeReaction {
303
+ /** Tells it from a server emoji. */
304
+ kind: "unicode";
305
+ /** The emoji character, as written. */
306
+ value: string;
191
307
  }
192
- interface EnvConfig {
193
- /**
194
- * Namespace prefixes used by this project's env vars.
195
- * Listed from least- to most-specific (cascade model — last wins).
196
- * Tooling reads this to generate `.env.example`, validate required
197
- * vars, and produce documentation.
198
- *
199
- * @example
200
- * // Project-only prefix
201
- * namespaces: ["CLI_TEMPLATE"]
202
- *
203
- * // Org-wide defaults + project-specific overrides
204
- * namespaces: ["HOLOCRON", "MY_CLI"]
205
- */
206
- namespaces?: string[];
308
+ /** One of the server's own emoji, by name. */
309
+ interface CustomReaction {
310
+ /** Tells it from a Unicode emoji. */
311
+ kind: "custom";
312
+ /** The emoji's name, without colons. */
313
+ name: string;
314
+ /** The file in the repo `setup` makes the emoji from when the server has none. */
315
+ image?: string;
207
316
  }
317
+ /** A layout reaction after reading. */
318
+ type ParsedReaction = UnicodeReaction | CustomReaction;
319
+ /** A server emoji written as Discord shows it: `:name:`, the name 2 to 32 letters, digits and underscores. */
320
+ export declare const CUSTOM_EMOJI: RegExp;
208
321
  /**
209
- * A single Chromatic project entry in a monorepo `run-chromatic` config.
210
- * Each entry produces one matrix job in CI, publishing to a separate Chromatic project.
211
- *
212
- * The `tokenName` maps to a repository secret named `CHROMATIC_PROJECT_TOKEN_<TOKENNAME>`.
213
- * Additional fields correspond to chromaui/action inputs and are passed through directly.
214
- *
215
- * @see https://www.chromatic.com/docs/monorepos/
322
+ * Reads a layout reaction. `":git_merge:"` (or `{ emoji: ":git_merge:", image }`) is a server emoji named `git_merge`;
323
+ * any other string is a Unicode emoji and kept as written. It does not judge a value: `reactionProblem()` does, before
324
+ * anything is applied, so an invalid `emoji` here is kept as the name it was given.
216
325
  */
217
- interface ChromaticProjectConfig {
218
- /**
219
- * Secret suffix. The CI job reads `CHROMATIC_PROJECT_TOKEN_<tokenName>`.
220
- * Must be uppercase (e.g. `"WEB"`, `"UI"`).
221
- */
222
- tokenName: string;
223
- /**
224
- * Path to run the Chromatic build from, relative to the repo root.
225
- * Typically the package directory (e.g. `"apps/web"`, `"packages/ui"`).
226
- */
227
- workingDir: string;
228
- /**
229
- * Script name to build Storybook. Defaults to `"build:storybook"`.
230
- * Must accept `--output-dir` pass-through (use `turbo run … --` at root).
231
- */
232
- buildScript?: string;
233
- /**
234
- * Path to the Storybook folder relative to `workingDir`, for TurboSnap.
235
- * Tells Chromatic where to find `.storybook/` when the Storybook config
236
- * is in a subdirectory. Corresponds to `--storybook-base-dir`.
237
- */
238
- storybookBaseDir?: string;
239
- /**
240
- * Glob patterns of files/dirs that should NOT trigger a TurboSnap bailout
241
- * when changed. Useful for ignoring non-UI changes in a monorepo
242
- * (e.g. `"./packages/!(ui)/**"` to focus TurboSnap on the UI package).
243
- * Corresponds to `--untraced`. Accepts a single glob string or array.
244
- */
245
- untraced?: string | string[];
246
- /**
247
- * Glob patterns matching story files to snapshot. When set, only matching
248
- * stories are captured. Corresponds to `--only-story-files`.
249
- * Cannot be combined with `onlyStoryNames`.
250
- */
251
- onlyStoryFiles?: string;
252
- /**
253
- * Exit with code 0 even when visual changes are detected.
254
- * Useful during initial setup before baselines are approved.
255
- * Corresponds to `--exit-zero-on-changes`.
256
- */
257
- exitZeroOnChanges?: boolean;
326
+ export declare function parseReaction(reaction: NotificationsReaction): ParsedReaction;
327
+ /** The folder a layout's emoji pictures live in, as the webhook avatar's files do. */
328
+ export declare const EMOJI_MEDIA_DIR = ".holocron/media/";
329
+ /**
330
+ * The first reason a reaction cannot work, or undefined; `noun` names it in the message (`` `defaultReaction` ``, "a
331
+ * starter reaction"). A Unicode emoji must be a character, not a word (`git_merge` without colons would be sent to
332
+ * Discord as text), a server emoji `:name:` with a name Discord allows, and an `image` a file under `.holocron/media/`
333
+ * (a path, not a URL, with no `..` out of it). A `null` a config wrote is refused, not read as absent.
334
+ */
335
+ export declare function reactionProblem(noun: string, reaction: NotificationsReaction | null): string | undefined;
336
+ /** How a reaction is written in a layout and shown in a row: `:name:` for a server emoji, the character otherwise. */
337
+ export declare function reactionSpelling(reaction: NotificationsReaction): string;
338
+ /**
339
+ * The first reason a forum tag's `emoji` cannot work, or undefined. A string with no colon at either end is a Unicode
340
+ * emoji and kept as written (it is not judged). One that starts or ends with a colon is meant as a server emoji, so it
341
+ * must be `:name:` (2 to 32 letters, digits and underscores), and the layout must give that emoji a picture somewhere
342
+ * (`pictured`: the names an `image` is declared for, from `layoutEmojis()`), because a tag's `emoji` is only a name and
343
+ * `setup` makes the emoji before any channel.
344
+ */
345
+ export declare function tagEmojiProblem(tagName: string, emoji: string | undefined, pictured: ReadonlySet<string>): string | undefined;
346
+ interface RoleSyncOutcome {
347
+ role: string;
348
+ team: string;
349
+ plan: RoleSyncPlan;
350
+ /** Members the role was given to (empty on a dry run). */
351
+ added: string[];
352
+ /** Members the role was taken from (empty on a dry run or with `keep`). */
353
+ removed: string[];
354
+ }
355
+ /** One person: their GitHub account and their member id on the notifications provider. */
356
+ interface MemberLink {
357
+ /** The GitHub user id, as a string. It survives a rename; the login does not. */
358
+ github: string;
359
+ /** The GitHub login when the link was made; for reports only. */
360
+ login: string;
361
+ /** The member's id on the notifications provider (for Discord, the user id). */
362
+ member: string;
363
+ }
364
+ /** The file that says which server member is which GitHub account. */
365
+ interface LinksFile {
366
+ /** The file format version. */
367
+ version: 1;
368
+ /** One entry per linked person. */
369
+ links: MemberLink[];
258
370
  }
371
+ interface RoleSyncPlan {
372
+ /** Team members who are linked and do not hold the role: give it to them. */
373
+ add: Array<{
374
+ member: string;
375
+ login: string;
376
+ }>;
377
+ /** Holders linked to a GitHub account that is no longer on the team: take it away. */
378
+ remove: Array<{
379
+ member: string;
380
+ login: string;
381
+ }>;
382
+ /** Team members with no link: the role cannot reach them until they link their account. */
383
+ unlinked: SourceTeamMember[];
384
+ /** Holders with no link at all. Left alone, because nothing says they should not have it. */
385
+ unknownHolders: Array<{
386
+ member: string;
387
+ name?: string;
388
+ }>;
389
+ /** Linked team members who already hold the role. */
390
+ inSync: number;
391
+ }
392
+ /** What {@link syncRoles} needs: the providers, the links, and the roles to keep equal to their teams. */
393
+ interface SyncRolesInput {
394
+ /** The provider that lists and changes who holds a role. */
395
+ notifications: Notifications;
396
+ /** The provider that lists a team's members. */
397
+ source: Source;
398
+ /** Who is which person, from the links file. */
399
+ links: LinksFile;
400
+ /** Each role and the team it follows. */
401
+ roles: ReadonlyArray<{
402
+ name: string;
403
+ team: string;
404
+ }>;
405
+ /** The organisation the teams are in; defaults to the source's own. */
406
+ org?: string;
407
+ /** Report what would change without changing anything. */
408
+ dryRun?: boolean;
409
+ /** Give the role to new team members but do not take it from people who left. */
410
+ keep?: boolean;
411
+ /** Where progress lines go; nowhere when left out. */
412
+ print?: (line: string) => void;
413
+ }
414
+ /** What {@link syncRoles} did. */
415
+ interface SyncRolesResult {
416
+ /** One entry per role whose plan could be made. */
417
+ roles: RoleSyncOutcome[];
418
+ /** Steps that failed; the run carried on past each. */
419
+ failures: Array<{
420
+ step: string;
421
+ message: string;
422
+ }>;
423
+ /** Roles given or taken. */
424
+ ok: number;
425
+ /** Already in sync, left alone, or only previewed. */
426
+ skipped: number;
427
+ }
428
+ /** What a source provider needs to be able to do to feed a role sync, or the reason it cannot. */
429
+ export declare function sourceProblem(source: Source | undefined): string | undefined;
430
+ /** Reads the links file; a file that does not exist yet is an empty one, a damaged one throws. */
431
+ export declare function readLinks(source: Source, layout: NotificationsLayout, org: string | undefined, provider: string): Promise<LinksFile>;
432
+ /**
433
+ * The first role the layout declares for two different teams, or undefined. Names compare ignoring case, as
434
+ * the server does; the role would be synced against one team and then the other, so the last would win.
435
+ */
436
+ export declare function roleTeamProblem(layout: {
437
+ roles?: ReadonlyArray<{
438
+ name: string;
439
+ team?: string;
440
+ }>;
441
+ }): string | undefined;
259
442
  /**
260
- * A single Storybook app in a deploy workflow config.
261
- * `name` becomes the sandbox sub-path (`_site/sandbox/<name>/`).
262
- * `path` is the working directory relative to the repo root; defaults to `"."` (repo root) when omitted.
443
+ * Makes each role's holders equal its team, one role after another. This is the sync itself, with no setup in
444
+ * front of it: the caller has already picked the providers, read the links and checked the layout. `holocron
445
+ * sync roles` and Sentinel's role sync are two callers of it. A step that fails is recorded and the
446
+ * run goes on; nothing here throws for a provider error. Idempotent: a role that already matches changes nothing.
447
+ * Lines go to `input.print` when it is given, and nowhere otherwise.
263
448
  */
264
- interface StorybookDeployProject {
265
- name?: string;
266
- path?: string;
449
+ export declare function syncRoles(input: SyncRolesInput): Promise<SyncRolesResult>;
450
+ /** Why a pull request moves an item's status. */
451
+ type PullRequestStatusReason = "pull-request-open" | "checks-green" | "checks-failed";
452
+ /** The status change a pull request asks for. */
453
+ interface PullRequestStatusChange {
454
+ /** The item's `issues` key. */
455
+ key: string;
456
+ /** The item's title, for the printed line. */
457
+ title: string;
458
+ /** The status it holds now. */
459
+ from: string;
460
+ /** The template's status it is set to. */
461
+ to: string;
462
+ /** The category of `to`. */
463
+ category: Extract<BoardStatusCategory, "active" | "review">;
464
+ /** Which rule applies. */
465
+ reason: PullRequestStatusReason;
466
+ }
467
+ /** A rule applies, but the template has no status of the category to set. Reported, never guessed. */
468
+ interface PullRequestStatusUnresolved {
469
+ /** The item's `issues` key. */
470
+ key: string;
471
+ /** The item's title. */
472
+ title: string;
473
+ /** The category the rule wanted. */
474
+ category: PullRequestStatusChange["category"];
475
+ /** Which rule applies. */
476
+ reason: PullRequestStatusReason;
267
477
  }
478
+ /** What {@link planPullRequestStatus} decided: a change or an unresolved rule (it returns `undefined` for nothing). */
479
+ type PullRequestStatusPlan = {
480
+ kind: "change";
481
+ change: PullRequestStatusChange;
482
+ } | {
483
+ kind: "unresolved";
484
+ unresolved: PullRequestStatusUnresolved;
485
+ };
268
486
  /**
269
- * Typed `with:` inputs for reusable workflows.
487
+ * Decide the status an item's linked pull requests ask for (spec `tech-board-status-automation`, #2388). Pure: it reads
488
+ * one item and the template and touches nothing; status only, never priority or any other field.
270
489
  *
271
- * `run-chromatic` accepts either a plain boolean (single-project) or a
272
- * `ChromaticProjectConfig[]` object (multi-project monorepo).
490
+ * - an open linked pull request (a draft counts) puts the item in `active`;
491
+ * - an open one whose aggregate check is `success` puts it in `review`;
492
+ * - when the item is in `review` and no open pull request is green, a `failure` moves it back to `active`, while
493
+ * `pending` and `none` leave it, so a re-run after a push does not flicker the board;
494
+ * - no open pull request: no change (closed and merged ones are `planReconcile()`'s, through the closed issue).
273
495
  *
274
- * `docs` / `storybook` are high-level deploy shorthand that `holocron setup`
275
- * translates to `type` / `storybook-projects` before writing the thin caller.
276
- * They also drive automatic `paths:` derivation so you never need to write
277
- * `paths:` manually for deploy entries.
278
- */
279
- type WorkflowWithConfig = Record<string, unknown> & {
280
- "run-chromatic"?: boolean | {
281
- projects: ChromaticProjectConfig[];
282
- };
283
- /**
284
- * Docs deployment shorthand. `true` uses the org-standard `docs/` directory;
285
- * `{ path: "custom" }` uses a custom directory. Both derive a `paths:` entry automatically.
286
- */
287
- docs?: true | {
288
- path: string;
289
- };
290
- /** Storybook apps to deploy alongside docs. Each entry's `path` is appended to `paths:`. */
291
- storybook?: StorybookDeployProject[];
292
- };
496
+ * Left to `planReconcile()`, which runs first: a closed item, an item with an open blocker or in `blocked`, and an
497
+ * item with no status (reported there, not set). An item in `done` is left alone. Where the template has no status of
498
+ * the wanted category the rule comes back as `unresolved` and nothing is guessed; where a category has several statuses
499
+ * the first in template order is used. Applying the change and planning again gives no change.
500
+ */
501
+ export declare function planPullRequestStatus(item: BoardItem, template: BoardTemplate): PullRequestStatusPlan | undefined;
502
+ /** Why an item's status is changed. */
503
+ type ReconcileReason = "blocked" | "unblocked" | "closed" | PullRequestStatusReason;
504
+ /** One status change `reconcile` makes. */
505
+ interface ReconcileChange {
506
+ /** The item's `issues` key. */
507
+ key: string;
508
+ /** The item's title, for the printed line. */
509
+ title: string;
510
+ /** The status it holds now, or undefined for none. */
511
+ from?: string;
512
+ /** The template's status it is set to. */
513
+ to: string;
514
+ /** The category of `to`. */
515
+ category: Extract<BoardStatusCategory, "blocked" | "planned" | "done" | "active" | "review">;
516
+ /** Which rule applies. */
517
+ reason: ReconcileReason;
518
+ }
519
+ /** An item a rule applies to, but whose template has no status of the category to set. Reported, never guessed. */
520
+ interface ReconcileUnresolved {
521
+ /** The item's `issues` key. */
522
+ key: string;
523
+ /** The item's title. */
524
+ title: string;
525
+ /** The category the rule wanted. */
526
+ category: ReconcileChange["category"];
527
+ /** Which rule applies. */
528
+ reason: ReconcileReason;
529
+ }
530
+ /** What {@link planReconcile} decided. */
531
+ interface ReconcilePlan {
532
+ /** The status changes to make, in the items' order. */
533
+ changes: ReconcileChange[];
534
+ /** Open items with no status: reported, not set, since they need a decision and not a rule. */
535
+ unset: BoardItem[];
536
+ /** Items a rule applies to whose template lacks a status of the category. */
537
+ unresolved: ReconcileUnresolved[];
538
+ }
293
539
  /**
294
- * A `tasks` manifest entry in object form. A bare string entry is shorthand
295
- * for `{ name, ci: true, local: true }`.
540
+ * Decide the status changes that keep a board true (spec `command-project`, "Keeping a board true"). Pure: it reads
541
+ * the items and the template and touches nothing. Status only, never priority or any other field.
542
+ *
543
+ * - closed or merged, not in a `done` status: set to `done` (whatever the blockers say);
544
+ * - open with no status: not changed, listed in `unset` (it needs a decision, not a rule; this holds even when it has a
545
+ * blocker);
546
+ * - open with an open blocker, not in a `blocked` status: set to `blocked`;
547
+ * - open, in a `blocked` status, with no open blocker: set to `planned` (the status it held before is unknown).
548
+ *
549
+ * Where a category has several statuses the first in template order is used; where it has none the item is listed in
550
+ * `unresolved` and nothing is guessed. An item's category is read from the template by its status name, falling back
551
+ * to the one the provider reports. Applying the changes and planning again gives no change.
296
552
  */
297
- interface TaskEntryConfig {
553
+ export declare function planReconcile(items: readonly BoardItem[], template: BoardTemplate): ReconcilePlan;
554
+ /** One board a repo keeps: which template it follows and what it is called. */
555
+ interface BoardDeclaration {
556
+ /** The template's name, a built-in or a file in the templates directory. */
557
+ template: string;
558
+ /** The board's name, which is how it is found among the open boards. */
298
559
  name: string;
299
- with?: WorkflowWithConfig;
300
- paths?: string[];
301
- linters?: string[];
302
- /** Emit a `.github/workflows/<name>.yml` thin caller + include in `holocron ci`. Default `true`. */
303
- ci?: boolean;
304
- /** Write a `package.json` script + let `holocron run <name>` resolve the task. Default `true`. */
305
- local?: boolean;
306
- /** The task's CI check context is a required status check + part of `holocron ci`'s default run. */
307
- required?: boolean;
308
- }
309
- interface HolocronConfig {
310
- /** Project name. Derived from package.json when absent. */
311
- name?: string;
312
- description?: string;
313
- /** Project homepage URL. Synced to package.json#homepage and the GitHub repo's website field by `holocron sync`. */
314
- homepage?: string;
315
- /**
316
- * Active org name for namespaced keyring lookup. When set, token resolution
317
- * tries `<service>.<org>` before the unnamespaced `<service>` fallback, so
318
- * a single machine can hold credentials for multiple GitHub orgs without
319
- * collision. Overridden by `--org` CLI flag or `HOLOCRON_ORG` env var.
320
- */
321
- org?: string;
322
- /**
323
- * Org canonical domain (e.g. `"theholocron.dev"`). Subdomains are derived
324
- * from this — `preview: true` on a deploy workflow resolves the preview base
325
- * domain as `preview.<domain>`, giving URLs like `<repo>-pr-<n>.<domain>`.
326
- */
327
- domain?: string;
328
- /**
329
- * Repository identity and metadata. When set, `PluginLoader` injects
330
- * `repo.name` into every plugin's `RuntimeContext.repo` so plugins that
331
- * need a repo (github, etc.) don't require `--repo` on every invocation.
332
- * `--repo` on the command line still overrides.
333
- */
334
- repo?: RepoConfig;
335
- /**
336
- * The task manifest — what this repo runs. Each entry is a task name
337
- * (backed by a reusable workflow in `theholocron/.github`), or the object
338
- * form to pass `with:` inputs. `@theholocron/astromech` reads this as the
339
- * single source for `holocron run` / `holocron ci` / the generated CI
340
- * workflows / `package.json` scripts.
341
- *
342
- * Supported values (intent-facing vocabulary — epic #672, D3):
343
- * "verification.unitTests" | "verification.typeSafety" | "verification.performance" |
344
- * "sourceQuality.staticAnalysis" | "sourceQuality.formatting" |
345
- * "sourceQuality.structuredDataValidation" | "sourceQuality.deadCodeAnalysis" |
346
- * "security.secretDetection" | "security.codeScanning" |
347
- * "delivery.build" | "delivery.publish" | "delivery.deploy" | "delivery.bundleSize" |
348
- * "platform.repoSync" | "platform.commitStandards" | "platform.repoValidation" |
349
- * "knowledge.wiki" | "knowledge.docs" | "knowledge.components" |
350
- * "review" | "tag" | "stale" | "greetings" | "dependencies" | "bookkeeping"
351
- *
352
- * `holocron setup` writes `.github/workflows/<name>.yml` for each entry,
353
- * calling the corresponding reusable workflow in `theholocron/.github`.
354
- * Files are overwritten on each run — they are generated artifacts.
355
- *
356
- * ### delivery.deploy / knowledge.docs / knowledge.components
357
- * `delivery.deploy` uses `docs` and/or `storybook` in `with:` — setup
358
- * derives `paths:` automatically. `docs: true` uses the org-standard
359
- * `docs/` directory; `docs: { path: "custom" }` overrides it.
360
- * `knowledge.docs` / `knowledge.components` are the same underlying
361
- * mechanism, each dedicated to exactly one type — they imply the
362
- * corresponding shorthand, so a repo using them never has to spell out
363
- * `docs: true` / `storybook: […]` itself.
364
- *
365
- * ```ts
366
- * // Docs only (standard layout)
367
- * { name: "delivery.deploy", with: { docs: true } }
368
- * // …or equivalently, the dedicated task:
369
- * "knowledge.docs"
370
- *
371
- * // Docs + monorepo storybooks
372
- * {
373
- * name: "delivery.deploy",
374
- * with: {
375
- * docs: true,
376
- * storybook: [
377
- * { name: "web", path: "apps/web" },
378
- * { name: "ui", path: "packages/ui" },
379
- * ],
380
- * },
381
- * }
382
- *
383
- * // Non-standard docs location
384
- * { name: "delivery.deploy", with: { docs: { path: "packages/site" } } }
385
- * ```
386
- *
387
- * ### run-chromatic
388
- * For a single-project repo, use `"run-chromatic": true` with a
389
- * `CHROMATIC_PROJECT_TOKEN` repository secret.
390
- *
391
- * For monorepos with multiple Storybooks, use the object form:
392
- * ```ts
393
- * "run-chromatic": {
394
- * projects: [
395
- * { tokenName: "WEB", workingDir: "apps/web" },
396
- * { tokenName: "UI", workingDir: "packages/ui" },
397
- * ]
398
- * }
399
- * ```
400
- * Each `tokenName` maps to a repository secret named
401
- * `CHROMATIC_PROJECT_TOKEN_<TOKENNAME>`. `holocron setup` expands this
402
- * to the flat `run-chromatic: true` + `chromatic-projects: <json>` inputs
403
- * that the reusable workflow accepts.
404
- *
405
- * @example
406
- * ["sourceQuality.staticAnalysis", { "name": "delivery.publish", "with": { "run-build": false } }]
407
- * { "name": "delivery.deploy", "with": { "docs": true } }
408
- */
409
- tasks?: Array<string | TaskEntryConfig>;
410
- /**
411
- * Opt out of `holocron sync`'s `package.json` script writes. Default `true`.
412
- */
413
- syncScripts?: boolean;
414
- /**
415
- * The command the synced `"holocron"` `package.json` script runs. Default
416
- * `"holocron"` (the installed bin). This repo overrides it to run its own
417
- * build (`"node packages/cli/dist/cli.mjs"`).
418
- */
419
- holocronScript?: string;
420
- /**
421
- * Required status-check contexts not backed by a `required` task (codecov
422
- * gates, the bundle-build check, …). `holocron setup` appends these to the
423
- * task-derived list from `astromech.requiredChecks()`.
424
- */
425
- extraRequiredChecks?: string[];
426
- /**
427
- * Git hooks `holocron setup` installs. `true` / `{ prePush: true }` writes
428
- * `.husky/pre-push` (runs `holocron ci` before every push); `false` /
429
- * `{ prePush: false }` opts out. Omitted → on for `protection: "strict"`,
430
- * off otherwise. `--hooks` / `--no-hooks` on `holocron setup` override.
431
- */
432
- hooks?: boolean | {
433
- prePush?: boolean;
434
- };
435
- providers: RawProvidersConfig;
436
- apps?: AppConfig[];
437
- doctor?: DoctorConfig;
438
- /**
439
- * Agent runtime that determines where skills are installed by `holocron setup`.
440
- * Skills are installed to `.agents/skills/<name>/` (canonical) with a
441
- * relative symlink at the agent-specific path:
442
- * - `"claude"` → `.claude/skills/<name>` → `../../.agents/skills/<name>`
443
- * - `"codex"` | `"gemini"` → logged as unsupported; skipped gracefully.
444
- */
445
- agent?: "claude" | "codex" | "gemini";
446
- /**
447
- * Skill names from `@theholocron/skills` to install during `holocron setup`.
448
- * Installed paths are gitignored and managed by setup — do not commit them.
449
- *
450
- * @example
451
- * ["git-safety", "pr-workflow", "commit-standards"]
452
- */
453
- skills?: string[];
454
- /**
455
- * GitHub Pages configuration. When present, `holocron setup` calls the
456
- * Pages API using `HOLOCRON_DEPLOY_TOKEN` (requires `pages:write` + `repo` scope).
457
- * When absent, Pages is left as-is.
458
- *
459
- * @example
460
- * { build: "workflow", domain: "docs.theholocron.dev", https: true }
461
- */
462
- docs?: DocsConfig;
463
- /**
464
- * Environment variable namespace configuration.
465
- * Declares the prefix(es) this project uses for its env vars so that
466
- * tooling can generate `.env.example`, validate required vars, and
467
- * produce accurate documentation without hard-coding prefix strings.
468
- *
469
- * @example
470
- * { namespaces: ["HOLOCRON", "MY_CLI"] }
471
- */
472
- env?: EnvConfig;
473
- /**
474
- * Structured-logging config. Only the level belongs here — Axiom
475
- * credentials come from env vars, never a committed file.
476
- *
477
- * @example
478
- * { level: "debug" }
479
- */
480
- log?: LogConfig;
481
- /**
482
- * CLI self-telemetry override layer. Env var (`HOLOCRON_TELEMETRY=false`)
483
- * still wins; this is the committed way to opt a repo out or drop usage
484
- * analytics while keeping error reporting.
485
- *
486
- * @example
487
- * { enabled: false }
488
- * { analytics: "none" }
489
- */
490
- telemetry?: TelemetryConfig;
491
560
  }
492
- interface ResolvedTuple {
493
- provider: string;
494
- /** Resolved package name (`@theholocron/holocron-plugin-<provider>` for short refs). */
495
- packageName: string;
496
- options: ProviderOptions;
561
+ /** The options of `providers.projects`, with their defaults filled in. */
562
+ interface ProjectOptions {
563
+ /** Whoever the boards belong to (a GitHub organization): the `org` option, else the config's `org`. */
564
+ owner: string;
565
+ /** The boards this repo keeps, template to name. Empty when the option is absent. */
566
+ boards: BoardDeclaration[];
567
+ /** The directory holding the repo's own template files, relative to the repo root. */
568
+ templatesDir: string;
497
569
  }
498
- type ResolvedProviderEntry = {
499
- cardinality: "single";
500
- tuple: ResolvedTuple;
570
+ /** What {@link resolveProjectOptions} made: the options, or every problem with them. */
571
+ type ResolveProjectOptionsResult = {
572
+ ok: true;
573
+ options: ProjectOptions;
501
574
  } | {
502
- cardinality: "many";
503
- tuples: ResolvedTuple[];
575
+ ok: false;
576
+ problems: string[];
504
577
  };
505
- type ResolvedProvidersConfig = Partial<Record<CapabilityKey, ResolvedProviderEntry>>;
506
- interface ResolvedHolocronConfig {
507
- name: string;
508
- description?: string;
509
- homepage?: string;
510
- org?: string;
511
- domain?: string;
512
- repo?: RepoConfig;
513
- tasks?: Array<string | TaskEntryConfig>;
514
- syncScripts?: boolean;
515
- holocronScript?: string;
516
- extraRequiredChecks?: string[];
517
- hooks?: boolean | {
518
- prePush?: boolean;
519
- };
520
- providers: ResolvedProvidersConfig;
521
- apps: AppConfig[];
522
- doctor: DoctorConfig;
523
- agent?: "claude" | "codex" | "gemini";
524
- skills?: string[];
525
- /** Resolved Pages config. `build` is guaranteed present when this field exists. */
526
- docs?: PagesConfig;
527
- env?: EnvConfig;
528
- log?: LogConfig;
529
- telemetry?: TelemetryConfig;
530
- }
531
- declare class ConfigError extends Error {
532
- name: string;
578
+ /** Where a repo's own template files live unless the `templates` option says otherwise. */
579
+ export declare const DEFAULT_TEMPLATES_DIR = ".holocron/projects";
580
+ /**
581
+ * Read the options of `providers.projects`: `org` (the owner, defaulting to `fallbackOwner`, the config's org), `boards`
582
+ * (a list of `{ template, name }`, nothing else about a board is written in the config) and `templates` (the directory
583
+ * of template files). Every problem is listed at once, and two boards with the same name are one.
584
+ */
585
+ export declare function resolveProjectOptions(options: Readonly<Record<string, unknown>>, fallbackOwner: string): ResolveProjectOptionsResult;
586
+ /** The templates that ship in `@theholocron/cli`, by name. A repo's own template with the same name replaces one. */
587
+ export declare const BUILTIN_TEMPLATES: Readonly<Record<string, BoardTemplate>>;
588
+ /**
589
+ * The labels every repository gets from `setup`, with their GitHub colours (hex, no `#`) and descriptions. A
590
+ * plugin that makes labels of its own, such as Linear's setup, takes the colour of the one with the same name.
591
+ */
592
+ export declare const CANONICAL_LABELS: readonly [{
593
+ readonly name: "bug";
594
+ readonly color: "d73a4a";
595
+ readonly description: "Something isn't working";
596
+ }, {
597
+ readonly name: "chore";
598
+ readonly color: "ededed";
599
+ readonly description: "Maintenance, no user-facing change";
600
+ }, {
601
+ readonly name: "ci";
602
+ readonly color: "0075ca";
603
+ readonly description: "CI/CD pipeline changes";
604
+ }, {
605
+ readonly name: "dependencies";
606
+ readonly color: "0366d6";
607
+ readonly description: "Dependency update";
608
+ }, {
609
+ readonly name: "documentation";
610
+ readonly color: "0075ca";
611
+ readonly description: "Documentation only";
612
+ }, {
613
+ readonly name: "duplicate";
614
+ readonly color: "cfd3d7";
615
+ readonly description: "Already reported";
616
+ }, {
617
+ readonly name: "enhancement";
618
+ readonly color: "a2eeef";
619
+ readonly description: "New feature or request";
620
+ }, {
621
+ readonly name: "good first issue";
622
+ readonly color: "7057ff";
623
+ readonly description: "Good for newcomers";
624
+ }, {
625
+ readonly name: "help wanted";
626
+ readonly color: "008672";
627
+ readonly description: "Extra attention needed";
628
+ }, {
629
+ readonly name: "invalid";
630
+ readonly color: "e4e669";
631
+ readonly description: "Doesn't seem right";
632
+ }, {
633
+ readonly name: "performance";
634
+ readonly color: "fbca04";
635
+ readonly description: "Performance improvement";
636
+ }, {
637
+ readonly name: "question";
638
+ readonly color: "d876e3";
639
+ readonly description: "Further information requested";
640
+ }, {
641
+ readonly name: "refactor";
642
+ readonly color: "cfd3d7";
643
+ readonly description: "Code restructuring";
644
+ }, {
645
+ readonly name: "released";
646
+ readonly color: "ededed";
647
+ readonly description: "Included in a release";
648
+ }, {
649
+ readonly name: "test";
650
+ readonly color: "bfd4f2";
651
+ readonly description: "Test-related changes";
652
+ }, {
653
+ readonly name: "triage";
654
+ readonly color: "e4e669";
655
+ readonly description: "Needs investigation";
656
+ }, {
657
+ readonly name: "wontfix";
658
+ readonly color: "ffffff";
659
+ readonly description: "Won't be addressed";
660
+ }];
661
+ /**
662
+ * The area a title scope means, by `repo.labels.scopes` (spec `tech-github-area-labels`): `sentinel` gives the area it is
663
+ * mapped to. The scope is matched without regard to case; a scope the map does not name, or a repo with no map, gives
664
+ * `undefined`. It is the area's name, not its label: `areaLabelsForTitle()` adds the prefix.
665
+ */
666
+ export declare function areaForScope(scope: string, scopes: Record<string, string> | undefined): string | undefined;
667
+ /** The colour of every area label: one family, one colour (spec `tech-github-area-labels`). */
668
+ export declare const AREA_LABEL_COLOR = "c5def5";
669
+ /**
670
+ * The labels `holocron setup` makes for the areas a repo declares: `area:<name>`, the one family colour and the
671
+ * description `Changes under <paths>` from the area's own (not excluded) patterns, cut to GitHub's 100 characters. They
672
+ * are never part of `CANONICAL_LABELS`: an area names this repo's folders, so another repo has none of them.
673
+ */
674
+ export declare function areaLabelDefs(areas: Record<string, string[]> | undefined): LabelDef[];
675
+ /**
676
+ * The `area:<name>` labels a set of changed paths earns, in the order the areas are declared (spec
677
+ * `tech-github-area-labels`). An area's patterns are the ones in `repo.labels.areas`; one starting with `!` takes a path
678
+ * out of the area (`docs/**` with `!docs/wiki/**`), so a path is in an area when some pattern includes it and none
679
+ * excludes it. A path in no area earns nothing, which is right, not a failure. This is the one mapping from changed
680
+ * folders to labels in the CLI; Sentinel's `planAreaLabels()` is meant to agree with it.
681
+ */
682
+ export declare function areaLabelsForFiles(files: readonly string[], areas: Record<string, string[]> | undefined): string[];
683
+ /**
684
+ * The `area:<name>` labels the scopes of an issue's title earn, through `repo.labels.scopes` (spec
685
+ * `tech-github-area-labels`): `feat(sentinel): ...` gives `["area:sentinel"]`. An issue has no changed files, so this is
686
+ * its only source of an area. A title with no scope, or a scope the map does not name, earns nothing; the same area
687
+ * from two scopes is given once, in the order of the title.
688
+ */
689
+ export declare function areaLabelsForTitle(title: string, scopes: Record<string, string> | undefined): string[];
690
+ /** The prefix of an area label (spec `tech-github-area-labels`): `area:cli`. */
691
+ export declare const AREA_PREFIX = "area:";
692
+ /**
693
+ * Whether a repository path (forward slashes, from the root) matches one pattern of `repo.labels.areas`. A pattern with
694
+ * a `*` or `?` is a glob (`cli/**`, `docs/**` then `/*.md`); one without is a file (`turbo.json`) or a folder and
695
+ * everything under it (`.holocron`, `.holocron/`).
696
+ */
697
+ export declare function pathMatches(path: string, pattern: string): boolean;
698
+ /**
699
+ * The scopes of a Conventional Commit title: `feat(sentinel): ...` gives `["sentinel"]`, `fix(cli, docs)!: ...` gives
700
+ * `["cli", "docs"]`. A title with no scope, or that is not in the `type(scope): subject` form, gives none.
701
+ */
702
+ export declare function titleScopes(title: string): string[];
703
+ /** What one token must carry in one layer, as `tokenExpectations()` reads it from a plugin's `PluginToken.expect`. */
704
+ interface LayerTokenExpectation {
705
+ /** The token's plugin environment variable (`PluginToken.envName`), its identity in the plugin's list. */
706
+ envName: string;
707
+ /** The layer that holds it. */
708
+ layer: EnvironmentLayer;
709
+ /** Every permission with its rule. Empty for a layer that holds the token with no permission rules. */
710
+ rules: Readonly<Record<string, PermissionRule>>;
711
+ /** The permissions the token must have, in declaration order. */
712
+ required: readonly string[];
713
+ /** The permissions the token must not have, in declaration order. */
714
+ absent: readonly string[];
715
+ /** When the token is due for rotation: the declared policy over `DEFAULT_TOKEN_ROTATION`. */
716
+ rotation: Required<TokenRotation>;
717
+ }
718
+ /** Which of the declared expectations to return; both left out returns all of them. */
719
+ interface TokenExpectationFilter {
720
+ /** Only this layer. */
721
+ layer?: string;
722
+ /** Only the token with this `envName`. */
723
+ envName?: string;
533
724
  }
534
725
  /**
535
- * Resolve `"github"` → `"@theholocron/holocron-plugin-github"`.
536
- * Fully-qualified names (scoped or not) are honored verbatim, which
537
- * is how third-party plugins published outside the org work.
538
- */
539
- declare function resolvePluginPackage(provider: string): string;
540
- declare function resolveEntry(key: CapabilityKey, raw: RawProviderEntry): ResolvedProviderEntry;
541
- declare function resolveConfig(raw: HolocronConfig): ResolvedHolocronConfig;
542
- //#endregion
543
- //#region src/commands/setup/derived-properties.d.ts
544
- /**
545
- * Derived custom-properties (#677). Unlike the existing 6 GitHub
546
- * custom-properties fields (`lifecycle`, `open_source`, `runtime_environment`,
547
- * `uses_external_packages`, `monorepo`, `branch_protection_level`) — which
548
- * mirror what `holocron.config.ts` already states explicitly — these four are
549
- * *derived*: signal that isn't an explicit config field today (framework
550
- * choice, repo archetype, capability drift). See
551
- * `.notes/tech-holocron-platform.spec.md` → "Custom-properties sync — field
552
- * definitions (#677)" for the full design.
553
- */
554
- type HolocronProfile = "library" | "cli" | "plugin" | "template" | "app" | "docs" | "platform";
555
- interface PackageJsonLike {
556
- name?: string;
557
- private?: boolean;
558
- bin?: unknown;
559
- dependencies?: Record<string, string>;
560
- devDependencies?: Record<string, string>;
561
- }
562
- interface DeriveProfileInput {
563
- rootPackageJson: PackageJsonLike | null;
564
- repoName: string;
565
- isMonorepo: boolean;
566
- /** `packages/*` package.json contents, monorepo repos only — used to find the primary published artifact. */
567
- workspacePackageJsons: PackageJsonLike[];
568
- }
569
- /**
570
- * Repo archetype, in priority order:
571
- * 1. `*-template` repo name → `template` (independent of package shape).
572
- * 2. Monorepo whose primary published artifact is a CLI (some workspace
573
- * package has `bin`) → `platform` — matches `holocron` itself: the CLI is
574
- * the deliverable, the plugin packages are supporting infrastructure for
575
- * it, not separate products.
576
- * 3. Monorepo with no CLI but at least one non-private workspace package →
577
- * `library` — matches `clients`/`configs`/`utils`/`themes`/
578
- * `observability`: a family of published packages, none of them a CLI.
579
- * Checked *before* falling into the root-package branch below, because
580
- * these repos' own root `package.json` is private and often carries
581
- * `@theholocron/astro-config` for a docs site built from the monorepo
582
- * root — without this check they'd wrongly resolve to `docs` off that
583
- * root-level signal alone, when the docs site is a secondary concern of
584
- * a library collection, not what the repo fundamentally is.
585
- * 4. Single-package repo with `package.json#bin` → `cli`.
586
- * 5. Docs-only site (astro/starlight present, root package private, no
587
- * publishable exports) → `docs`.
588
- * 6. Private, non-publishable, non-docs → `app`.
589
- * 7. Otherwise, a single publishable package → `library`.
590
- */
591
- declare function deriveProfile(input: DeriveProfileInput): HolocronProfile;
592
- /**
593
- * Detected build/framework tooling — the literal "does this repo need
594
- * next/vite/tsdown" signal `holocron.config.ts` has no field for today
595
- * (framework choice isn't a config concept, unlike `providers`/`tasks`).
596
- * Curated table, not exhaustive by design — add to `KNOWN_STACK_DEPS` as new
597
- * frameworks show up rather than trying to detect anything on npm.
598
- */
599
- declare function deriveStack(pkg: PackageJsonLike | null): string[];
600
- /** The provider capability keys actually wired in `providers: {}` — zero heuristics. */
601
- declare function deriveCapabilities(providers: ResolvedProvidersConfig | undefined): string[];
602
- declare function deriveCompliance(capabilities: readonly string[]): "compliant" | "non-compliant";
603
- /**
604
- * The Phase B refinement `deriveCompliance()`'s own doc comment names —
605
- * *why* a repo is non-compliant, not just that it is. `[]` when compliant.
606
- * Same `REQUIRED_BASELINE` `deriveCompliance()` checks against — one
607
- * table, not two independently-maintained baselines.
608
- */
609
- declare function missingCapabilities(capabilities: readonly string[]): string[];
610
- /**
611
- * Reads each workspace package's actual `package.json` content (not just
612
- * `readWorkspacePackages()`'s `{ slug, name, dir }` — `deriveProfile()`'s
613
- * `platform` detection needs `bin`, which that helper doesn't carry).
614
- * Missing/invalid files are skipped, matching `readWorkspacePackages()`'s
615
- * own soft-fail behavior.
616
- */
617
- declare function readWorkspacePackageJsons(repoRoot: string, workspacePackages: readonly WorkspacePackage[]): Promise<PackageJsonLike[]>;
618
- //#endregion
619
- //#region src/config/compose.d.ts
620
- type TaskEntry = NonNullable<HolocronConfig["tasks"]>[number];
621
- /** A single composable capability fragment. */
622
- interface Capability {
623
- /** Unique identifier — used for deduplication and dependency resolution. */
624
- id: string;
625
- /** Other capability IDs that must be present in the same compose() call. */
626
- requires?: string[];
627
- /** Task entries contributed by this capability. Merged by name; last writer wins. */
628
- tasks?: TaskEntry[];
629
- /** Provider config. Shallow-merged at the top level; later capabilities override per-key. */
630
- providers?: RawProvidersConfig;
631
- /**
632
- * Required status-check contexts **not** backed by a `required` task
633
- * (codecov gates, `Storybook Publish`, …). Unioned across all capabilities
634
- * onto the top-level `extraRequiredChecks`. Task-backed checks come from
635
- * `{ required: true }` task entries via `astromech.requiredChecks()`.
636
- */
637
- extraRequiredChecks?: string[];
638
- /** Repo config fragment. Scalar fields: last writer wins. properties/topics/teams: merged. */
639
- repo?: Partial<Omit<RepoConfig, "name">>;
640
- /** Org name. Last writer wins. */
641
- org?: string;
642
- /** Org canonical domain. Last writer wins. */
643
- domain?: string;
644
- /** Docs site config. Last writer wins. */
645
- docs?: DocsConfig;
646
- }
647
- /** The merged result of a compose() call. Spreads into defineConfig(). */
648
- interface ComposedPreset {
649
- tasks: TaskEntry[];
650
- providers: RawProvidersConfig;
651
- repo: Partial<Omit<RepoConfig, "name">>;
652
- /** Non-task required-check contexts, unioned across capabilities. */
653
- extraRequiredChecks: string[];
654
- org?: string;
655
- domain?: string;
656
- docs?: DocsConfig;
726
+ * Reads what a plugin's tokens declare (`PluginToken.expect`) as one entry per token and layer that holds it, in the
727
+ * order of `ENVIRONMENT_LAYERS`. The one reader the token probes, the doctor and the docs check share, so none of them
728
+ * walks the declaration itself. A token with no `expect` yields nothing; a layer no token holds is never listed.
729
+ */
730
+ export declare function tokenExpectations(tokens: readonly PluginToken[], filter?: TokenExpectationFilter): LayerTokenExpectation[];
731
+ /** When a provider says a token was made and when it stops working. Each is an ISO date or time, left out when unknown. */
732
+ interface TokenLifetime {
733
+ /** When the token was made, or became valid when that is all the provider says (Cloudflare `not_before`). */
734
+ createdAt?: string;
735
+ /** When the token expires. Unset for a token that never does. */
736
+ expiresAt?: string;
657
737
  }
738
+ /** The rotation policy of a token that declares none: a token is due after 90 days, and an expiry is flagged 14 days ahead. */
739
+ export declare const DEFAULT_TOKEN_ROTATION: Required<TokenRotation>;
658
740
  /**
659
- * Merge any number of capability fragments into a single preset object that
660
- * spreads directly into `defineConfig()`.
661
- *
662
- * - Accepts individual capabilities or nested arrays (for bundle presets).
663
- * - Deduplicates by `id` — when the same ID appears more than once, the last
664
- * occurrence wins. This lets callers override bundle defaults by listing an
665
- * explicit capability after the bundle.
666
- * - Validates all `requires` at call time and throws `ConfigError` if any are
667
- * unmet, listing every missing dependency in a single message.
668
- *
669
- * @example
670
- * // docs-only site — no typecheck
671
- * const preset = compose(node(), docs());
672
- *
673
- * // library with docs
674
- * const preset = compose(node(), typecheck(), docs());
741
+ * Rows saying whether a token is due for rotation, from what its provider exposes. Provider-neutral: a token probe reads
742
+ * the lifetime however its provider offers it and hands it here, with the layer's `rotation` from `tokenExpectations()`.
743
+ * `lifetime` is `undefined` when the provider exposes nothing (the row says so rather than passing), and a date the
744
+ * provider gave that does not parse is an `info` row, never a pass. An expired or near-expiry token fails, and so does
745
+ * one older than `maxAgeDays`. Only dates are printed, never the token.
746
+ */
747
+ export declare function tokenRotationRows(lifetime: TokenLifetime | undefined, rotation: Required<TokenRotation>, now: Date): ProbeRow[];
748
+ /**
749
+ * What stdout is. A token is never written to a `terminal` (it would sit in scrollback) or to `other` (a redirect to
750
+ * a regular file, which would leave plaintext tokens on disk without the protections of the file option); only a
751
+ * `pipe` receives the lines. On a terminal they go to the file option instead, or the clipboard when asked.
752
+ */
753
+ type AuthExportOutKind = "terminal" | "pipe" | "other";
754
+ /**
755
+ * What file descriptor `fd` (stdout) is, for deciding where tokens may go: a `terminal`, a `pipe` (a FIFO, or the
756
+ * socket some shells and runners use for one), or `other` (a regular file, a device, or anything that cannot be
757
+ * inspected). Only a pipe is safe to write the lines to, so anything unknown is `other`.
758
+ */
759
+ export declare function stdoutKind(isTerminal: boolean, fd?: number, stat?: (fd: number) => Pick<Stats, "isFIFO" | "isSocket">): AuthExportOutKind;
760
+ /**
761
+ * The vault Environment `holocron sync secrets --env <environment>` reads. A layer word (`local`, `dev`, `ci`, `prod`) is the
762
+ * Environment of that layer of this repository, `<org/repo> - <layer>`; any other text is a literal Environment name.
763
+ * A literal name wins only when it is not exactly a layer word, so an Environment that is itself called `prod` cannot be
764
+ * addressed by that name (spec `tech-environment-layers`, #2069).
675
765
  *
676
- * // nextjs() is a bundle that returns Capability[]
677
- * const preset = compose(node(), nextjs());
678
- */
679
- declare function compose(...args: (Capability | Capability[])[]): ComposedPreset;
680
- //#endregion
681
- //#region src/config/define-config.d.ts
682
- declare function defineConfig(config: HolocronConfig): HolocronConfig;
683
- //#endregion
684
- //#region src/config/load-config.d.ts
685
- interface LoadedConfig {
686
- resolved: ResolvedHolocronConfig;
687
- /** Absolute path to the file the config was read from. */
688
- filepath: string;
689
- }
690
- /**
691
- * Read + parse + resolve `holocron.config.*` from the given directory.
692
- * Throws {@link ConfigFileError} when nothing is found or a file cannot
693
- * be loaded, or `ConfigError` when the config is invalid.
694
- */
695
- declare function loadConfig(cwd: string): Promise<LoadedConfig>;
696
- //#endregion
697
- export { Analytics, AppConfig, Auth, AuthDescription, AuthError, AuthEvent, AuthEventType, AuthIdentity, AuthUser, CARDINALITY, Capability, CapabilityConfigPackage, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, ChromaticProjectConfig, Ci, CiRun, CiRunFilter, CiRunStatus, ComposedPreset, ConfigError, ConfigFileError, ConnectionStringOptions, CreateAuthUserInput, DeployFunctionConfig, DeployFunctionResult, DeployScriptConfig, DeployScriptResult, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, DeriveProfileInput, Dns, DnsRecord, DnsRecordRequest, DnsRecordType, DocsConfig, DoctorConfig, EnsureResult, EnvConfig, Environment, EnvironmentReviewer, Environments, Errors, FeatureResolverConfig, HolocronConfig, HolocronProfile, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, LoadedConfig, LogConfig, Logs, MultiEntry, NormalizedAuthUser, Notifications, PackageJsonLike, PagesConfig, ParseWebhookInput, ProviderApiError, ProviderIdentity, ProviderOptions, PullRequest, REQUIRED_CAPABILITIES, RawProviderEntry, RawProvidersConfig, RepoConfig, RepoProperties, RepoProtection, RepoRef, RepoSettings, type RequestOptions, ResolveTokenConfig, type ResolveTokenInput, ResolvedCapability, ResolvedHolocronConfig, ResolvedProviderEntry, ResolvedProvidersConfig, ResolvedTuple, type RestClient, type RestClientConfig, Ruleset, SecretScope, Secrets, SingleEntry, Source, StatusCategory, Storage, StorageBranch, StorybookDeployProject, TaskEntryConfig, TeamEntry, TeamPermission, TelemetryConfig, Tooling, ToolingDoctorReport, TrackerDoctorReport, TrackerUser, Vault, WebhookDashboardInfo, WebhookVerificationError, Wiki, WikiProvisionOpts, WikiProxyConfig, Workers, WorkflowWithConfig, compose, createFeatureResolver, createResolveToken, createRestClient, defineConfig, deleteToken, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, getToken, isMulti, listStoredProviders, loadConfig, missingCapabilities, readWorkspacePackageJsons, resolveConfig, resolveEntry, resolvePluginPackage, setToken };
766
+ * @param id - The `--env` value the user gave.
767
+ * @param input - Where the repository is (its `origin` remote is read there), and optionally how to read it.
768
+ * @throws {ConfigError} For a layer word when the remote cannot be read (the message names the `environment` option).
769
+ */
770
+ export declare function resolveEnvironmentId(id: string, input: {
771
+ repoRoot: string;
772
+ gitExec?: GitExec;
773
+ }): Promise<string>;
774
+ /** The line that says how to fix a credentials path the version control ignore rules do not cover. */
775
+ export declare function ignoreAdvice(isDefault: boolean, choose: string): string;
776
+ /** The file `export tokens` and `new github-app` write by default, relative to the repository root. */
777
+ export declare const PRIVATE_CREDENTIALS_FILE = ".holocron/.private/.credentials";
778
+ /** Where a credentials file goes: its absolute path, and whether it is the default one in the private directory. */
779
+ interface CredentialsFileTarget {
780
+ path: string;
781
+ /** True when no `--file` was given, so the file is in `.holocron/.private/` and a missing ignore rule is fixed by `sync`. */
782
+ isDefault: boolean;
783
+ }
784
+ /**
785
+ * The credentials file for a command: `file` (relative to `base`) when given, else `.holocron/.private/.credentials`
786
+ * under `base`. The default's directory is created when missing (owner-only), because the ignore check can only ask
787
+ * about a path whose directory exists and the file cannot be written without it.
788
+ */
789
+ export declare function resolveCredentialsFile(base: string, file: string | undefined, makeDir?: (dir: string) => void): CredentialsFileTarget;
790
+ /**
791
+ * The closed list of area files `loadConfig` reads from `.holocron/` (the directory is `.<config name>`, set by kyber):
792
+ * `.holocron/notifications.*` fills `providers.notifications`' `layout`, `.holocron/repo.*` fills keys of `repo`, and `.holocron/org.*` fills provider options (`teamId`, `accountId`) a config leaves out.
793
+ * A file not on this list is never read.
794
+ */
795
+ export declare const HOLOCRON_AREAS: readonly ["notifications", "repo", "org"];
796
+ /**
797
+ * The areas a config in a subdirectory also reads from the repository root's `.holocron/` (SPEC-0069): only `org`,
798
+ * because its values are the organization's and every config needs them. `repo` and `notifications` describe the
799
+ * repository itself, so an app's config does not take them from the root.
800
+ */
801
+ export declare const SHARED_AREAS: readonly ["org"];
802
+ /**
803
+ * Put the area files of `.holocron/` into the config as loaded, before `deriveDefaults` runs: `notifications` becomes
804
+ * the `layout` of the notifications provider and `repo` supplies keys of `repo` and `org` fills the provider options a config leaves out. A value set both inline and in a file
805
+ * is a `ConfigError` naming both (no merge, no precedence). With no area files the config is returned as it was.
806
+ */
807
+ export declare function placeAreas(areas: ConfigDirArea[], raw: HolocronConfig): HolocronConfig;
808
+ export { AddedItem, type AgentName, type AgentOptions, Analytics, type AppConfig, Auth, AuthDescription, AuthError, AuthEvent, AuthEventType, type AuthExportOutKind, AuthIdentity, AuthUser, type BoardDeclaration, BoardField, BoardFieldType, BoardItem, BoardItemInput, BoardPullRequest, BoardPullRequestChecks, BoardRule, BoardState, BoardStatus, BoardStatusCategory, BoardSummary, BoardTemplate, BoardTemplateFile, BoardView, CARDINALITY, Cache, CacheTokenCheck, type Capability, type CapabilityConfigPackage, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, type ChromaticProjectConfig, Ci, CiRun, CiRunFilter, CiRunStatus, type ComposedPreset, ConfigError, ConfigFileError, ConnectionStringOptions, CoreIssueKind, Coverage, CoverageConfigComponent, CoverageConfigDocumentation, CoverageConfigInput, CoverageExpectations, CoverageNameDiff, CoverageRepoReport, CoverageStatusContext, CoverageStatusInput, CoverageTokenCheck, CoverageUploadFlagResult, CoverageUploadGroup, CoverageUploadInput, CoverageUploadResult, CreateAuthUserInput, Credentials, type CredentialsConfig, CredentialsInspection, type CustomReaction, DeployFunctionConfig, DeployFunctionResult, DeployScriptConfig, DeployScriptResult, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, type DeriveProfileInput, type DevConfig, type DevServeConfig, DiscussionPatch, DiscussionPost, Dns, DnsRecord, DnsRecordRequest, DnsRecordType, type DocsConfig, type DoctorConfig, DuplicateDiscussion, ElevationRequiredError, EmojiCheck, EnsureDiscussionInput, EnsureRelayInput, EnsureRelayResult, EnsureRelaySourceInput, EnsureRelaySourceResult, EnsureReport, EnsureResult, EnsureWebhookResult, EnsuredDiscussion, EnsuredResource, EnsuredTunnel, type EnvConfig, Environment, EnvironmentEntry, type EnvironmentLayer, EnvironmentReviewer, Environments, Errors, ErrorsInspection, ErrorsOrgState, ErrorsProjectState, type EslintConfig, ExportInfo, type FeatureResolver, type FeatureResolverConfig, type GitHubAppConfig, type HolocronConfig, type HolocronProfile, IdeaRecord, Ideas, type IdeasConfig, ImportOptions, ImportResult, InspectErrorsInput, InspectRelayInput, InspectRelaySourceInput, Issue, IssueClearable, IssueComment, IssueCreateInput, IssueEffort, IssueFields, IssueKind, IssueOrder, IssuePatch, IssuePriority, IssueRecord, IssueSearchFilter, IssueSelector, IssueTypeDeclaration, IssueTypeInfo, IssueUpdateResult, Issues, KNOWN_STACK_DEPS, LabelDef, type LayerTokenExpectation, type LayoutEmoji, LifecycleResult, LifecycleSlot, type LinksFile, type LoadedConfig, type LogConfig, Logs, LogsDataset, type MemberLink, MissingTokenError, Monitoring, MonitoringAlertChannelInput, MonitoringAlertChannelResult, MonitoringAlertChannelState, MonitoringAlertSettings, MonitoringAssertion, MonitoringAssertionComparison, MonitoringAssertionSource, MonitoringCheck, MonitoringCheckInput, MonitoringDashboardInput, MonitoringDashboardState, MonitoringHeartbeatInput, MonitoringHeartbeatResult, MonitoringHeartbeatUnit, MonitoringHttpMethod, MonitoringIncident, MonitoringIncidentImpact, MonitoringIncidentInput, MonitoringIncidentQuery, MonitoringIncidentResolveInput, MonitoringIncidentStatus, MonitoringIncidentUpdate, MonitoringIncidentUpdateInput, MonitoringIncidentWrite, MonitoringStatusComponentInput, MonitoringStatusPageInput, MonitoringStatusPageResult, MonitoringStatusPageState, MoveReport, type MultiEntry, NormalizedAuthUser, Notifications, NotificationsAccess, NotificationsApplicationLayout, NotificationsChannelLayout, NotificationsDelivery, NotificationsEveryoneLayout, NotificationsForumTag, NotificationsLayout, NotificationsLinksLayout, NotificationsMember, NotificationsMonitoringFeed, NotificationsOnboardingLayout, NotificationsPicture, NotificationsPinnedLayout, NotificationsPrsFeed, NotificationsReaction, NotificationsRelaySource, NotificationsServerLayout, NotificationsSignIn, NotificationsSignedIn, NotificationsWelcomeLayout, type OrgConfig, type OrgIssueType, OrganizationSecretScope, type PackageJsonLike, PagesConfig, ParseWebhookInput, type ParsedReaction, type PermissionRule, type PluginProbes, type PluginToken, type Probe, type ProbeContext, type ProbeRow, type ProjectOptions, Projects, type ProviderAction, type ProviderActionContext, type ProviderActions, ProviderApiError, ProviderIdentity, type ProviderOptions, type ProviderRow, PullRequest, PullRequestChecks, PullRequestChecksState, PullRequestFields, PullRequestInput, PullRequestLink, PullRequestPatch, PullRequestResult, type PullRequestStatusChange, type PullRequestStatusPlan, type PullRequestStatusReason, type PullRequestStatusUnresolved, REQUIRED_CAPABILITIES, type RawProviderEntry, type RawProvidersConfig, type ReadKeysLimitedInput, type ReconcileChange, type ReconcilePlan, type ReconcileReason, type ReconcileUnresolved, RelaySourceCapability, RelaySourceMethods, RelaySourceState, RelayState, type RepoConfig, type RepoLabels, type RepoProperties, type RepoProtection, RepoRef, type RepoSecrets, type RepoSecretsDeploy, type RepoSecretsSync, RepoSettings, type RepoValidationConfig, type RepoVariables, type RepoVariablesSync, type RequestOptions, type ResolveProjectOptionsResult, type ResolveTokenConfig, type ResolveTokenInput, ResolvedCapability, type ResolvedHolocronConfig, type ResolvedProviderEntry, type ResolvedProvidersConfig, type ResolvedTuple, type RestClient, type RestClientConfig, Ruleset, SecretAccess, SecretScope, SecretVisibility, Secrets, ServerInspection, type SingleEntry, Source, SourceBranch, SourceCheckRun, SourceCheckRunWrite, SourceCommitStatus, SourceFile, SourceRepoInfo, SourceRulesetDetail, SourceSecurity, SourceTeamMember, type StackName, StatusCategory, Storage, StorageBranch, type StorybookDeployProject, SyncResult, type SyncRolesInput, type SyncRolesResult, type TaskEntry, type TaskEntryConfig, TeamEntry, TeamPermission, type TelemetryConfig, type TokenExpectation, type TokenExpectationFilter, type TokenLifetime, type TokenResolver, type TokenRotation, Tooling, ToolingDoctorReport, ToolingExportInput, ToolingExportIssue, ToolingExportResult, ToolingOpenInput, ToolingOpenLaunch, ToolingOpenPlan, ToolingOpenWant, ToolingWorkspaceFile, ToolingWorkspaceInput, ToolingWorkspaceResult, ToolingWorkspaceSide, ToolingWorkspaceState, TrackerDoctorReport, TrackerUser, TunnelRoute, Tunnels, type UnicodeReaction, Vault, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, WebhookDashboardInfo, WebhookVerificationError, Wiki, WikiInspection, WikiInstanceState, WikiNavigationState, WikiOrganizationState, WikiProbe, WikiProvisionOpts, WikiProxyConfig, WikiPublishedState, WorkerDeploymentState, WorkerScriptState, Workers, type WorkflowWithConfig, compose, createRestClient, credentialsEnvironment, defineConfig, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, isMulti, loadConfig, missingCapabilities, readWorkspacePackageJsons, resolveConfig, resolveEntry, resolvePluginPackage, resolveValue };