@theholocron/cli 5.0.0-alpha.17 → 5.0.0-alpha.19

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,6 +1,7 @@
1
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";
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
+ import { WorkspacePackage } from "@theholocron/astromech";
4
5
  import { LogLevel } from "@theholocron/observability/core";
5
6
  //#region src/auth/auth-resolver.d.ts
6
7
  type ResolveTokenConfig = Omit<ResolveTokenConfig$1, "getKeyringToken">;
@@ -539,6 +540,82 @@ declare function resolvePluginPackage(provider: string): string;
539
540
  declare function resolveEntry(key: CapabilityKey, raw: RawProviderEntry): ResolvedProviderEntry;
540
541
  declare function resolveConfig(raw: HolocronConfig): ResolvedHolocronConfig;
541
542
  //#endregion
543
+ //#region src/commands/setup/derived-properties.d.ts
544
+ /**
545
+ * Derived custom-properties (#677). Unlike the existing 6 GitHub
546
+ * custom-properties fields (`lifecycle`, `open_source`, `runtime_environment`,
547
+ * `uses_external_packages`, `monorepo`, `branch_protection_level`) — which
548
+ * mirror what `holocron.config.ts` already states explicitly — these four are
549
+ * *derived*: signal that isn't an explicit config field today (framework
550
+ * choice, repo archetype, capability drift). See
551
+ * `.notes/tech-holocron-platform.spec.md` → "Custom-properties sync — field
552
+ * definitions (#677)" for the full design.
553
+ */
554
+ type HolocronProfile = "library" | "cli" | "plugin" | "template" | "app" | "docs" | "platform";
555
+ interface PackageJsonLike {
556
+ name?: string;
557
+ private?: boolean;
558
+ bin?: unknown;
559
+ dependencies?: Record<string, string>;
560
+ devDependencies?: Record<string, string>;
561
+ }
562
+ interface DeriveProfileInput {
563
+ rootPackageJson: PackageJsonLike | null;
564
+ repoName: string;
565
+ isMonorepo: boolean;
566
+ /** `packages/*` package.json contents, monorepo repos only — used to find the primary published artifact. */
567
+ workspacePackageJsons: PackageJsonLike[];
568
+ }
569
+ /**
570
+ * Repo archetype, in priority order:
571
+ * 1. `*-template` repo name → `template` (independent of package shape).
572
+ * 2. Monorepo whose primary published artifact is a CLI (some workspace
573
+ * package has `bin`) → `platform` — matches `holocron` itself: the CLI is
574
+ * the deliverable, the plugin packages are supporting infrastructure for
575
+ * it, not separate products.
576
+ * 3. Monorepo with no CLI but at least one non-private workspace package →
577
+ * `library` — matches `clients`/`configs`/`utils`/`themes`/
578
+ * `observability`: a family of published packages, none of them a CLI.
579
+ * Checked *before* falling into the root-package branch below, because
580
+ * these repos' own root `package.json` is private and often carries
581
+ * `@theholocron/astro-config` for a docs site built from the monorepo
582
+ * root — without this check they'd wrongly resolve to `docs` off that
583
+ * root-level signal alone, when the docs site is a secondary concern of
584
+ * a library collection, not what the repo fundamentally is.
585
+ * 4. Single-package repo with `package.json#bin` → `cli`.
586
+ * 5. Docs-only site (astro/starlight present, root package private, no
587
+ * publishable exports) → `docs`.
588
+ * 6. Private, non-publishable, non-docs → `app`.
589
+ * 7. Otherwise, a single publishable package → `library`.
590
+ */
591
+ declare function deriveProfile(input: DeriveProfileInput): HolocronProfile;
592
+ /**
593
+ * Detected build/framework tooling — the literal "does this repo need
594
+ * next/vite/tsdown" signal `holocron.config.ts` has no field for today
595
+ * (framework choice isn't a config concept, unlike `providers`/`tasks`).
596
+ * Curated table, not exhaustive by design — add to `KNOWN_STACK_DEPS` as new
597
+ * frameworks show up rather than trying to detect anything on npm.
598
+ */
599
+ declare function deriveStack(pkg: PackageJsonLike | null): string[];
600
+ /** The provider capability keys actually wired in `providers: {}` — zero heuristics. */
601
+ declare function deriveCapabilities(providers: ResolvedProvidersConfig | undefined): string[];
602
+ declare function deriveCompliance(capabilities: readonly string[]): "compliant" | "non-compliant";
603
+ /**
604
+ * The Phase B refinement `deriveCompliance()`'s own doc comment names —
605
+ * *why* a repo is non-compliant, not just that it is. `[]` when compliant.
606
+ * Same `REQUIRED_BASELINE` `deriveCompliance()` checks against — one
607
+ * table, not two independently-maintained baselines.
608
+ */
609
+ declare function missingCapabilities(capabilities: readonly string[]): string[];
610
+ /**
611
+ * Reads each workspace package's actual `package.json` content (not just
612
+ * `readWorkspacePackages()`'s `{ slug, name, dir }` — `deriveProfile()`'s
613
+ * `platform` detection needs `bin`, which that helper doesn't carry).
614
+ * Missing/invalid files are skipped, matching `readWorkspacePackages()`'s
615
+ * own soft-fail behavior.
616
+ */
617
+ declare function readWorkspacePackageJsons(repoRoot: string, workspacePackages: readonly WorkspacePackage[]): Promise<PackageJsonLike[]>;
618
+ //#endregion
542
619
  //#region src/config/compose.d.ts
