@theholocron/cli 5.0.0-alpha.340 → 5.0.0-alpha.342

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.
@@ -1,11 +1,11 @@
1
1
  import { CARDINALITY, REQUIRED_CAPABILITIES } from "./plugin/capabilities.mjs";
2
+ import { ConfigError, ConfigFileError, createConfigSystem, lastWins, mergeByKey, shallowMerge, union } from "@theholocron/kyber/config";
3
+ import { basename, dirname } from "node:path";
4
+ import { readPackageJson } from "@theholocron/pkg-utils";
2
5
  import { resolveTaskName } from "@theholocron/astromech";
6
+ import { loadTasksConfig } from "@theholocron/astromech/config";
7
+ import { readGitRemote } from "@theholocron/git-utils";
3
8
  // src/config/config/config.ts
4
- /** Thrown when a `holocron.config` is invalid. */
5
- var ConfigError = class extends Error {
6
- /** The error's name, `"ConfigError"`. */
7
- name = "ConfigError";
8
- };
9
9
  const PLUGIN_PREFIX = "@theholocron/holocron-plugin-";
10
10
  const COMMUNITY_PREFIX = "holocron-plugin-";
11
11
  /**
@@ -163,17 +163,7 @@ function resolveConfig(raw) {
163
163
  eslint: raw.eslint
164
164
  };
165
165
  }
166
- // src/config/compose/compose.ts
167
- /**
168
- * The key a task entry merges under. A name that stands for exactly one flat id (the id itself, or an old dotted
169
- * alias such as `verification.unitTests`) keys by that id, so the alias overrides the preset's entry instead of
170
- * sitting next to it; a name that stands for several ids or none (a suite, an unknown name) keys by itself.
171
- */
172
- function taskName(e) {
173
- const name = typeof e === "string" ? e : e.name;
174
- const resolved = resolveTaskName(name);
175
- return resolved.length === 1 ? resolved[0].id : name;
176
- }
166
+ // src/config/compose/merge-sync/merge-sync.ts
177
167
  /**
178
168
  * Merge two lists of `repo.secrets.sync` entries. An entry is the same sync when its environment and scope match;
179
169
  * the keys then add up, and an entry that names no keys (every key the vault holds) stays that way.
@@ -193,6 +183,139 @@ function mergeSync(a, b) {
193
183
  keys
194
184
  } : rest);
195
185
  }
186
+ // src/config/compose/merge-repo/merge-repo.ts
187
+ const names = union();
188
+ const properties = shallowMerge();
189
+ const teamsByKey = mergeByKey((t) => typeof t === "string" ? t : t.slug);
190
+ /**
191
+ * Merge one capability's `repo` fragment onto what earlier ones gave. Scalars: last writer wins. `properties`: shallow
192
+ * merge. `variables`: merged per scope (`repo`, `org`). `secrets`: each name list is a union, and `sync` entries merge by
193
+ * environment and scope. `topics`: union. `teams`: merged by slug.
194
+ */
195
+ function mergeRepo(prev, next) {
196
+ const { properties: nextProperties, topics, teams, variables, secrets, ...scalars } = next;
197
+ const repo = {
198
+ ...prev,
199
+ ...scalars
200
+ };
201
+ if (nextProperties) repo.properties = properties.merge(repo.properties ?? {}, nextProperties);
202
+ if (variables) repo.variables = {
203
+ ...repo.variables,
204
+ ...variables,
205
+ ...repo.variables?.repo || variables.repo ? { repo: {
206
+ ...repo.variables?.repo,
207
+ ...variables.repo
208
+ } } : {},
209
+ ...repo.variables?.org || variables.org ? { org: {
210
+ ...repo.variables?.org,
211
+ ...variables.org
212
+ } } : {}
213
+ };
214
+ if (secrets) {
215
+ const environments = { ...repo.secrets?.environments };
216
+ for (const [env, list] of Object.entries(secrets.environments ?? {})) environments[env] = names.merge(environments[env] ?? [], list);
217
+ repo.secrets = {
218
+ ...repo.secrets?.repo || secrets.repo ? { repo: names.merge(repo.secrets?.repo ?? [], secrets.repo ?? []) } : {},
219
+ ...repo.secrets?.org || secrets.org ? { org: names.merge(repo.secrets?.org ?? [], secrets.org ?? []) } : {},
220
+ ...Object.keys(environments).length > 0 ? { environments } : {},
221
+ ...repo.secrets?.sync || secrets.sync ? { sync: mergeSync(repo.secrets?.sync, secrets.sync) } : {}
222
+ };
223
+ }
224
+ if (topics) repo.topics = names.merge(repo.topics ?? [], topics);
225
+ if (teams) repo.teams = teamsByKey.merge(repo.teams ?? [], teams);
226
+ return repo;
227
+ }
228
+ // src/config/compose/task-name/task-name.ts
229
+ /**
230
+ * The key a task entry merges under. A name that stands for exactly one flat id (the id itself, or an old dotted
231
+ * alias such as `verification.unitTests`) keys by that id, so the alias overrides the preset's entry instead of
232
+ * sitting next to it; a name that stands for several ids or none (a suite, an unknown name) keys by itself.
233
+ */
234
+ function taskName(e) {
235
+ const name = typeof e === "string" ? e : e.name;
236
+ const resolved = resolveTaskName(name);
237
+ return resolved.length === 1 ? resolved[0].id : name;
238
+ }
239
+ // src/config/compose/merge-strategies/merge-strategies.ts
240
+ /**
241
+ * How `compose()` merges each key of the capabilities: tasks by name (an old dotted alias overrides the entry it names),
242
+ * providers shallowly, the non-task required checks as a union, `repo` by its own rules, the rest last writer wins.
243
+ */
244
+ const mergeStrategies = {
245
+ tasks: mergeByKey(taskName),
246
+ providers: shallowMerge(),
247
+ extraRequiredChecks: union(),
248
+ repo: {
249
+ empty: {},
250
+ merge: mergeRepo
251
+ },
252
+ org: lastWins(),
253
+ domain: lastWins(),
254
+ docs: lastWins()
255
+ };
256
+ // src/config/load-config/read-package-json-name/read-package-json-name.ts
257
+ /** The `name` of the `package.json` in `dir` without its scope, or `undefined`. */
258
+ async function readPackageJsonName(dir) {
259
+ const name = (await readPackageJson(dir))?.name;
260
+ return name === void 0 ? void 0 : name.replace(/^@[^/]+\//, "");
261
+ }
262
+ // src/config/load-config/derive-defaults/derive-defaults.ts
263
+ /**
264
+ * Fill in what a `holocron.config` leaves out: `name` from the package or directory, `repo.name` from the GitHub
265
+ * remote, and the task manifest (merged from `astromech.config.*`).
266
+ */
267
+ async function deriveDefaults(found) {
268
+ const configDir = dirname(found.filepath);
269
+ const result = { ...found.config };
270
+ if (!result.name) result.name = await readPackageJsonName(configDir) ?? basename(configDir);
271
+ if (result.repo && !result.repo.name) {
272
+ const remote = await readGitRemote(configDir);
273
+ if (remote?.host === "github.com") result.repo = {
274
+ ...result.repo,
275
+ name: remote.slug
276
+ };
277
+ }
278
+ const manifest = await loadTasksConfig(configDir, { holocron: found });
279
+ if (manifest.tasks) result.tasks = manifest.tasks;
280
+ if (manifest.syncScripts !== void 0) result.syncScripts = manifest.syncScripts;
281
+ if (manifest.holocronScript !== void 0) result.holocronScript = manifest.holocronScript;
282
+ if (manifest.hooks !== void 0) result.hooks = manifest.hooks;
283
+ if (manifest.extraRequiredChecks) result.extraRequiredChecks = [...result.extraRequiredChecks ?? [], ...manifest.extraRequiredChecks];
284
+ return result;
285
+ }
286
+ // src/config/config-system.ts
287
+ /**
288
+ * Holocron's config system: `defineConfig`, `loadConfig` and `compose`, all built from one
289
+ * `createConfigSystem` call.
290
+ *
291
+ * File discovery, the walk up to `.git`, module loading (typed configs via `tsx`) and the derive-then-resolve flow come
292
+ * from `@theholocron/kyber/config`. The holocron-specific parts are `deriveDefaults` (name, `repo.name`, the task
293
+ * manifest), `resolveConfig` and `mergeStrategies`.
294
+ *
295
+ * The three functions live together because each is only a method of the one system object; splitting them back into
296
+ * one file apiece would just be pass-through wrappers (an exception to the one-function-per-file rule).
297
+ *
298
+ * Probe order is TS-first (`.ts` → `.js` → `.mjs` → `.cjs` → `.json`) —
299
+ * see ADR-0010 / issue #75 / #81.
300
+ */
301
+ const system = createConfigSystem({
302
+ name: "holocron",
303
+ derive: deriveDefaults,
304
+ resolve: resolveConfig,
305
+ merge: mergeStrategies
306
+ });
307
+ /** Returns the config unchanged; it exists to type and autocomplete a `holocron.config.ts`. */
308
+ const defineConfig = system.defineConfig;
309
+ /**
310
+ * Read + parse + resolve `holocron.config.*` starting from the given
311
+ * directory, walking up through ancestors to the nearest `.git` boundary
312
+ * when `cwd` itself has no match — every command is usable from any
313
+ * subdirectory of a repo, not only its exact root (see
314
+ * `@theholocron/datapad`'s own doc comment for the stop conditions).
315
+ * Throws `ConfigFileError` when nothing is found or a file cannot
316
+ * be loaded, or `ConfigError` when the config fails schema checks.
317
+ */
318
+ const loadConfig = system.loadConfig;
196
319
  /**
197
320
  * Merge any number of capability fragments into a single preset object that
198
321
  * spreads directly into `defineConfig()`.
@@ -214,89 +337,5 @@ function mergeSync(a, b) {
214
337
  * // nextjs() is a bundle that returns Capability[]
215
338
  * const preset = compose(node(), nextjs());
216
339
  */
217
- function compose(...args) {
218
- const flat = args.flat();
219
- const byId = /* @__PURE__ */ new Map();
220
- for (const cap of flat) byId.set(cap.id, cap);
221
- const caps = [...byId.values()];
222
- const available = new Set(caps.map((c) => c.id));
223
- const errors = [];
224
- for (const cap of caps) for (const req of cap.requires ?? []) if (!available.has(req)) errors.push(`"${cap.id}" requires "${req}"`);
225
- if (errors.length > 0) throw new ConfigError(`compose(): unmet dependencies — ${errors.join(", ")}`);
226
- const taskMap = /* @__PURE__ */ new Map();
227
- for (const cap of caps) for (const entry of cap.tasks ?? []) taskMap.set(taskName(entry), entry);
228
- let providers = {};
229
- for (const cap of caps) if (cap.providers) providers = {
230
- ...providers,
231
- ...cap.providers
232
- };
233
- const checksSeen = /* @__PURE__ */ new Set();
234
- const extraRequiredChecks = [];
235
- for (const cap of caps) for (const check of cap.extraRequiredChecks ?? []) if (!checksSeen.has(check)) {
236
- checksSeen.add(check);
237
- extraRequiredChecks.push(check);
238
- }
239
- let repo = {};
240
- for (const cap of caps) {
241
- if (!cap.repo) continue;
242
- const { properties, topics, teams, variables, secrets, ...scalars } = cap.repo;
243
- repo = {
244
- ...repo,
245
- ...scalars
246
- };
247
- if (properties) repo.properties = {
248
- ...repo.properties,
249
- ...properties
250
- };
251
- if (variables) repo.variables = {
252
- ...repo.variables,
253
- ...variables,
254
- ...repo.variables?.repo || variables.repo ? { repo: {
255
- ...repo.variables?.repo,
256
- ...variables.repo
257
- } } : {},
258
- ...repo.variables?.org || variables.org ? { org: {
259
- ...repo.variables?.org,
260
- ...variables.org
261
- } } : {}
262
- };
263
- if (secrets) {
264
- const union = (a, b) => [.../* @__PURE__ */ new Set([...a ?? [], ...b ?? []])];
265
- const environments = { ...repo.secrets?.environments };
266
- for (const [env, names] of Object.entries(secrets.environments ?? {})) environments[env] = union(environments[env], names);
267
- repo.secrets = {
268
- ...repo.secrets?.repo || secrets.repo ? { repo: union(repo.secrets?.repo, secrets.repo) } : {},
269
- ...repo.secrets?.org || secrets.org ? { org: union(repo.secrets?.org, secrets.org) } : {},
270
- ...Object.keys(environments).length > 0 ? { environments } : {},
271
- ...repo.secrets?.sync || secrets.sync ? { sync: mergeSync(repo.secrets?.sync, secrets.sync) } : {}
272
- };
273
- }
274
- if (topics) {
275
- const merged = /* @__PURE__ */ new Set([...repo.topics ?? [], ...topics]);
276
- repo.topics = [...merged];
277
- }
278
- if (teams) {
279
- const teamMap = new Map((repo.teams ?? []).map((t) => [typeof t === "string" ? t : t.slug, t]));
280
- for (const t of teams) teamMap.set(typeof t === "string" ? t : t.slug, t);
281
- repo.teams = [...teamMap.values()];
282
- }
283
- }
284
- let org;
285
- let domain;
286
- let docs;
287
- for (const cap of caps) {
288
- if (cap.org !== void 0) org = cap.org;
289
- if (cap.domain !== void 0) domain = cap.domain;
290
- if (cap.docs !== void 0) docs = cap.docs;
291
- }
292
- return {
293
- tasks: [...taskMap.values()],
294
- providers,
295
- repo,
296
- extraRequiredChecks,
297
- ...org !== void 0 ? { org } : {},
298
- ...domain !== void 0 ? { domain } : {},
299
- ...docs !== void 0 ? { docs } : {}
300
- };
301
- }
302
- export { resolveEntry as a, resolveConfig as i, ConfigError as n, resolvePluginPackage as o, credentialsEnvironment as r, compose as t };
340
+ const compose = system.compose;
341
+ export { ConfigError as a, resolveEntry as c, loadConfig as i, resolvePluginPackage as l, compose as n, credentialsEnvironment as o, defineConfig as r, resolveConfig as s, ConfigFileError as t };
@@ -1,4 +1,5 @@
1
1
  import { D as CapabilityKey, Qt as PagesConfig, xn as TeamEntry } from "./index-XBpiD6Sx.mjs";
2
+ import { ConfigError, ConfigFileError } from "@theholocron/kyber/config";
2
3
  import { DocsCoverageMode } from "@theholocron/astromech";
3
4
  import { LogLevel } from "@theholocron/observability/core";
4
5
  /** Structured-logging config. The Axiom **token** never lives here — only in
@@ -740,11 +741,6 @@ interface ResolvedHolocronConfig {
740
741
  /** ESLint settings. */
741
742
  eslint?: EslintConfig;
742
743
  }
