@theholocron/cli 5.0.0-alpha.12 → 5.0.0-alpha.120

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,7 +1,9 @@
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, Errors, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, Logs, NormalizedAuthUser, Notifications, 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";
1
+ import { Analytics, Auth, AuthDescription, AuthEvent, AuthEventType, AuthIdentity, AuthUser, CARDINALITY, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, Ci, CiRun, CiRunFilter, CiRunStatus, ConnectionStringOptions, CreateAuthUserInput, DeployFunctionConfig, DeployFunctionResult, DeployScriptConfig, DeployScriptResult, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, Dns, DnsRecord, DnsRecordRequest, DnsRecordType, EnsureResult, Environment, EnvironmentReviewer, Environments, Errors, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, Logs, NormalizedAuthUser, Notifications, 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, 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
3
  import { ConfigFileError } from "@theholocron/datapad";
4
4
  import { LogLevel } from "@theholocron/observability/core";
5
+ import { WorkspacePackage } from "@theholocron/astromech";
6
+ import { QualifiedConfig } from "@commitlint/types";
5
7
  //#region src/auth/auth-resolver.d.ts
6
8
  type ResolveTokenConfig = Omit<ResolveTokenConfig$1, "getKeyringToken">;
7
9
  /** Wraps `createResolveToken` from `@theholocron/http` and injects the
@@ -66,6 +68,19 @@ declare function deleteToken(provider: string): boolean;
66
68
  */
67
69
  declare function listStoredProviders(): string[];
68
70
  //#endregion
71
+ //#region src/commands/auth.d.ts
72
+ interface VerifyTokenSuccess {
73
+ ok: true;
74
+ /** "workplace: acme" / "user: cnewton@x" — surfaced in success output. */
75
+ subject: string;
76
+ }
77
+ interface VerifyTokenFailure {
78
+ ok: false;
79
+ /** Reason the token was rejected. Surfaces to the operator. */
80
+ message: string;
81
+ }
82
+ type VerifyTokenResult = VerifyTokenSuccess | VerifyTokenFailure;
83
+ //#endregion
69
84
  //#region src/config/config.d.ts
70
85
  /** Structured-logging config. The Axiom **token** never lives here — only in
71
86
  * env vars or the OS keyring — but the non-secret dataset name may. */
@@ -161,6 +176,21 @@ interface RepoProperties {
161
176
  interface RepoConfig {
162
177
  /** "owner/name" — the GitHub repository coordinate. Derived from the git remote when absent. */
163
178
  name?: string;
179
+ /**
180
+ * GitHub's repo-level default branch (`HEAD`) — what a fresh clone checks
181
+ * out, what `gh pr create`/the compare UI target by default, and what
182
+ * Sentinel's `validateConfig()` reads (D6: the App only ever reads config
183
+ * from the repo's default branch, never a PR ref, as a security boundary
184
+ * — never widen that to read PR branches instead of fixing this field).
185
+ * Synced by `holocron setup`. Omit to leave GitHub's current setting
186
+ * untouched — most repos never need this. Exists for a repo using a
187
+ * `main`/`alpha` prerelease-channel split (CLAUDE.md's Releases section)
188
+ * where active development happens on a non-`main` branch: set this to
189
+ * that branch so Sentinel validates against what's actually being
190
+ * developed, then change it back once that branch merges to `main` for a
191
+ * stable cut and stops being the active branch.
192
+ */
193
+ defaultBranch?: string;
164
194
  /**
165
195
  * Branch protection preset applied by `holocron setup`. When omitted,
166
196
  * no protection is applied and no `branch_protection_level` property is set.
@@ -487,6 +517,29 @@ interface HolocronConfig {
487
517
  * { analytics: "none" }
488
518
  */
489
519
  telemetry?: TelemetryConfig;
520
+ /**
521
+ * ESLint bundle option overrides that Sentinel's centralized static-
522
+ * analysis check (holocron#849) can't otherwise see. Bucket 1 checks
523
+ * never read a PR's own committed files for config — this is the
524
+ * declared source of truth Sentinel reads instead, so its check stays
525
+ * in sync with what each package's own `eslint.config.ts` already
526
+ * enforces locally and in CI.
527
+ */
528
+ eslint?: EslintConfig;
529
+ }
530
+ /**
531
+ * Repo-root-relative directories treated as browser-targeted for eslint's
532
+ * node-builtins compatibility checks — mirrors
533
+ * `@theholocron/eslint-config`'s `library({ browserPackages })` option.
534
+ * Only needed for a package whose own `eslint.config.ts` already declares
535
+ * `browserPackages` (a deliberate outlier, not the norm — see that
536
+ * package's own config file for why).
537
+ *
538
+ * @example
539
+ * { browserPackages: ["packages/github-client/src/app-auth"] }
540
+ */
541
+ interface EslintConfig {
542
+ browserPackages?: string[];
490
543
  }
491
544
  interface ResolvedTuple {
492
545
  provider: string;
@@ -526,6 +579,7 @@ interface ResolvedHolocronConfig {
526
579
  env?: EnvConfig;
527
580
  log?: LogConfig;
528
581
  telemetry?: TelemetryConfig;
582
+ eslint?: EslintConfig;
529
583
  }
530
584
  declare class ConfigError extends Error {
531
585
  name: string;
@@ -539,6 +593,98 @@ declare function resolvePluginPackage(provider: string): string;
539
593
  declare function resolveEntry(key: CapabilityKey, raw: RawProviderEntry): ResolvedProviderEntry;
540
594
  declare function resolveConfig(raw: HolocronConfig): ResolvedHolocronConfig;
541
595
  //#endregion
596
+ //#region src/commands/setup/derived-properties.d.ts
597
+ /**
598
+ * Derived custom-properties (#677). Unlike the existing 6 GitHub
599
+ * custom-properties fields (`lifecycle`, `open_source`, `runtime_environment`,
600
+ * `uses_external_packages`, `monorepo`, `branch_protection_level`) — which
601
+ * mirror what `holocron.config.ts` already states explicitly — these four are
602
+ * *derived*: signal that isn't an explicit config field today (framework
603
+ * choice, repo archetype, capability drift). See
604
+ * `.notes/tech-holocron-platform.spec.md` → "Custom-properties sync — field
605
+ * definitions (#677)" for the full design.
606
+ */
607
+ type HolocronProfile = "library" | "cli" | "plugin" | "template" | "app" | "docs" | "platform";
608
+ interface PackageJsonLike {
609
+ name?: string;
610
+ private?: boolean;
611
+ bin?: unknown;
612
+ dependencies?: Record<string, string>;
613
+ devDependencies?: Record<string, string>;
614
+ }
615
+ interface DeriveProfileInput {
616
+ rootPackageJson: PackageJsonLike | null;
617
+ repoName: string;
618
+ isMonorepo: boolean;
619
+ /** `packages/*` package.json contents, monorepo repos only — used to find the primary published artifact. */
620
+ workspacePackageJsons: PackageJsonLike[];
621
+ }
622
+ /**
623
+ * Repo archetype, in priority order:
624
+ * 1. `*-template` repo name → `template` (independent of package shape).
625
+ * 2. Monorepo whose primary published artifact is a CLI (some workspace
626
+ * package has `bin`) → `platform` — matches `holocron` itself: the CLI is
627
+ * the deliverable, the plugin packages are supporting infrastructure for
628
+ * it, not separate products.
629
+ * 3. Monorepo with no CLI but at least one non-private workspace package →
630
+ * `library` — matches `clients`/`configs`/`utils`/`themes`/
631
+ * `observability`: a family of published packages, none of them a CLI.
632
+ * Checked *before* falling into the root-package branch below, because
633
+ * these repos' own root `package.json` is private and often carries
634
+ * `@theholocron/astro-config` for a docs site built from the monorepo
635
+ * root — without this check they'd wrongly resolve to `docs` off that
636
+ * root-level signal alone, when the docs site is a secondary concern of
637
+ * a library collection, not what the repo fundamentally is.
638
+ * 4. Single-package repo with `package.json#bin` → `cli`.
639
+ * 5. Docs-only site (astro/starlight present, root package private, no
640
+ * publishable exports) → `docs`.
641
+ * 6. Private, non-publishable, non-docs → `app`.
642
+ * 7. Otherwise, a single publishable package → `library`.
643
+ */
644
+ declare function deriveProfile(input: DeriveProfileInput): HolocronProfile;
645
+ /**
646
+ * Detected build/framework tooling — the literal "does this repo need
647
+ * next/vite/tsdown" signal `holocron.config.ts` has no field for today
648
+ * (framework choice isn't a config concept, unlike `providers`/`tasks`).
649
+ * Curated table, not exhaustive by design — add to `KNOWN_STACK_DEPS` as new
650
+ * frameworks show up rather than trying to detect anything on npm.
651
+ */
652
+ declare function deriveStack(pkg: PackageJsonLike | null): string[];
653
+ /** The provider capability keys actually wired in `providers: {}` — zero heuristics. */
654
+ declare function deriveCapabilities(providers: ResolvedProvidersConfig | undefined): string[];
655
+ declare function deriveCompliance(capabilities: readonly string[]): "compliant" | "non-compliant";
656
+ /**
657
+ * The Phase B refinement `deriveCompliance()`'s own doc comment names —
658
+ * *why* a repo is non-compliant, not just that it is. `[]` when compliant.
659
+ * Same `REQUIRED_BASELINE` `deriveCompliance()` checks against — one
660
+ * table, not two independently-maintained baselines.
661
+ */
662
+ declare function missingCapabilities(capabilities: readonly string[]): string[];
663
+ /**
664
+ * Reads each workspace package's actual `package.json` content (not just
665
+ * `readWorkspacePackages()`'s `{ slug, name, dir }` — `deriveProfile()`'s
666
+ * `platform` detection needs `bin`, which that helper doesn't carry).
667
+ * Missing/invalid files are skipped, matching `readWorkspacePackages()`'s
668
+ * own soft-fail behavior.
669
+ */
670
+ declare function readWorkspacePackageJsons(repoRoot: string, workspacePackages: readonly WorkspacePackage[]): Promise<PackageJsonLike[]>;
671
+ //#endregion
672
+ //#region src/commit-lint/lint-message.d.ts
673
+ interface CommitMessageViolation {
674
+ /** Rule name, e.g. `"subject-empty"`. */
675
+ rule: string;
676
+ /** commitlint's own message for the failure, e.g. `"subject may not be empty"`. */
677
+ message: string;
678
+ }
679
+ declare function lintCommitMessage(message: string, loaded: QualifiedConfig): Promise<CommitMessageViolation[]>;
680
+ //#endregion
681
+ //#region src/commit-lint/lint-commit-msg-file.d.ts
682
+ interface LintCommitMsgFileResult {
683
+ valid: boolean;
684
+ violations: CommitMessageViolation[];
685
+ }
686
+ declare function lintCommitMsgFile(filePath: string, cwd?: string): Promise<LintCommitMsgFileResult>;
687
+ //#endregion
542
688
  //#region src/config/compose.d.ts
543
689
  type TaskEntry = NonNullable<HolocronConfig["tasks"]>[number];
544
690
  /** A single composable capability fragment. */
@@ -611,10 +757,87 @@ interface LoadedConfig {
611
757
  filepath: string;
612
758
  }
613
759
  /**
614
- * Read + parse + resolve `holocron.config.*` from the given directory.
760
+ * Read + parse + resolve `holocron.config.*` starting from the given
761
+ * directory, walking up through ancestors to the nearest `.git` boundary
762
+ * when `cwd` itself has no match — every command is usable from any
763
+ * subdirectory of a repo, not only its exact root (see
764
+ * `@theholocron/datapad`'s own doc comment for the stop conditions).
615
765
  * Throws {@link ConfigFileError} when nothing is found or a file cannot
616
- * be loaded, or `ConfigError` when the config is invalid.
766
+ * be loaded, or `ConfigError` when the config fails schema checks.
617
767
  */
618
768
  declare function loadConfig(cwd: string): Promise<LoadedConfig>;
619
769
  //#endregion
620
- 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, Errors, FeatureResolverConfig, HolocronConfig, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, LoadedConfig, LogConfig, Logs, MultiEntry, NormalizedAuthUser, Notifications, 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, TaskEntryConfig, TeamEntry, TeamPermission, TelemetryConfig, 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 };
770
+ //#region src/editorconfig/config.d.ts
771
+ /**
772
+ * The paths editorconfig-checker skips, read from the same
773
+ * `editorconfig-checker.json` template `holocron setup` writes as a repo's
774
+ * `.editorconfig-checker.json` — so Sentinel's central editorconfig check
775
+ * (holocron#927) excludes exactly what CI's editorconfig-checker does, from
776
+ * one source.
777
+ *
778
+ * The exclusion that matters most is `\.md$` / `\.mdx$`: the generated
779
+ * `.editorconfig` gives every file tab indentation, but
780
+ * `@theholocron/prettier-config` formats markdown with spaces, so a README's
781
+ * indented code example would fail one tool or the other. Markdown is left
782
+ * to prettier and markdownlint.
783
+ *
784
+ * Each entry is a regular-expression source, matched against a
785
+ * repo-relative path, as editorconfig-checker itself treats them.
786
+ */
787
+ declare const EDITORCONFIG_CHECKER_EXCLUDE: readonly string[];
788
+ /** `true` when `path` matches any {@link EDITORCONFIG_CHECKER_EXCLUDE} pattern. */
789
+ declare function isEditorConfigExcluded(path: string): boolean;
790
+ //#endregion
791
+ //#region src/formatting/config.d.ts
792
+ /**
793
+ * The org's canonical prettier ignore-pattern list for a central Sentinel
794
+ * check (holocron#769/#819) — the `PRETTIER_CONFIG` object itself doesn't
795
+ * need a home here, since `@theholocron/prettier-config`'s default export
796
+ * already *is* one canonical, importable config (the same "one config,
797
+ * not N copies" reasoning `@theholocron/commitlint-config` established for
798
+ * commit-message linting, and `ALEX_CONFIG` established for inclusive
799
+ * language) — only the ignore list is a Sentinel-specific decision that
800
+ * belongs alongside `ALEX_IGNORE_PATTERNS`, not inside the config package.
801
+ *
802
+ * Reuses `ALEX_IGNORE_PATTERNS`' own entries (`.github/*`, `CHANGELOG.md`,
803
+ * `LICENSE` all independently confirmed to fail a real `prettier.check()`
804
+ * today — machine-generated or unparseable content, same reasoning that
805
+ * excluded them from alex), plus `pnpm-lock.yaml` — prettier-specific
806
+ * (alex never reads a lockfile, but prettier would try to reformat it):
807
+ * machine-written by pnpm's own writer, and not gitignored (lockfiles are
808
+ * tracked), so prettier picks it up by default. Reformatting it just
809
+ * fights every subsequent `pnpm install` (this repo's own `.prettierignore`
810
+ * already excludes it for that exact reason).
811
+ */
812
+ declare const PRETTIER_IGNORE_PATTERNS: string[];
813
+ //#endregion
814
+ //#region src/inclusive-language/config.d.ts
815
+ /**
816
+ * The org's canonical `alex` (inclusive-language) config, as raw parsed
817
+ * data rather than the pre-rendered file strings `createRcConfig()`/
818
+ * `createIgnoreConfig()` produce for `holocron setup` to write into a
819
+ * repo's own `.alexrc.json`/`.alexignore`.
820
+ *
821
+ * `.alexrc.json` is explicitly "generated by `holocron setup` — do not
822
+ * edit manually" (this repo's own `AGENTS.md`) — the real source of truth
823
+ * is this JSON file, one canonical copy, not each repo's synced one. A
824
+ * central Sentinel check (holocron#769/#793) reads it directly rather
825
+ * than fetching each repo's own copy via the Contents API — the same "one
826
+ * config, not N copies" reasoning `@theholocron/commitlint-config` already
827
+ * established for commit-message linting.
828
+ */
829
+ declare const ALEX_CONFIG: {
830
+ allow: string[];
831
+ };
832
+ /**
833
+ * Glob-ish path patterns `alex` skips. Kept as a literal here rather than
834
+ * importing `../templates/configs/alexjs/alexignore` directly — that file
835
+ * (like `commit-msg`/`pre-push`) is deliberately extensionless, matching
836
+ * the real filename `holocron setup` writes, which ECMAScript's own
837
+ * module resolution (`moduleResolution: "nodenext"`) can't import across
838
+ * a package boundary without an extension. Keep in sync with that file by
839
+ * hand; it changes rarely.
840
+ */
841
+ declare const ALEX_IGNORE_PATTERNS: string[];
842
+ //#endregion
843
+ export { ALEX_CONFIG, ALEX_IGNORE_PATTERNS, Analytics, AppConfig, Auth, AuthDescription, AuthError, AuthEvent, AuthEventType, AuthIdentity, AuthUser, CARDINALITY, Capability, CapabilityConfigPackage, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, ChromaticProjectConfig, Ci, CiRun, CiRunFilter, CiRunStatus, CommitMessageViolation, ComposedPreset, ConfigError, ConfigFileError, ConnectionStringOptions, CreateAuthUserInput, DeployFunctionConfig, DeployFunctionResult, DeployScriptConfig, DeployScriptResult, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, DeriveProfileInput, Dns, DnsRecord, DnsRecordRequest, DnsRecordType, DocsConfig, DoctorConfig, EDITORCONFIG_CHECKER_EXCLUDE, EnsureResult, EnvConfig, Environment, EnvironmentReviewer, Environments, Errors, EslintConfig, FeatureResolverConfig, HolocronConfig, HolocronProfile, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, LintCommitMsgFileResult, LoadedConfig, LogConfig, Logs, MultiEntry, NormalizedAuthUser, Notifications, PRETTIER_IGNORE_PATTERNS, PackageJsonLike, 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, TaskEntryConfig, TeamEntry, TeamPermission, TelemetryConfig, Tooling, ToolingDoctorReport, TrackerDoctorReport, TrackerUser, Vault, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, WebhookDashboardInfo, WebhookVerificationError, Wiki, WikiProvisionOpts, WikiProxyConfig, Workers, WorkflowWithConfig, compose, createFeatureResolver, createResolveToken, createRestClient, defineConfig, deleteToken, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, getToken, isEditorConfigExcluded, isMulti, lintCommitMessage, lintCommitMsgFile, listStoredProviders, loadConfig, missingCapabilities, readWorkspacePackageJsons, resolveConfig, resolveEntry, resolvePluginPackage, setToken };
package/dist/index.mjs CHANGED
@@ -2,9 +2,11 @@ import { CARDINALITY, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificati
2
2
  import { AuthError, createResolveToken as createResolveToken$1, createRestClient } from "@theholocron/http-client";
3
3
  import { createEnvLookup } from "@theholocron/env-utils";
4
4
  import { Entry, findCredentials } from "@napi-rs/keyring";
5
- import { execFile } from "node:child_process";
6
5
  import { readFile } from "node:fs/promises";
7
6
  import { basename, dirname, join } from "node:path";
7
+ import load from "@commitlint/load";
8
+ import lint from "@commitlint/lint";
9
+ import { execFile } from "node:child_process";
8
10
  import { promisify } from "node:util";
9
11
  import { loadTasksConfig } from "@theholocron/astromech/config";
10
12
  import { ConfigFileError, ConfigFileError as ConfigFileError$1, loadConfigFile } from "@theholocron/datapad";
@@ -113,6 +115,170 @@ function createFeatureResolver(config) {
113
115
  };
114
116
  }
115
117
  //#endregion
118
+ //#region src/commands/setup/derived-properties.ts
119
+ /**
120
+ * Repo archetype, in priority order:
121
+ * 1. `*-template` repo name → `template` (independent of package shape).
122
+ * 2. Monorepo whose primary published artifact is a CLI (some workspace
123
+ * package has `bin`) → `platform` — matches `holocron` itself: the CLI is
124
+ * the deliverable, the plugin packages are supporting infrastructure for
125
+ * it, not separate products.
126
+ * 3. Monorepo with no CLI but at least one non-private workspace package →
127
+ * `library` — matches `clients`/`configs`/`utils`/`themes`/
128
+ * `observability`: a family of published packages, none of them a CLI.
129
+ * Checked *before* falling into the root-package branch below, because
130
+ * these repos' own root `package.json` is private and often carries
131
+ * `@theholocron/astro-config` for a docs site built from the monorepo
132
+ * root — without this check they'd wrongly resolve to `docs` off that
133
+ * root-level signal alone, when the docs site is a secondary concern of
134
+ * a library collection, not what the repo fundamentally is.
135
+ * 4. Single-package repo with `package.json#bin` → `cli`.
136
+ * 5. Docs-only site (astro/starlight present, root package private, no
137
+ * publishable exports) → `docs`.
138
+ * 6. Private, non-publishable, non-docs → `app`.
139
+ * 7. Otherwise, a single publishable package → `library`.
140
+ */
141
+ function deriveProfile(input) {
142
+ if (/-template$/.test(input.repoName)) return "template";
143
+ if (input.isMonorepo) {
144
+ if (input.workspacePackageJsons.some((pkg) => Boolean(pkg.bin))) return "platform";
145
+ if (input.workspacePackageJsons.some((pkg) => pkg.private !== true)) return "library";
146
+ }
147
+ const pkg = input.rootPackageJson;
148
+ if (pkg?.bin) return "cli";
149
+ const deps = {
150
+ ...pkg?.dependencies,
151
+ ...pkg?.devDependencies
152
+ };
153
+ const isDocsSite = Boolean(deps["@theholocron/astro-config"] || deps["astro"]);
154
+ if (pkg?.private && isDocsSite) return "docs";
155
+ if (pkg?.private) return "app";
156
+ return "library";
157
+ }
158
+ const KNOWN_STACK_DEPS = [
159
+ "next",
160
+ "vite",
161
+ "astro",
162
+ "tsdown",
163
+ "rollup",
164
+ "webpack",
165
+ "storybook",
166
+ "vitest",
167
+ "playwright",
168
+ "turbo"
169
+ ];
170
+ /**
171
+ * Detected build/framework tooling — the literal "does this repo need
172
+ * next/vite/tsdown" signal `holocron.config.ts` has no field for today
173
+ * (framework choice isn't a config concept, unlike `providers`/`tasks`).
174
+ * Curated table, not exhaustive by design — add to `KNOWN_STACK_DEPS` as new
175
+ * frameworks show up rather than trying to detect anything on npm.
176
+ */
177
+ function deriveStack(pkg) {
178
+ const deps = {
179
+ ...pkg?.dependencies,
180
+ ...pkg?.devDependencies
181
+ };
182
+ return KNOWN_STACK_DEPS.filter((name) => name in deps);
183
+ }
184
+ /** The provider capability keys actually wired in `providers: {}` — zero heuristics. */
185
+ function deriveCapabilities(providers) {
186
+ return Object.keys(providers ?? {}).sort();
187
+ }
188
+ /**
189
+ * `source` + `ci` are the minimal baseline every repo `holocron setup`
190
+ * touches wires — every `holocron.config.ts` in this org already satisfies
191
+ * this, so `non-compliant` here means drift (a provider manually removed
192
+ * after setup), not an unmet aspirational policy. Deliberately not a richer
193
+ * per-profile policy yet (e.g. "a `library` must have `deployment`") — that's
194
+ * a Phase B (GitHub App) refinement once it can post *why* on a check run.
195
+ */
196
+ const REQUIRED_BASELINE = ["source", "ci"];
197
+ function deriveCompliance(capabilities) {
198
+ return REQUIRED_BASELINE.every((key) => capabilities.includes(key)) ? "compliant" : "non-compliant";
199
+ }
200
+ /**
201
+ * The Phase B refinement `deriveCompliance()`'s own doc comment names —
202
+ * *why* a repo is non-compliant, not just that it is. `[]` when compliant.
203
+ * Same `REQUIRED_BASELINE` `deriveCompliance()` checks against — one
204
+ * table, not two independently-maintained baselines.
205
+ */
206
+ function missingCapabilities(capabilities) {
207
+ return REQUIRED_BASELINE.filter((key) => !capabilities.includes(key));
208
+ }
209
+ /**
210
+ * Reads each workspace package's actual `package.json` content (not just
211
+ * `readWorkspacePackages()`'s `{ slug, name, dir }` — `deriveProfile()`'s
212
+ * `platform` detection needs `bin`, which that helper doesn't carry).
213
+ * Missing/invalid files are skipped, matching `readWorkspacePackages()`'s
214
+ * own soft-fail behavior.
215
+ */
216
+ async function readWorkspacePackageJsons(repoRoot, workspacePackages) {
217
+ const results = [];
218
+ for (const { slug, dir = "packages" } of workspacePackages) try {
219
+ const raw = await readFile(join(repoRoot, dir, slug, "package.json"), "utf8");
220
+ results.push(JSON.parse(raw));
221
+ } catch {}
222
+ return results;
223
+ }
224
+ //#endregion
225
+ //#region src/commit-lint/lint-message.ts
226
+ /**
227
+ * Lints one commit message string against an already-loaded commitlint
228
+ * config. The genuinely environment-independent half of commit-message
229
+ * linting (holocron#789) — *obtaining* a `QualifiedConfig` differs by
230
+ * caller (Sentinel isolates itself from any ambient config since it runs
231
+ * standalone, away from a real repo checkout; `lintCommitMsgFile` below
232
+ * just lets cosmiconfig discover the invoking repo's own
233
+ * `commitlint.config.*`, matching `commitlint --edit`'s own contract) —
234
+ * but linting one message against a loaded config is identical either way.
235
+ *
236
+ * Real `@commitlint/lint` — the same programmatic API `@commitlint/cli`
237
+ * itself uses internally — never a reimplementation of commitlint's rules.
238
+ */
239
+ /** `parserPreset.parserOpts`, if the loaded config sets one — same lookup `@commitlint/cli`'s own `selectParserOpts()` does. */
240
+ function selectParserOpts(parserPreset) {
241
+ return parserPreset?.parserOpts;
242
+ }
243
+ async function lintCommitMessage(message, loaded) {
244
+ const opts = {
245
+ /* istanbul ignore next -- see comment above */
246
+ parserOpts: selectParserOpts(loaded.parserPreset) ?? {},
247
+ plugins: loaded.plugins,
248
+ /* istanbul ignore next -- see comment above */
249
+ ignores: loaded.ignores ?? [],
250
+ defaultIgnores: loaded.defaultIgnores !== false
251
+ };
252
+ const outcome = await lint(message, loaded.rules, opts);
253
+ if (outcome.valid) return [];
254
+ return outcome.errors.map((error) => ({
255
+ rule: error.name,
256
+ message: error.message
257
+ }));
258
+ }
259
+ //#endregion
260
+ //#region src/commit-lint/lint-commit-msg-file.ts
261
+ /**
262
+ * `holocron lint commit-msg <file>` — a real programmatic replacement for
263
+ * shelling out to `commitlint --edit "$1"` from `.husky/commit-msg`
264
+ * (holocron#789). Matches that CLI's own contract exactly: `file` is a
265
+ * path to the commit message being written (the arg git's `commit-msg`
266
+ * hook passes as `$1`), no `--config` override needed — `@commitlint/load`
267
+ * runs from `cwd` with no seed, so cosmiconfig's own normal upward search
268
+ * discovers the invoking repo's real `commitlint.config.*` file, exactly
269
+ * as `commitlint --edit` (no `--config` flag) already does today. Unlike
270
+ * Sentinel's `loadIsolatedConfig()`, no isolation is needed here — this
271
+ * runs inside a real repo checkout with a real `node_modules`, not
272
+ * standalone on a server.
273
+ */
274
+ async function lintCommitMsgFile(filePath, cwd = process.cwd()) {
275
+ const violations = await lintCommitMessage(await readFile(filePath, "utf8"), await load({}, { cwd }));
276
+ return {
277
+ valid: violations.length === 0,
278
+ violations
279
+ };
280
+ }
281
+ //#endregion
116
282
  //#region src/config/config.ts
117
283
  var ConfigError = class extends Error {
118
284
  name = "ConfigError";
@@ -217,7 +383,8 @@ function resolveConfig(raw) {
217
383
  docs,
218
384
  env: raw.env,
219
385
  log: raw.log,
220
- telemetry: raw.telemetry
386
+ telemetry: raw.telemetry,
387
+ eslint: raw.eslint
221
388
  };
222
389
  }
223
390
  //#endregion
@@ -328,14 +495,19 @@ function defineConfig(config) {
328
495
  */
329
496
  const execFileAsync = promisify(execFile);
330
497
  /**
331
- * Read + parse + resolve `holocron.config.*` from the given directory.
498
+ * Read + parse + resolve `holocron.config.*` starting from the given
499
+ * directory, walking up through ancestors to the nearest `.git` boundary
500
+ * when `cwd` itself has no match — every command is usable from any
501
+ * subdirectory of a repo, not only its exact root (see
502
+ * `@theholocron/datapad`'s own doc comment for the stop conditions).
332
503
  * Throws {@link ConfigFileError} when nothing is found or a file cannot
333
- * be loaded, or `ConfigError` when the config is invalid.
504
+ * be loaded, or `ConfigError` when the config fails schema checks.
334
505
  */
335
506
  async function loadConfig(cwd) {
336
507
  const found = await loadConfigFile({
337
508
  cwd,
338
- name: "holocron"
509
+ name: "holocron",
510
+ walkUp: true
339
511
  });
340
512
  if (!found) throw new ConfigFileError$1(`no holocron.config.{ts,js,mjs,cjs,json} found in ${cwd}. Create one — see the README for the schema.`);
341
513
  return {
@@ -389,4 +561,97 @@ function parseGitRemoteUrl(url) {
389
561
  if (sshMatch) return sshMatch[1];
390
562
  }
391
563
  //#endregion
392
- export { AuthError, CARDINALITY, ConfigError, ConfigFileError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, compose, createFeatureResolver, createResolveToken, createRestClient, defineConfig, deleteToken, getToken, isMulti, listStoredProviders, loadConfig, resolveConfig, resolveEntry, resolvePluginPackage, setToken };
564
+ //#region src/editorconfig/config.ts
565
+ /**
566
+ * The paths editorconfig-checker skips, read from the same
567
+ * `editorconfig-checker.json` template `holocron setup` writes as a repo's
568
+ * `.editorconfig-checker.json` — so Sentinel's central editorconfig check
569
+ * (holocron#927) excludes exactly what CI's editorconfig-checker does, from
570
+ * one source.
571
+ *
572
+ * The exclusion that matters most is `\.md$` / `\.mdx$`: the generated
573
+ * `.editorconfig` gives every file tab indentation, but
574
+ * `@theholocron/prettier-config` formats markdown with spaces, so a README's
575
+ * indented code example would fail one tool or the other. Markdown is left
576
+ * to prettier and markdownlint.
577
+ *
578
+ * Each entry is a regular-expression source, matched against a
579
+ * repo-relative path, as editorconfig-checker itself treats them.
580
+ */
581
+ const EDITORCONFIG_CHECKER_EXCLUDE = [
582
+ "(^|.+/)LICENSE$",
583
+ "^public/.*",
584
+ "\\.md$",
585
+ "\\.mdx$"
586
+ ];
587
+ /** `true` when `path` matches any {@link EDITORCONFIG_CHECKER_EXCLUDE} pattern. */
588
+ function isEditorConfigExcluded(path) {
589
+ return EDITORCONFIG_CHECKER_EXCLUDE.some((pattern) => new RegExp(pattern).test(path));
590
+ }
591
+ //#endregion
592
+ //#region src/inclusive-language/config.ts
593
+ /**
594
+ * The org's canonical `alex` (inclusive-language) config, as raw parsed
595
+ * data rather than the pre-rendered file strings `createRcConfig()`/
596
+ * `createIgnoreConfig()` produce for `holocron setup` to write into a
597
+ * repo's own `.alexrc.json`/`.alexignore`.
598
+ *
599
+ * `.alexrc.json` is explicitly "generated by `holocron setup` — do not
600
+ * edit manually" (this repo's own `AGENTS.md`) — the real source of truth
601
+ * is this JSON file, one canonical copy, not each repo's synced one. A
602
+ * central Sentinel check (holocron#769/#793) reads it directly rather
603
+ * than fetching each repo's own copy via the Contents API — the same "one
604
+ * config, not N copies" reasoning `@theholocron/commitlint-config` already
605
+ * established for commit-message linting.
606
+ */
607
+ const ALEX_CONFIG = { allow: [
608
+ "dead",
609
+ "execute",
610
+ "execution",
611
+ "executes",
612
+ "failure",
613
+ "failures",
614
+ "hook",
615
+ "hooks",
616
+ "husky",
617
+ "period"
618
+ ] };
619
+ /**
620
+ * Glob-ish path patterns `alex` skips. Kept as a literal here rather than
621
+ * importing `../templates/configs/alexjs/alexignore` directly — that file
622
+ * (like `commit-msg`/`pre-push`) is deliberately extensionless, matching
623
+ * the real filename `holocron setup` writes, which ECMAScript's own
624
+ * module resolution (`moduleResolution: "nodenext"`) can't import across
625
+ * a package boundary without an extension. Keep in sync with that file by
626
+ * hand; it changes rarely.
627
+ */
628
+ const ALEX_IGNORE_PATTERNS = [
629
+ ".github/*",
630
+ "CHANGELOG.md",
631
+ "LICENSE"
632
+ ];
633
+ //#endregion
634
+ //#region src/formatting/config.ts
635
+ /**
636
+ * The org's canonical prettier ignore-pattern list for a central Sentinel
637
+ * check (holocron#769/#819) — the `PRETTIER_CONFIG` object itself doesn't
638
+ * need a home here, since `@theholocron/prettier-config`'s default export
639
+ * already *is* one canonical, importable config (the same "one config,
640
+ * not N copies" reasoning `@theholocron/commitlint-config` established for
641
+ * commit-message linting, and `ALEX_CONFIG` established for inclusive
642
+ * language) — only the ignore list is a Sentinel-specific decision that
643
+ * belongs alongside `ALEX_IGNORE_PATTERNS`, not inside the config package.
644
+ *
645
+ * Reuses `ALEX_IGNORE_PATTERNS`' own entries (`.github/*`, `CHANGELOG.md`,
646
+ * `LICENSE` all independently confirmed to fail a real `prettier.check()`
647
+ * today — machine-generated or unparseable content, same reasoning that
648
+ * excluded them from alex), plus `pnpm-lock.yaml` — prettier-specific
649
+ * (alex never reads a lockfile, but prettier would try to reformat it):
650
+ * machine-written by pnpm's own writer, and not gitignored (lockfiles are
651
+ * tracked), so prettier picks it up by default. Reformatting it just
652
+ * fights every subsequent `pnpm install` (this repo's own `.prettierignore`
653
+ * already excludes it for that exact reason).
654
+ */
655
+ const PRETTIER_IGNORE_PATTERNS = [...ALEX_IGNORE_PATTERNS, "pnpm-lock.yaml"];
656
+ //#endregion
657
+ export { ALEX_CONFIG, ALEX_IGNORE_PATTERNS, AuthError, CARDINALITY, ConfigError, ConfigFileError, EDITORCONFIG_CHECKER_EXCLUDE, PRETTIER_IGNORE_PATTERNS, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, compose, createFeatureResolver, createResolveToken, createRestClient, defineConfig, deleteToken, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, getToken, isEditorConfigExcluded, isMulti, lintCommitMessage, lintCommitMsgFile, listStoredProviders, loadConfig, missingCapabilities, readWorkspacePackageJsons, resolveConfig, resolveEntry, resolvePluginPackage, setToken };