@theholocron/cli 5.0.0-alpha.354 → 5.0.0-alpha.355

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.
@@ -323,6 +323,12 @@ const HOLOCRON_AREAS = [
323
323
  "repo",
324
324
  "org"
325
325
  ];
326
+ /**
327
+ * The areas a config in a subdirectory also reads from the repository root's `.holocron/` (SPEC-0069): only `org`,
328
+ * because its values are the organization's and every config needs them. `repo` and `notifications` describe the
329
+ * repository itself, so an app's config does not take them from the root.
330
+ */
331
+ const SHARED_AREAS = ["org"];
326
332
  // src/config/load-config/place-notifications/place-notifications.ts
327
333
  const isTuple$1 = (entry) => Array.isArray(entry) && entry.length === 2 && typeof entry[0] === "string" && typeof entry[1] === "object" && entry[1] !== null && !Array.isArray(entry[1]);
328
334
  const providerName = (entry) => isTuple$1(entry) ? entry[0] : entry;
@@ -388,15 +394,34 @@ function validate(area) {
388
394
  }
389
395
  return area.value;
390
396
  }
397
+ /**
398
+ * The org options of an area and, when the repository root has the same area, the root's under them: an option set in
399
+ * both takes the config's own value, option by option (the root's other options stay). Each file is checked on its own.
400
+ */
401
+ function merge(area) {
402
+ const merged = {};
403
+ for (const layer of area.root ? [area.root, area] : [area]) for (const [provider, options] of Object.entries(validate(layer))) {
404
+ const sourced = merged[provider] ??= {};
405
+ for (const [option, value] of Object.entries(options)) sourced[option] = {
406
+ value,
407
+ path: layer.path
408
+ };
409
+ }
410
+ return merged;
411
+ }
391
412
  /** Fill one entry when it names a provider the area holds; throws when the config already sets one of its options. */