743
- /** Thrown when a `holocron.config` is invalid. */
744
- declare class ConfigError extends Error {
745
- /** The error's name, `"ConfigError"`. */
746
- name: string;
747
- }
748
744
  /**
749
745
  * Resolve `"github"` → `"@theholocron/holocron-plugin-github"`.
750
746
  * Fully-qualified names (scoped or not) are honored verbatim, which
@@ -808,6 +804,25 @@ interface ComposedPreset {
808
804
  /** Docs site config; the last capability that sets it wins. */
809
805
  docs?: DocsConfig;
810
806
  }
807
+ /** A loaded and resolved `holocron.config`. */
808
+ interface LoadedConfig {
809
+ /** The config after `resolveConfig`. */
810
+ resolved: ResolvedHolocronConfig;
811
+ /** Absolute path to the file the config was read from. */
812
+ filepath: string;
813
+ }
814
+ /** Returns the config unchanged; it exists to type and autocomplete a `holocron.config.ts`. */
815
+ declare const defineConfig: (config: HolocronConfig) => HolocronConfig;
816
+ /**
817
+ * Read + parse + resolve `holocron.config.*` starting from the given
818
+ * directory, walking up through ancestors to the nearest `.git` boundary
819
+ * when `cwd` itself has no match — every command is usable from any
820
+ * subdirectory of a repo, not only its exact root (see
821
+ * `@theholocron/datapad`'s own doc comment for the stop conditions).
822
+ * Throws `ConfigFileError` when nothing is found or a file cannot
823
+ * be loaded, or `ConfigError` when the config fails schema checks.
824
+ */
825
+ declare const loadConfig: (cwd: string) => Promise<LoadedConfig>;
811
826
  /**
812
827
  * Merge any number of capability fragments into a single preset object that
813
828
  * spreads directly into `defineConfig()`.
@@ -829,5 +844,5 @@ interface ComposedPreset {
829
844
  * // nextjs() is a bundle that returns Capability[]
830
845
  * const preset = compose(node(), nextjs());
831
846
  */
