@theholocron/cli 5.0.0-alpha.336 → 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/index.d.mts CHANGED
@@ -79,38 +79,25 @@ export declare function createFeatureResolver(config: FeatureResolverConfig): Fe
79
79
  /**
80
80
  * Keyring-backed bootstrap credential store.
81
81
  *
82
- * Every holocron plugin's bootstrap token (the one it needs before it
83
- * can talk to its vendor's API) can be stored in the OS keyring under
84
- * a single reverse-DNS service scope. Managed via `holocron auth`
85
- * subcommands; consulted at position 4 in every plugin's auth
86
- * precedence chain (after --token / HOLOCRON_<X>_TOKEN / <native>_TOKEN).
82
+ * Every holocron plugin's bootstrap token (the one it needs before it can talk to its vendor's API) can be stored in
83
+ * the OS keyring under a single reverse-DNS service scope. Managed via `holocron auth` subcommands; consulted at
84
+ * position 4 in every plugin's auth precedence chain (after --token / HOLOCRON_<X>_TOKEN / <native>_TOKEN).
87
85
  *
88
- * See `docs/wiki/specifications/tech-auth-bootstrap.spec.md` for the design rationale.
86
+ * The keyring itself, with its best-effort failure model and its per-process cache, is `createKeyring` in
87
+ * `@theholocron/kyber/secrets`; this file only names the service and keeps the function names the CLI uses.
89
88
  *
90
- * Failure model: keyring access is best-effort. Platforms without a
91
- * supported credential store (some Linux CI images, sandboxed
92
- * environments) will throw from the underlying library. Every export
93
- * here catches and returns a null/empty result rather than propagating
94
- * — the plugin's precedence chain then falls through to
95
- * env-var-only paths, which is exactly how CI is meant to work.
89
+ * See `docs/wiki/specifications/tech-auth-bootstrap.spec.md` for the design rationale.
96
90
  */
97
91
  /**
98
- * Forget every token `getToken` has remembered, so the next read asks the keyring again. `setToken` and
99
- * `deleteToken` already keep the cache right for what they change; this is for a test, or after the keyring was
100
- * changed from outside the process.
92
+ * Forget every token `getToken` has remembered, so the next read asks the keyring again. For a test, or after the
93
+ * keyring was changed from outside the process.
101
94
  */
102
95
  export declare function clearTokenCache(): void;
103
- /**
104
- * Store or overwrite a bootstrap token for a provider. Returns true on
105
- * success, false when the underlying keyring is unsupported or errored.
106
- */
96
+ /** Store or overwrite a bootstrap token for a provider. Returns true on success, false when the keyring is unsupported or errored. */
107
97
  export declare function setToken(provider: string, token: string): boolean;
108
98
  /**
109
- * Read the bootstrap token for a provider. Returns `null` for both
110
- * "not stored" and "keyring unavailable" — callers can treat them the
111
- * same way (fall through to env-var precedence). The answer is
112
- * remembered for the rest of the process, so the keyring is asked once
113
- * per provider.
99
+ * Read the bootstrap token for a provider. Returns `null` for both "not stored" and "keyring unavailable", so callers
100
+ * fall through to env-var precedence. The answer is remembered for the rest of the process.
114
101
  */
115
102
  export declare function getToken(provider: string): string | null;
116
103
  /**
@@ -118,18 +105,9 @@ export declare function getToken(provider: string): string | null;
118
105
  * cannot be reached alike; a caller that must tell an outage from an empty keyring asks this first.
119
106
  */
120
107
  export declare function isKeyringAvailable(): boolean;
121
- /**
122
- * Delete a stored token. Returns true when a token was removed, false
123
- * when there was nothing to delete or the keyring is unavailable.
124
- * Distinguishing the two cases isn't worth the surface area — the
125
- * command output makes the situation clear either way.
126
- */
108
+ /** Delete a stored token. Returns true when a token was removed, false when there was nothing to delete or the keyring is unavailable. */
127
109
  export declare function deleteToken(provider: string): boolean;
128
- /**
129
- * List provider slugs with a stored token in this service scope.
130
- * Uses the library's `findCredentials(service)` — supported on all
131
- * platforms the underlying credential store supports.
132
- */
110
+ /** List the provider slugs that have a stored token under the holocron service scope. */
133
111
  export declare function listStoredProviders(): string[];
134
112
  /** One line a probe reports: `info` for a fact, `ok` / `fail` for a result, `heading` to title the rows that follow. */
