@theholocron/cli 5.0.0-alpha.152 → 5.0.0-alpha.154
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/README.md +3 -3
- package/dist/cli.mjs +1345 -1600
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +82 -162
- package/dist/index.mjs +9 -162
- package/dist/plugin/capabilities.d.mts +32 -30
- package/dist/plugin/capabilities.mjs +1 -1
- package/package.json +11 -16
package/dist/index.d.mts
CHANGED
|
@@ -4,18 +4,19 @@ import { PackageJson } from "@theholocron/pkg-utils";
|
|
|
4
4
|
import { ConfigFileError } from "@theholocron/datapad";
|
|
5
5
|
import { LogLevel } from "@theholocron/observability/core";
|
|
6
6
|
import { WorkspacePackage } from "@theholocron/astromech";
|
|
7
|
-
|
|
8
|
-
//#region src/auth/auth-resolver.d.ts
|
|
7
|
+
//#region src/auth/auth-resolver/auth-resolver.type.d.ts
|
|
9
8
|
type ResolveTokenConfig = Omit<ResolveTokenConfig$1, "getKeyringToken">;
|
|
10
|
-
/** Wraps `createResolveToken` from `@theholocron/http` and injects the
|
|
11
|
-
* system keyring so plugins stay at a one-liner call site. */
|
|
12
|
-
declare function createResolveToken(config: ResolveTokenConfig): (input?: ResolveTokenInput) => string;
|
|
13
9
|
interface FeatureResolverConfig {
|
|
14
10
|
/** Env var name for this feature, e.g. `"HOLOCRON_ISSUES_TOKEN"`. */
|
|
15
11
|
envName: string;
|
|
16
12
|
/** Keyring account key, e.g. `"github.issues"`. */
|
|
17
13
|
keyringKey: string;
|
|
18
14
|
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/auth/auth-resolver/auth-resolver.d.ts
|
|
17
|
+
/** Wraps `createResolveToken` from `@theholocron/http` and injects the
|
|
18
|
+
* system keyring so plugins stay at a one-liner call site. */
|
|
19
|
+
declare function createResolveToken(config: ResolveTokenConfig): (input?: ResolveTokenInput) => string;
|
|
19
20
|
/**
|
|
20
21
|
* Build a strict, single-feature token resolver.
|
|
21
22
|
*
|
|
@@ -25,7 +26,7 @@ interface FeatureResolverConfig {
|
|
|
25
26
|
*/
|
|
26
27
|
declare function createFeatureResolver(config: FeatureResolverConfig): (input?: ResolveTokenInput) => string;
|
|
27
28
|
//#endregion
|
|
28
|
-
//#region src/auth/keyring.d.ts
|
|
29
|
+
//#region src/auth/keyring/keyring.d.ts
|
|
29
30
|
/**
|
|
30
31
|
* Keyring-backed bootstrap credential store.
|
|
31
32
|
*
|
|
@@ -69,7 +70,7 @@ declare function deleteToken(provider: string): boolean;
|
|
|
69
70
|
*/
|
|
70
71
|
declare function listStoredProviders(): string[];
|
|
71
72
|
//#endregion
|
|
72
|
-
//#region src/commands/auth.d.ts
|
|
73
|
+
//#region src/commands/auth/auth.type.d.ts
|
|
73
74
|
interface VerifyTokenSuccess {
|
|
74
75
|
ok: true;
|
|
75
76
|
/** "workplace: acme" / "user: cnewton@x" — surfaced in success output. */
|
|
@@ -82,7 +83,7 @@ interface VerifyTokenFailure {
|
|
|
82
83
|
}
|
|
83
84
|
type VerifyTokenResult = VerifyTokenSuccess | VerifyTokenFailure;
|
|
84
85
|
//#endregion
|
|
85
|
-
//#region src/config/config.d.ts
|
|
86
|
+
//#region src/config/config/config.type.d.ts
|
|
86
87
|
/** Structured-logging config. The Axiom **token** never lives here — only in
|
|
87
88
|
* env vars or the OS keyring — but the non-secret dataset name may. */
|
|
88
89
|
interface LogConfig {
|
|
@@ -582,6 +583,8 @@ interface ResolvedHolocronConfig {
|
|
|
582
583
|
telemetry?: TelemetryConfig;
|
|
583
584
|
eslint?: EslintConfig;
|
|
584
585
|
}
|
|
586
|
+
//#endregion
|
|
587
|
+
//#region src/config/config/config.d.ts
|
|
585
588
|
declare class ConfigError extends Error {
|
|
586
589
|
name: string;
|
|
587
590
|
}
|
|
@@ -594,94 +597,7 @@ declare function resolvePluginPackage(provider: string): string;
|
|
|
594
597
|
declare function resolveEntry(key: CapabilityKey, raw: RawProviderEntry): ResolvedProviderEntry;
|
|
595
598
|
declare function resolveConfig(raw: HolocronConfig): ResolvedHolocronConfig;
|
|
596
599
|
//#endregion
|
|
597
|
-
//#region src/
|
|
598
|
-
/**
|
|
599
|
-
* Derived custom-properties (#677). Unlike the existing 6 GitHub
|
|
600
|
-
* custom-properties fields (`lifecycle`, `open_source`, `runtime_environment`,
|
|
601
|
-
* `uses_external_packages`, `monorepo`, `branch_protection_level`) — which
|
|
602
|
-
* mirror what `holocron.config.ts` already states explicitly — these four are
|
|
603
|
-
* *derived*: signal that isn't an explicit config field today (framework
|
|
604
|
-
* choice, repo archetype, capability drift). See
|
|
605
|
-
* `.notes/tech-holocron-platform.spec.md` → "Custom-properties sync — field
|
|
606
|
-
* definitions (#677)" for the full design.
|
|
607
|
-
*/
|
|
608
|
-
type HolocronProfile = "library" | "cli" | "plugin" | "template" | "app" | "docs" | "platform";
|
|
609
|
-
/** The `package.json` shape profile derivation reads — `@theholocron/pkg-utils`'s `PackageJson`, under the name Sentinel already imports. */
|
|
610
|
-
type PackageJsonLike = PackageJson;
|
|
611
|
-
interface DeriveProfileInput {
|
|
612
|
-
rootPackageJson: PackageJsonLike | null;
|
|
613
|
-
repoName: string;
|
|
614
|
-
isMonorepo: boolean;
|
|
615
|
-
/** `packages/*` package.json contents, monorepo repos only — used to find the primary published artifact. */
|
|
616
|
-
workspacePackageJsons: PackageJsonLike[];
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* Repo archetype, in priority order:
|
|
620
|
-
* 1. `*-template` repo name → `template` (independent of package shape).
|
|
621
|
-
* 2. Monorepo whose primary published artifact is a CLI (some workspace
|
|
622
|
-
* package has `bin`) → `platform` — matches `holocron` itself: the CLI is
|
|
623
|
-
* the deliverable, the plugin packages are supporting infrastructure for
|
|
624
|
-
* it, not separate products.
|
|
625
|
-
* 3. Monorepo with no CLI but at least one non-private workspace package →
|
|
626
|
-
* `library` — matches `clients`/`configs`/`utils`/`themes`/
|
|
627
|
-
* `observability`: a family of published packages, none of them a CLI.
|
|
628
|
-
* Checked *before* falling into the root-package branch below, because
|
|
629
|
-
* these repos' own root `package.json` is private and often carries
|
|
630
|
-
* `@theholocron/astro-config` for a docs site built from the monorepo
|
|
631
|
-
* root — without this check they'd wrongly resolve to `docs` off that
|
|
632
|
-
* root-level signal alone, when the docs site is a secondary concern of
|
|
633
|
-
* a library collection, not what the repo fundamentally is.
|
|
634
|
-
* 4. Single-package repo with `package.json#bin` → `cli`.
|
|
635
|
-
* 5. Docs-only site (astro/starlight present, root package private, no
|
|
636
|
-
* publishable exports) → `docs`.
|
|
637
|
-
* 6. Private, non-publishable, non-docs → `app`.
|
|
638
|
-
* 7. Otherwise, a single publishable package → `library`.
|
|
639
|
-
*/
|
|
640
|
-
declare function deriveProfile(input: DeriveProfileInput): HolocronProfile;
|
|
641
|
-
/**
|
|
642
|
-
* Detected build/framework tooling — the literal "does this repo need
|
|
643
|
-
* next/vite/tsdown" signal `holocron.config.ts` has no field for today
|
|
644
|
-
* (framework choice isn't a config concept, unlike `providers`/`tasks`).
|
|
645
|
-
* Curated table, not exhaustive by design — add to `KNOWN_STACK_DEPS` as new
|
|
646
|
-
* frameworks show up rather than trying to detect anything on npm.
|
|
647
|
-
*/
|
|
648
|
-
declare function deriveStack(pkg: PackageJsonLike | null): string[];
|
|
649
|
-
/** The provider capability keys actually wired in `providers: {}` — zero heuristics. */
|
|
650
|
-
declare function deriveCapabilities(providers: ResolvedProvidersConfig | undefined): string[];
|
|
651
|
-
declare function deriveCompliance(capabilities: readonly string[]): "compliant" | "non-compliant";
|
|
652
|
-
/**
|
|
653
|
-
* The Phase B refinement `deriveCompliance()`'s own doc comment names —
|
|
654
|
-
* *why* a repo is non-compliant, not just that it is. `[]` when compliant.
|
|
655
|
-
* Same `REQUIRED_BASELINE` `deriveCompliance()` checks against — one
|
|
656
|
-
* table, not two independently-maintained baselines.
|
|
657
|
-
*/
|
|
658
|
-
declare function missingCapabilities(capabilities: readonly string[]): string[];
|
|
659
|
-
/**
|
|
660
|
-
* Reads each workspace package's actual `package.json` content (not just
|
|
661
|
-
* `readWorkspacePackages()`'s `{ slug, name, dir }` — `deriveProfile()`'s
|
|
662
|
-
* `platform` detection needs `bin`, which that helper doesn't carry).
|
|
663
|
-
* Missing/invalid files are skipped, matching `readWorkspacePackages()`'s
|
|
664
|
-
* own soft-fail behavior.
|
|
665
|
-
*/
|
|
666
|
-
declare function readWorkspacePackageJsons(repoRoot: string, workspacePackages: readonly WorkspacePackage[]): Promise<PackageJsonLike[]>;
|
|
667
|
-
//#endregion
|
|
668
|
-
//#region src/commit-lint/lint-message.d.ts
|
|
669
|
-
interface CommitMessageViolation {
|
|
670
|
-
/** Rule name, e.g. `"subject-empty"`. */
|
|
671
|
-
rule: string;
|
|
672
|
-
/** commitlint's own message for the failure, e.g. `"subject may not be empty"`. */
|
|
673
|
-
message: string;
|
|
674
|
-
}
|
|
675
|
-
declare function lintCommitMessage(message: string, loaded: QualifiedConfig): Promise<CommitMessageViolation[]>;
|
|
676
|
-
//#endregion
|
|
677
|
-
//#region src/commit-lint/lint-commit-msg-file.d.ts
|
|
678
|
-
interface LintCommitMsgFileResult {
|
|
679
|
-
valid: boolean;
|
|
680
|
-
violations: CommitMessageViolation[];
|
|
681
|
-
}
|
|
682
|
-
declare function lintCommitMsgFile(filePath: string, cwd?: string): Promise<LintCommitMsgFileResult>;
|
|
683
|
-
//#endregion
|
|
684
|
-
//#region src/config/compose.d.ts
|
|
600
|
+
//#region src/config/compose/compose.type.d.ts
|
|
685
601
|
type TaskEntry = NonNullable<HolocronConfig["tasks"]>[number];
|
|
686
602
|
/** A single composable capability fragment. */
|
|
687
603
|
interface Capability {
|
|
@@ -720,6 +636,8 @@ interface ComposedPreset {
|
|
|
720
636
|
domain?: string;
|
|
721
637
|
docs?: DocsConfig;
|
|
722
638
|
}
|
|
639
|
+
//#endregion
|
|
640
|
+
//#region src/config/compose/compose.d.ts
|
|
723
641
|
/**
|
|
724
642
|
* Merge any number of capability fragments into a single preset object that
|
|
725
643
|
* spreads directly into `defineConfig()`.
|
|
@@ -743,15 +661,17 @@ interface ComposedPreset {
|
|
|
743
661
|
*/
|
|
744
662
|
declare function compose(...args: (Capability | Capability[])[]): ComposedPreset;
|
|
745
663
|
//#endregion
|
|
746
|
-
//#region src/config/define-config.d.ts
|
|
664
|
+
//#region src/config/define-config/define-config.d.ts
|
|
747
665
|
declare function defineConfig(config: HolocronConfig): HolocronConfig;
|
|
748
666
|
//#endregion
|
|
749
|
-
//#region src/config/load-config.d.ts
|
|
667
|
+
//#region src/config/load-config/load-config.type.d.ts
|
|
750
668
|
interface LoadedConfig {
|
|
751
669
|
resolved: ResolvedHolocronConfig;
|
|
752
670
|
/** Absolute path to the file the config was read from. */
|
|
753
671
|
filepath: string;
|
|
754
672
|
}
|
|
673
|
+
//#endregion
|
|
674
|
+
//#region src/config/load-config/load-config.d.ts
|
|
755
675
|
/**
|
|
756
676
|
* Read + parse + resolve `holocron.config.*` starting from the given
|
|
757
677
|
* directory, walking up through ancestors to the nearest `.git` boundary
|
|
@@ -763,77 +683,77 @@ interface LoadedConfig {
|
|
|
763
683
|
*/
|
|
764
684
|
declare function loadConfig(cwd: string): Promise<LoadedConfig>;
|
|
765
685
|
//#endregion
|
|
766
|
-
//#region src/
|
|
686
|
+
//#region src/commands/setup/derived-properties/derived-properties.type.d.ts
|
|
767
687
|
/**
|
|
768
|
-
*
|
|
769
|
-
*
|
|
770
|
-
*
|
|
771
|
-
*
|
|
772
|
-
*
|
|
773
|
-
*
|
|
774
|
-
*
|
|
775
|
-
*
|
|
776
|
-
* `@theholocron/prettier-config` formats markdown with spaces, so a README's
|
|
777
|
-
* indented code example would fail one tool or the other. Markdown is left
|
|
778
|
-
* to prettier and markdownlint.
|
|
779
|
-
*
|
|
780
|
-
* Each entry is a regular-expression source, matched against a
|
|
781
|
-
* repo-relative path, as editorconfig-checker itself treats them.
|
|
688
|
+
* Derived custom-properties (#677). Unlike the existing 6 GitHub
|
|
689
|
+
* custom-properties fields (`lifecycle`, `open_source`, `runtime_environment`,
|
|
690
|
+
* `uses_external_packages`, `monorepo`, `branch_protection_level`) — which
|
|
691
|
+
* mirror what `holocron.config.ts` already states explicitly — these four are
|
|
692
|
+
* *derived*: signal that isn't an explicit config field today (framework
|
|
693
|
+
* choice, repo archetype, capability drift). See
|
|
694
|
+
* `.notes/tech-holocron-platform.spec.md` → "Custom-properties sync — field
|
|
695
|
+
* definitions (#677)" for the full design.
|
|
782
696
|
*/
|
|
783
|
-
|
|
784
|
-
/** `
|
|
785
|
-
|
|
697
|
+
type HolocronProfile = "library" | "cli" | "plugin" | "template" | "app" | "docs" | "platform";
|
|
698
|
+
/** The `package.json` shape profile derivation reads — `@theholocron/pkg-utils`'s `PackageJson`, under the name Sentinel already imports. */
|
|
699
|
+
type PackageJsonLike = PackageJson;
|
|
700
|
+
interface DeriveProfileInput {
|
|
701
|
+
rootPackageJson: PackageJsonLike | null;
|
|
702
|
+
repoName: string;
|
|
703
|
+
isMonorepo: boolean;
|
|
704
|
+
/** `packages/*` package.json contents, monorepo repos only — used to find the primary published artifact. */
|
|
705
|
+
workspacePackageJsons: PackageJsonLike[];
|
|
706
|
+
}
|
|
786
707
|
//#endregion
|
|
787
|
-
//#region src/
|
|
708
|
+
//#region src/commands/setup/derived-properties/derived-properties.d.ts
|
|
788
709
|
/**
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
*
|
|
794
|
-
*
|
|
795
|
-
*
|
|
796
|
-
*
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
*
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
*
|
|
803
|
-
*
|
|
804
|
-
*
|
|
805
|
-
*
|
|
806
|
-
*
|
|
710
|
+
* Repo archetype, in priority order:
|
|
711
|
+
* 1. `*-template` repo name → `template` (independent of package shape).
|
|
712
|
+
* 2. Monorepo whose primary published artifact is a CLI (some workspace
|
|
713
|
+
* package has `bin`) → `platform` — matches `holocron` itself: the CLI is
|
|
714
|
+
* the deliverable, the plugin packages are supporting infrastructure for
|
|
715
|
+
* it, not separate products.
|
|
716
|
+
* 3. Monorepo with no CLI but at least one non-private workspace package →
|
|
717
|
+
* `library` — matches `clients`/`configs`/`utils`/`themes`/
|
|
718
|
+
* `observability`: a family of published packages, none of them a CLI.
|
|
719
|
+
* Checked *before* falling into the root-package branch below, because
|
|
720
|
+
* these repos' own root `package.json` is private and often carries
|
|
721
|
+
* `@theholocron/astro-config` for a docs site built from the monorepo
|
|
722
|
+
* root — without this check they'd wrongly resolve to `docs` off that
|
|
723
|
+
* root-level signal alone, when the docs site is a secondary concern of
|
|
724
|
+
* a library collection, not what the repo fundamentally is.
|
|
725
|
+
* 4. Single-package repo with `package.json#bin` → `cli`.
|
|
726
|
+
* 5. Docs-only site (astro/starlight present, root package private, no
|
|
727
|
+
* publishable exports) → `docs`.
|
|
728
|
+
* 6. Private, non-publishable, non-docs → `app`.
|
|
729
|
+
* 7. Otherwise, a single publishable package → `library`.
|
|
807
730
|
*/
|
|
808
|
-
declare
|
|
809
|
-
//#endregion
|
|
810
|
-
//#region src/inclusive-language/config.d.ts
|
|
731
|
+
declare function deriveProfile(input: DeriveProfileInput): HolocronProfile;
|
|
811
732
|
/**
|
|
812
|
-
*
|
|
813
|
-
*
|
|
814
|
-
*
|
|
815
|
-
*
|
|
816
|
-
*
|
|
817
|
-
* `.alexrc.json` is explicitly "generated by `holocron repo setup` — do not
|
|
818
|
-
* edit manually" (this repo's own `AGENTS.md`) — the real source of truth
|
|
819
|
-
* is this JSON file, one canonical copy, not each repo's synced one. A
|
|
820
|
-
* central Sentinel check (holocron#769/#793) reads it directly rather
|
|
821
|
-
* than fetching each repo's own copy via the Contents API — the same "one
|
|
822
|
-
* config, not N copies" reasoning `@theholocron/commitlint-config` already
|
|
823
|
-
* established for commit-message linting.
|
|
733
|
+
* Detected build/framework tooling — the literal "does this repo need
|
|
734
|
+
* next/vite/tsdown" signal `holocron.config.ts` has no field for today
|
|
735
|
+
* (framework choice isn't a config concept, unlike `providers`/`tasks`).
|
|
736
|
+
* Curated table, not exhaustive by design — add to `KNOWN_STACK_DEPS` as new
|
|
737
|
+
* frameworks show up rather than trying to detect anything on npm.
|
|
824
738
|
*/
|
|
825
|
-
declare
|
|
826
|
-
|
|
827
|
-
|
|
739
|
+
declare function deriveStack(pkg: PackageJsonLike | null): string[];
|
|
740
|
+
/** The provider capability keys actually wired in `providers: {}` — zero heuristics. */
|
|
741
|
+
declare function deriveCapabilities(providers: ResolvedProvidersConfig | undefined): string[];
|
|
742
|
+
declare function deriveCompliance(capabilities: readonly string[]): "compliant" | "non-compliant";
|
|
828
743
|
/**
|
|
829
|
-
*
|
|
830
|
-
*
|
|
831
|
-
*
|
|
832
|
-
*
|
|
833
|
-
* module resolution (`moduleResolution: "nodenext"`) can't import across
|
|
834
|
-
* a package boundary without an extension. Keep in sync with that file by
|
|
835
|
-
* hand; it changes rarely.
|
|
744
|
+
* The Phase B refinement `deriveCompliance()`'s own doc comment names —
|
|
745
|
+
* *why* a repo is non-compliant, not just that it is. `[]` when compliant.
|
|
746
|
+
* Same `REQUIRED_BASELINE` `deriveCompliance()` checks against — one
|
|
747
|
+
* table, not two independently-maintained baselines.
|
|
836
748
|
*/
|
|
837
|
-
declare
|
|
749
|
+
declare function missingCapabilities(capabilities: readonly string[]): string[];
|
|
750
|
+
/**
|
|
751
|
+
* Reads each workspace package's actual `package.json` content (not just
|
|
752
|
+
* `readWorkspacePackages()`'s `{ slug, name, dir }` — `deriveProfile()`'s
|
|
753
|
+
* `platform` detection needs `bin`, which that helper doesn't carry).
|
|
754
|
+
* Missing/invalid files are skipped, matching `readWorkspacePackages()`'s
|
|
755
|
+
* own soft-fail behavior.
|
|
756
|
+
*/
|
|
757
|
+
declare function readWorkspacePackageJsons(repoRoot: string, workspacePackages: readonly WorkspacePackage[]): Promise<PackageJsonLike[]>;
|
|
838
758
|
//#endregion
|
|
839
|
-
export {
|
|
759
|
+
export { Analytics, type AppConfig, Auth, AuthDescription, AuthError, AuthEvent, AuthEventType, AuthIdentity, AuthUser, CARDINALITY, type Capability, type CapabilityConfigPackage, CapabilityImpls, CapabilityKey, Cardinality, CardinalityFor, type ChromaticProjectConfig, Ci, CiRun, CiRunFilter, CiRunStatus, type ComposedPreset, ConfigError, ConfigFileError, ConnectionStringOptions, CreateAuthUserInput, DeployFunctionConfig, DeployFunctionResult, DeployScriptConfig, DeployScriptResult, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, type DeriveProfileInput, Dns, DnsRecord, DnsRecordRequest, DnsRecordType, type DocsConfig, type DoctorConfig, EnsureResult, type EnvConfig, Environment, EnvironmentReviewer, Environments, Errors, type EslintConfig, type FeatureResolverConfig, type HolocronConfig, type HolocronProfile, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, type LoadedConfig, type LogConfig, Logs, Monitoring, MonitoringAssertion, MonitoringAssertionComparison, MonitoringAssertionSource, MonitoringCheck, MonitoringCheckInput, MonitoringHttpMethod, type MultiEntry, NormalizedAuthUser, Notifications, type PackageJsonLike, PagesConfig, ParseWebhookInput, ProviderApiError, ProviderIdentity, type ProviderOptions, PullRequest, REQUIRED_CAPABILITIES, type RawProviderEntry, type RawProvidersConfig, type RepoConfig, type RepoProperties, type RepoProtection, RepoRef, RepoSettings, type RequestOptions, type ResolveTokenConfig, type ResolveTokenInput, ResolvedCapability, type ResolvedHolocronConfig, type ResolvedProviderEntry, type ResolvedProvidersConfig, type ResolvedTuple, type RestClient, type RestClientConfig, Ruleset, SecretScope, Secrets, type SingleEntry, Source, StatusCategory, Storage, StorageBranch, type StorybookDeployProject, type TaskEntry, type TaskEntryConfig, TeamEntry, TeamPermission, type TelemetryConfig, Tooling, ToolingDoctorReport, TrackerDoctorReport, TrackerUser, Vault, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, WebhookDashboardInfo, WebhookVerificationError, Wiki, WikiProvisionOpts, WikiProxyConfig, Workers, type WorkflowWithConfig, compose, createFeatureResolver, createResolveToken, createRestClient, defineConfig, deleteToken, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, getToken, isMulti, listStoredProviders, loadConfig, missingCapabilities, readWorkspacePackageJsons, resolveConfig, resolveEntry, resolvePluginPackage, setToken };
|
package/dist/index.mjs
CHANGED
|
@@ -4,13 +4,10 @@ import { createEnvLookup, withEnvPrefix } from "@theholocron/env-utils";
|
|
|
4
4
|
import { Entry, findCredentials } from "@napi-rs/keyring";
|
|
5
5
|
import { basename, dirname, join } from "node:path";
|
|
6
6
|
import { readPackageJson } from "@theholocron/pkg-utils";
|
|
7
|
-
import { readFile } from "node:fs/promises";
|
|
8
|
-
import load from "@commitlint/load";
|
|
9
|
-
import lint from "@commitlint/lint";
|
|
10
7
|
import { loadTasksConfig } from "@theholocron/astromech/config";
|
|
11
8
|
import { ConfigFileError, ConfigFileError as ConfigFileError$1, loadConfigFile } from "@theholocron/datapad";
|
|
12
9
|
import { readGitRemote } from "@theholocron/git-utils";
|
|
13
|
-
//#region src/env.ts
|
|
10
|
+
//#region src/env/env.ts
|
|
14
11
|
/** Singleton env for simple global lookups throughout the CLI. */
|
|
15
12
|
const env = createEnvLookup();
|
|
16
13
|
withEnvPrefix(env, "HOLOCRON");
|
|
@@ -22,7 +19,7 @@ function makeEnv(source) {
|
|
|
22
19
|
return createEnvLookup(source);
|
|
23
20
|
}
|
|
24
21
|
//#endregion
|
|
25
|
-
//#region src/auth/keyring.ts
|
|
22
|
+
//#region src/auth/keyring/keyring.ts
|
|
26
23
|
/**
|
|
27
24
|
* Keyring-backed bootstrap credential store.
|
|
28
25
|
*
|
|
@@ -92,7 +89,7 @@ function listStoredProviders() {
|
|
|
92
89
|
}
|
|
93
90
|
}
|
|
94
91
|
//#endregion
|
|
95
|
-
//#region src/auth/auth-resolver.ts
|
|
92
|
+
//#region src/auth/auth-resolver/auth-resolver.ts
|
|
96
93
|
/** Wraps `createResolveToken` from `@theholocron/http` and injects the
|
|
97
94
|
* system keyring so plugins stay at a one-liner call site. */
|
|
98
95
|
function createResolveToken(config) {
|
|
@@ -118,7 +115,7 @@ function createFeatureResolver(config) {
|
|
|
118
115
|
};
|
|
119
116
|
}
|
|
120
117
|
//#endregion
|
|
121
|
-
//#region src/commands/setup/derived-properties.ts
|
|
118
|
+
//#region src/commands/setup/derived-properties/derived-properties.ts
|
|
122
119
|
/**
|
|
123
120
|
* Repo archetype, in priority order:
|
|
124
121
|
* 1. `*-template` repo name → `template` (independent of package shape).
|
|
@@ -225,64 +222,7 @@ async function readWorkspacePackageJsons(repoRoot, workspacePackages) {
|
|
|
225
222
|
return results;
|
|
226
223
|
}
|
|
227
224
|
//#endregion
|
|
228
|
-
//#region src/
|
|
229
|
-
/**
|
|
230
|
-
* Lints one commit message string against an already-loaded commitlint
|
|
231
|
-
* config. The genuinely environment-independent half of commit-message
|
|
232
|
-
* linting (holocron#789) — *obtaining* a `QualifiedConfig` differs by
|
|
233
|
-
* caller (Sentinel isolates itself from any ambient config since it runs
|
|
234
|
-
* standalone, away from a real repo checkout; `lintCommitMsgFile` below
|
|
235
|
-
* just lets cosmiconfig discover the invoking repo's own
|
|
236
|
-
* `commitlint.config.*`, matching `commitlint --edit`'s own contract) —
|
|
237
|
-
* but linting one message against a loaded config is identical either way.
|
|
238
|
-
*
|
|
239
|
-
* Real `@commitlint/lint` — the same programmatic API `@commitlint/cli`
|
|
240
|
-
* itself uses internally — never a reimplementation of commitlint's rules.
|
|
241
|
-
*/
|
|
242
|
-
/** `parserPreset.parserOpts`, if the loaded config sets one — same lookup `@commitlint/cli`'s own `selectParserOpts()` does. */
|
|
243
|
-
function selectParserOpts(parserPreset) {
|
|
244
|
-
return parserPreset?.parserOpts;
|
|
245
|
-
}
|
|
246
|
-
async function lintCommitMessage(message, loaded) {
|
|
247
|
-
const opts = {
|
|
248
|
-
/* istanbul ignore next -- see comment above */
|
|
249
|
-
parserOpts: selectParserOpts(loaded.parserPreset) ?? {},
|
|
250
|
-
plugins: loaded.plugins,
|
|
251
|
-
/* istanbul ignore next -- see comment above */
|
|
252
|
-
ignores: loaded.ignores ?? [],
|
|
253
|
-
defaultIgnores: loaded.defaultIgnores !== false
|
|
254
|
-
};
|
|
255
|
-
const outcome = await lint(message, loaded.rules, opts);
|
|
256
|
-
if (outcome.valid) return [];
|
|
257
|
-
return outcome.errors.map((error) => ({
|
|
258
|
-
rule: error.name,
|
|
259
|
-
message: error.message
|
|
260
|
-
}));
|
|
261
|
-
}
|
|
262
|
-
//#endregion
|
|
263
|
-
//#region src/commit-lint/lint-commit-msg-file.ts
|
|
264
|
-
/**
|
|
265
|
-
* `holocron run lint commit-msg <file>` — a real programmatic replacement for
|
|
266
|
-
* shelling out to `commitlint --edit "$1"` from `.husky/commit-msg`
|
|
267
|
-
* (holocron#789). Matches that CLI's own contract exactly: `file` is a
|
|
268
|
-
* path to the commit message being written (the arg git's `commit-msg`
|
|
269
|
-
* hook passes as `$1`), no `--config` override needed — `@commitlint/load`
|
|
270
|
-
* runs from `cwd` with no seed, so cosmiconfig's own normal upward search
|
|
271
|
-
* discovers the invoking repo's real `commitlint.config.*` file, exactly
|
|
272
|
-
* as `commitlint --edit` (no `--config` flag) already does today. Unlike
|
|
273
|
-
* Sentinel's `loadIsolatedConfig()`, no isolation is needed here — this
|
|
274
|
-
* runs inside a real repo checkout with a real `node_modules`, not
|
|
275
|
-
* standalone on a server.
|
|
276
|
-
*/
|
|
277
|
-
async function lintCommitMsgFile(filePath, cwd = process.cwd()) {
|
|
278
|
-
const violations = await lintCommitMessage(await readFile(filePath, "utf8"), await load({}, { cwd }));
|
|
279
|
-
return {
|
|
280
|
-
valid: violations.length === 0,
|
|
281
|
-
violations
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
//#endregion
|
|
285
|
-
//#region src/config/config.ts
|
|
225
|
+
//#region src/config/config/config.ts
|
|
286
226
|
var ConfigError = class extends Error {
|
|
287
227
|
name = "ConfigError";
|
|
288
228
|
};
|
|
@@ -391,7 +331,7 @@ function resolveConfig(raw) {
|
|
|
391
331
|
};
|
|
392
332
|
}
|
|
393
333
|
//#endregion
|
|
394
|
-
//#region src/config/compose.ts
|
|
334
|
+
//#region src/config/compose/compose.ts
|
|
395
335
|
function taskName(e) {
|
|
396
336
|
return typeof e === "string" ? e : e.name;
|
|
397
337
|
}
|
|
@@ -479,12 +419,12 @@ function compose(...args) {
|
|
|
479
419
|
};
|
|
480
420
|
}
|
|
481
421
|
//#endregion
|
|
482
|
-
//#region src/config/define-config.ts
|
|
422
|
+
//#region src/config/define-config/define-config.ts
|
|
483
423
|
function defineConfig(config) {
|
|
484
424
|
return config;
|
|
485
425
|
}
|
|
486
426
|
//#endregion
|
|
487
|
-
//#region src/config/load-config.ts
|
|
427
|
+
//#region src/config/load-config/load-config.ts
|
|
488
428
|
/**
|
|
489
429
|
* `holocron.config.{ts,js,mjs,cjs,json}` loader.
|
|
490
430
|
*
|
|
@@ -541,97 +481,4 @@ async function readPackageJsonName(dir) {
|
|
|
541
481
|
return name === void 0 ? void 0 : name.replace(/^@[^/]+\//, "");
|
|
542
482
|
}
|
|
543
483
|
//#endregion
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* The paths editorconfig-checker skips, read from the same
|
|
547
|
-
* `editorconfig-checker.json` template `holocron repo setup` writes as a repo's
|
|
548
|
-
* `.editorconfig-checker.json` — so Sentinel's central editorconfig check
|
|
549
|
-
* (holocron#927) excludes exactly what CI's editorconfig-checker does, from
|
|
550
|
-
* one source.
|
|
551
|
-
*
|
|
552
|
-
* The exclusion that matters most is `\.md$` / `\.mdx$`: the generated
|
|
553
|
-
* `.editorconfig` gives every file tab indentation, but
|
|
554
|
-
* `@theholocron/prettier-config` formats markdown with spaces, so a README's
|
|
555
|
-
* indented code example would fail one tool or the other. Markdown is left
|
|
556
|
-
* to prettier and markdownlint.
|
|
557
|
-
*
|
|
558
|
-
* Each entry is a regular-expression source, matched against a
|
|
559
|
-
* repo-relative path, as editorconfig-checker itself treats them.
|
|
560
|
-
*/
|
|
561
|
-
const EDITORCONFIG_CHECKER_EXCLUDE = [
|
|
562
|
-
"(^|.+/)LICENSE$",
|
|
563
|
-
"^public/.*",
|
|
564
|
-
"\\.md$",
|
|
565
|
-
"\\.mdx$"
|
|
566
|
-
];
|
|
567
|
-
/** `true` when `path` matches any {@link EDITORCONFIG_CHECKER_EXCLUDE} pattern. */
|
|
568
|
-
function isEditorConfigExcluded(path) {
|
|
569
|
-
return EDITORCONFIG_CHECKER_EXCLUDE.some((pattern) => new RegExp(pattern).test(path));
|
|
570
|
-
}
|
|
571
|
-
//#endregion
|
|
572
|
-
//#region src/inclusive-language/config.ts
|
|
573
|
-
/**
|
|
574
|
-
* The org's canonical `alex` (inclusive-language) config, as raw parsed
|
|
575
|
-
* data rather than the pre-rendered file strings `createRcConfig()`/
|
|
576
|
-
* `createIgnoreConfig()` produce for `holocron repo setup` to write into a
|
|
577
|
-
* repo's own `.alexrc.json`/`.alexignore`.
|
|
578
|
-
*
|
|
579
|
-
* `.alexrc.json` is explicitly "generated by `holocron repo setup` — do not
|
|
580
|
-
* edit manually" (this repo's own `AGENTS.md`) — the real source of truth
|
|
581
|
-
* is this JSON file, one canonical copy, not each repo's synced one. A
|
|
582
|
-
* central Sentinel check (holocron#769/#793) reads it directly rather
|
|
583
|
-
* than fetching each repo's own copy via the Contents API — the same "one
|
|
584
|
-
* config, not N copies" reasoning `@theholocron/commitlint-config` already
|
|
585
|
-
* established for commit-message linting.
|
|
586
|
-
*/
|
|
587
|
-
const ALEX_CONFIG = { allow: [
|
|
588
|
-
"dead",
|
|
589
|
-
"execute",
|
|
590
|
-
"execution",
|
|
591
|
-
"executes",
|
|
592
|
-
"failure",
|
|
593
|
-
"failures",
|
|
594
|
-
"hook",
|
|
595
|
-
"hooks",
|
|
596
|
-
"husky",
|
|
597
|
-
"period"
|
|
598
|
-
] };
|
|
599
|
-
/**
|
|
600
|
-
* Glob-ish path patterns `alex` skips. Kept as a literal here rather than
|
|
601
|
-
* importing `../templates/configs/alexjs/alexignore` directly — that file
|
|
602
|
-
* (like `commit-msg`/`pre-push`) is deliberately extensionless, matching
|
|
603
|
-
* the real filename `holocron repo setup` writes, which ECMAScript's own
|
|
604
|
-
* module resolution (`moduleResolution: "nodenext"`) can't import across
|
|
605
|
-
* a package boundary without an extension. Keep in sync with that file by
|
|
606
|
-
* hand; it changes rarely.
|
|
607
|
-
*/
|
|
608
|
-
const ALEX_IGNORE_PATTERNS = [
|
|
609
|
-
".github/*",
|
|
610
|
-
"CHANGELOG.md",
|
|
611
|
-
"LICENSE"
|
|
612
|
-
];
|
|
613
|
-
//#endregion
|
|
614
|
-
//#region src/formatting/config.ts
|
|
615
|
-
/**
|
|
616
|
-
* The org's canonical prettier ignore-pattern list for a central Sentinel
|
|
617
|
-
* check (holocron#769/#819) — the `PRETTIER_CONFIG` object itself doesn't
|
|
618
|
-
* need a home here, since `@theholocron/prettier-config`'s default export
|
|
619
|
-
* already *is* one canonical, importable config (the same "one config,
|
|
620
|
-
* not N copies" reasoning `@theholocron/commitlint-config` established for
|
|
621
|
-
* commit-message linting, and `ALEX_CONFIG` established for inclusive
|
|
622
|
-
* language) — only the ignore list is a Sentinel-specific decision that
|
|
623
|
-
* belongs alongside `ALEX_IGNORE_PATTERNS`, not inside the config package.
|
|
624
|
-
*
|
|
625
|
-
* Reuses `ALEX_IGNORE_PATTERNS`' own entries (`.github/*`, `CHANGELOG.md`,
|
|
626
|
-
* `LICENSE` all independently confirmed to fail a real `prettier.check()`
|
|
627
|
-
* today — machine-generated or unparseable content, same reasoning that
|
|
628
|
-
* excluded them from alex), plus `pnpm-lock.yaml` — prettier-specific
|
|
629
|
-
* (alex never reads a lockfile, but prettier would try to reformat it):
|
|
630
|
-
* machine-written by pnpm's own writer, and not gitignored (lockfiles are
|
|
631
|
-
* tracked), so prettier picks it up by default. Reformatting it just
|
|
632
|
-
* fights every subsequent `pnpm install` (this repo's own `.prettierignore`
|
|
633
|
-
* already excludes it for that exact reason).
|
|
634
|
-
*/
|
|
635
|
-
const PRETTIER_IGNORE_PATTERNS = [...ALEX_IGNORE_PATTERNS, "pnpm-lock.yaml"];
|
|
636
|
-
//#endregion
|
|
637
|
-
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 };
|
|
484
|
+
export { AuthError, CARDINALITY, ConfigError, ConfigFileError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, compose, createFeatureResolver, createResolveToken, createRestClient, defineConfig, deleteToken, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, getToken, isMulti, listStoredProviders, loadConfig, missingCapabilities, readWorkspacePackageJsons, resolveConfig, resolveEntry, resolvePluginPackage, setToken };
|