392
- function fill(entry, org, capability, path) {
413
+ function fill(entry, org, capability) {
393
414
  const [provider, options] = isTuple(entry) ? entry : [entry, {}];
394
415
  const values = org[provider];
395
416
  if (values === void 0 || Object.keys(values).length === 0) return entry;
396
- for (const option of Object.keys(values)) if (options[option] !== void 0) throw new ConfigError(`${provider}.${option} is set in providers.${capability} and in ${path}. Set it in one place: remove the inline option or the key from ${path}`);
417
+ const filled = {};
418
+ for (const [option, { value, path }] of Object.entries(values)) {
419
+ if (options[option] !== void 0) throw new ConfigError(`${provider}.${option} is set in providers.${capability} and in ${path}. Set it in one place: remove the inline option or the key from ${path}`);
420
+ filled[option] = value;
421
+ }
397
422
  return [provider, {
398
423
  ...options,
399
- ...values
424
+ ...filled
400
425
  }];
401
426
  }
402
427
  /**
@@ -404,12 +429,14 @@ function fill(entry, org, capability, path) {
404
429
  * `[name, options]` tuple, or either inside a list) that names a provider the file holds gets each option it leaves
405
430
  * out. An option set inline and in the file is a `ConfigError` naming both (no merge, no precedence); a provider the
406
431
  * config does not use is ignored; a provider or option the file lists but `OrgConfig` does not know is an error.
432
+ * When the area also came from the repository root (`area.root`, a config in a subdirectory), the two files combine
433
+ * option by option and the config's own file wins; that is not an error.
407
434
  */
408
435
  function placeOrg(raw, area) {
409
- const org = validate(area);
436
+ const org = merge(area);
410
437
  if (raw.providers === void 0) return raw;
411
438
  const providers = { ...raw.providers };
412
- for (const [capability, entry] of Object.entries(raw.providers)) providers[capability] = Array.isArray(entry) && !isTuple(entry) ? entry.map((item) => fill(item, org, capability, area.path)) : fill(entry, org, capability, area.path);
439
+ for (const [capability, entry] of Object.entries(raw.providers)) providers[capability] = Array.isArray(entry) && !isTuple(entry) ? entry.map((item) => fill(item, org, capability)) : fill(entry, org, capability);
413
440
  return {
414
441
  ...raw,
415
442
  providers
@@ -465,6 +492,7 @@ function placeAreas(areas, raw) {
465
492
  const system = createConfigSystem({
466
493
  name: "holocron",
467
494
  areas: HOLOCRON_AREAS,
495
+ shared: SHARED_AREAS,
468
496
  place: placeAreas,
469
497
  derive: deriveDefaults,
470
498
  resolve: resolveConfig,
@@ -504,4 +532,4 @@ const loadConfig = system.loadConfig;
504
532
  * const preset = compose(node(), nextjs());
505
533
  */
506
534
  const compose = system.compose;
507
- export { placeAreas as a, credentialsEnvironment as c, resolvePluginPackage$1 as d, loadConfig as i, resolveConfig as l, compose as n, HOLOCRON_AREAS as o, defineConfig as r, ConfigError$1 as s, ConfigFileError as t, resolveEntry as u };
535
+ export { placeAreas as a, ConfigError$1 as c, resolveEntry as d, resolvePluginPackage$1 as f, loadConfig as i, credentialsEnvironment as l, compose as n, HOLOCRON_AREAS as o, defineConfig as r, SHARED_AREAS as s, ConfigFileError as t, resolveConfig as u };
package/dist/index.d.mts CHANGED
@@ -313,6 +313,12 @@ export declare function readWorkspacePackageJsons(repoRoot: string, workspacePac
313
313
  * A file not on this list is never read.
314
314
  */
315
315
  export declare const HOLOCRON_AREAS: readonly ["notifications", "repo", "org"];
316
+ /**
317
+ * The areas a config in a subdirectory also reads from the repository root's `.holocron/` (SPEC-0069): only `org`,
318
+ * because its values are the organization's and every config needs them. `repo` and `notifications` describe the
319
+ * repository itself, so an app's config does not take them from the root.
320
+ */
321
+ export declare const SHARED_AREAS: readonly ["org"];
316
322
  /**
317
323
  * Put the area files of `.holocron/` into the config as loaded, before `deriveDefaults` runs: `notifications` becomes
318
324
  * the `layout` of the notifications provider and `repo` supplies keys of `repo` and `org` fills the provider options a config leaves out. A value set both inline and in a file
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CARDINALITY, ElevationRequiredError, MissingTokenError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, isMulti } from "./plugin/capabilities.mjs";
2
- import { a as placeAreas, c as credentialsEnvironment, d as resolvePluginPackage, i as loadConfig, l as resolveConfig, n as compose, o as HOLOCRON_AREAS, r as defineConfig, s as ConfigError, t as ConfigFileError, u as resolveEntry } from "./config-system-DKtlo5Pb.mjs";
2
+ import { a as placeAreas, c as ConfigError, d as resolveEntry, f as resolvePluginPackage, i as loadConfig, l as credentialsEnvironment, n as compose, o as HOLOCRON_AREAS, r as defineConfig, s as SHARED_AREAS, t as ConfigFileError, u as resolveConfig } from "./config-system-u8-jh7xW.mjs";
3
3
  import { Entry, findCredentials } from "@napi-rs/keyring";
4
4
  import { AuthError, createFeatureResolver as createFeatureResolver$1, createKeyring, createResolveToken as createResolveToken$1, resolveValue } from "@theholocron/kyber/secrets";
5
5
  import { describeError, style } from "@theholocron/kyber/ui";
@@ -392,4 +392,4 @@ async function readWorkspacePackageJsons(repoRoot, workspacePackages) {
392
392
  function connectionProbe(input) {
393
393
  return connectionProbe$1(input);
394
394
  }
395
- export { AuthError, CARDINALITY, ConfigError, ConfigFileError, ElevationRequiredError, HOLOCRON_AREAS, MissingTokenError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, compose, connectionProbe, createFeatureResolver, createResolveToken, createRestClient, credentialsEnvironment, defineConfig, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, isMulti, keyring, loadConfig, missingCapabilities, placeAreas, readLinks, readWorkspacePackageJsons, resolveConfig, resolveEntry, resolvePluginPackage, resolveValue, roleTeamProblem, sourceProblem, syncRoles };
395
+ export { AuthError, CARDINALITY, ConfigError, ConfigFileError, ElevationRequiredError, HOLOCRON_AREAS, MissingTokenError, ProviderApiError, REQUIRED_CAPABILITIES, SHARED_AREAS, WebhookVerificationError, compose, connectionProbe, createFeatureResolver, createResolveToken, createRestClient, credentialsEnvironment, defineConfig, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, isMulti, keyring, loadConfig, missingCapabilities, placeAreas, readLinks, readWorkspacePackageJsons, resolveConfig, resolveEntry, resolvePluginPackage, resolveValue, roleTeamProblem, sourceProblem, syncRoles };
package/dist/presets.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as compose } from "./config-system-DKtlo5Pb.mjs";
1
+ import { n as compose } from "./config-system-u8-jh7xW.mjs";
2
2
  // src/presets/capabilities/audit.ts
3
3
  /**
4
4
  * Adds bundle-size measuring (`measure-bundle`) + optional Knip (`lint:unused`) and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/cli",
3
- "version": "5.0.0-alpha.354",
3
+ "version": "5.0.0-alpha.355",
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.354",
58
- "@theholocron/dagobah": "5.0.0-alpha.354",
59
- "@theholocron/datapad": "5.0.0-alpha.354",
60
- "@theholocron/fs-utils": "^1.17.0-alpha.1",
57
+ "@theholocron/astromech": "5.0.0-alpha.355",
58
+ "@theholocron/datapad": "5.0.0-alpha.355",
61
59
  "@theholocron/env-utils": "^1.17.0-alpha.1",
62
- "@theholocron/github-client": "^1.58.0-alpha.11",
63
- "@theholocron/json-utils": "^1.17.0-alpha.1",
64
- "@theholocron/http-client": "^1.58.0-alpha.11",
60
+ "@theholocron/dagobah": "5.0.0-alpha.355",
61
+ "@theholocron/fs-utils": "^1.17.0-alpha.1",
62
+ "@theholocron/github-client": "^1.58.0-alpha.12",
63
+ "@theholocron/http-client": "^1.58.0-alpha.12",
65
64
  "@theholocron/git-utils": "^1.17.0-alpha.1",
65
+ "@theholocron/json-utils": "^1.17.0-alpha.1",
66
+ "@theholocron/kyber": "5.0.0-alpha.355",
66
67
  "@theholocron/misc-utils": "^1.17.0-alpha.1",
67
- "@theholocron/kyber": "5.0.0-alpha.354",
68
- "@theholocron/pkg-utils": "^1.17.0-alpha.1",
69
- "@theholocron/observability": "^0.7.0-alpha.1"
68
+ "@theholocron/observability": "^0.7.0-alpha.1",
69
+ "@theholocron/pkg-utils": "^1.17.0-alpha.1"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/node": "^26",
@@ -81,8 +81,8 @@
81
81
  "vitest": "^5.0.5",
82
82
  "@theholocron/eslint-config": "^8.9.0-alpha.8",
83
83
  "@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.8",
84
- "@theholocron/tsconfig": "^8.9.0-alpha.8",
85
- "@theholocron/vitest-config": "^8.9.0-alpha.8"
84
+ "@theholocron/vitest-config": "^8.9.0-alpha.8",
85
+ "@theholocron/tsconfig": "^8.9.0-alpha.8"
86
86
  },
87
87
  "engines": {
88
88
  "node": ">=22.0.0"