@theholocron/cli 5.0.0-alpha.557 → 5.0.0-alpha.559

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
@@ -81,6 +81,11 @@ interface PluginToken {
81
81
  * Default `false`.
82
82
  */
83
83
  optional?: boolean;
84
+ /**
85
+ * The vendor's own page that makes this token, so `holocron new instance` can tell a person where to make it
86
+ * (`tech-new-instance-command`). A public address, never a credential.
87
+ */
88
+ page?: string;
84
89
  /**
85
90
  * Which layers hold this token and what it must and must not be able to do in each (#2149). One declaration that the
86
91
  * token probes, the doctor and the docs check read through `tokenExpectations()`; see `TokenExpectation`.
@@ -177,6 +182,36 @@ export declare function readKeysLimited<T>(input: ReadKeysLimitedInput<T>): Prom
177
182
  * @param total - How many items there are.
178
183
  */
179
184
  export declare function reportProgress(onProgress: ((done: number, total: number) => void) | undefined, done: number, total: number): void;
185
+ /** What `holocron new api-token` asks a plugin to make. */
186
+ interface MintTokenInput {
187
+ /** The name the token is made with, as the vendor shows it (`holocron-cloudflare-ci-20261128`). */
188
+ name: string;
189
+ /** The layer that will hold the token: the plugin's declaration for it (`PluginToken.expect`) says what the token may do. */
190
+ layer: EnvironmentLayer;
191
+ /** Days until the token stops working, when the vendor can enforce one. Default: the declared rotation's `maxAgeDays`. */
192
+ expiresInDays?: number;
193
+ /** The clock, for tests. Defaults to now. */
194
+ now?: () => Date;
195
+ }
196
+ /** A token a plugin made. The value is the only copy: it goes to the private import file and is never printed. */
197
+ interface MintTokenResult {
198
+ /** The token's value. Handed over once, never printed, logged or put in a row. */
199
+ value: string;
200
+ /** The plugin's environment variable the value is stored under (`PluginToken.envName`). */
201
+ envName: string;
202
+ /** The vendor's id for the token (not the value), so it can be found and revoked in the vendor's UI. */
203
+ id?: string;
204
+ /** When the token stops working (ISO 8601), when the vendor enforces one. */
205
+ expiresAt?: string;
206
+ /** Lines for the person: what the token reaches, what the vendor could not scope. Never a value. */
207
+ notes: string[];
208
+ }
209
+ /**
210
+ * A plugin's way to make a token through the vendor's own API (`holocron new api-token <provider>`), with a more
211
+ * powerful bootstrap token it already resolves. It fails closed: a layer with no declared permissions is refused, never
212
+ * answered with an unscoped token.
213
+ */
214
+ type MintToken = (input: MintTokenInput) => Promise<MintTokenResult>;
180
215
  /** One line a probe reports: `info` for a fact, `ok` / `fail` for a result, `heading` to title the rows that follow. */
181
216
  interface ProbeRow {
182
217
  /** `ok` or `fail` for a result, `info` for a fact, `heading` to title the rows that follow. */
@@ -250,12 +285,14 @@ interface ProviderActionContext {
250
285
  * `fail` row and the next step still runs. It never prints a token.
251
286
  */
252
287
  type ProviderAction = (ctx: ProviderActionContext) => Promise<ProviderRow[]>;
253
- /** A provider's `setup` and `doctor`, as `holocron provider <name> setup|doctor` finds them. */
288
+ /** A provider's `setup`, `doctor` and `whoami`, as `holocron provider <name> setup|doctor` finds them. */
254
289
  interface ProviderActions {
255
290
  /** Makes what the provider's own config block declares. Optional. */
256
291
  setup?: ProviderAction;
257
292
  /** Compares what the provider's own config block declares with what exists, read-only. Optional. */
258
293
  doctor?: ProviderAction;
294
+ /** Who the provider's token is, when it stops working and what it may do, read-only. Optional. */
295
+ whoami?: ProviderAction;
259
296
  }
260
297
  /** What a connection probe needs to check a provider's host and token: kyber's input, with the plugin's `verifyToken` as `verify`. */
261
298
  export interface ConnectionProbeInput extends Omit<ConnectionProbeInput$1, "verify"> {
@@ -745,6 +782,37 @@ export declare const DEFAULT_TOKEN_ROTATION: Required<TokenRotation>;
745
782
  * one older than `maxAgeDays`. Only dates are printed, never the token.
746
783
  */
747
784
  export declare function tokenRotationRows(lifetime: TokenLifetime | undefined, rotation: Required<TokenRotation>, now: Date): ProbeRow[];
785
+ /** What a plugin hands `whoamiAction()` to build its `whoami`. */
786
+ interface WhoamiInput {
787
+ /** The provider's name, as `holocron provider <name> whoami` calls it (`vercel`). */
788
+ provider: string;
789
+ /** The token in use, by the plugin's own resolver; throws (an `AuthError`) when none is set. */
790
+ token: () => string;
791
+ /** The plugin's `verifyToken`: who the vendor says the token belongs to, or why it refused it. */
792
+ verify: (token: string) => Promise<VerifyTokenResult>;
793
+ /** The plugin's `tokens` declaration, for the permissions and the rotation policy it declares per layer. */
794
+ tokens: readonly PluginToken[];
795
+ /**
796
+ * Reads when the token was made and when it stops working, for a vendor that says. Left out (or `undefined` back):
797
+ * the rotation row says the provider does not expose it. A throw is a skipped row, never a failure of the run.
798
+ */
799
+ lifetime?: (token: string) => Promise<TokenLifetime | undefined>;
800
+ /** The command that proves the permissions, e.g. `holocron probe vercel token --environment <layer>`. Default: built from `provider`. */
801
+ proveWith?: string;
802
+ /** The clock, for tests. Defaults to now. */
803
+ now?: () => Date;
804
+ }
805
+ /**
806
+ * A provider's `whoami` (`holocron provider <name> whoami`): who its token belongs to, when it stops working and what
807
+ * the plugin declares it may do. Read-only, one row per fact, and a failing step is a row, not the end of the run. The
808
+ * token and its value are never printed: only the vendor's own description of it (`verifyToken`'s subject), dates and
809
+ * permission names.
810
+ *
811
+ * The permission row lists what each layer's declaration (`PluginToken.expect`) says the token needs and must not
812
+ * have, and names the probe that proves it against the vendor: a vendor's API rarely says what a token may do, so
813
+ * `whoami` reports the declaration and does not claim more than it has read.
814
+ */
815
+ export declare function whoamiAction(input: WhoamiInput): ProviderAction;
748
816
  /**
749
817
  * What stdout is. A token is never written to a `terminal` (it would sit in scrollback) or to `other` (a redirect to
750
818
  * a regular file, which would leave plaintext tokens on disk without the protections of the file option); only a
@@ -805,4 +873,4 @@ export declare const SHARED_AREAS: readonly ["org"];
805
873
  * is a `ConfigError` naming both (no merge, no precedence). With no area files the config is returned as it was.
806
874
  */
807
875
  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 RepoEnvironment, type RepoEnvironmentReviewer, 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 };
876
+ 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, type MintToken, type MintTokenInput, type MintTokenResult, 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 RepoEnvironment, type RepoEnvironmentReviewer, 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, type WhoamiInput, 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 };
package/dist/index.mjs CHANGED
@@ -1232,6 +1232,99 @@ function tokenExpectations(tokens, filter = {}) {
1232
1232
  }
1233
1233
  return found;
1234
1234
  }
1235
+ // src/commands/whoami-action/whoami-action.ts
1236
+ /**
1237
+ * A provider's `whoami` (`holocron provider <name> whoami`): who its token belongs to, when it stops working and what
1238
+ * the plugin declares it may do. Read-only, one row per fact, and a failing step is a row, not the end of the run. The
1239
+ * token and its value are never printed: only the vendor's own description of it (`verifyToken`'s subject), dates and
1240
+ * permission names.
1241
+ *
1242
+ * The permission row lists what each layer's declaration (`PluginToken.expect`) says the token needs and must not
1243
+ * have, and names the probe that proves it against the vendor: a vendor's API rarely says what a token may do, so
1244
+ * `whoami` reports the declaration and does not claim more than it has read.
1245
+ */
1246
+ function whoamiAction(input) {
1247
+ return async () => {
1248
+ const id = (suffix) => `${input.provider}:whoami:${suffix}`;
1249
+ let token;
1250
+ try {
1251
+ token = input.token();
1252
+ } catch (err) {
1253
+ return [{
1254
+ id: id("token"),
1255
+ title: `${input.provider} token`,
1256
+ status: "fail",
1257
+ detail: describeError(err),
1258
+ problems: []
1259
+ }];
1260
+ }
1261
+ const rows = [];
1262
+ const verified = await input.verify(token).catch((err) => ({
1263
+ ok: false,
1264
+ message: describeError(err)
1265
+ }));
1266
+ rows.push(verified.ok ? {
1267
+ id: id("identity"),
1268
+ title: "identity",
1269
+ status: "ok",
1270
+ detail: verified.subject,
1271
+ problems: []
1272
+ } : {
1273
+ id: id("identity"),
1274
+ title: "identity",
1275
+ status: "fail",
1276
+ detail: "the provider did not accept the token",
1277
+ problems: [verified.message]
1278
+ });
1279
+ if (!verified.ok) return rows;
1280
+ let lifetime = verified.expiresAt ? { expiresAt: verified.expiresAt } : void 0;
1281
+ let lifetimeProblem;
1282
+ if (input.lifetime) try {
1283
+ lifetime = await input.lifetime(token) ?? lifetime;
1284
+ } catch (err) {
1285
+ lifetimeProblem = describeError(err);
1286
+ }
1287
+ const policy = tokenExpectations(input.tokens)[0]?.rotation ?? DEFAULT_TOKEN_ROTATION;
1288
+ if (lifetimeProblem) rows.push({
1289
+ id: id("rotation"),
1290
+ title: "rotation",
1291
+ status: "skip",
1292
+ detail: `the provider's expiry could not be read: ${lifetimeProblem}`,
1293
+ problems: []
1294
+ });
1295
+ else for (const row of tokenRotationRows(lifetime, policy, (input.now ?? (() => /* @__PURE__ */ new Date()))())) {
1296
+ const detail = String(row.detail);
1297
+ rows.push({
1298
+ id: id(row.label),
1299
+ title: row.label,
1300
+ status: row.status === "ok" || row.status === "fail" ? row.status : "skip",
1301
+ detail,
1302
+ problems: row.status === "fail" ? [detail] : []
1303
+ });
1304
+ }
1305
+ const declared = tokenExpectations(input.tokens);
1306
+ const prove = input.proveWith ?? `holocron probe ${input.provider} token --environment <layer>`;
1307
+ rows.push(declared.length === 0 ? {
1308
+ id: id("permissions"),
1309
+ title: "permissions",
1310
+ status: "skip",
1311
+ detail: `the plugin declares none for this token; ${input.provider} does not say what a token may do`,
1312
+ problems: []
1313
+ } : {
1314
+ id: id("permissions"),
1315
+ title: "permissions",
1316
+ status: "skip",
1317
+ detail: `declared, not read from ${input.provider}: ${declared.map((e) => `${e.layer} ${describeRules(e.required, e.absent)}`).join("; ")}. Prove it with \`${prove}\``,
1318
+ problems: []
1319
+ });
1320
+ return rows;
1321
+ };
1322
+ }
1323
+ /** `needs pages; must not have dns, routes`, or `no permission rules` for a layer that only holds the token. */
1324
+ function describeRules(required, absent) {
1325
+ if (required.length === 0 && absent.length === 0) return "holds it, no permission rules";
1326
+ return [required.length > 0 ? `needs ${required.join(", ")}` : "", absent.length > 0 ? `must not have ${absent.join(", ")}` : ""].filter(Boolean).join("; ");
1327
+ }
1235
1328
  // src/commands/auth-export/stdout-kind/stdout-kind.ts
1236
1329
  /**
1237
1330
  * What file descriptor `fd` (stdout) is, for deciding where tokens may go: a `terminal`, a `pipe` (a FIFO, or the
@@ -1290,4 +1383,4 @@ function resolveCredentialsFile(base, file, makeDir = (dir) => void mkdirSync(di
1290
1383
  isDefault: true
1291
1384
  };
1292
1385
  }
1293
- export { AREA_LABEL_COLOR, AREA_PREFIX, AuthError, BUILTIN_TEMPLATES, CANONICAL_LABELS, CARDINALITY, CUSTOM_EMOJI, ConfigError, ConfigFileError, DEFAULT_TEMPLATES_DIR, DEFAULT_TOKEN_ROTATION, EMOJI_MEDIA_DIR, ElevationRequiredError, HOLOCRON_AREAS, KNOWN_STACK_DEPS, MAX_EMOJI_BYTES, MissingTokenError, PRIVATE_CREDENTIALS_FILE, ProviderApiError, REQUIRED_CAPABILITIES, SHARED_AREAS, WebhookVerificationError, areaForScope, areaLabelDefs, areaLabelsForFiles, areaLabelsForTitle, compose, connectionProbe, coverageExpectations, createFeatureResolver, createResolveToken, createRestClient, credentialsEnvironment, defineConfig, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, emojiConflictProblem, ignoreAdvice, isMulti, keyring, layoutEmojis, layoutReactions, loadConfig, loadEmojiImage, missingCapabilities, orderKeys, parseReaction, pathMatches, pickByCreation, placeAreas, planPullRequestStatus, planReconcile, reactionProblem, reactionSpelling, readKeysLimited, readLinks, readWorkspacePackageJsons, reportProgress, resolveConfig, resolveCredentialsFile, resolveEntry, resolveEnvironmentId, resolvePluginPackage, resolveProjectOptions, resolveValue, roleTeamProblem, sourceProblem, stdoutKind, syncRoles, tagEmojiProblem, titleScopes, tokenExpectations, tokenRotationRows };
1386
+ export { AREA_LABEL_COLOR, AREA_PREFIX, AuthError, BUILTIN_TEMPLATES, CANONICAL_LABELS, CARDINALITY, CUSTOM_EMOJI, ConfigError, ConfigFileError, DEFAULT_TEMPLATES_DIR, DEFAULT_TOKEN_ROTATION, EMOJI_MEDIA_DIR, ElevationRequiredError, HOLOCRON_AREAS, KNOWN_STACK_DEPS, MAX_EMOJI_BYTES, MissingTokenError, PRIVATE_CREDENTIALS_FILE, ProviderApiError, REQUIRED_CAPABILITIES, SHARED_AREAS, WebhookVerificationError, areaForScope, areaLabelDefs, areaLabelsForFiles, areaLabelsForTitle, compose, connectionProbe, coverageExpectations, createFeatureResolver, createResolveToken, createRestClient, credentialsEnvironment, defineConfig, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, emojiConflictProblem, ignoreAdvice, isMulti, keyring, layoutEmojis, layoutReactions, loadConfig, loadEmojiImage, missingCapabilities, orderKeys, parseReaction, pathMatches, pickByCreation, placeAreas, planPullRequestStatus, planReconcile, reactionProblem, reactionSpelling, readKeysLimited, readLinks, readWorkspacePackageJsons, reportProgress, resolveConfig, resolveCredentialsFile, resolveEntry, resolveEnvironmentId, resolvePluginPackage, resolveProjectOptions, resolveValue, roleTeamProblem, sourceProblem, stdoutKind, syncRoles, tagEmojiProblem, titleScopes, tokenExpectations, tokenRotationRows, whoamiAction };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/cli",
3
- "version": "5.0.0-alpha.557",
3
+ "version": "5.0.0-alpha.559",
4
4
  "description": "The Holocron CLI - a pluggable, capability-based orchestrator for spinning up and operating software projects.",
5
5
  "keywords": [
6
6
  "cli",
@@ -59,16 +59,16 @@
59
59
  "posthog-node": "^6.0.5",
60
60
  "tsx": "4.23.15",
61
61
  "yargs": "^18.1.0",
62
- "@theholocron/astromech": "5.0.0-alpha.557",
63
- "@theholocron/dagobah": "5.0.0-alpha.557",
64
- "@theholocron/datapad": "5.0.0-alpha.557",
62
+ "@theholocron/astromech": "5.0.0-alpha.559",
63
+ "@theholocron/dagobah": "5.0.0-alpha.559",
64
+ "@theholocron/datapad": "5.0.0-alpha.559",
65
65
  "@theholocron/env-utils": "^1.17.0-alpha.8",
66
66
  "@theholocron/fs-utils": "^1.17.0-alpha.8",
67
67
  "@theholocron/git-utils": "^1.17.0-alpha.8",
68
- "@theholocron/github-client": "^1.58.0-alpha.60",
69
- "@theholocron/http-client": "^1.58.0-alpha.60",
68
+ "@theholocron/github-client": "^1.58.0-alpha.61",
69
+ "@theholocron/http-client": "^1.58.0-alpha.61",
70
70
  "@theholocron/json-utils": "^1.17.0-alpha.8",
71
- "@theholocron/kyber": "5.0.0-alpha.557",
71
+ "@theholocron/kyber": "5.0.0-alpha.559",
72
72
  "@theholocron/misc-utils": "^1.17.0-alpha.8",
73
73
  "@theholocron/observability": "^0.7.0-alpha.8",
74
74
  "@theholocron/pkg-utils": "^1.17.0-alpha.8"
@@ -84,8 +84,8 @@
84
84
  "tsdown": "^0.23.7",
85
85
  "typescript": "^6.0.3",
86
86
  "vitest": "^5.1.1",
87
- "@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.24",
88
87
  "@theholocron/eslint-config": "^8.9.0-alpha.24",
88
+ "@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.24",
89
89
  "@theholocron/tsconfig": "^8.9.0-alpha.24",
90
90
  "@theholocron/vitest-config": "^8.9.0-alpha.24"
91
91
  },