135
113
  interface ProbeRow {
package/dist/index.mjs CHANGED
@@ -1,16 +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 { AuthError, createResolveToken as createResolveToken$1, createRestClient } from "@theholocron/http-client";
3
+ import { AuthError, createResolveToken as createResolveToken$1, createRestClient, onRetry } from "@theholocron/http-client";
4
+ import { createKeyring, getCredential } from "@theholocron/kyber/secrets";
4
5
  import { createEnvLookup, withEnvPrefix } from "@theholocron/env-utils/lookup";
5
6
  import { Entry, findCredentials } from "@napi-rs/keyring";
6
7
  import { errorMessage } from "@theholocron/misc-utils";
7
- import { basename, dirname, join } from "node:path";
8
- import chalk from "chalk";
8
+ import { createProgress, progressEnabled, withProgress } from "@theholocron/kyber/ui";
9
9
  import { lookup } from "node:dns/promises";
10
+ import { basename, dirname, join } from "node:path";
10
11
  import { readPackageJson } from "@theholocron/pkg-utils";
11
12
  import { loadTasksConfig } from "@theholocron/astromech/config";
12
13
  import { ConfigFileError, ConfigFileError as ConfigFileError$1, loadConfigFile } from "@theholocron/datapad";
13
14
  import { readGitRemote } from "@theholocron/git-utils";
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
+ });
36
+ }
37
+ return to;
38
+ };
39
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
40
  // src/env/env.ts
15
41
  /** Singleton env for simple global lookups throughout the CLI. */
16
42
  const env = createEnvLookup();
@@ -22,137 +48,58 @@ withEnvPrefix(env, "HOLOCRON");
22
48
  function makeEnv(source) {
23
49
  return createEnvLookup(source);
24
50
  }
25
- // src/auth/credential-store/credential-store.ts
26
- /**
27
- * The variables the `credentials` providers returned, kept for the life of the process.
28
- *
29
- * The plugin loader reads each provider once (`setCredentials`), and the token resolvers look a token up here
30
- * (`getCredential`) after the flag and the process environment and before the keyring. It is in memory only: the
31
- * values were already in this process when the provider returned them, and nothing here writes them anywhere.
32
- *
33
- * A source is one provider's answer for one environment. They are kept in the order they were set, which is the
34
- * order `holocron.config` lists the providers, and the first source that has a value wins.
35
- */
36
- const sources = /* @__PURE__ */ new Map();
37
- /**
38
- * The first non-empty value for any of `names`, from the first source that has one. Sources are tried in the order
39
- * they were set; within a source the names are tried in the order given (the project's own variable name before the
40
- * vendor's). `undefined` when no source has one.
41
- */
42
- function getCredential(...names) {
43
- for (const variables of sources.values()) for (const name of names) {
44
- const value = variables[name];
45
- if (value) return value;
46
- }
47
- }
48
51
  // src/auth/keyring/keyring.ts
49
52
  /**
50
53
  * Keyring-backed bootstrap credential store.
51
54
  *
52
- * Every holocron plugin's bootstrap token (the one it needs before it
53
- * can talk to its vendor's API) can be stored in the OS keyring under
54
- * a single reverse-DNS service scope. Managed via `holocron auth`
55
- * subcommands; consulted at position 4 in every plugin's auth
56
- * precedence chain (after --token / HOLOCRON_<X>_TOKEN / <native>_TOKEN).
55
+ * Every holocron plugin's bootstrap token (the one it needs before it can talk to its vendor's API) can be stored in
56
+ * the OS keyring under a single reverse-DNS service scope. Managed via `holocron auth` subcommands; consulted at
57
+ * position 4 in every plugin's auth precedence chain (after --token / HOLOCRON_<X>_TOKEN / <native>_TOKEN).
57
58
  *
58
- * See `docs/wiki/specifications/tech-auth-bootstrap.spec.md` for the design rationale.
59
+ * The keyring itself, with its best-effort failure model and its per-process cache, is `createKeyring` in
60
+ * `@theholocron/kyber/secrets`; this file only names the service and keeps the function names the CLI uses.
59
61
  *
60
- * Failure model: keyring access is best-effort. Platforms without a
61
- * supported credential store (some Linux CI images, sandboxed
62
- * environments) will throw from the underlying library. Every export
63
- * here catches and returns a null/empty result rather than propagating
64
- * — the plugin's precedence chain then falls through to
65
- * env-var-only paths, which is exactly how CI is meant to work.
66
- */
67
- const SERVICE = "com.theholocron.cli";
68
- /**
69
- * What `getToken` has already read, by provider, for the life of this process. A miss (`null`) is remembered too, so
70
- * a token that is not stored, or a keyring that is unavailable, is asked about once, not on every lookup. The OS
71
- * keyring can prompt on each read, and several resolvers ask for the same entry in one command.
72
- *
73
- * It lives in memory only. A cache that outlived the process would mean writing tokens somewhere else, which is
74
- * what the keyring is there to avoid.
62
+ * See `docs/wiki/specifications/tech-auth-bootstrap.spec.md` for the design rationale.
75
63
  */
