@theholocron/cli 5.0.0-alpha.346 → 5.0.0-alpha.348
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 +5 -0
- package/dist/cli.mjs +44 -218
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +11 -27
- package/dist/index.mjs +10 -139
- package/package.json +10 -10
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ import { RequestOptions, RestClient, RestClientConfig, createRestClient } from "
|
|
|
5
5
|
import "@theholocron/kyber/plugins";
|
|
6
6
|
import { PackageJson } from "@theholocron/pkg-utils";
|
|
7
7
|
import { WorkspacePackage } from "@theholocron/astromech";
|
|
8
|
+
import { ConnectionProbeInput as ConnectionProbeInput$1 } from "@theholocron/kyber/checks";
|
|
8
9
|
import "@theholocron/observability/core";
|
|
9
10
|
/** A plugin's `verifyToken` result when the provider accepted the token. */
|
|
10
11
|
interface VerifyTokenSuccess {
|
|
@@ -127,33 +128,6 @@ interface Probe {
|
|
|
127
128
|
}
|
|
128
129
|
/** A plugin's probes by name (kebab-case), as returned from `createPlugin` next to `capabilities`. */
|
|
129
130
|
type PluginProbes = Record<string, Probe>;
|
|
130
|
-
/** What a connection probe needs to check a provider's host and token. */
|
|
131
|
-
export interface ConnectionProbeInput {
|
|
132
|
-
/** How the provider is named in output, e.g. `Axiom`. */
|
|
133
|
-
provider: string;
|
|
134
|
-
/** 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). */
|
|
135
|
-
url?: string;
|
|
136
|
-
/** Finds the token the plugin would use. Throws with a message that says where to put one when there is none. */
|
|
137
|
-
token: () => string | Promise<string>;
|
|
138
|
-
/** The plugin's `verifyToken`: asks the provider who the token belongs to. */
|
|
139
|
-
verify: (token: string) => Promise<VerifyTokenResult>;
|
|
140
|
-
/** Stands in for the network, so with one the name lookup (which cannot be stood in for) is not made. */
|
|
141
|
-
fetch?: typeof fetch;
|
|
142
|
-
/** Resolves a hostname. Defaults to the system resolver, unless `fetch` is given. */
|
|
143
|
-
lookup?: (host: string) => Promise<{
|
|
144
|
-
address: string;
|
|
145
|
-
}>;
|
|
146
|
-
/** Longest to wait for the host to answer. Defaults to 10 s. */
|
|
147
|
-
timeoutMs?: number;
|
|
148
|
-
}
|
|
149
|
-
/** A network failure in plain words, with what usually causes it. Never includes anything from a request. */
|
|
150
|
-
export declare function describeNetworkError(err: unknown, timeoutMs: number): string;
|
|
151
|
-
/**
|
|
152
|
-
* The `connection` probe every provider offers, for telling a network problem from a credential problem: does the name
|
|
153
|
-
* resolve, does the host answer, is there a token, and does the provider accept it. A step that cannot work because an
|
|
154
|
-
* earlier one failed is reported as not tried rather than failing a second time for the same reason.
|
|
155
|
-
*/
|
|
156
|
-
export declare function connectionProbe(input: ConnectionProbeInput): Probe;
|
|
157
131
|
interface RoleSyncOutcome {
|
|
158
132
|
role: string;
|
|
159
133
|
team: string;
|
|
@@ -332,4 +306,14 @@ export declare function missingCapabilities(capabilities: readonly string[]): st
|
|
|
332
306
|
* own soft-fail behavior.
|
|
333
307
|
*/
|
|
334
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;
|
|
335
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
|
@@ -5,9 +5,9 @@ import { AuthError, createFeatureResolver as createFeatureResolver$1, createKeyr
|
|
|
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
|
-
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/cli",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.348",
|
|
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,19 +54,19 @@
|
|
|
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.
|
|
58
|
-
"@theholocron/
|
|
59
|
-
"@theholocron/datapad": "5.0.0-alpha.346",
|
|
57
|
+
"@theholocron/astromech": "5.0.0-alpha.348",
|
|
58
|
+
"@theholocron/datapad": "5.0.0-alpha.348",
|
|
60
59
|
"@theholocron/fs-utils": "^1.17.0-alpha.1",
|
|
61
|
-
"@theholocron/env-utils": "^1.17.0-alpha.1",
|
|
62
|
-
"@theholocron/git-utils": "^1.17.0-alpha.1",
|
|
63
60
|
"@theholocron/github-client": "^1.58.0-alpha.10",
|
|
61
|
+
"@theholocron/git-utils": "^1.17.0-alpha.1",
|
|
62
|
+
"@theholocron/dagobah": "5.0.0-alpha.348",
|
|
64
63
|
"@theholocron/http-client": "^1.58.0-alpha.10",
|
|
64
|
+
"@theholocron/env-utils": "^1.17.0-alpha.1",
|
|
65
65
|
"@theholocron/json-utils": "^1.17.0-alpha.1",
|
|
66
66
|
"@theholocron/misc-utils": "^1.17.0-alpha.1",
|
|
67
|
-
"@theholocron/kyber": "5.0.0-alpha.346",
|
|
68
67
|
"@theholocron/observability": "^0.7.0-alpha.1",
|
|
69
|
-
"@theholocron/pkg-utils": "^1.17.0-alpha.1"
|
|
68
|
+
"@theholocron/pkg-utils": "^1.17.0-alpha.1",
|
|
69
|
+
"@theholocron/kyber": "5.0.0-alpha.348"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "^26",
|
|
@@ -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/
|
|
83
|
+
"@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.8",
|
|
84
84
|
"@theholocron/tsconfig": "^8.9.0-alpha.8",
|
|
85
|
-
"@theholocron/
|
|
85
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.8"
|
|
86
86
|
},
|
|
87
87
|
"engines": {
|
|
88
88
|
"node": ">=22.0.0"
|