@theholocron/cli 5.0.0-alpha.340 → 5.0.0-alpha.341
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/README.md +7 -7
- package/dist/cli.mjs +3009 -3321
- package/dist/cli.mjs.map +1 -1
- package/dist/{compose-DU_NeIR0.mjs → compose-BucaYv2k.mjs} +117 -100
- package/dist/{index-D9taYHzW.d.mts → index-BfArEnkX.d.mts} +1 -5
- package/dist/index.d.mts +18 -43
- package/dist/index.mjs +49 -219
- package/dist/presets.d.mts +1 -1
- package/dist/presets.mjs +1 -1
- package/package.json +11 -11
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CARDINALITY, REQUIRED_CAPABILITIES } from "./plugin/capabilities.mjs";
|
|
2
|
+
import { ConfigError, 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/
|
|
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,115 @@ 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/system/system.ts
|
|
287
|
+
/** Holocron's config system, built from kyber's factory; `loadConfig`, `compose` and `defineConfig` wrap its parts. */
|
|
288
|
+
const system = createConfigSystem({
|
|
289
|
+
name: "holocron",
|
|
290
|
+
derive: deriveDefaults,
|
|
291
|
+
resolve: resolveConfig,
|
|
292
|
+
merge: mergeStrategies
|
|
293
|
+
});
|
|
294
|
+
// src/config/compose/compose.ts
|
|
196
295
|
/**
|
|
197
296
|
* Merge any number of capability fragments into a single preset object that
|
|
198
297
|
* spreads directly into `defineConfig()`.
|
|
@@ -215,88 +314,6 @@ function mergeSync(a, b) {
|
|
|
215
314
|
* const preset = compose(node(), nextjs());
|
|
216
315
|
*/
|
|
217
316
|
function compose(...args) {
|
|
218
|
-
|
|
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
|
-
};
|
|
317
|
+
return system.compose(...args);
|
|
301
318
|
}
|
|
302
|
-
export {
|
|
319
|
+
export { resolveConfig as a, credentialsEnvironment as i, system as n, resolveEntry as o, ConfigError as r, resolvePluginPackage as s, compose 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 } 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
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
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-
|
|
3
|
-
import { AuthError,
|
|
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-BfArEnkX.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";
|
|
5
|
+
import { ConfigFileError } from "@theholocron/kyber/config";
|
|
4
6
|
import { PackageJson } from "@theholocron/pkg-utils";
|
|
5
7
|
import { WorkspacePackage } from "@theholocron/astromech";
|
|
6
|
-
import { ConfigFileError } from "@theholocron/datapad";
|
|
7
8
|
import "@theholocron/observability/core";
|
|
8
9
|
/** A plugin's `verifyToken` result when the provider accepted the token. */
|
|
9
10
|
interface VerifyTokenSuccess {
|
|
@@ -45,7 +46,7 @@ interface PluginToken {
|
|
|
45
46
|
optional?: boolean;
|
|
46
47
|
}
|
|
47
48
|
/** Options for a token resolver, without the keyring lookup, which the CLI supplies itself. */
|
|
48
|
-
type ResolveTokenConfig = Omit<ResolveTokenConfig$1, "
|
|
49
|
+
type ResolveTokenConfig = Omit<ResolveTokenConfig$1, "keyring" | "orgEnvName">;
|
|
49
50
|
/** Settings for a feature-specific token resolver: which env var and keyring entry it reads. */
|
|
50
51
|
interface FeatureResolverConfig {
|
|
51
52
|
/** Env var name for this feature, e.g. `"HOLOCRON_ISSUES_TOKEN"`. */
|
|
@@ -65,50 +66,24 @@ type TokenResolver = ((input?: ResolveTokenInput$1) => string) & {
|
|
|
65
66
|
/** The environment variables and keyring entry this resolver reads, for `holocron doctor tokens`. */
|
|
66
67
|
readonly token: PluginToken;
|
|
67
68
|
};
|
|
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
69
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
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.
|
|
70
|
+
* The holocron keyring: `get` answers `null` for "not stored" and for "keyring unavailable" alike, so callers fall
|
|
71
|
+
* through to env-var precedence, and remembers the answer for the process (`clearCache` forgets it); `set` and `delete`
|
|
72
|
+
* answer whether they did anything; `list` names the stored providers; `isAvailable` tells an outage from an empty keyring.
|
|
90
73
|
*/
|
|
74
|
+
export declare const keyring: import("@theholocron/kyber/secrets").Keyring;
|
|
91
75
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
76
|
+
* Kyber's `createResolveToken` with the keyring, the `HOLOCRON_ORG` variable and the `token` description
|
|
77
|
+
* `holocron doctor tokens` reads filled in, so a plugin stays at a one-liner call site. The chain is the flag, the
|
|
78
|
+
* plugin's variable, the vendor's variable, the `credentials` providers' variables, the keyring.
|
|
94
79
|
*/
|
|
95
|
-
export declare function
|
|
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;
|
|
98
|
-
/**
|
|
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.
|
|
101
|
-
*/
|
|
102
|
-
export declare function getToken(provider: string): string | null;
|
|
80
|
+
export declare function createResolveToken(config: ResolveTokenConfig): TokenResolver;
|
|
103
81
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
82
|
+
* Kyber's `createFeatureResolver` for a strict, single-feature token: the flag, the feature's variable, the
|
|
83
|
+
* `credentials` providers' variable of that name, the keyring. No broad-token fallback; if the feature's token is absent
|
|
84
|
+
* the operation fails with a message naming the exact variable to set and `holocron auth set`.
|
|
106
85
|
*/
|
|
107
|
-
export declare function
|
|
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[];
|
|
86
|
+
export declare function createFeatureResolver(config: FeatureResolverConfig): FeatureResolver;
|
|
112
87
|
/** One line a probe reports: `info` for a fact, `ok` / `fail` for a result, `heading` to title the rows that follow. */
|
|
113
88
|
interface ProbeRow {
|
|
114
89
|
/** `ok` or `fail` for a result, `info` for a fact, `heading` to title the rows that follow. */
|
|
@@ -194,7 +169,7 @@ interface LoadedConfig {
|
|
|
194
169
|
* when `cwd` itself has no match — every command is usable from any
|
|
195
170
|
* subdirectory of a repo, not only its exact root (see
|
|
196
171
|
* `@theholocron/datapad`'s own doc comment for the stop conditions).
|
|
197
|
-
* Throws
|
|
172
|
+
* Throws `ConfigFileError` when nothing is found or a file cannot
|
|
198
173
|
* be loaded, or `ConfigError` when the config fails schema checks.
|
|
199
174
|
*/
|
|
200
175
|
export declare function loadConfig(cwd: string): Promise<LoadedConfig>;
|