@theholocron/cli 2.0.0-alpha.5 → 2.0.0-alpha.51

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
@@ -1,26 +1,56 @@
1
- import { $ as StorageBranch, A as EnvironmentReviewer, B as ParseWebhookInput, C as DeploymentTarget, D as DnsRecordType, E as DnsRecord, F as LifecycleResult, G as RepoSettings, H as ProviderIdentity, I as LifecycleSlot, J as SecretScope, K as ResolvedCapability, L as NormalizedAuthUser, M as Issue, N as IssueSearchFilter, O as EnsureResult, P as Issues, Q as Storage, R as Notifications, S as DeploymentRecord, T as Dns, U as REQUIRED_CAPABILITIES, V as ProviderApiError, W as RepoRef, X as Source, Y as Secrets, Z as StatusCategory, _ as ConnectionStringOptions, a as AuthEventType, at as WebhookDashboardInfo, b as DeploymentProject, c as CARDINALITY, d as Cardinality, et as Tooling, f as CardinalityFor, g as CiRunStatus, h as CiRunFilter, i as AuthEvent, it as Vault, j as Environments, k as Environment, l as CapabilityImpls, m as CiRun, n as Auth, nt as TrackerDoctorReport, o as AuthIdentity, ot as WebhookVerificationError, p as Ci, q as Ruleset, r as AuthDescription, rt as TrackerUser, s as AuthUser, st as isMulti, t as Analytics, tt as ToolingDoctorReport, u as CapabilityKey, v as CreateAuthUserInput, w as DeploymentTrigger, x as DeploymentProjectSettings, y as Deployment, z as Observability } from "./index-jxPVFH7-.mjs";
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, ParseWebhookInput, ProviderApiError, ProviderIdentity, REQUIRED_CAPABILITIES, RepoRef, RepoSettings, ResolvedCapability, Ruleset, SecretScope, Secrets, Source, StatusCategory, Storage, StorageBranch, Tooling, ToolingDoctorReport, TrackerDoctorReport, TrackerUser, Vault, WebhookDashboardInfo, WebhookVerificationError, isMulti } from "./capabilities/index.mjs";
2
+ import { AuthError, RequestOptions, ResolveTokenConfig as ResolveTokenConfig$1, ResolveTokenInput, RestClient, RestClientConfig, createRestClient } from "@theholocron/http-client";
2
3
 
4
+ //#region src/auth-resolver.d.ts
5
+ type ResolveTokenConfig = Omit<ResolveTokenConfig$1, "getKeyringToken">;
6
+ /** Wraps `createResolveToken` from `@theholocron/http` and injects the
7
+ * system keyring so plugins stay at a one-liner call site. */
8
+ declare function createResolveToken(config: ResolveTokenConfig): (input?: import("@theholocron/http-client").ResolveTokenInput) => string;
9
+ //#endregion
3
10
  //#region src/config.d.ts
4
11
  type ProviderOptions = Record<string, unknown>;
12
+ /**
13
+ * The shape a capability config package's default export must satisfy.
14
+ * Config packages let teams share a pre-bundled provider + options across
15
+ * repos (Level 1 of the shareable-configs story, issue #75).
16
+ *
17
+ * @example
18
+ * // @acme/holocron-vault/index.ts
19
+ * import type { CapabilityConfigPackage } from '@theholocron/cli'
20
+ * export default {
21
+ * provider: '1password',
22
+ * options: { vault: 'acme-app' },
23
+ * } satisfies CapabilityConfigPackage
24
+ */
25
+ interface CapabilityConfigPackage {
26
+ provider: string;
27
+ options?: ProviderOptions;
28
+ }
5
29
  type SingleEntry = string | [provider: string, options: ProviderOptions];
6
30
  type MultiEntry = Array<string | [provider: string, options: ProviderOptions]>;
7
31
  type RawProviderEntry = SingleEntry | MultiEntry;
8
32
  type RawProvidersConfig = Partial<Record<CapabilityKey, RawProviderEntry>>;
