@theholocron/cli 5.0.0-alpha.345 → 5.0.0-alpha.347

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,4 +1,5 @@
1
1
  import { CARDINALITY, REQUIRED_CAPABILITIES } from "./plugin/capabilities.mjs";
2
+ import { resolvePluginPackage } from "@theholocron/kyber/plugins";
2
3
  import { ConfigError, ConfigFileError, createConfigSystem, lastWins, mergeByKey, shallowMerge, union } from "@theholocron/kyber/config";
3
4
  import { basename, dirname } from "node:path";
4
5
  import { readPackageJson } from "@theholocron/pkg-utils";
@@ -13,12 +14,9 @@ const COMMUNITY_PREFIX = "holocron-plugin-";
13
14
  * Fully-qualified names (scoped or not) are honored verbatim, which
14
15
  * is how third-party plugins published outside the org work.
15
16
  */
16
- function resolvePluginPackage(provider) {
17
+ function resolvePluginPackage$1(provider) {
17
18
  if (!provider) throw new ConfigError("provider name is empty");
18
- if (provider.startsWith("@")) return provider;
19
- if (provider.startsWith(COMMUNITY_PREFIX)) return provider;
20
- if (provider.includes("/")) return provider;
21
- return PLUGIN_PREFIX + provider;
19
+ return resolvePluginPackage(provider, PLUGIN_PREFIX, COMMUNITY_PREFIX);
22
20
  }
23
21
  /** A bare `[provider, options]` tuple, with both elements present? */
24
22
  function isOptionsTuple(value) {
@@ -31,13 +29,13 @@ function isOptionsTuple(value) {
31
29
  function normalizeEntry(entry) {
32
30
  if (typeof entry === "string") return {
33
31
  provider: entry,
34
- packageName: resolvePluginPackage(entry),
32
+ packageName: resolvePluginPackage$1(entry),
35
33
  options: {}
36
34
  };
37
35
  const [provider, options] = entry;
38
36
  return {
39
37
  provider,
40
- packageName: resolvePluginPackage(provider),
38
+ packageName: resolvePluginPackage$1(provider),
41
39
  options
42
40
  };
43
41
  }
@@ -338,4 +336,4 @@ const loadConfig = system.loadConfig;
338
336
  * const preset = compose(node(), nextjs());
339
337
  */
340
338
  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 };
339
+ export { ConfigError as a, resolveEntry as c, loadConfig as i, resolvePluginPackage$1 as l, compose as n, credentialsEnvironment as o, defineConfig as r, resolveConfig as s, ConfigFileError as t };
package/dist/index.d.mts CHANGED
@@ -2,8 +2,10 @@ import { $ as DnsRecordType, $t as ParseWebhookInput, A as Ci, An as WebhookDash
2
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
3
  import { AuthError, ResolveTokenConfig as ResolveTokenConfig$1, ResolveTokenInput, ResolveTokenInput as ResolveTokenInput$1 } from "@theholocron/kyber/secrets";
4
4
  import { RequestOptions, RestClient, RestClientConfig, createRestClient } from "@theholocron/http-client";
5
+ import "@theholocron/kyber/plugins";
5
6
  import { PackageJson } from "@theholocron/pkg-utils";
6
7
  import { WorkspacePackage } from "@theholocron/astromech";
8
+ import { ConnectionProbeInput as ConnectionProbeInput$1 } from "@theholocron/kyber/checks";
7
9
  import "@theholocron/observability/core";
8
10
  /** A plugin's `verifyToken` result when the provider accepted the token. */
9
11
  interface VerifyTokenSuccess {
@@ -126,33 +128,6 @@ interface Probe {
126
128
  }
127
129
  /** A plugin's probes by name (kebab-case), as returned from `createPlugin` next to `capabilities`. */
128
130
  type PluginProbes = Record<string, Probe>;
129
- /** What a connection probe needs to check a provider's host and token. */
130
- export interface ConnectionProbeInput {
131
- /** How the provider is named in output, e.g. `Axiom`. */
132
- provider: string;
133
- /** A URL on the provider's API host. Without one, only the token is checked (a provider that has no HTTP API of its own). */
134
- url?: string;
135
- /** Finds the token the plugin would use. Throws with a message that says where to put one when there is none. */
136
- token: () => string | Promise<string>;
137
- /** The plugin's `verifyToken`: asks the provider who the token belongs to. */
138
- verify: (token: string) => Promise<VerifyTokenResult>;
139
- /** Stands in for the network, so with one the name lookup (which cannot be stood in for) is not made. */
140
- fetch?: typeof fetch;
141
- /** Resolves a hostname. Defaults to the system resolver, unless `fetch` is given. */
142
- lookup?: (host: string) => Promise<{
143
- address: string;
144
- }>;
145
- /** Longest to wait for the host to answer. Defaults to 10 s. */
146
- timeoutMs?: number;
147
- }
148
- /** A network failure in plain words, with what usually causes it. Never includes anything from a request. */
149
- export declare function describeNetworkError(err: unknown, timeoutMs: number): string;
150
- /**
151
- * The `connection` probe every provider offers, for telling a network problem from a credential problem: does the name
152
- * resolve, does the host answer, is there a token, and does the provider accept it. A step that cannot work because an
153
- * earlier one failed is reported as not tried rather than failing a second time for the same reason.
154
- */
155
- export declare function connectionProbe(input: ConnectionProbeInput): Probe;
156
131
  interface RoleSyncOutcome {
157
132
  role: string;
158
133
  team: string;
@@ -331,4 +306,14 @@ export declare function missingCapabilities(capabilities: readonly string[]): st
331
306
  * own soft-fail behavior.
332
307
  */
333
308
  export declare function readWorkspacePackageJsons(repoRoot: string, workspacePackages: readonly WorkspacePackage[]): Promise<PackageJsonLike[]>;
309
+ /** What a connection probe needs to check a provider's host and token: kyber's input, with the plugin's `verifyToken` as `verify`. */
310
+ export interface ConnectionProbeInput extends Omit<ConnectionProbeInput$1, "verify"> {
311
+ /** The plugin's `verifyToken`: asks the provider who the token belongs to. */
312
+ verify: (token: string) => Promise<VerifyTokenResult>;
313
+ }
314
+ /**
315
+ * The `connection` probe every provider offers, for telling a network problem from a credential problem. The checks are
316
+ * kyber's `connectionProbe`; this types the result as the plugin system's {@link Probe} and `verify` as `VerifyTokenResult`.
317
+ */
318
+ export declare function connectionProbe(input: ConnectionProbeInput): Probe;
334
319
  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 };
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import { CARDINALITY, ElevationRequiredError, MissingTokenError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, isMulti } from "./plugin/capabilities.mjs";
2
- import { a as ConfigError, c as resolveEntry, i as loadConfig, l as resolvePluginPackage, n as compose, o as credentialsEnvironment, r as defineConfig, s as resolveConfig, t as ConfigFileError } from "./config-system-Bq6510iF.mjs";
2
+ import { a as ConfigError, c as resolveEntry, i as loadConfig, l as resolvePluginPackage, n as compose, o as credentialsEnvironment, r as defineConfig, s as resolveConfig, t as ConfigFileError } from "./config-system-CZ0F8Uq7.mjs";
3
3
  import { Entry, findCredentials } from "@napi-rs/keyring";
4
4
  import { AuthError, createFeatureResolver as createFeatureResolver$1, createKeyring, createResolveToken as createResolveToken$1 } from "@theholocron/kyber/secrets";
5
5
  import { describeError, style } from "@theholocron/kyber/ui";
6
6
  import { errorMessage } from "@theholocron/misc-utils";
7
7
  import { createRestClient } from "@theholocron/http-client";
8
- import { lookup } from "node:dns/promises";
9
8
  import { join } from "node:path";
10
9
  import { readPackageJson } from "@theholocron/pkg-utils";
10
+ import { connectionProbe as connectionProbe$1 } from "@theholocron/kyber/checks";
11
11
  // src/auth.ts
12
12
  /**
13
13
  * The CLI's credentials: the OS keyring every plugin's bootstrap token lives in, and the two token resolvers built on
@@ -62,143 +62,6 @@ function createFeatureResolver(config) {
62
62
  keyringKey: config.keyringKey
63
63
  } });
64
64
  }
65
- // src/plugin/connection-probe/connection-probe.ts
66
- const TLS_CODES = /* @__PURE__ */ new Set([
67
- "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
68
- "SELF_SIGNED_CERT_IN_CHAIN",
69
- "DEPTH_ZERO_SELF_SIGNED_CERT",
70
- "CERT_HAS_EXPIRED",
71
- "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
72
- "ERR_TLS_CERT_ALTNAME_INVALID"
73
- ]);
74
- /** The code Node attaches to a network failure, with that error's message: on the error itself, or on its `cause` (where `fetch` puts it). */
75
- function codeOf(err) {
76
- for (let e = err, depth = 0; e && depth < 4; depth++) {
77
- if (typeof e.code === "string") return {
78
- code: e.code,
79
- message: String(e.message ?? "")
80
- };
81
- e = e.cause;
82
- }
83
- }
84
- /** A network failure in plain words, with what usually causes it. Never includes anything from a request. */
85
- function describeNetworkError(err, timeoutMs) {
86
- const found = codeOf(err);
87
- const code = found?.code;
88
- const name = err?.name;
89
- if (name === "TimeoutError" || name === "AbortError" || code === "UND_ERR_CONNECT_TIMEOUT" || code === "ETIMEDOUT") return `no answer within ${timeoutMs / 1e3}s (${code ?? name}): a firewall, VPN or proxy may be dropping it`;
90
- switch (code) {
91
- case "ENOTFOUND":
92
- case "EAI_AGAIN": return `${code}: the name did not resolve; check your network and DNS`;
93
- case "ECONNREFUSED": return "ECONNREFUSED: the host refused the connection";
94
- case "ECONNRESET":
95
- case "UND_ERR_SOCKET": return `${code}: the connection was cut off; a proxy or firewall may be interfering`;
96
- case "ENETUNREACH":
97
- case "EHOSTUNREACH": return `${code}: no route to the host; check that you are online`;
98
- default:
99
- if (code && TLS_CODES.has(code)) return `${code}: the TLS certificate was not trusted; a corporate proxy that re-signs traffic needs NODE_EXTRA_CA_CERTS`;
100
- return found ? `${found.code}: ${found.message}` : String(err?.message ?? err);
101
- }
102
- }
103
- /**
104
- * The `connection` probe every provider offers, for telling a network problem from a credential problem: does the name
105
- * resolve, does the host answer, is there a token, and does the provider accept it. A step that cannot work because an
106
- * earlier one failed is reported as not tried rather than failing a second time for the same reason.
107
- */
108
- function connectionProbe(input) {
109
- const timeoutMs = input.timeoutMs ?? 1e4;
110
- return {
111
- summary: `Check the network path to ${input.provider} and that it accepts your token.`,
112
- writes: false,
113
- async run(probe) {
114
- let reachable = true;
115
- if (input.url) {
116
- const host = new URL(input.url).hostname;
117
- const lookup$1 = input.lookup ?? (input.fetch ? void 0 : (h) => lookup(h));
118
- if (lookup$1) try {
119
- const { address } = await lookup$1(host);
120
- probe.say({
121
- status: "ok",
122
- label: `DNS ${host}`,
123
- detail: address
124
- });
125
- } catch (err) {
126
- reachable = false;
127
- probe.say({
128
- status: "fail",
129
- label: `DNS ${host}`,
130
- detail: describeNetworkError(err, timeoutMs)
131
- });
132
- }
133
- if (reachable) {
134
- const started = Date.now();
135
- try {
136
- const res = await (input.fetch ?? fetch)(input.url, {
137
- method: "GET",
138
- signal: AbortSignal.timeout(timeoutMs)
139
- });
140
- probe.say({
141
- status: "ok",
142
- label: `reach ${host}`,
143
- detail: `HTTP ${res.status} in ${Date.now() - started} ms`
144
- });
145
- } catch (err) {
146
- reachable = false;
147
- probe.say({
148
- status: "fail",
149
- label: `reach ${host}`,
150
- detail: describeNetworkError(err, timeoutMs)
151
- });
152
- }
153
- } else probe.say({
154
- status: "info",
155
- label: `reach ${host}`,
156
- detail: "not tried: the name did not resolve"
157
- });
158
- }
159
- let token;
160
- try {
161
- token = await input.token();
162
- } catch (err) {
163
- probe.say({
164
- status: "fail",
165
- label: "token",
166
- detail: err.message
167
- });
168
- probe.say({
169
- status: "info",
170
- label: "accepted",
171
- detail: "not tried: there is no token"
172
- });
173
- return;
174
- }
175
- probe.secret(token);
176
- probe.say({
177
- status: "ok",
178
- label: "token",
179
- detail: "found"
180
- });
181
- if (!reachable) {
182
- probe.say({
183
- status: "info",
184
- label: "accepted",
185
- detail: "not tried: the host could not be reached"
186
- });
187
- return;
188
- }
189
- const result = await input.verify(token);
190
- probe.say(result.ok ? {
191
- status: "ok",
192
- label: "accepted",
193
- detail: result.subject
194
- } : {
195
- status: "fail",
196
- label: "accepted",
197
- detail: result.message
198
- });
199
- }
200
- };
201
- }
202
65
  // src/commands/notifications-sync-roles/links.ts
203
66
  const EMPTY_LINKS = {
204
67
  version: 1,
@@ -521,4 +384,12 @@ async function readWorkspacePackageJsons(repoRoot, workspacePackages) {
521
384
  }
522
385
  return results;
523
386
  }
524
- export { AuthError, CARDINALITY, ConfigError, ConfigFileError, ElevationRequiredError, MissingTokenError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, compose, connectionProbe, createFeatureResolver, createResolveToken, createRestClient, credentialsEnvironment, defineConfig, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, describeNetworkError, isMulti, keyring, loadConfig, missingCapabilities, readLinks, readWorkspacePackageJsons, resolveConfig, resolveEntry, resolvePluginPackage, roleTeamProblem, sourceProblem, syncRoles };
387
+ // src/plugin/connection-probe/connection-probe.ts
388
+ /**
389
+ * The `connection` probe every provider offers, for telling a network problem from a credential problem. The checks are
390
+ * kyber's `connectionProbe`; this types the result as the plugin system's {@link Probe} and `verify` as `VerifyTokenResult`.
391
+ */
392
+ function connectionProbe(input) {
393
+ return connectionProbe$1(input);
394
+ }
395
+ export { AuthError, CARDINALITY, ConfigError, ConfigFileError, ElevationRequiredError, MissingTokenError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, compose, connectionProbe, createFeatureResolver, createResolveToken, createRestClient, credentialsEnvironment, defineConfig, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, isMulti, keyring, loadConfig, missingCapabilities, readLinks, readWorkspacePackageJsons, resolveConfig, resolveEntry, resolvePluginPackage, roleTeamProblem, sourceProblem, syncRoles };
package/dist/presets.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as compose } from "./config-system-Bq6510iF.mjs";
1
+ import { n as compose } from "./config-system-CZ0F8Uq7.mjs";
2
2
  // src/presets/capabilities/audit.ts
3
3
  /**
4
4
  * Adds bundle-size measuring (`measure-bundle`) + optional Knip (`lint:unused`) and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/cli",
3
- "version": "5.0.0-alpha.345",
3
+ "version": "5.0.0-alpha.347",
4
4
  "description": "The Holocron CLI - a pluggable, capability-based orchestrator for spinning up and operating software projects.",
5
5
  "keywords": [
6
6
  "cli",
@@ -54,16 +54,16 @@
54
54
  "posthog-node": "^5.61.1",
55
55
  "tsx": "4.23.15",
56
56
  "yargs": "^18.1.0",
57
- "@theholocron/astromech": "5.0.0-alpha.345",
58
- "@theholocron/dagobah": "5.0.0-alpha.345",
59
- "@theholocron/datapad": "5.0.0-alpha.345",
57
+ "@theholocron/datapad": "5.0.0-alpha.347",
58
+ "@theholocron/dagobah": "5.0.0-alpha.347",
59
+ "@theholocron/astromech": "5.0.0-alpha.347",
60
60
  "@theholocron/env-utils": "^1.17.0-alpha.1",
61
61
  "@theholocron/fs-utils": "^1.17.0-alpha.1",
62
- "@theholocron/github-client": "^1.58.0-alpha.10",
63
62
  "@theholocron/git-utils": "^1.17.0-alpha.1",
64
- "@theholocron/kyber": "5.0.0-alpha.345",
65
- "@theholocron/json-utils": "^1.17.0-alpha.1",
63
+ "@theholocron/github-client": "^1.58.0-alpha.10",
66
64
  "@theholocron/http-client": "^1.58.0-alpha.10",
65
+ "@theholocron/json-utils": "^1.17.0-alpha.1",
66
+ "@theholocron/kyber": "5.0.0-alpha.347",
67
67
  "@theholocron/observability": "^0.7.0-alpha.1",
68
68
  "@theholocron/pkg-utils": "^1.17.0-alpha.1",
69
69
  "@theholocron/misc-utils": "^1.17.0-alpha.1"
@@ -80,9 +80,9 @@
80
80
  "typescript": "^5.9.3",
81
81
  "vitest": "^5.0.5",
82
82
  "@theholocron/eslint-config": "^8.9.0-alpha.8",
83
- "@theholocron/tsconfig": "^8.9.0-alpha.8",
83
+ "@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.8",
84
84
  "@theholocron/vitest-config": "^8.9.0-alpha.8",
85
- "@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.8"
85
+ "@theholocron/tsconfig": "^8.9.0-alpha.8"
86
86
  },
87
87
  "engines": {
88
88
  "node": ">=22.0.0"