@theholocron/cli 3.47.0 → 3.49.0
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/cli.mjs +1191 -1077
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +52 -60
- package/dist/index.mjs +17 -22
- package/dist/{capabilities/index.d.mts → plugin/capabilities.d.mts} +1 -1
- package/dist/{capabilities/index.mjs → plugin/capabilities.mjs} +1 -1
- package/package.json +13 -11
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Analytics, Auth, AuthDescription, AuthEvent, AuthEventType, AuthIdentity, AuthUser, CARDINALITY, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, Ci, CiRun, CiRunFilter, CiRunStatus, ConnectionStringOptions, CreateAuthUserInput, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, Dns, DnsRecord, DnsRecordType, EnsureResult, Environment, EnvironmentReviewer, Environments, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, NormalizedAuthUser, Notifications, Observability, PagesConfig, ParseWebhookInput, ProviderApiError, ProviderIdentity, PullRequest, REQUIRED_CAPABILITIES, RepoRef, RepoSettings, ResolvedCapability, Ruleset, SecretScope, Secrets, Source, StatusCategory, Storage, StorageBranch, TeamEntry, TeamPermission, Tooling, ToolingDoctorReport, TrackerDoctorReport, TrackerUser, Vault, WebhookDashboardInfo, WebhookVerificationError, Wiki, WikiDnsRecord, WikiProvisionOpts, WikiProxyConfig, Workers, isMulti } from "./capabilities
|
|
1
|
+
import { Analytics, Auth, AuthDescription, AuthEvent, AuthEventType, AuthIdentity, AuthUser, CARDINALITY, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, Ci, CiRun, CiRunFilter, CiRunStatus, ConnectionStringOptions, CreateAuthUserInput, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, Dns, DnsRecord, DnsRecordType, EnsureResult, Environment, EnvironmentReviewer, Environments, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, NormalizedAuthUser, Notifications, Observability, PagesConfig, ParseWebhookInput, ProviderApiError, ProviderIdentity, PullRequest, REQUIRED_CAPABILITIES, RepoRef, RepoSettings, ResolvedCapability, Ruleset, SecretScope, Secrets, Source, StatusCategory, Storage, StorageBranch, TeamEntry, TeamPermission, Tooling, ToolingDoctorReport, TrackerDoctorReport, TrackerUser, Vault, WebhookDashboardInfo, WebhookVerificationError, Wiki, WikiDnsRecord, WikiProvisionOpts, WikiProxyConfig, Workers, isMulti } from "./plugin/capabilities.mjs";
|
|
2
2
|
import { AuthError, RequestOptions, ResolveTokenConfig as ResolveTokenConfig$1, ResolveTokenInput, RestClient, RestClientConfig, createRestClient } from "@theholocron/http-client";
|
|
3
|
-
//#region src/auth-resolver.d.ts
|
|
3
|
+
//#region src/auth/auth-resolver.d.ts
|
|
4
4
|
type ResolveTokenConfig = Omit<ResolveTokenConfig$1, "getKeyringToken">;
|
|
5
5
|
/** Wraps `createResolveToken` from `@theholocron/http` and injects the
|
|
6
6
|
* system keyring so plugins stay at a one-liner call site. */
|
|
@@ -20,7 +20,51 @@ interface FeatureResolverConfig {
|
|
|
20
20
|
*/
|
|
21
21
|
declare function createFeatureResolver(config: FeatureResolverConfig): (input?: ResolveTokenInput) => string;
|
|
22
22
|
//#endregion
|
|
23
|
-
//#region src/
|
|
23
|
+
//#region src/auth/keyring.d.ts
|
|
24
|
+
/**
|
|
25
|
+
* Keyring-backed bootstrap credential store.
|
|
26
|
+
*
|
|
27
|
+
* Every holocron plugin's bootstrap token (the one it needs before it
|
|
28
|
+
* can talk to its vendor's API) can be stored in the OS keyring under
|
|
29
|
+
* a single reverse-DNS service scope. Managed via `holocron auth`
|
|
30
|
+
* subcommands; consulted at position 4 in every plugin's auth
|
|
31
|
+
* precedence chain (after --token / HOLOCRON_<X>_TOKEN / <native>_TOKEN).
|
|
32
|
+
*
|
|
33
|
+
* See `.notes/tech-auth-bootstrap.spec.md` for the design rationale.
|
|
34
|
+
*
|
|
35
|
+
* Failure model: keyring access is best-effort. Platforms without a
|
|
36
|
+
* supported credential store (some Linux CI images, sandboxed
|
|
37
|
+
* environments) will throw from the underlying library. Every export
|
|
38
|
+
* here catches and returns a null/empty result rather than propagating
|
|
39
|
+
* — the plugin's precedence chain then falls through to
|
|
40
|
+
* env-var-only paths, which is exactly how CI is meant to work.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* Store or overwrite a bootstrap token for a provider. Returns true on
|
|
44
|
+
* success, false when the underlying keyring is unsupported or errored.
|
|
45
|
+
*/
|
|
46
|
+
declare function setToken(provider: string, token: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Read the bootstrap token for a provider. Returns `null` for both
|
|
49
|
+
* "not stored" and "keyring unavailable" — callers can treat them the
|
|
50
|
+
* same way (fall through to env-var precedence).
|
|
51
|
+
*/
|
|
52
|
+
declare function getToken(provider: string): string | null;
|
|
53
|
+
/**
|
|
54
|
+
* Delete a stored token. Returns true when a token was removed, false
|
|
55
|
+
* when there was nothing to delete or the keyring is unavailable.
|
|
56
|
+
* Distinguishing the two cases isn't worth the surface area — the
|
|
57
|
+
* command output makes the situation clear either way.
|
|
58
|
+
*/
|
|
59
|
+
declare function deleteToken(provider: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* List provider slugs with a stored token in this service scope.
|
|
62
|
+
* Uses the library's `findCredentials(service)` — supported on all
|
|
63
|
+
* platforms the underlying credential store supports.
|
|
64
|
+
*/
|
|
65
|
+
declare function listStoredProviders(): string[];
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/config/config.d.ts
|
|
24
68
|
type ProviderOptions = Record<string, unknown>;
|
|
25
69
|
/**
|
|
26
70
|
* The shape a capability config package's default export must satisfy.
|
|
@@ -106,8 +150,7 @@ interface EnvConfig {
|
|
|
106
150
|
* Namespace prefixes used by this project's env vars.
|
|
107
151
|
* Listed from least- to most-specific (cascade model — last wins).
|
|
108
152
|
* Tooling reads this to generate `.env.example`, validate required
|
|
109
|
-
* vars, and produce documentation.
|
|
110
|
-
* value to `createEnvParser({ namespaces })` from `@theholocron/env-utils`.
|
|
153
|
+
* vars, and produce documentation.
|
|
111
154
|
*
|
|
112
155
|
* @example
|
|
113
156
|
* // Project-only prefix
|
|
@@ -379,7 +422,7 @@ declare function resolvePluginPackage(provider: string): string;
|
|
|
379
422
|
declare function resolveEntry(key: CapabilityKey, raw: RawProviderEntry): ResolvedProviderEntry;
|
|
380
423
|
declare function resolveConfig(raw: HolocronConfig): ResolvedHolocronConfig;
|
|
381
424
|
//#endregion
|
|
382
|
-
//#region src/compose.d.ts
|
|
425
|
+
//#region src/config/compose.d.ts
|
|
383
426
|
type WorkflowEntry = NonNullable<HolocronConfig["workflows"]>[number];
|
|
384
427
|
/** A single composable capability fragment. */
|
|
385
428
|
interface Capability {
|
|
@@ -436,61 +479,10 @@ interface ComposedPreset {
|
|
|
436
479
|
*/
|
|
437
480
|
declare function compose(...args: (Capability | Capability[])[]): ComposedPreset;
|
|
438
481
|
//#endregion
|
|
439
|
-
//#region src/define-config.d.ts
|
|
482
|
+
//#region src/config/define-config.d.ts
|
|
440
483
|
declare function defineConfig(config: HolocronConfig): HolocronConfig;
|
|
441
484
|
//#endregion
|
|
442
|
-
//#region src/
|
|
443
|
-
interface EnvLookup {
|
|
444
|
-
get(key: string): string | undefined;
|
|
445
|
-
first(...keys: string[]): string | undefined;
|
|
446
|
-
}
|
|
447
|
-
declare function createEnvLookup(source?: NodeJS.ProcessEnv): EnvLookup;
|
|
448
|
-
//#endregion
|
|
449
|
-
//#region src/keyring.d.ts
|
|
450
|
-
/**
|
|
451
|
-
* Keyring-backed bootstrap credential store.
|
|
452
|
-
*
|
|
453
|
-
* Every holocron plugin's bootstrap token (the one it needs before it
|
|
454
|
-
* can talk to its vendor's API) can be stored in the OS keyring under
|
|
455
|
-
* a single reverse-DNS service scope. Managed via `holocron auth`
|
|
456
|
-
* subcommands; consulted at position 4 in every plugin's auth
|
|
457
|
-
* precedence chain (after --token / HOLOCRON_<X>_TOKEN / <native>_TOKEN).
|
|
458
|
-
*
|
|
459
|
-
* See `.notes/tech-auth-bootstrap.spec.md` for the design rationale.
|
|
460
|
-
*
|
|
461
|
-
* Failure model: keyring access is best-effort. Platforms without a
|
|
462
|
-
* supported credential store (some Linux CI images, sandboxed
|
|
463
|
-
* environments) will throw from the underlying library. Every export
|
|
464
|
-
* here catches and returns a null/empty result rather than propagating
|
|
465
|
-
* — the plugin's precedence chain then falls through to
|
|
466
|
-
* env-var-only paths, which is exactly how CI is meant to work.
|
|
467
|
-
*/
|
|
468
|
-
/**
|
|
469
|
-
* Store or overwrite a bootstrap token for a provider. Returns true on
|
|
470
|
-
* success, false when the underlying keyring is unsupported or errored.
|
|
471
|
-
*/
|
|
472
|
-
declare function setToken(provider: string, token: string): boolean;
|
|
473
|
-
/**
|
|
474
|
-
* Read the bootstrap token for a provider. Returns `null` for both
|
|
475
|
-
* "not stored" and "keyring unavailable" — callers can treat them the
|
|
476
|
-
* same way (fall through to env-var precedence).
|
|
477
|
-
*/
|
|
478
|
-
declare function getToken(provider: string): string | null;
|
|
479
|
-
/**
|
|
480
|
-
* Delete a stored token. Returns true when a token was removed, false
|
|
481
|
-
* when there was nothing to delete or the keyring is unavailable.
|
|
482
|
-
* Distinguishing the two cases isn't worth the surface area — the
|
|
483
|
-
* command output makes the situation clear either way.
|
|
484
|
-
*/
|
|
485
|
-
declare function deleteToken(provider: string): boolean;
|
|
486
|
-
/**
|
|
487
|
-
* List provider slugs with a stored token in this service scope.
|
|
488
|
-
* Uses the library's `findCredentials(service)` — supported on all
|
|
489
|
-
* platforms the underlying credential store supports.
|
|
490
|
-
*/
|
|
491
|
-
declare function listStoredProviders(): string[];
|
|
492
|
-
//#endregion
|
|
493
|
-
//#region src/load-config.d.ts
|
|
485
|
+
//#region src/config/load-config.d.ts
|
|
494
486
|
declare class ConfigFileError extends Error {
|
|
495
487
|
name: string;
|
|
496
488
|
}
|
|
@@ -506,4 +498,4 @@ interface LoadedConfig {
|
|
|
506
498
|
*/
|
|
507
499
|
declare function loadConfig(cwd: string): Promise<LoadedConfig>;
|
|
508
500
|
//#endregion
|
|
509
|
-
export { Analytics, AppConfig, Auth, AuthDescription, AuthError, AuthEvent, AuthEventType, AuthIdentity, AuthUser, CARDINALITY, Capability, CapabilityConfigPackage, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, ChromaticProjectConfig, Ci, CiRun, CiRunFilter, CiRunStatus, ComposedPreset, ConfigError, ConfigFileError, ConnectionStringOptions, CreateAuthUserInput, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, Dns, DnsRecord, DnsRecordType, DocsConfig, DoctorConfig, EnsureResult, EnvConfig,
|
|
501
|
+
export { Analytics, AppConfig, Auth, AuthDescription, AuthError, AuthEvent, AuthEventType, AuthIdentity, AuthUser, CARDINALITY, Capability, CapabilityConfigPackage, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, ChromaticProjectConfig, Ci, CiRun, CiRunFilter, CiRunStatus, ComposedPreset, ConfigError, ConfigFileError, ConnectionStringOptions, CreateAuthUserInput, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, Dns, DnsRecord, DnsRecordType, DocsConfig, DoctorConfig, EnsureResult, EnvConfig, Environment, EnvironmentReviewer, Environments, FeatureResolverConfig, HolocronConfig, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, LoadedConfig, MultiEntry, NormalizedAuthUser, Notifications, Observability, PagesConfig, ParseWebhookInput, ProviderApiError, ProviderIdentity, ProviderOptions, PullRequest, REQUIRED_CAPABILITIES, RawProviderEntry, RawProvidersConfig, RepoConfig, RepoProperties, RepoProtection, RepoRef, RepoSettings, type RequestOptions, ResolveTokenConfig, type ResolveTokenInput, ResolvedCapability, ResolvedHolocronConfig, ResolvedProviderEntry, ResolvedProvidersConfig, ResolvedTuple, type RestClient, type RestClientConfig, Ruleset, SecretScope, Secrets, SingleEntry, Source, StatusCategory, Storage, StorageBranch, StorybookDeployProject, TeamEntry, TeamPermission, Tooling, ToolingDoctorReport, TrackerDoctorReport, TrackerUser, Vault, WebhookDashboardInfo, WebhookVerificationError, Wiki, WikiDnsRecord, WikiProvisionOpts, WikiProxyConfig, Workers, WorkflowWithConfig, compose, createFeatureResolver, createResolveToken, createRestClient, defineConfig, deleteToken, getToken, isMulti, listStoredProviders, loadConfig, resolveConfig, resolveEntry, resolvePluginPackage, setToken };
|
package/dist/index.mjs
CHANGED
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import { CARDINALITY, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, isMulti } from "./capabilities
|
|
1
|
+
import { CARDINALITY, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, isMulti } from "./plugin/capabilities.mjs";
|
|
2
2
|
import { AuthError, createResolveToken as createResolveToken$1, createRestClient } from "@theholocron/http-client";
|
|
3
|
+
import { createEnvLookup } from "@theholocron/env-utils";
|
|
3
4
|
import { Entry, findCredentials } from "@napi-rs/keyring";
|
|
4
5
|
import { execFile } from "node:child_process";
|
|
5
6
|
import { readFile, stat } from "node:fs/promises";
|
|
6
7
|
import { basename, dirname, join } from "node:path";
|
|
7
8
|
import { pathToFileURL } from "node:url";
|
|
8
9
|
import { promisify } from "node:util";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
for (const key of keys) {
|
|
17
|
-
const val = source[key];
|
|
18
|
-
if (val) return val;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
10
|
+
createEnvLookup();
|
|
11
|
+
/**
|
|
12
|
+
* Create an injectable env for commands that accept a fake env in tests.
|
|
13
|
+
* Pass `input.env` when available, falls back to `process.env`.
|
|
14
|
+
*/
|
|
15
|
+
function makeEnv(source) {
|
|
16
|
+
return createEnvLookup(source);
|
|
22
17
|
}
|
|
23
18
|
//#endregion
|
|
24
|
-
//#region src/keyring.ts
|
|
19
|
+
//#region src/auth/keyring.ts
|
|
25
20
|
/**
|
|
26
21
|
* Keyring-backed bootstrap credential store.
|
|
27
22
|
*
|
|
@@ -91,7 +86,7 @@ function listStoredProviders() {
|
|
|
91
86
|
}
|
|
92
87
|
}
|
|
93
88
|
//#endregion
|
|
94
|
-
//#region src/auth-resolver.ts
|
|
89
|
+
//#region src/auth/auth-resolver.ts
|
|
95
90
|
/** Wraps `createResolveToken` from `@theholocron/http` and injects the
|
|
96
91
|
* system keyring so plugins stay at a one-liner call site. */
|
|
97
92
|
function createResolveToken(config) {
|
|
@@ -109,7 +104,7 @@ function createResolveToken(config) {
|
|
|
109
104
|
*/
|
|
110
105
|
function createFeatureResolver(config) {
|
|
111
106
|
return function resolveFeatureToken(input = {}) {
|
|
112
|
-
const env =
|
|
107
|
+
const env = makeEnv(input.env);
|
|
113
108
|
const keyring = input.keyring ?? getToken;
|
|
114
109
|
const token = input.cliToken || env.get(config.envName) || keyring(config.keyringKey);
|
|
115
110
|
if (!token) throw new AuthError(`no GitHub token found for this operation. Pass --token <PAT>, set ${config.envName}, or run: holocron auth set ${config.keyringKey} <PAT>`);
|
|
@@ -117,7 +112,7 @@ function createFeatureResolver(config) {
|
|
|
117
112
|
};
|
|
118
113
|
}
|
|
119
114
|
//#endregion
|
|
120
|
-
//#region src/config.ts
|
|
115
|
+
//#region src/config/config.ts
|
|
121
116
|
/**
|
|
122
117
|
* `holocron.config.json` schema, parser, and provider resolution.
|
|
123
118
|
*
|
|
@@ -244,7 +239,7 @@ function resolveConfig(raw) {
|
|
|
244
239
|
};
|
|
245
240
|
}
|
|
246
241
|
//#endregion
|
|
247
|
-
//#region src/compose.ts
|
|
242
|
+
//#region src/config/compose.ts
|
|
248
243
|
function workflowName(e) {
|
|
249
244
|
return typeof e === "string" ? e : e.name;
|
|
250
245
|
}
|
|
@@ -334,12 +329,12 @@ function compose(...args) {
|
|
|
334
329
|
};
|
|
335
330
|
}
|
|
336
331
|
//#endregion
|
|
337
|
-
//#region src/define-config.ts
|
|
332
|
+
//#region src/config/define-config.ts
|
|
338
333
|
function defineConfig(config) {
|
|
339
334
|
return config;
|
|
340
335
|
}
|
|
341
336
|
//#endregion
|
|
342
|
-
//#region src/load-config.ts
|
|
337
|
+
//#region src/config/load-config.ts
|
|
343
338
|
/**
|
|
344
339
|
* `holocron.config.{json,js,ts}` file loader.
|
|
345
340
|
*
|
|
@@ -457,4 +452,4 @@ async function fileExists(path) {
|
|
|
457
452
|
}
|
|
458
453
|
}
|
|
459
454
|
//#endregion
|
|
460
|
-
export { AuthError, CARDINALITY, ConfigError, ConfigFileError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, compose,
|
|
455
|
+
export { AuthError, CARDINALITY, ConfigError, ConfigFileError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, compose, createFeatureResolver, createResolveToken, createRestClient, defineConfig, deleteToken, getToken, isMulti, listStoredProviders, loadConfig, resolveConfig, resolveEntry, resolvePluginPackage, setToken };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.49.0",
|
|
4
4
|
"description": "The Holocron CLI — a pluggable, capability-based orchestrator for spinning up and operating software projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"default": "./dist/index.mjs"
|
|
29
29
|
},
|
|
30
30
|
"./capabilities": {
|
|
31
|
-
"types": "./dist/capabilities
|
|
32
|
-
"import": "./dist/capabilities
|
|
33
|
-
"default": "./dist/capabilities
|
|
31
|
+
"types": "./dist/plugin/capabilities.d.mts",
|
|
32
|
+
"import": "./dist/plugin/capabilities.mjs",
|
|
33
|
+
"default": "./dist/plugin/capabilities.mjs"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"bin": {
|
|
@@ -44,18 +44,19 @@
|
|
|
44
44
|
"@napi-rs/keyring": "^1.3.0",
|
|
45
45
|
"@sentry/node": "^10.70.0",
|
|
46
46
|
"@theholocron/components-doc": "^1.6.0",
|
|
47
|
-
"@theholocron/
|
|
48
|
-
"@theholocron/
|
|
49
|
-
"@theholocron/
|
|
47
|
+
"@theholocron/env-utils": "^1.6.0",
|
|
48
|
+
"@theholocron/github-client": "^1.14.2",
|
|
49
|
+
"@theholocron/http-client": "^1.14.2",
|
|
50
|
+
"@theholocron/registry-doc": "^1.8.0",
|
|
50
51
|
"chalk": "^6.0.0",
|
|
51
52
|
"ora": "^9.4.1",
|
|
52
53
|
"tsx": "4.23.12",
|
|
53
54
|
"yargs": "^18.1.0"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
|
-
"@theholocron/eslint-config": "^7.
|
|
57
|
-
"@theholocron/tsconfig": "^7.
|
|
58
|
-
"@theholocron/vitest-config": "^7.
|
|
57
|
+
"@theholocron/eslint-config": "^7.32.1",
|
|
58
|
+
"@theholocron/tsconfig": "^7.32.1",
|
|
59
|
+
"@theholocron/vitest-config": "^7.32.1",
|
|
59
60
|
"@types/node": "^26",
|
|
60
61
|
"@types/yargs": "^17.0.35",
|
|
61
62
|
"@vitest/coverage-v8": "^4.1.11",
|
|
@@ -65,7 +66,8 @@
|
|
|
65
66
|
"globals": "^17.11.0",
|
|
66
67
|
"tsdown": "^0.22.14",
|
|
67
68
|
"typescript": "^5.9.3",
|
|
68
|
-
"vitest": "^4.1.11"
|
|
69
|
+
"vitest": "^4.1.11",
|
|
70
|
+
"@theholocron/rollup-plugin-transform-template": "3.49.0"
|
|
69
71
|
},
|
|
70
72
|
"engines": {
|
|
71
73
|
"node": ">=22.0.0"
|