9
- interface RepoPolicyConfig {
33
+ type RepoProtection = "balanced" | "strict" | "none";
34
+ interface RepoProperties {
35
+ lifecycle?: "active" | "experimental" | "deprecated";
36
+ open_source?: boolean;
37
+ runtime_environment?: "node" | "browser" | "universal" | "none";
38
+ uses_external_packages?: boolean;
39
+ }
40
+ interface RepoConfig {
41
+ /** "owner/name" — the GitHub repository coordinate. */
42
+ name: string;
10
43
  /**
11
- * "balanced" squash-only merges, delete-branch-on-merge, issues/discussions/projects
12
- * enabled, auto-merge enabled, web sign-off required, always suggest updating, no wiki;
13
- * plus a ruleset that blocks force-push + deletion and requires a pull request (0 reviews).
14
- *
15
- * "strict" — everything in "balanced" plus required status checks from `requiredChecks`.
16
- *
17
- * "none" — skips repo settings + ruleset entirely.
18
- *
19
- * @default "balanced"
44
+ * Branch protection preset applied by `holocron setup`. When omitted,
45
+ * no protection is applied and no `branch_protection_level` property is set.
20
46
  */
21
- preset?: "balanced" | "strict" | "none";
22
- /** CI check context names required on the default branch (used by "strict"). */
47
+ protection?: RepoProtection;
48
+ /** CI check context names required on the default branch (only used when `protection` is "strict"). */
23
49
  requiredChecks?: string[];
50
+ /** GitHub topics set on the repository. */
51
+ topics?: string[];
52
+ /** GitHub custom properties synced to the org dashboard. */
53
+ properties?: RepoProperties;
24
54
  }
25
55
  interface AppConfig {
26
56
  name: string;
@@ -35,21 +65,16 @@ interface HolocronConfig {
35
65
  name: string;
36
66
  description?: string;
37
67
  /**
38
- * Repo coord `"owner/name"`. When set, `PluginLoader` injects
39
- * it into every plugin's `RuntimeContext.repo` so plugins that
40
- * need a repo (github, etc.) don't require `--repo` on every
41
- * invocation. `--repo` on the command line still overrides.
42
- */
43
- repo?: string;
44
- /**
45
- * Repo-level policy applied by `holocron setup`. Defines merge
46
- * strategy, branch protection rulesets, and security defaults.
47
- * Requires `source` capability to be configured.
68
+ * Repository identity and metadata. When set, `PluginLoader` injects
69
+ * `repo.name` into every plugin's `RuntimeContext.repo` so plugins that
70
+ * need a repo (github, etc.) don't require `--repo` on every invocation.
71
+ * `--repo` on the command line still overrides.
48
72
  */
49
- repoPolicy?: RepoPolicyConfig;
73
+ repo?: RepoConfig;
50
74
  /**
51
75
  * CI workflow names to install as thin wrappers during `holocron setup`.
52
76
  * Each name maps to a reusable workflow in `theholocron/.github`.
77
+ * Use the object form to pass `with:` inputs to the reusable workflow.
53
78
  *
54
79
  * Supported values: "lint" | "test" | "typecheck" | "codeql" | "review" |
55
80
  * "release" | "stale" | "greetings" | "dependencies" | "bookkeeping-pr" | "audit"
@@ -57,8 +82,14 @@ interface HolocronConfig {
57
82
  * `holocron setup` writes `.github/workflows/<name>.yml` for each entry,
58
83
  * calling the corresponding `ci-<name>.yml@main` reusable workflow.
59
84
  * Files are overwritten on each run — they are generated artifacts.
85
+ *
86
+ * @example
87
+ * ["lint", { "name": "release", "with": { "run-build": false } }]
60
88
  */
61
- workflows?: string[];
89
+ workflows?: Array<string | {
90
+ name: string;
91
+ with?: Record<string, unknown>;
92
+ }>;
62
93
  };
63
94
  providers: RawProvidersConfig;
64
95
  apps?: AppConfig[];
@@ -96,6 +127,9 @@ declare function resolvePluginPackage(provider: string): string;
96
127
  declare function resolveEntry(key: CapabilityKey, raw: RawProviderEntry): ResolvedProviderEntry;
97
128
  declare function resolveConfig(raw: HolocronConfig): ResolvedHolocronConfig;
98
129
  //#endregion
130
+ //#region src/define-config.d.ts
131
+ declare function defineConfig(config: HolocronConfig): HolocronConfig;
132
+ //#endregion
99
133
  //#region src/keyring.d.ts
100
134
  /**
101
135
  * Keyring-backed bootstrap credential store.
@@ -140,4 +174,20 @@ declare function deleteToken(provider: string): boolean;
140
174
  */
141
175
  declare function listStoredProviders(): string[];
142
176
  //#endregion
143
- export { Analytics, AppConfig, Auth, AuthDescription, AuthEvent, AuthEventType, AuthIdentity, AuthUser, CARDINALITY, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, Ci, CiRun, CiRunFilter, CiRunStatus, ConfigError, ConnectionStringOptions, CreateAuthUserInput, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, Dns, DnsRecord, DnsRecordType, DoctorConfig, EnsureResult, Environment, EnvironmentReviewer, Environments, HolocronConfig, Issue, IssueSearchFilter, Issues, LifecycleResult, LifecycleSlot, MultiEntry, NormalizedAuthUser, Notifications, Observability, ParseWebhookInput, ProviderApiError, ProviderIdentity, ProviderOptions, REQUIRED_CAPABILITIES, RawProviderEntry, RawProvidersConfig, RepoPolicyConfig, RepoRef, RepoSettings, ResolvedCapability, ResolvedHolocronConfig, ResolvedProviderEntry, ResolvedProvidersConfig, ResolvedTuple, Ruleset, SecretScope, Secrets, SingleEntry, Source, StatusCategory, Storage, StorageBranch, Tooling, ToolingDoctorReport, TrackerDoctorReport, TrackerUser, Vault, WebhookDashboardInfo, WebhookVerificationError, deleteToken, getToken, isMulti, listStoredProviders, resolveConfig, resolveEntry, resolvePluginPackage, setToken };
177
+ //#region src/load-config.d.ts
178
+ declare class ConfigFileError extends Error {
179
+ name: string;
180
+ }
181
+ interface LoadedConfig {
182
+ resolved: ResolvedHolocronConfig;
183
+ /** Absolute path to the file the config was read from. */
184
+ filepath: string;
185
+ }
186
+ /**
187
+ * Read + parse + resolve `holocron.config.*` from the given directory.
188
+ * Search order: json → js → ts. Throws `ConfigFileError` if nothing
189
+ * found, or `ConfigError` if the config is malformed / invalid.
190
+ */
191
+ declare function loadConfig(cwd: string): Promise<LoadedConfig>;
192
+ //#endregion
193
+ export { Analytics, AppConfig, Auth, AuthDescription, AuthError, AuthEvent, AuthEventType, AuthIdentity, AuthUser, CARDINALITY, CapabilityConfigPackage, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, Ci, CiRun, CiRunFilter, CiRunStatus, ConfigError, ConfigFileError, ConnectionStringOptions, CreateAuthUserInput, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, Dns, DnsRecord, DnsRecordType, DoctorConfig, EnsureResult, Environment, EnvironmentReviewer, Environments, HolocronConfig, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, LoadedConfig, MultiEntry, NormalizedAuthUser, Notifications, Observability, ParseWebhookInput, ProviderApiError, ProviderIdentity, ProviderOptions, 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, Tooling, ToolingDoctorReport, TrackerDoctorReport, TrackerUser, Vault, WebhookDashboardInfo, WebhookVerificationError, createResolveToken, createRestClient, defineConfig, deleteToken, getToken, isMulti, listStoredProviders, loadConfig, resolveConfig, resolveEntry, resolvePluginPackage, setToken };
package/dist/index.mjs CHANGED
@@ -1,3 +1,279 @@
1
- import { a as isMulti, i as WebhookVerificationError, n as ProviderApiError, r as REQUIRED_CAPABILITIES, t as CARDINALITY } from "./capabilities-DapaKOlX.mjs";
2
- import { a as ConfigError, c as resolvePluginPackage, i as setToken, n as getToken, o as resolveConfig, r as listStoredProviders, s as resolveEntry, t as deleteToken } from "./keyring-DwNEmrBc.mjs";
3
- export { CARDINALITY, ConfigError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, deleteToken, getToken, isMulti, listStoredProviders, resolveConfig, resolveEntry, resolvePluginPackage, setToken };
1
+ import { CARDINALITY, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, isMulti } from "./capabilities/index.mjs";
2
+ import { AuthError, createResolveToken as createResolveToken$1, createRestClient } from "@theholocron/http-client";
3
+ import { Entry, findCredentials } from "@napi-rs/keyring";
4
+ import { readFile, stat } from "node:fs/promises";
5
+ import { join } from "node:path";
6
+ import { pathToFileURL } from "node:url";
7
+ //#region src/keyring.ts
8
+ /**
9
+ * Keyring-backed bootstrap credential store.
10
+ *
11
+ * Every holocron plugin's bootstrap token (the one it needs before it
12
+ * can talk to its vendor's API) can be stored in the OS keyring under
13
+ * a single reverse-DNS service scope. Managed via `holocron auth`
14
+ * subcommands; consulted at position 4 in every plugin's auth
15
+ * precedence chain (after --token / HOLOCRON_<X>_TOKEN / <native>_TOKEN).
16
+ *
17
+ * See `.notes/tech-auth-bootstrap.spec.md` for the design rationale.
18
+ *
19
+ * Failure model: keyring access is best-effort. Platforms without a
20
+ * supported credential store (some Linux CI images, sandboxed
21
+ * environments) will throw from the underlying library. Every export
22
+ * here catches and returns a null/empty result rather than propagating
23
+ * — the plugin's precedence chain then falls through to
24
+ * env-var-only paths, which is exactly how CI is meant to work.
25
+ */
26
+ const SERVICE = "com.theholocron.cli";
27
+ /**
28
+ * Store or overwrite a bootstrap token for a provider. Returns true on
29
+ * success, false when the underlying keyring is unsupported or errored.
30
+ */
31
+ function setToken(provider, token) {
32
+ try {
33
+ new Entry(SERVICE, provider).setPassword(token);
34
+ return true;
35
+ } catch {
36
+ return false;
37
+ }
38
+ }
39
+ /**
40
+ * Read the bootstrap token for a provider. Returns `null` for both
41
+ * "not stored" and "keyring unavailable" — callers can treat them the
42
+ * same way (fall through to env-var precedence).
43
+ */
44
+ function getToken(provider) {
45
+ try {
46
+ return new Entry(SERVICE, provider).getPassword();
47
+ } catch {
48
+ return null;
49
+ }
50
+ }
51
+ /**
52
+ * Delete a stored token. Returns true when a token was removed, false
53
+ * when there was nothing to delete or the keyring is unavailable.
54
+ * Distinguishing the two cases isn't worth the surface area — the
55
+ * command output makes the situation clear either way.
56
+ */
57
+ function deleteToken(provider) {
58
+ try {
59
+ return new Entry(SERVICE, provider).deletePassword();
60
+ } catch {
61
+ return false;
62
+ }
63
+ }
64
+ /**
65
+ * List provider slugs with a stored token in this service scope.
66
+ * Uses the library's `findCredentials(service)` — supported on all
67
+ * platforms the underlying credential store supports.
68
+ */
69
+ function listStoredProviders() {
70
+ try {
71
+ return findCredentials(SERVICE).map((c) => c.account);
72
+ } catch {
73
+ return [];
74
+ }
75
+ }
76
+ //#endregion
77
+ //#region src/auth-resolver.ts
78
+ /** Wraps `createResolveToken` from `@theholocron/http` and injects the
79
+ * system keyring so plugins stay at a one-liner call site. */
80
+ function createResolveToken(config) {
81
+ return createResolveToken$1({
82
+ ...config,
83
+ getKeyringToken: getToken
84
+ });
85
+ }
86
+ //#endregion
87
+ //#region src/config.ts
88
+ /**
89
+ * `holocron.config.json` schema, parser, and provider resolution.
90
+ *
91
+ * ESLint-style entry forms:
92
+ *
93
+ * "source": "github" ← single, short
94
+ * "deployment": ["vercel", { team: "rando" }] ← single, with options
95
+ * "notifications": ["slack", "discord"] ← multi, short
96
+ * "notifications": [
97
+ * ["slack", { channel: "#ops" }],
98
+ * ["discord", { webhook: "env:HOOK" }]
99
+ * ] ← multi, with options
100
+ *
101
+ * Discriminator: an array entry is a `[provider, options]` tuple when
102
+ * the length is 2 AND element[1] is a non-array, non-null object.
103
+ * Otherwise it's a multi-provider list (string[] or tuple[]).
104
+ *
105
+ * Validation rules:
106
+ * - `vault` is REQUIRED (every project has secrets somewhere)
107
+ * - Entries for `'many'` capabilities are normalized to an array of
108
+ * normalized tuples; entries for `'single'` capabilities are
109
+ * normalized to one tuple
110
+ * - Tokens / secret values never appear in config — providers read
111
+ * them from env (or pull from `vault` at runtime)
112
+ */
113
+ var ConfigError = class extends Error {
114
+ name = "ConfigError";
115
+ };
116
+ const PLUGIN_PREFIX = "@theholocron/holocron-plugin-";
117
+ const COMMUNITY_PREFIX = "holocron-plugin-";
118
+ /**
119
+ * Resolve `"github"` → `"@theholocron/holocron-plugin-github"`.
120
+ * Fully-qualified names (scoped or not) are honored verbatim, which
121
+ * is how third-party plugins published outside the org work.
122
+ */
123
+ function resolvePluginPackage(provider) {
124
+ if (!provider) throw new ConfigError("provider name is empty");
125
+ if (provider.startsWith("@")) return provider;
126
+ if (provider.startsWith(COMMUNITY_PREFIX)) return provider;
127
+ if (provider.includes("/")) return provider;
128
+ return PLUGIN_PREFIX + provider;
129
+ }
130
+ /** A bare `[provider, options]` tuple, with both elements present? */
131
+ function isOptionsTuple(value) {
132
+ if (!Array.isArray(value)) return false;
133
+ if (value.length !== 2) return false;
134
+ if (typeof value[0] !== "string") return false;
135
+ const opt = value[1];
136
+ return typeof opt === "object" && opt !== null && !Array.isArray(opt);
137
+ }
138
+ function normalizeEntry(entry) {
139
+ if (typeof entry === "string") return {
140
+ provider: entry,
141
+ packageName: resolvePluginPackage(entry),
142
+ options: {}
143
+ };
144
+ const [provider, options] = entry;
145
+ return {
146
+ provider,
147
+ packageName: resolvePluginPackage(provider),
148
+ options
149
+ };
150
+ }
151
+ function resolveEntry(key, raw) {
152
+ const cardinality = CARDINALITY[key];
153
+ if (typeof raw === "string") {
154
+ if (cardinality === "many") throw new ConfigError(`\`${key}\` accepts multiple providers; wrap a single one in an array: ["${raw}"]`);
155
+ return {
156
+ cardinality: "single",
157
+ tuple: normalizeEntry(raw)
158
+ };
159
+ }
160
+ if (!Array.isArray(raw)) throw new ConfigError(`\`${key}\` entry must be a string or array, got ${typeof raw}`);
161
+ if (isOptionsTuple(raw)) {
162
+ if (cardinality === "many") return {
163
+ cardinality: "many",
164
+ tuples: [normalizeEntry(raw)]
165
+ };
166
+ return {
167
+ cardinality: "single",
168
+ tuple: normalizeEntry(raw)
169
+ };
170
+ }
171
+ if (cardinality === "single") throw new ConfigError(`\`${key}\` accepts exactly one provider; got a multi-provider list with ${raw.length} entries`);
172
+ return {
173
+ cardinality: "many",
174
+ tuples: raw.map((entry, idx) => {
175
+ if (typeof entry === "string") return normalizeEntry(entry);
176
+ if (isOptionsTuple(entry)) return normalizeEntry(entry);
177
+ throw new ConfigError(`\`${key}[${idx}]\` must be a provider string or [provider, options] tuple`);
178
+ })
179
+ };
180
+ }
181
+ function resolveConfig(raw) {
182
+ if (!raw.project?.name) throw new ConfigError("`project.name` is required");
183
+ if (!raw.providers || typeof raw.providers !== "object") throw new ConfigError("`providers` block is required");
184
+ const providers = {};
185
+ for (const [key, entry] of Object.entries(raw.providers)) {
186
+ if (entry === void 0) continue;
187
+ providers[key] = resolveEntry(key, entry);
188
+ }
189
+ for (const required of REQUIRED_CAPABILITIES) if (!providers[required]) throw new ConfigError(`required capability \`${required}\` is missing from providers`);
190
+ return {
191
+ project: raw.project,
192
+ providers,
193
+ apps: raw.apps ?? [],
194
+ doctor: raw.doctor ?? {}
195
+ };
196
+ }
197
+ //#endregion
198
+ //#region src/define-config.ts
199
+ function defineConfig(config) {
200
+ return config;
201
+ }
202
+ //#endregion
203
+ //#region src/load-config.ts
204
+ /**
205
+ * `holocron.config.{json,js,ts}` file loader.
206
+ *
207
+ * Search order: json → js → ts. JSON is parsed directly; JS is loaded
208
+ * via native dynamic import; TS is loaded via `tsImport` from tsx (a
209
+ * runtime dep) so operators can write typed configs with `defineConfig`
210
+ * without needing a separate build step.
211
+ *
212
+ * All three forms are validated through the same `resolveConfig` path.
213
+ * Implements the lookup-order contract from issue #75 / #81.
214
+ */
215
+ const CANDIDATE_FILENAMES = [
216
+ "holocron.config.json",
217
+ "holocron.config.js",
218
+ "holocron.config.ts"
219
+ ];
220
+ var ConfigFileError = class extends Error {
221
+ name = "ConfigFileError";
222
+ };
223
+ /**
224
+ * Read + parse + resolve `holocron.config.*` from the given directory.
225
+ * Search order: json → js → ts. Throws `ConfigFileError` if nothing
226
+ * found, or `ConfigError` if the config is malformed / invalid.
227
+ */
228
+ async function loadConfig(cwd) {
229
+ for (const filename of CANDIDATE_FILENAMES) {
230
+ const fullPath = join(cwd, filename);
231
+ if (await fileExists(fullPath)) {
232
+ if (filename.endsWith(".json")) return {
233
+ resolved: await loadJson(fullPath),
234
+ filepath: fullPath
235
+ };
236
+ if (filename.endsWith(".ts")) return {
237
+ resolved: await loadTs(fullPath),
238
+ filepath: fullPath
239
+ };
240
+ return {
241
+ resolved: await loadJs(fullPath),
242
+ filepath: fullPath
243
+ };
244
+ }
245
+ }
246
+ throw new ConfigFileError(`no holocron.config.{json,js,ts} found in ${cwd}. Create one — see the README for the schema.`);
247
+ }
248
+ async function loadJson(filepath) {
249
+ const raw = await readFile(filepath, "utf8");
250
+ let parsed;
251
+ try {
252
+ parsed = JSON.parse(raw);
253
+ } catch (err) {
254
+ throw new ConfigError(`${filepath} is not valid JSON: ${err instanceof Error ? err.message : String(err)}`);
255
+ }
256
+ return resolveConfig(parsed);
257
+ }
258
+ async function loadJs(filepath) {
259
+ return extractAndResolve(filepath, await import(pathToFileURL(filepath).href));
260
+ }
261
+ async function loadTs(filepath) {
262
+ const { tsImport } = await import("tsx/esm/api");
263
+ return extractAndResolve(filepath, await tsImport(pathToFileURL(filepath).href, import.meta.url));
264
+ }
265
+ function extractAndResolve(filepath, mod) {
266
+ const outer = mod.default;
267
+ const raw = outer?.__esModule === true ? outer.default : outer;
268
+ if (raw === void 0 || raw === null) throw new ConfigFileError(`${filepath} must have a default export (use \`export default defineConfig({…})\`)`);
269
+ return resolveConfig(raw);
270
+ }
271
+ async function fileExists(path) {
272
+ try {
273
+ return (await stat(path)).isFile();
274
+ } catch {
275
+ return false;
276
+ }
277
+ }
278
+ //#endregion
279
+ export { AuthError, CARDINALITY, ConfigError, ConfigFileError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, 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": "2.0.0-alpha.5",
3
+ "version": "2.0.0-alpha.51",
4
4
  "description": "The Holocron CLI — a pluggable, capability-based orchestrator for spinning up and operating software projects.",
5
5
  "homepage": "https://github.com/theholocron/holocron/tree/main/packages/cli#readme",
6
6
  "bugs": "https://github.com/theholocron/holocron/issues",
@@ -34,20 +34,25 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@napi-rs/keyring": "^1.3.0",
37
- "yargs": "^18.0.0",
38
- "@theholocron/cli-utils": "0.0.0"
37
+ "@theholocron/github-client": "^0.7.0",
38
+ "@theholocron/http-client": "^0.7.0",
39
+ "tsx": "^4.22.4",
40
+ "yargs": "^18.0.0"
39
41
  },
40
42
  "devDependencies": {
41
- "@theholocron/eslint-config": "^4.1.0",
42
- "@theholocron/tsconfig": "^4.1.0",
43
- "@tsconfig/node-lts": "^24.0.0",
43
+ "@theholocron/eslint-config": "^7.0.0",
44
+ "@theholocron/tsconfig": "^7.0.0",
45
+ "@theholocron/vitest-config": "^7.0.0",
46
+ "@types/node": "^26",
44
47
  "@types/yargs": "^17.0.35",
45
- "@vitest/coverage-v8": "^3.2.6",
46
- "eslint": "^9.36.0",
47
- "globals": "^16.5.0",
48
+ "@vitest/eslint-plugin": "^1.6.23",
49
+ "eslint": "^10.7.0",
50
+ "eslint-plugin-n": "^18.2.2",
51
+ "globals": "^17.7.0",
48
52
  "tsdown": "^0.22.3",
49
53
  "typescript": "^5.9.3",
50
- "vitest": "^3.2.6"
54
+ "vitest": "^4.1.10",
55
+ "@theholocron/cli-utils": "0.0.0"
51
56
  },
52
57
  "publishConfig": {
53
58
  "access": "public"
@@ -1,47 +0,0 @@
1
- //#region src/capabilities/index.ts
2
- const CARDINALITY = {
3
- source: "single",
4
- ci: "single",
5
- secrets: "single",
6
- environments: "single",
7
- issues: "single",
8
- deployment: "single",
9
- storage: "single",
10
- auth: "single",
11
- vault: "single",
12
- dns: "single",
13
- tooling: "many",
14
- notifications: "many",
15
- analytics: "many",
16
- observability: "many"
17
- };
18
- /**
19
- * No capabilities are strictly required — repos without secrets (e.g. org
20
- * community health repos) legitimately omit vault. Plugins validate their
21
- * own requirements at call time.
22
- */
23
- const REQUIRED_CAPABILITIES = [];
24
- /**
25
- * Surfaced from every capability call that hits a vendor API. Wraps
26
- * the underlying error with `status` (HTTP) and `details` so
27
- * orchestrators (`holocron setup`, `doctor`) can soft-skip rather
28
- * than abort.
29
- */
30
- var ProviderApiError = class extends Error {
31
- status;
32
- details;
33
- name = "ProviderApiError";
34
- constructor(message, status, details) {
35
- super(message);
36
- this.status = status;
37
- this.details = details;
38
- }
39
- };
40
- var WebhookVerificationError = class extends Error {
41
- name = "WebhookVerificationError";
42
- };
43
- function isMulti(key) {
44
- return CARDINALITY[key] === "many";
45
- }
46
- //#endregion
47
- export { isMulti as a, WebhookVerificationError as i, ProviderApiError as n, REQUIRED_CAPABILITIES as r, CARDINALITY as t };
package/dist/cli.d.mts DELETED
@@ -1 +0,0 @@
1
- export { };