543
620
  type TaskEntry = NonNullable<HolocronConfig["tasks"]>[number];
544
621
  /** A single composable capability fragment. */
@@ -617,4 +694,4 @@ interface LoadedConfig {
617
694
  */
618
695
  declare function loadConfig(cwd: string): Promise<LoadedConfig>;
619
696
  //#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 };
697
+ 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, DeriveProfileInput, Dns, DnsRecord, DnsRecordType, DocsConfig, DoctorConfig, EnsureResult, EnvConfig, Environment, EnvironmentReviewer, Environments, Errors, FeatureResolverConfig, HolocronConfig, HolocronProfile, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, LoadedConfig, LogConfig, Logs, MultiEntry, NormalizedAuthUser, Notifications, 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, WebhookDashboardInfo, WebhookVerificationError, Wiki, WikiDnsRecord, WikiProvisionOpts, WikiProxyConfig, Workers, 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
@@ -2,9 +2,9 @@ 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 { execFile } from "node:child_process";
8
8
  import { promisify } from "node:util";
9
9
  import { loadTasksConfig } from "@theholocron/astromech/config";
10
10
  import { ConfigFileError, ConfigFileError as ConfigFileError$1, loadConfigFile } from "@theholocron/datapad";
@@ -113,6 +113,113 @@ function createFeatureResolver(config) {
113
113
  };
114
114
  }
115
115
  //#endregion
116
+ //#region src/commands/setup/derived-properties.ts
117
+ /**
118
+ * Repo archetype, in priority order:
119
+ * 1. `*-template` repo name → `template` (independent of package shape).
120
+ * 2. Monorepo whose primary published artifact is a CLI (some workspace
121
+ * package has `bin`) → `platform` — matches `holocron` itself: the CLI is
122
+ * the deliverable, the plugin packages are supporting infrastructure for
123
+ * it, not separate products.
124
+ * 3. Monorepo with no CLI but at least one non-private workspace package →
125
+ * `library` — matches `clients`/`configs`/`utils`/`themes`/
126
+ * `observability`: a family of published packages, none of them a CLI.
127
+ * Checked *before* falling into the root-package branch below, because
128
+ * these repos' own root `package.json` is private and often carries
129
+ * `@theholocron/astro-config` for a docs site built from the monorepo
130
+ * root — without this check they'd wrongly resolve to `docs` off that
131
+ * root-level signal alone, when the docs site is a secondary concern of
132
+ * a library collection, not what the repo fundamentally is.
133
+ * 4. Single-package repo with `package.json#bin` → `cli`.
134
+ * 5. Docs-only site (astro/starlight present, root package private, no
135
+ * publishable exports) → `docs`.
136
+ * 6. Private, non-publishable, non-docs → `app`.
137
+ * 7. Otherwise, a single publishable package → `library`.
138
+ */
139
+ function deriveProfile(input) {
140
+ if (/-template$/.test(input.repoName)) return "template";
141
+ if (input.isMonorepo) {
142
+ if (input.workspacePackageJsons.some((pkg) => Boolean(pkg.bin))) return "platform";
143
+ if (input.workspacePackageJsons.some((pkg) => pkg.private !== true)) return "library";
144
+ }
145
+ const pkg = input.rootPackageJson;
146
+ if (pkg?.bin) return "cli";
147
+ const deps = {
148
+ ...pkg?.dependencies,
149
+ ...pkg?.devDependencies
150
+ };
151
+ const isDocsSite = Boolean(deps["@theholocron/astro-config"] || deps["astro"]);
152
+ if (pkg?.private && isDocsSite) return "docs";
153
+ if (pkg?.private) return "app";
154
+ return "library";
155
+ }
156
+ const KNOWN_STACK_DEPS = [
157
+ "next",
158
+ "vite",
159
+ "astro",
160
+ "tsdown",
161
+ "rollup",
162
+ "webpack",
163
+ "storybook",
164
+ "vitest",
165
+ "playwright",
166
+ "turbo"
167
+ ];
168
+ /**
169
+ * Detected build/framework tooling — the literal "does this repo need
170
+ * next/vite/tsdown" signal `holocron.config.ts` has no field for today
171
+ * (framework choice isn't a config concept, unlike `providers`/`tasks`).
172
+ * Curated table, not exhaustive by design — add to `KNOWN_STACK_DEPS` as new
173
+ * frameworks show up rather than trying to detect anything on npm.
174
+ */
175
+ function deriveStack(pkg) {
176
+ const deps = {
177
+ ...pkg?.dependencies,
178
+ ...pkg?.devDependencies
179
+ };
180
+ return KNOWN_STACK_DEPS.filter((name) => name in deps);
181
+ }
182
+ /** The provider capability keys actually wired in `providers: {}` — zero heuristics. */
183
+ function deriveCapabilities(providers) {
184
+ return Object.keys(providers ?? {}).sort();
185
+ }
186
+ /**
187
+ * `source` + `ci` are the minimal baseline every repo `holocron setup`
188
+ * touches wires — every `holocron.config.ts` in this org already satisfies
189
+ * this, so `non-compliant` here means drift (a provider manually removed
190
+ * after setup), not an unmet aspirational policy. Deliberately not a richer
191
+ * per-profile policy yet (e.g. "a `library` must have `deployment`") — that's
192
+ * a Phase B (GitHub App) refinement once it can post *why* on a check run.
193
+ */
194
+ const REQUIRED_BASELINE = ["source", "ci"];
195
+ function deriveCompliance(capabilities) {
196
+ return REQUIRED_BASELINE.every((key) => capabilities.includes(key)) ? "compliant" : "non-compliant";
197
+ }
198
+ /**
199
+ * The Phase B refinement `deriveCompliance()`'s own doc comment names —
200
+ * *why* a repo is non-compliant, not just that it is. `[]` when compliant.
201
+ * Same `REQUIRED_BASELINE` `deriveCompliance()` checks against — one
202
+ * table, not two independently-maintained baselines.
203
+ */
204
+ function missingCapabilities(capabilities) {
205
+ return REQUIRED_BASELINE.filter((key) => !capabilities.includes(key));
206
+ }
207
+ /**
208
+ * Reads each workspace package's actual `package.json` content (not just
209
+ * `readWorkspacePackages()`'s `{ slug, name, dir }` — `deriveProfile()`'s
210
+ * `platform` detection needs `bin`, which that helper doesn't carry).
211
+ * Missing/invalid files are skipped, matching `readWorkspacePackages()`'s
212
+ * own soft-fail behavior.
213
+ */
214
+ async function readWorkspacePackageJsons(repoRoot, workspacePackages) {
215
+ const results = [];
216
+ for (const { slug, dir = "packages" } of workspacePackages) try {
217
+ const raw = await readFile(join(repoRoot, dir, slug, "package.json"), "utf8");
218
+ results.push(JSON.parse(raw));
219
+ } catch {}
220
+ return results;
221
+ }
222
+ //#endregion
116
223
  //#region src/config/config.ts
