@theholocron/cli 5.0.0-alpha.337 → 5.0.0-alpha.338
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 +461 -1701
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +58 -143
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -1,129 +1,42 @@
|
|
|
1
1
|
import { CARDINALITY, ElevationRequiredError, MissingTokenError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, isMulti } from "./plugin/capabilities.mjs";
|
|
2
2
|
import { a as resolveEntry, i as resolveConfig, n as ConfigError, o as resolvePluginPackage, r as credentialsEnvironment, t as compose } from "./compose-DU_NeIR0.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { basename, dirname, join } from "node:path";
|
|
6
|
-
import "dotenv";
|
|
3
|
+
import { AuthError, createResolveToken as createResolveToken$1, createRestClient, onRetry } from "@theholocron/http-client";
|
|
4
|
+
import { createKeyring, getCredential } from "@theholocron/kyber/secrets";
|
|
7
5
|
import { createEnvLookup, withEnvPrefix } from "@theholocron/env-utils/lookup";
|
|
8
6
|
import { Entry, findCredentials } from "@napi-rs/keyring";
|
|
9
7
|
import { errorMessage } from "@theholocron/misc-utils";
|
|
10
|
-
import
|
|
11
|
-
import "ora";
|
|
8
|
+
import { createProgress, progressEnabled, withProgress } from "@theholocron/kyber/ui";
|
|
12
9
|
import { lookup } from "node:dns/promises";
|
|
10
|
+
import { basename, dirname, join } from "node:path";
|
|
13
11
|
import { readPackageJson } from "@theholocron/pkg-utils";
|
|
14
12
|
import { loadTasksConfig } from "@theholocron/astromech/config";
|
|
15
13
|
import { ConfigFileError, ConfigFileError as ConfigFileError$1, loadConfigFile } from "@theholocron/datapad";
|
|
16
14
|
import { readGitRemote } from "@theholocron/git-utils";
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function loadBinding() {
|
|
41
|
-
try {
|
|
42
|
-
return createRequire(import.meta.url)("@napi-rs/keyring");
|
|
43
|
-
} catch {
|
|
44
|
-
return null;
|
|
15
|
+
// \0rolldown/runtime.js
|
|
16
|
+
var __defProp = Object.defineProperty;
|
|
17
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
18
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
19
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20
|
+
var __exportAll = (all, no_symbols) => {
|
|
21
|
+
let target = {};
|
|
22
|
+
for (var name in all) __defProp(target, name, {
|
|
23
|
+
get: all[name],
|
|
24
|
+
enumerable: true
|
|
25
|
+
});
|
|
26
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
29
|
+
var __copyProps = (to, from, except, desc) => {
|
|
30
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
31
|
+
key = keys[i];
|
|
32
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
33
|
+
get: ((k) => from[k]).bind(null, key),
|
|
34
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
35
|
+
});
|
|
45
36
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
* Keyring access is best-effort. Platforms without a supported credential store (some Linux CI images, sandboxed
|
|
51
|
-
* environments) throw from the underlying library, and `@napi-rs/keyring` is an optional peer that may not be installed
|
|
52
|
-
* at all. Every method catches that and answers `null`, `false` or an empty list rather than propagating, so a caller's
|
|
53
|
-
* chain (a flag, then the environment, then the keyring) falls through to the paths that do work, which is how CI is
|
|
54
|
-
* meant to run.
|
|
55
|
-
*
|
|
56
|
-
* Reads are remembered in memory only, for the life of the process. A cache that outlived the process would mean writing
|
|
57
|
-
* secrets somewhere else, which is what the keyring is there to avoid.
|
|
58
|
-
*/
|
|
59
|
-
function createKeyring(options) {
|
|
60
|
-
const { service } = options;
|
|
61
|
-
const cache = /* @__PURE__ */ new Map();
|
|
62
|
-
let binding = options.binding;
|
|
63
|
-
const loaded = () => {
|
|
64
|
-
if (binding === void 0) binding = loadBinding();
|
|
65
|
-
return binding;
|
|
66
|
-
};
|
|
67
|
-
const entry = (account) => {
|
|
68
|
-
const b = loaded();
|
|
69
|
-
if (!b) throw new Error("no OS keyring available");
|
|
70
|
-
return new b.Entry(service, account);
|
|
71
|
-
};
|
|
72
|
-
return {
|
|
73
|
-
get(account) {
|
|
74
|
-
if (cache.has(account)) return cache.get(account);
|
|
75
|
-
let secret;
|
|
76
|
-
try {
|
|
77
|
-
secret = entry(account).getPassword();
|
|
78
|
-
} catch {
|
|
79
|
-
secret = null;
|
|
80
|
-
}
|
|
81
|
-
cache.set(account, secret);
|
|
82
|
-
return secret;
|
|
83
|
-
},
|
|
84
|
-
set(account, secret) {
|
|
85
|
-
try {
|
|
86
|
-
entry(account).setPassword(secret);
|
|
87
|
-
cache.set(account, secret);
|
|
88
|
-
return true;
|
|
89
|
-
} catch {
|
|
90
|
-
cache.delete(account);
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
delete(account) {
|
|
95
|
-
try {
|
|
96
|
-
const removed = entry(account).deletePassword();
|
|
97
|
-
cache.set(account, null);
|
|
98
|
-
return removed;
|
|
99
|
-
} catch {
|
|
100
|
-
cache.delete(account);
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
list() {
|
|
105
|
-
try {
|
|
106
|
-
const b = loaded();
|
|
107
|
-
return b ? b.findCredentials(service).map((c) => c.account) : [];
|
|
108
|
-
} catch {
|
|
109
|
-
return [];
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
isAvailable() {
|
|
113
|
-
try {
|
|
114
|
-
const b = loaded();
|
|
115
|
-
if (!b) return false;
|
|
116
|
-
b.findCredentials(service);
|
|
117
|
-
return true;
|
|
118
|
-
} catch {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
clearCache() {
|
|
123
|
-
cache.clear();
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
37
|
+
return to;
|
|
38
|
+
};
|
|
39
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
127
40
|
// src/env/env.ts
|
|
128
41
|
/** Singleton env for simple global lookups throughout the CLI. */
|
|
129
42
|
const env = createEnvLookup();
|
|
@@ -222,26 +135,28 @@ function createFeatureResolver(config) {
|
|
|
222
135
|
keyringKey: config.keyringKey
|
|
223
136
|
} });
|
|
224
137
|
}
|
|
225
|
-
//
|
|
226
|
-
/**
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
138
|
+
// src/ui/progress/progress.ts
|
|
139
|
+
/** Says on the spinner when a request is being sent again, so a slow step is not mistaken for a stuck one. */
|
|
140
|
+
const retryNotice = (label, setText) => onRetry((e) => {
|
|
141
|
+
setText(`${label} (retrying ${e.vendor ?? "the request"}, attempt ${e.attempt} of ${e.of})`);
|
|
142
|
+
});
|
|
143
|
+
/** {@link createSpinnerProgress} with the retry notice hooked in. */
|
|
144
|
+
function createProgress$1(print, enabled = progressEnabled) {
|
|
145
|
+
return createProgress(print, enabled, retryNotice);
|
|
146
|
+
}
|
|
147
|
+
/** `fn` under a cleared-when-done spinner named `label`, on a terminal only, with the retry notice hooked in. */
|
|
148
|
+
function withProgress$1(label, fn) {
|
|
149
|
+
return withProgress(label, fn, retryNotice);
|
|
150
|
+
}
|
|
151
|
+
// src/ui/index.ts
|
|
152
|
+
var ui_exports = /* @__PURE__ */ __exportAll({
|
|
153
|
+
createProgress: () => createProgress$1,
|
|
154
|
+
withProgress: () => withProgress$1
|
|
155
|
+
});
|
|
156
|
+
import * as import__theholocron_kyber_prompts from "@theholocron/kyber/prompts";
|
|
157
|
+
__reExport(ui_exports, import__theholocron_kyber_prompts);
|
|
158
|
+
import * as import__theholocron_kyber_ui from "@theholocron/kyber/ui";
|
|
159
|
+
__reExport(ui_exports, import__theholocron_kyber_ui);
|
|
245
160
|
// src/plugin/connection-probe/connection-probe.ts
|
|
246
161
|
const TLS_CODES = /* @__PURE__ */ new Set([
|
|
247
162
|
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
@@ -541,7 +456,7 @@ async function syncRoles(input) {
|
|
|
541
456
|
skipped: 0
|
|
542
457
|
};
|
|
543
458
|
for (const role of input.roles) {
|
|
544
|
-
print(`\n${style.header(`${role.name} ← team ${role.team}`)}`);
|
|
459
|
+
print(`\n${ui_exports.style.header(`${role.name} ← team ${role.team}`)}`);
|
|
545
460
|
const step = `role ${role.name}`;
|
|
546
461
|
let plan;
|
|
547
462
|
try {
|
|
@@ -555,7 +470,7 @@ async function syncRoles(input) {
|
|
|
555
470
|
});
|
|
556
471
|
} catch (err) {
|
|
557
472
|
const message = describeProviderError(err);
|
|
558
|
-
print(` ${style.fail(`${step}: ${message}`)}`);
|
|
473
|
+
print(` ${ui_exports.style.fail(`${step}: ${message}`)}`);
|
|
559
474
|
result.failures.push({
|
|
560
475
|
step,
|
|
561
476
|
message
|
|
@@ -571,11 +486,11 @@ async function syncRoles(input) {
|
|
|
571
486
|
};
|
|
572
487
|
result.roles.push(outcome);
|
|
573
488
|
result.skipped += plan.inSync;
|
|
574
|
-
if (plan.inSync > 0) print(` ${style.skip(`${plan.inSync} already have it`)}`);
|
|
489
|
+
if (plan.inSync > 0) print(` ${ui_exports.style.skip(`${plan.inSync} already have it`)}`);
|
|
575
490
|
const act = async (verb, who) => {
|
|
576
491
|
const label = `${verb === "add" ? "gave" : "took"} ${role.name} ${verb === "add" ? "to" : "from"} ${who.login} (${who.member})`;
|
|
577
492
|
if (dryRun || verb === "remove" && keep) {
|
|
578
|
-
print(` ${style.skip(`would ${verb === "add" ? "give" : "take"} ${role.name} ${verb === "add" ? "to" : "from"} ${who.login} (${who.member})${keep && verb === "remove" ? " (kept: --keep)" : ""}`)}`);
|
|
493
|
+
print(` ${ui_exports.style.skip(`would ${verb === "add" ? "give" : "take"} ${role.name} ${verb === "add" ? "to" : "from"} ${who.login} (${who.member})${keep && verb === "remove" ? " (kept: --keep)" : ""}`)}`);
|
|
579
494
|
result.skipped++;
|
|
580
495
|
return;
|
|
581
496
|
}
|
|
@@ -583,11 +498,11 @@ async function syncRoles(input) {
|
|
|
583
498
|
if (verb === "add") await notifications.addRoleMember(role.name, who.member);
|
|
584
499
|
else await notifications.removeRoleMember(role.name, who.member);
|
|
585
500
|
(verb === "add" ? outcome.added : outcome.removed).push(who.member);
|
|
586
|
-
print(` ${style.success(label)}`);
|
|
501
|
+
print(` ${ui_exports.style.success(label)}`);
|
|
587
502
|
result.ok++;
|
|
588
503
|
} catch (err) {
|
|
589
504
|
const message = describeProviderError(err);
|
|
590
|
-
print(` ${style.fail(`${step}: ${verb} ${who.login}: ${message}`)}`);
|
|
505
|
+
print(` ${ui_exports.style.fail(`${step}: ${verb} ${who.login}: ${message}`)}`);
|
|
591
506
|
result.failures.push({
|
|
592
507
|
step: `${step} ${verb} ${who.login}`,
|
|
593
508
|
message
|
|
@@ -597,11 +512,11 @@ async function syncRoles(input) {
|
|
|
597
512
|
for (const who of plan.add) await act("add", who);
|
|
598
513
|
for (const who of plan.remove) await act("remove", who);
|
|
599
514
|
for (const person of plan.unlinked) {
|
|
600
|
-
print(` ${style.skip(`${person.login} is on the team but has not linked their account`)}`);
|
|
515
|
+
print(` ${ui_exports.style.skip(`${person.login} is on the team but has not linked their account`)}`);
|
|
601
516
|
result.skipped++;
|
|
602
517
|
}
|
|
603
518
|
for (const holder of plan.unknownHolders) {
|
|
604
|
-
print(` ${style.skip(`${holder.name ?? holder.member} holds ${role.name} but is not linked to anyone: left alone`)}`);
|
|
519
|
+
print(` ${ui_exports.style.skip(`${holder.name ?? holder.member} holds ${role.name} but is not linked to anyone: left alone`)}`);
|
|
605
520
|
result.skipped++;
|
|
606
521
|
}
|
|
607
522
|
}
|
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.338",
|
|
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,17 +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.
|
|
57
|
+
"@theholocron/astromech": "5.0.0-alpha.338",
|
|
58
58
|
"@theholocron/env-utils": "^1.17.0-alpha.1",
|
|
59
59
|
"@theholocron/fs-utils": "^1.17.0-alpha.1",
|
|
60
60
|
"@theholocron/git-utils": "^1.17.0-alpha.1",
|
|
61
|
-
"@theholocron/
|
|
61
|
+
"@theholocron/dagobah": "5.0.0-alpha.338",
|
|
62
|
+
"@theholocron/datapad": "5.0.0-alpha.338",
|
|
62
63
|
"@theholocron/http-client": "^1.58.0-alpha.7",
|
|
64
|
+
"@theholocron/github-client": "^1.58.0-alpha.7",
|
|
65
|
+
"@theholocron/json-utils": "^1.17.0-alpha.1",
|
|
66
|
+
"@theholocron/kyber": "5.0.0-alpha.338",
|
|
63
67
|
"@theholocron/misc-utils": "^1.17.0-alpha.1",
|
|
64
|
-
"@theholocron/pkg-utils": "^1.17.0-alpha.1",
|
|
65
68
|
"@theholocron/observability": "^0.7.0-alpha.1",
|
|
66
|
-
"@theholocron/
|
|
67
|
-
"@theholocron/datapad": "5.0.0-alpha.337"
|
|
69
|
+
"@theholocron/pkg-utils": "^1.17.0-alpha.1"
|
|
68
70
|
},
|
|
69
71
|
"devDependencies": {
|
|
70
72
|
"@types/node": "^26",
|
|
@@ -77,9 +79,7 @@
|
|
|
77
79
|
"tsdown": "^0.23.4",
|
|
78
80
|
"typescript": "^5.9.3",
|
|
79
81
|
"vitest": "^5.0.5",
|
|
80
|
-
"@theholocron/dagobah": "0.0.0",
|
|
81
82
|
"@theholocron/eslint-config": "^8.9.0-alpha.8",
|
|
82
|
-
"@theholocron/kyber": "^0.0.0",
|
|
83
83
|
"@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.8",
|
|
84
84
|
"@theholocron/tsconfig": "^8.9.0-alpha.8",
|
|
85
85
|
"@theholocron/vitest-config": "^8.9.0-alpha.8"
|