832
- declare function compose(...args: (Capability | Capability[])[]): ComposedPreset;
833
- export { RepoSecretsSync as A, TelemetryConfig as B, ProviderOptions as C, RepoProperties as D, RepoConfig as E, ResolvedProvidersConfig as F, ResolvedTuple as I, SingleEntry as L, RepoVariables as M, ResolvedHolocronConfig as N, RepoProtection as O, ResolvedProviderEntry as P, StorybookDeployProject as R, MultiEntry as S, RawProvidersConfig as T, WorkflowWithConfig as V, DoctorConfig as _, ConfigError as a, HolocronConfig as b, resolveEntry as c, CapabilityConfigPackage as d, ChromaticProjectConfig as f, DocsConfig as g, DevServeConfig as h, TaskEntry as i, RepoValidationConfig as j, RepoSecrets as k, resolvePluginPackage as l, DevConfig as m, Capability as n, credentialsEnvironment as o, CredentialsConfig as p, ComposedPreset as r, resolveConfig as s, compose as t, AppConfig as u, EnvConfig as v, RawProviderEntry as w, LogConfig as x, EslintConfig as y, TaskEntryConfig as z };
847
+ declare const compose: (...args: (Capability | Capability[])[]) => ComposedPreset;
848
+ export { RepoConfig as A, ResolvedTuple as B, EslintConfig as C, ProviderOptions as D, MultiEntry as E, RepoValidationConfig as F, WorkflowWithConfig as G, StorybookDeployProject as H, RepoVariables as I, ResolvedHolocronConfig as L, RepoProtection as M, RepoSecrets as N, RawProviderEntry as O, RepoSecretsSync as P, ResolvedProviderEntry as R, EnvConfig as S, LogConfig as T, TaskEntryConfig as U, SingleEntry as V, TelemetryConfig as W, CredentialsConfig as _, LoadedConfig as a, DocsConfig as b, TaskEntry as c, resolveConfig as d, resolveEntry as f, ChromaticProjectConfig as g, CapabilityConfigPackage as h, loadConfig as i, RepoProperties as j, RawProvidersConfig as k, ConfigError as l, AppConfig as m, compose as n, Capability as o, resolvePluginPackage as p, defineConfig as r, ComposedPreset as s, ConfigFileError as t, credentialsEnvironment as u, DevConfig as v, HolocronConfig as w, DoctorConfig as x, DevServeConfig as y, ResolvedProvidersConfig as z };
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { $ as DnsRecordType, $t as ParseWebhookInput, A as Ci, An as WebhookDashboardInfo, At as MonitoringCheckInput, B as DeployScriptConfig, Bt as NotificationsForumTag, C as BoardTemplate, Cn as Tooling, Ct as MonitoringAlertChannelResult, D as CapabilityKey, Dn as TunnelRoute, Dt as MonitoringAssertionComparison, E as CapabilityImpls, En as TrackerUser, Et as MonitoringAssertion, F as CreateAuthUserInput, Fn as Workers, Ft as NotificationsAccess, G as DeploymentRecord, Gt as NotificationsOnboardingLayout, H as Deployment, Ht as NotificationsLinksLayout, I as Credentials, It as NotificationsApplicationLayout, J as DiscussionPatch, Jt as NotificationsServerLayout, K as DeploymentTarget, Kt as NotificationsPicture, L as CredentialsInspection, Lt as NotificationsChannelLayout, M as CiRunFilter, Mn as WikiProvisionOpts, Mt as MoveReport, N as CiRunStatus, Nn as WikiProxyConfig, Nt as NormalizedAuthUser, O as Cardinality, On as Tunnels, Ot as MonitoringAssertionSource, P as ConnectionStringOptions, Pn as WorkerScriptState, Pt as Notifications, Q as DnsRecordRequest, Qt as PagesConfig, R as DeployFunctionConfig, Rt as NotificationsDelivery, S as BoardSummary, Sn as TeamPermission, St as MonitoringAlertChannelInput, T as BoardView, Tn as TrackerDoctorReport, Tt as MonitoringAlertSettings, U as DeploymentProject, Ut as NotificationsMember, V as DeployScriptResult, Vt as NotificationsLayout, W as DeploymentProjectSettings, Wt as NotificationsMonitoringFeed, X as Dns, Xt as NotificationsSignedIn, Y as DiscussionPost, Yt as NotificationsSignIn, Z as DnsRecord, Zt as NotificationsWelcomeLayout, _ as BoardItem, _n as SourceTeamMember, _t as LabelDef, a as REQUIRED_CAPABILITIES, an as RepoSettings, at as EnsureWebhookResult, b as BoardStatus, bn as StorageBranch, bt as Logs, c as Analytics, cn as SecretScope, ct as EnsuredTunnel, d as AuthEvent, dn as Source, dt as Environments, en as Projects, et as EnsureDiscussionInput, f as AuthEventType, fn as SourceBranch, ft as Errors, g as BoardFieldType, gn as SourceSecurity, gt as Issues, h as BoardField, hn as SourceRulesetDetail, ht as IssueSearchFilter, i as ProviderApiError, in as RepoRef, it as EnsureResult, j as CiRun, jn as Wiki, jt as MonitoringHttpMethod, k as CardinalityFor, kn as Vault, kt as MonitoringCheck, l as Auth, ln as Secrets, lt as Environment, m as AuthUser, mn as SourceRepoInfo, mt as Issue, n as ElevationRequiredError, nn as PullRequest, nt as EnsureRelayResult, o as WebhookVerificationError, on as ResolvedCapability, ot as EnsuredDiscussion, p as AuthIdentity, pn as SourceFile, pt as InspectRelayInput, q as DeploymentTrigger, qt as NotificationsPinnedLayout, r as MissingTokenError, rn as RelayState, rt as EnsureReport, s as isMulti, sn as Ruleset, st as EnsuredResource, t as CARDINALITY, tn as ProviderIdentity, tt as EnsureRelayInput, u as AuthDescription, un as ServerInspection, ut as EnvironmentReviewer, v as BoardRule, vn as StatusCategory, vt as LifecycleResult, w as BoardTemplateFile, wn as ToolingDoctorReport, wt as MonitoringAlertChannelState, x as BoardStatusCategory, xn as TeamEntry, xt as Monitoring, y as BoardState, yn as Storage, yt as LifecycleSlot, z as DeployFunctionResult, zt as NotificationsEveryoneLayout } from "./index-XBpiD6Sx.mjs";
2
- import { A as RepoSecretsSync, B as TelemetryConfig, C as ProviderOptions, D as RepoProperties, E as RepoConfig, F as ResolvedProvidersConfig, I as ResolvedTuple, L as SingleEntry, M as RepoVariables, N as ResolvedHolocronConfig, O as RepoProtection, P as ResolvedProviderEntry, R as StorybookDeployProject, S as MultiEntry, T as RawProvidersConfig, V as WorkflowWithConfig, _ as DoctorConfig, a as ConfigError, b as HolocronConfig, c as resolveEntry, d as CapabilityConfigPackage, f as ChromaticProjectConfig, g as DocsConfig, h as DevServeConfig, i as TaskEntry, j as RepoValidationConfig, k as RepoSecrets, l as resolvePluginPackage, m as DevConfig, n as Capability, o as credentialsEnvironment, p as CredentialsConfig, r as ComposedPreset, s as resolveConfig, t as compose, u as AppConfig, v as EnvConfig, w as RawProviderEntry, x as LogConfig, y as EslintConfig, z as TaskEntryConfig } from "./index-D9taYHzW.mjs";
3
- import { AuthError, RequestOptions, ResolveTokenConfig as ResolveTokenConfig$1, ResolveTokenInput, ResolveTokenInput as ResolveTokenInput$1, RestClient, RestClientConfig, createRestClient } from "@theholocron/http-client";
2
+ import { A as RepoConfig, B as ResolvedTuple, C as EslintConfig, D as ProviderOptions, E as MultiEntry, F as RepoValidationConfig, G as WorkflowWithConfig, H as StorybookDeployProject, I as RepoVariables, L as ResolvedHolocronConfig, M as RepoProtection, N as RepoSecrets, O as RawProviderEntry, P as RepoSecretsSync, R as ResolvedProviderEntry, S as EnvConfig, T as LogConfig, U as TaskEntryConfig, V as SingleEntry, W as TelemetryConfig, _ as CredentialsConfig, a as LoadedConfig, b as DocsConfig, c as TaskEntry, d as resolveConfig, f as resolveEntry, g as ChromaticProjectConfig, h as CapabilityConfigPackage, i as loadConfig, j as RepoProperties, k as RawProvidersConfig, l as ConfigError, m as AppConfig, n as compose, o as Capability, p as resolvePluginPackage, r as defineConfig, s as ComposedPreset, t as ConfigFileError, u as credentialsEnvironment, v as DevConfig, w as HolocronConfig, x as DoctorConfig, y as DevServeConfig, z as ResolvedProvidersConfig } from "./config-system-uaeB3g1g.mjs";
3
+ import { AuthError, ResolveTokenConfig as ResolveTokenConfig$1, ResolveTokenInput, ResolveTokenInput as ResolveTokenInput$1 } from "@theholocron/kyber/secrets";
4
+ import { RequestOptions, RestClient, RestClientConfig, createRestClient } from "@theholocron/http-client";
4
5
  import { PackageJson } from "@theholocron/pkg-utils";