117
224
  var ConfigError = class extends Error {
118
225
  name = "ConfigError";
@@ -389,4 +496,4 @@ function parseGitRemoteUrl(url) {
389
496
  if (sshMatch) return sshMatch[1];
390
497
  }
391
498
  //#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 };
499
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/cli",
3
- "version": "5.0.0-alpha.17",
3
+ "version": "5.0.0-alpha.19",
4
4
  "description": "The Holocron CLI - a pluggable, capability-based orchestrator for spinning up and operating software projects.",
5
5
  "keywords": [
6
6
  "cli",
@@ -47,8 +47,8 @@
47
47
  "@sentry/node": "^10.70.0",
48
48
  "@theholocron/components-doc": "^1.6.0",
49
49
  "@theholocron/env-utils": "^1.6.0",
50
- "@theholocron/github-client": "^1.18.0",
51
- "@theholocron/http-client": "^1.18.0",
50
+ "@theholocron/github-client": "^1.19.0",
51
+ "@theholocron/http-client": "^1.19.0",
52
52
  "@theholocron/observability": "^0.3.0",
53
53
  "@theholocron/registry-doc": "^1.12.0",
54
54
  "chalk": "^6.0.0",
@@ -57,8 +57,8 @@
57
57
  "pino-pretty": "^13.1.3",
58
58
  "posthog-node": "^5.51.6",
59
59
  "yargs": "^18.1.0",
60
- "@theholocron/astromech": "5.0.0-alpha.17",
61
- "@theholocron/datapad": "5.0.0-alpha.17"
60
+ "@theholocron/astromech": "5.0.0-alpha.19",
61
+ "@theholocron/datapad": "5.0.0-alpha.19"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@theholocron/eslint-config": "^8.0.0",
@@ -75,7 +75,7 @@
75
75
  "tsx": "4.23.12",
76
76
  "typescript": "^5.9.3",
77
77
  "vitest": "^4.1.11",
78
- "@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.17"
78
+ "@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.19"
79
79
  },
80
80
  "engines": {
81
81
  "node": ">=22.0.0"