76
- const cache = /* @__PURE__ */ new Map();
64
+ const keyring = createKeyring({
65
+ service: "com.theholocron.cli",
66
+ binding: {
67
+ Entry,
68
+ findCredentials
69
+ }
70
+ });
77
71
  /**
78
- * Forget every token `getToken` has remembered, so the next read asks the keyring again. `setToken` and
79
- * `deleteToken` already keep the cache right for what they change; this is for a test, or after the keyring was
80
- * changed from outside the process.
72
+ * Forget every token `getToken` has remembered, so the next read asks the keyring again. For a test, or after the
73
+ * keyring was changed from outside the process.
81
74
  */
82
75
  function clearTokenCache() {
83
- cache.clear();
76
+ keyring.clearCache();
84
77
  }
85
- /**
86
- * Store or overwrite a bootstrap token for a provider. Returns true on
87
- * success, false when the underlying keyring is unsupported or errored.
88
- */
78
+ /** Store or overwrite a bootstrap token for a provider. Returns true on success, false when the keyring is unsupported or errored. */
89
79
  function setToken(provider, token) {
90
- try {
91
- new Entry(SERVICE, provider).setPassword(token);
92
- cache.set(provider, token);
93
- return true;
94
- } catch {
95
- cache.delete(provider);
96
- return false;
97
- }
80
+ return keyring.set(provider, token);
98
81
  }
99
82
  /**
100
- * Read the bootstrap token for a provider. Returns `null` for both
101
- * "not stored" and "keyring unavailable" — callers can treat them the
102
- * same way (fall through to env-var precedence). The answer is
103
- * remembered for the rest of the process, so the keyring is asked once
104
- * per provider.
83
+ * Read the bootstrap token for a provider. Returns `null` for both "not stored" and "keyring unavailable", so callers
84
+ * fall through to env-var precedence. The answer is remembered for the rest of the process.
105
85
  */
106
86
  function getToken(provider) {
107
- if (cache.has(provider)) return cache.get(provider);
108
- let token;
109
- try {
110
- token = new Entry(SERVICE, provider).getPassword();
111
- } catch {
112
- token = null;
113
- }
114
- cache.set(provider, token);
115
- return token;
87
+ return keyring.get(provider);
116
88
  }
117
89
  /**
118
90
  * Whether the OS keyring can be used at all. `getToken` answers `null` for a missing entry and for a keyring that
119
91
  * cannot be reached alike; a caller that must tell an outage from an empty keyring asks this first.
120
92
  */
121
93
  function isKeyringAvailable() {
122
- try {
123
- findCredentials(SERVICE);
124
- return true;
125
- } catch {
126
- return false;
127
- }
94
+ return keyring.isAvailable();
128
95
  }
129
- /**
130
- * Delete a stored token. Returns true when a token was removed, false
131
- * when there was nothing to delete or the keyring is unavailable.
132
- * Distinguishing the two cases isn't worth the surface area — the
133
- * command output makes the situation clear either way.
134
- */
96
+ /** Delete a stored token. Returns true when a token was removed, false when there was nothing to delete or the keyring is unavailable. */
135
97
  function deleteToken(provider) {
136
- try {
137
- const removed = new Entry(SERVICE, provider).deletePassword();
138
- cache.set(provider, null);
139
- return removed;
140
- } catch {
141
- cache.delete(provider);
142
- return false;
143
- }
98
+ return keyring.delete(provider);
144
99
  }
145
- /**
146
- * List provider slugs with a stored token in this service scope.
147
- * Uses the library's `findCredentials(service)` — supported on all
148
- * platforms the underlying credential store supports.
149
- */
100
+ /** List the provider slugs that have a stored token under the holocron service scope. */
150
101
  function listStoredProviders() {
151
- try {
152
- return findCredentials(SERVICE).map((c) => c.account);
153
- } catch {
154
- return [];
155
- }
102
+ return keyring.list();
156
103
  }
157
104
  // src/auth/auth-resolver/auth-resolver.ts