5
6
  import { WorkspacePackage } from "@theholocron/astromech";
6
- import { ConfigFileError } from "@theholocron/datapad";
7
7
  import "@theholocron/observability/core";
8
8
  /** A plugin's `verifyToken` result when the provider accepted the token. */
9
9
  interface VerifyTokenSuccess {
@@ -45,7 +45,7 @@ interface PluginToken {
45
45
  optional?: boolean;
46
46
  }
47
47
  /** Options for a token resolver, without the keyring lookup, which the CLI supplies itself. */
48
- type ResolveTokenConfig = Omit<ResolveTokenConfig$1, "getKeyringToken">;
48
+ type ResolveTokenConfig = Omit<ResolveTokenConfig$1, "keyring" | "orgEnvName">;
49
49
  /** Settings for a feature-specific token resolver: which env var and keyring entry it reads. */
50
50
  interface FeatureResolverConfig {
51
51
  /** Env var name for this feature, e.g. `"HOLOCRON_ISSUES_TOKEN"`. */
@@ -65,50 +65,24 @@ type TokenResolver = ((input?: ResolveTokenInput$1) => string) & {
65
65
  /** The environment variables and keyring entry this resolver reads, for `holocron doctor tokens`. */
66
66
  readonly token: PluginToken;
67
67
  };
68
- /** Wraps `createResolveToken` from `@theholocron/http` and injects the
69
- * system keyring so plugins stay at a one-liner call site. */
70
- export declare function createResolveToken(config: ResolveTokenConfig): TokenResolver;
71
- /**
72
- * Build a strict, single-feature token resolver.
73
- *
74
- * Resolution chain: `--token flag → envName env var → the `credentials` providers' envName → keyring(keyringKey)`.
75
- * No broad-token fallback — if the feature-specific token is absent the
76
- * operation fails with a message naming the exact env var to set.
77
- */
78
- export declare function createFeatureResolver(config: FeatureResolverConfig): FeatureResolver;
79
- /**
80
- * Keyring-backed bootstrap credential store.
81
- *
82
- * Every holocron plugin's bootstrap token (the one it needs before it can talk to its vendor's API) can be stored in
83
- * the OS keyring under a single reverse-DNS service scope. Managed via `holocron auth` subcommands; consulted at
84
- * position 4 in every plugin's auth precedence chain (after --token / HOLOCRON_<X>_TOKEN / <native>_TOKEN).
85
- *
86
- * The keyring itself, with its best-effort failure model and its per-process cache, is `createKeyring` in
87
- * `@theholocron/kyber/secrets`; this file only names the service and keeps the function names the CLI uses.
88
- *
89
- * See `docs/wiki/specifications/tech-auth-bootstrap.spec.md` for the design rationale.
90
- */
91
68
  /**
92
- * Forget every token `getToken` has remembered, so the next read asks the keyring again. For a test, or after the
93
- * keyring was changed from outside the process.
69
+ * The holocron keyring: `get` answers `null` for "not stored" and for "keyring unavailable" alike, so callers fall
70
+ * through to env-var precedence, and remembers the answer for the process (`clearCache` forgets it); `set` and `delete`
71
+ * answer whether they did anything; `list` names the stored providers; `isAvailable` tells an outage from an empty keyring.
94
72
  */
95
- export declare function clearTokenCache(): void;
96
- /** Store or overwrite a bootstrap token for a provider. Returns true on success, false when the keyring is unsupported or errored. */
97
- export declare function setToken(provider: string, token: string): boolean;
73
+ export declare const keyring: import("@theholocron/kyber/secrets").Keyring;
98
74
  /**
99
- * Read the bootstrap token for a provider. Returns `null` for both "not stored" and "keyring unavailable", so callers
100
- * fall through to env-var precedence. The answer is remembered for the rest of the process.
75
+ * Kyber's `createResolveToken` with the keyring, the `HOLOCRON_ORG` variable and the `token` description
76
+ * `holocron doctor tokens` reads filled in, so a plugin stays at a one-liner call site. The chain is the flag, the
77
+ * plugin's variable, the vendor's variable, the `credentials` providers' variables, the keyring.
101
78
  */
102
- export declare function getToken(provider: string): string | null;
79
+ export declare function createResolveToken(config: ResolveTokenConfig): TokenResolver;
103
80
  /**
104
- * Whether the OS keyring can be used at all. `getToken` answers `null` for a missing entry and for a keyring that
105
- * cannot be reached alike; a caller that must tell an outage from an empty keyring asks this first.
81
+ * Kyber's `createFeatureResolver` for a strict, single-feature token: the flag, the feature's variable, the
82
+ * `credentials` providers' variable of that name, the keyring. No broad-token fallback; if the feature's token is absent
83
+ * the operation fails with a message naming the exact variable to set and `holocron auth set`.
106
84
  */
107
- export declare function isKeyringAvailable(): boolean;
108
- /** Delete a stored token. Returns true when a token was removed, false when there was nothing to delete or the keyring is unavailable. */
109
- export declare function deleteToken(provider: string): boolean;
110
- /** List the provider slugs that have a stored token under the holocron service scope. */
111
- export declare function listStoredProviders(): string[];
85
+ export declare function createFeatureResolver(config: FeatureResolverConfig): FeatureResolver;
112
86
  /** One line a probe reports: `info` for a fact, `ok` / `fail` for a result, `heading` to title the rows that follow. */
113
87
  interface ProbeRow {
114
88
  /** `ok` or `fail` for a result, `info` for a fact, `heading` to title the rows that follow. */
@@ -179,25 +153,6 @@ export declare function describeNetworkError(err: unknown, timeoutMs: number): s
179
153
  * earlier one failed is reported as not tried rather than failing a second time for the same reason.
180
154
  */
181
155
  export declare function connectionProbe(input: ConnectionProbeInput): Probe;
182
- /** Returns the config unchanged; it exists to type and autocomplete a `holocron.config.ts`. */
183
- export declare function defineConfig(config: HolocronConfig): HolocronConfig;
184
- /** A loaded and resolved `holocron.config`. */
185
- interface LoadedConfig {
186
- /** The config after `resolveConfig`. */
187
- resolved: ResolvedHolocronConfig;
188
- /** Absolute path to the file the config was read from. */
189
- filepath: string;
190
- }
191
- /**
192
- * Read + parse + resolve `holocron.config.*` starting from the given
193
- * directory, walking up through ancestors to the nearest `.git` boundary
194
- * when `cwd` itself has no match — every command is usable from any
195
- * subdirectory of a repo, not only its exact root (see
196
- * `@theholocron/datapad`'s own doc comment for the stop conditions).
197
- * Throws {@link ConfigFileError} when nothing is found or a file cannot
198
- * be loaded, or `ConfigError` when the config fails schema checks.
199
- */
200
- export declare function loadConfig(cwd: string): Promise<LoadedConfig>;
201
156
  interface RoleSyncOutcome {
202
157
  role: string;
203
158
  team: string;
@@ -376,4 +331,4 @@ export declare function missingCapabilities(capabilities: readonly string[]): st
376
331
  * own soft-fail behavior.
377
332
  */
378
333
  export declare function readWorkspacePackageJsons(repoRoot: string, workspacePackages: readonly WorkspacePackage[]): Promise<PackageJsonLike[]>;
379
- export { Analytics, type AppConfig, Auth, AuthDescription, AuthError, AuthEvent, AuthEventType, AuthIdentity, AuthUser, BoardField, BoardFieldType, BoardItem, BoardRule, BoardState, BoardStatus, BoardStatusCategory, BoardSummary, BoardTemplate, BoardTemplateFile, BoardView, CARDINALITY, type Capability, type CapabilityConfigPackage, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, type ChromaticProjectConfig, Ci, CiRun, CiRunFilter, CiRunStatus, type ComposedPreset, ConfigError, ConfigFileError, ConnectionStringOptions, CreateAuthUserInput, Credentials, type CredentialsConfig, CredentialsInspection, 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, ElevationRequiredError, EnsureDiscussionInput, EnsureRelayInput, EnsureRelayResult, EnsureReport, EnsureResult, EnsureWebhookResult, EnsuredDiscussion, EnsuredResource, EnsuredTunnel, type EnvConfig, Environment, EnvironmentReviewer, Environments, Errors, type EslintConfig, type FeatureResolver, type FeatureResolverConfig, type HolocronConfig, type HolocronProfile, InspectRelayInput, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, type LinksFile, type LoadedConfig, type LogConfig, Logs, type MemberLink, MissingTokenError, Monitoring, MonitoringAlertChannelInput, MonitoringAlertChannelResult, MonitoringAlertChannelState, MonitoringAlertSettings, MonitoringAssertion, MonitoringAssertionComparison, MonitoringAssertionSource, MonitoringCheck, MonitoringCheckInput, MonitoringHttpMethod, MoveReport, type MultiEntry, NormalizedAuthUser, Notifications, NotificationsAccess, NotificationsApplicationLayout, NotificationsChannelLayout, NotificationsDelivery, NotificationsEveryoneLayout, NotificationsForumTag, NotificationsLayout, NotificationsLinksLayout, NotificationsMember, NotificationsMonitoringFeed, NotificationsOnboardingLayout, NotificationsPicture, NotificationsPinnedLayout, NotificationsServerLayout, NotificationsSignIn, NotificationsSignedIn, NotificationsWelcomeLayout, type PackageJsonLike, PagesConfig, ParseWebhookInput, type PluginProbes, type PluginToken, type Probe, type ProbeContext, type ProbeRow, Projects, ProviderApiError, ProviderIdentity, type ProviderOptions, PullRequest, REQUIRED_CAPABILITIES, type RawProviderEntry, type RawProvidersConfig, RelayState, type RepoConfig, type RepoProperties, type RepoProtection, RepoRef, type RepoSecrets, type RepoSecretsSync, RepoSettings, type RepoValidationConfig, type RepoVariables, type RequestOptions, type ResolveTokenConfig, type ResolveTokenInput, ResolvedCapability, type ResolvedHolocronConfig, type ResolvedProviderEntry, type ResolvedProvidersConfig, type ResolvedTuple, type RestClient, type RestClientConfig, Ruleset, SecretScope, Secrets, ServerInspection, type SingleEntry, Source, SourceBranch, SourceFile, SourceRepoInfo, SourceRulesetDetail, SourceSecurity, SourceTeamMember, StatusCategory, Storage, StorageBranch, type StorybookDeployProject, type SyncRolesInput, type SyncRolesResult, type TaskEntry, type TaskEntryConfig, TeamEntry, TeamPermission, type TelemetryConfig, type TokenResolver, Tooling, ToolingDoctorReport, TrackerDoctorReport, TrackerUser, TunnelRoute, Tunnels, Vault, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, WebhookDashboardInfo, WebhookVerificationError, Wiki, WikiProvisionOpts, WikiProxyConfig, WorkerScriptState, Workers, type WorkflowWithConfig, compose, createRestClient, credentialsEnvironment, isMulti, resolveConfig, resolveEntry, resolvePluginPackage };
334
+ export { Analytics, type AppConfig, Auth, AuthDescription, AuthError, AuthEvent, AuthEventType, AuthIdentity, AuthUser, BoardField, BoardFieldType, BoardItem, BoardRule, BoardState, BoardStatus, BoardStatusCategory, BoardSummary, BoardTemplate, BoardTemplateFile, BoardView, CARDINALITY, type Capability, type CapabilityConfigPackage, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, type ChromaticProjectConfig, Ci, CiRun, CiRunFilter, CiRunStatus, type ComposedPreset, ConfigError, ConfigFileError, ConnectionStringOptions, CreateAuthUserInput, Credentials, type CredentialsConfig, CredentialsInspection, 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, ElevationRequiredError, EnsureDiscussionInput, EnsureRelayInput, EnsureRelayResult, EnsureReport, EnsureResult, EnsureWebhookResult, EnsuredDiscussion, EnsuredResource, EnsuredTunnel, type EnvConfig, Environment, EnvironmentReviewer, Environments, Errors, type EslintConfig, type FeatureResolver, type FeatureResolverConfig, type HolocronConfig, type HolocronProfile, InspectRelayInput, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, type LinksFile, type LoadedConfig, type LogConfig, Logs, type MemberLink, MissingTokenError, Monitoring, MonitoringAlertChannelInput, MonitoringAlertChannelResult, MonitoringAlertChannelState, MonitoringAlertSettings, MonitoringAssertion, MonitoringAssertionComparison, MonitoringAssertionSource, MonitoringCheck, MonitoringCheckInput, MonitoringHttpMethod, MoveReport, type MultiEntry, NormalizedAuthUser, Notifications, NotificationsAccess, NotificationsApplicationLayout, NotificationsChannelLayout, NotificationsDelivery, NotificationsEveryoneLayout, NotificationsForumTag, NotificationsLayout, NotificationsLinksLayout, NotificationsMember, NotificationsMonitoringFeed, NotificationsOnboardingLayout, NotificationsPicture, NotificationsPinnedLayout, NotificationsServerLayout, NotificationsSignIn, NotificationsSignedIn, NotificationsWelcomeLayout, type PackageJsonLike, PagesConfig, ParseWebhookInput, type PluginProbes, type PluginToken, type Probe, type ProbeContext, type ProbeRow, Projects, ProviderApiError, ProviderIdentity, type ProviderOptions, PullRequest, REQUIRED_CAPABILITIES, type RawProviderEntry, type RawProvidersConfig, RelayState, type RepoConfig, type RepoProperties, type RepoProtection, RepoRef, type RepoSecrets, type RepoSecretsSync, RepoSettings, type RepoValidationConfig, type RepoVariables, type RequestOptions, type ResolveTokenConfig, type ResolveTokenInput, ResolvedCapability, type ResolvedHolocronConfig, type ResolvedProviderEntry, type ResolvedProvidersConfig, type ResolvedTuple, type RestClient, type RestClientConfig, Ruleset, SecretScope, Secrets, ServerInspection, type SingleEntry, Source, SourceBranch, SourceFile, SourceRepoInfo, SourceRulesetDetail, SourceSecurity, SourceTeamMember, StatusCategory, Storage, StorageBranch, type StorybookDeployProject, type SyncRolesInput, type SyncRolesResult, type TaskEntry, type TaskEntryConfig, TeamEntry, TeamPermission, type TelemetryConfig, type TokenResolver, Tooling, ToolingDoctorReport, TrackerDoctorReport, TrackerUser, TunnelRoute, Tunnels, Vault, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, WebhookDashboardInfo, WebhookVerificationError, Wiki, WikiProvisionOpts, WikiProxyConfig, WorkerScriptState, Workers, type WorkflowWithConfig, compose, createRestClient, credentialsEnvironment, defineConfig, isMulti, loadConfig, resolveConfig, resolveEntry, resolvePluginPackage };