158
105
  /** Wraps `createResolveToken` from `@theholocron/http` and injects the
@@ -188,18 +135,28 @@ function createFeatureResolver(config) {
188
135
  keyringKey: config.keyringKey
189
136
  } });
190
137
  }
191
- // src/ui/style/style.ts
192
- const style = {
193
- success: (msg) => `${chalk.green("✓")} ${msg}`,
194
- warn: (msg) => `${chalk.yellow("⚠")} ${msg}`,
195
- fail: (msg) => `${chalk.red("✗")} ${msg}`,
196
- step: (msg) => `${chalk.cyan("→")} ${msg}`,
197
- /** A dim `·` marker for a row that's neither a pass nor a failure — loaded but inactive, or skipped. */
198
- skip: (msg) => chalk.dim(`· ${msg}`),
199
- hint: (msg) => chalk.dim(msg),
200
- dim: (msg) => chalk.dim(msg),
201
- header: (msg) => chalk.bold(msg)
202
- };
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);
203
160
  // src/plugin/connection-probe/connection-probe.ts
204
161
  const TLS_CODES = /* @__PURE__ */ new Set([
205
162
  "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
@@ -499,7 +456,7 @@ async function syncRoles(input) {
499
456
  skipped: 0
500
457
  };
501
458
  for (const role of input.roles) {
502
- print(`\n${style.header(`${role.name} ← team ${role.team}`)}`);
459
+ print(`\n${ui_exports.style.header(`${role.name} ← team ${role.team}`)}`);
503
460
  const step = `role ${role.name}`;
504
461
  let plan;
505
462
  try {
@@ -513,7 +470,7 @@ async function syncRoles(input) {
513
470
  });
514
471
  } catch (err) {
515
472
  const message = describeProviderError(err);
516
- print(` ${style.fail(`${step}: ${message}`)}`);
473
+ print(` ${ui_exports.style.fail(`${step}: ${message}`)}`);
517
474
  result.failures.push({
518
475
  step,
519
476
  message
@@ -529,11 +486,11 @@ async function syncRoles(input) {
529
486
  };
530
487
  result.roles.push(outcome);
531
488
  result.skipped += plan.inSync;
532
- 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`)}`);
533
490
  const act = async (verb, who) => {
534
491
  const label = `${verb === "add" ? "gave" : "took"} ${role.name} ${verb === "add" ? "to" : "from"} ${who.login} (${who.member})`;
535
492
  if (dryRun || verb === "remove" && keep) {
536
- 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)" : ""}`)}`);
537
494
  result.skipped++;
538
495
  return;
539
496
  }
@@ -541,11 +498,11 @@ async function syncRoles(input) {
541
498
  if (verb === "add") await notifications.addRoleMember(role.name, who.member);
542
499
  else await notifications.removeRoleMember(role.name, who.member);
543
500
  (verb === "add" ? outcome.added : outcome.removed).push(who.member);
544
- print(` ${style.success(label)}`);
501
+ print(` ${ui_exports.style.success(label)}`);
545
502
  result.ok++;
546
503
  } catch (err) {
547
504
  const message = describeProviderError(err);
548
- print(` ${style.fail(`${step}: ${verb} ${who.login}: ${message}`)}`);
505
+ print(` ${ui_exports.style.fail(`${step}: ${verb} ${who.login}: ${message}`)}`);
549
506
  result.failures.push({
550
507
  step: `${step} ${verb} ${who.login}`,
551
508
  message
@@ -555,11 +512,11 @@ async function syncRoles(input) {
555
512
  for (const who of plan.add) await act("add", who);
556
513
  for (const who of plan.remove) await act("remove", who);
557
514
  for (const person of plan.unlinked) {
558
- 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`)}`);
559
516
  result.skipped++;
560
517
  }
561
518
  for (const holder of plan.unknownHolders) {
562
- 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`)}`);
563
520
  result.skipped++;
564
521
  }
565
522
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/cli",
3
- "version": "5.0.0-alpha.336",
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,14 +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.336",
58
- "@theholocron/datapad": "5.0.0-alpha.336",
57
+ "@theholocron/astromech": "5.0.0-alpha.338",
59
58
  "@theholocron/env-utils": "^1.17.0-alpha.1",
60
59
  "@theholocron/fs-utils": "^1.17.0-alpha.1",
61
60
  "@theholocron/git-utils": "^1.17.0-alpha.1",
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",
63
64
  "@theholocron/github-client": "^1.58.0-alpha.7",
64
65
  "@theholocron/json-utils": "^1.17.0-alpha.1",
66
+ "@theholocron/kyber": "5.0.0-alpha.338",
65
67
  "@theholocron/misc-utils": "^1.17.0-alpha.1",
66
68
  "@theholocron/observability": "^0.7.0-alpha.1",
67
69
  "@theholocron/pkg-utils": "^1.17.0-alpha.1"
@@ -77,7 +79,6 @@
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
83
  "@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.8",
83
84
  "@theholocron/tsconfig": "^8.9.0-alpha.8",