@theholocron/cli 5.0.0-alpha.54 → 5.0.0-alpha.56

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
@@ -3,6 +3,7 @@ import { AuthError, RequestOptions, ResolveTokenConfig as ResolveTokenConfig$1,
3
3
  import { ConfigFileError } from "@theholocron/datapad";
4
4
  import { WorkspacePackage } from "@theholocron/astromech";
5
5
  import { LogLevel } from "@theholocron/observability/core";
6
+ import { QualifiedConfig } from "@commitlint/types";
6
7
  //#region src/auth/auth-resolver.d.ts
7
8
  type ResolveTokenConfig = Omit<ResolveTokenConfig$1, "getKeyringToken">;
8
9
  /** Wraps `createResolveToken` from `@theholocron/http` and injects the
@@ -616,6 +617,22 @@ declare function missingCapabilities(capabilities: readonly string[]): string[];
616
617
  */
617
618
  declare function readWorkspacePackageJsons(repoRoot: string, workspacePackages: readonly WorkspacePackage[]): Promise<PackageJsonLike[]>;
618
619
  //#endregion
620
+ //#region src/commit-lint/lint-message.d.ts
621
+ interface CommitMessageViolation {
622
+ /** Rule name, e.g. `"subject-empty"`. */
623
+ rule: string;
624
+ /** commitlint's own message for the failure, e.g. `"subject may not be empty"`. */
625
+ message: string;
626
+ }
627
+ declare function lintCommitMessage(message: string, loaded: QualifiedConfig): Promise<CommitMessageViolation[]>;
628
+ //#endregion
629
+ //#region src/commit-lint/lint-commit-msg-file.d.ts
630
+ interface LintCommitMsgFileResult {
631
+ valid: boolean;
632
+ violations: CommitMessageViolation[];
633
+ }
634
+ declare function lintCommitMsgFile(filePath: string, cwd?: string): Promise<LintCommitMsgFileResult>;
635
+ //#endregion
619
636
  //#region src/config/compose.d.ts
620
637
  type TaskEntry = NonNullable<HolocronConfig["tasks"]>[number];
621
638
  /** A single composable capability fragment. */
@@ -694,4 +711,4 @@ interface LoadedConfig {
694
711
  */
695
712
  declare function loadConfig(cwd: string): Promise<LoadedConfig>;
696
713
  //#endregion
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, DeployFunctionConfig, DeployFunctionResult, DeployScriptConfig, DeployScriptResult, Deployment, DeploymentProject, DeploymentProjectSettings, DeploymentRecord, DeploymentTarget, DeploymentTrigger, DeriveProfileInput, Dns, DnsRecord, DnsRecordRequest, 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, WikiProvisionOpts, WikiProxyConfig, Workers, WorkflowWithConfig, compose, createFeatureResolver, createResolveToken, createRestClient, defineConfig, deleteToken, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, getToken, isMulti, listStoredProviders, loadConfig, missingCapabilities, readWorkspacePackageJsons, resolveConfig, resolveEntry, resolvePluginPackage, setToken };
714
+ export { 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, EnsureResult, EnvConfig, Environment, EnvironmentReviewer, Environments, Errors, FeatureResolverConfig, HolocronConfig, HolocronProfile, Issue, IssueSearchFilter, Issues, LabelDef, LifecycleResult, LifecycleSlot, LintCommitMsgFileResult, 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, WikiProvisionOpts, WikiProxyConfig, Workers, WorkflowWithConfig, compose, createFeatureResolver, createResolveToken, createRestClient, defineConfig, deleteToken, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, getToken, isMulti, lintCommitMessage, lintCommitMsgFile, listStoredProviders, loadConfig, missingCapabilities, readWorkspacePackageJsons, resolveConfig, resolveEntry, resolvePluginPackage, setToken };
package/dist/index.mjs CHANGED
@@ -4,6 +4,8 @@ import { createEnvLookup } from "@theholocron/env-utils";
4
4
  import { Entry, findCredentials } from "@napi-rs/keyring";
5
5
  import { readFile } from "node:fs/promises";
6
6
  import { basename, dirname, join } from "node:path";
7
+ import load from "@commitlint/load";
8
+ import lint from "@commitlint/lint";
7
9
  import { execFile } from "node:child_process";
8
10
  import { promisify } from "node:util";
9
11
  import { loadTasksConfig } from "@theholocron/astromech/config";
@@ -220,6 +222,63 @@ async function readWorkspacePackageJsons(repoRoot, workspacePackages) {
220
222
  return results;
221
223
  }
222
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
223
282
  //#region src/config/config.ts
224
283
  var ConfigError = class extends Error {
225
284
  name = "ConfigError";
@@ -496,4 +555,4 @@ function parseGitRemoteUrl(url) {
496
555
  if (sshMatch) return sshMatch[1];
497
556
  }
498
557
  //#endregion
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 };
558
+ export { AuthError, CARDINALITY, ConfigError, ConfigFileError, ProviderApiError, REQUIRED_CAPABILITIES, WebhookVerificationError, compose, createFeatureResolver, createResolveToken, createRestClient, defineConfig, deleteToken, deriveCapabilities, deriveCompliance, deriveProfile, deriveStack, getToken, isMulti, lintCommitMessage, lintCommitMsgFile, 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.54",
3
+ "version": "5.0.0-alpha.56",
4
4
  "description": "The Holocron CLI - a pluggable, capability-based orchestrator for spinning up and operating software projects.",
5
5
  "keywords": [
6
6
  "cli",
@@ -41,6 +41,9 @@
41
41
  ],
42
42
  "dependencies": {
43
43
  "@axiomhq/pino": "^2.0.0",
44
+ "@commitlint/lint": "^21.2.3",
45
+ "@commitlint/load": "^21.2.3",
46
+ "@commitlint/types": "^21.2.3",
44
47
  "@inquirer/prompts": "^8.5.2",
45
48
  "@inquirer/search": "^4.3.3",
46
49
  "@napi-rs/keyring": "^1.3.0",
@@ -57,10 +60,12 @@
57
60
  "pino-pretty": "^13.1.3",
58
61
  "posthog-node": "^5.51.6",
59
62
  "yargs": "^18.1.0",
60
- "@theholocron/astromech": "5.0.0-alpha.54",
61
- "@theholocron/datapad": "5.0.0-alpha.54"
63
+ "@theholocron/astromech": "5.0.0-alpha.56",
64
+ "@theholocron/datapad": "5.0.0-alpha.56"
62
65
  },
63
66
  "devDependencies": {
67
+ "@commitlint/config-conventional": "^21.2.3",
68
+ "@theholocron/commitlint-config": "^8.4.5",
64
69
  "@theholocron/eslint-config": "^8.4.5",
65
70
  "@theholocron/tsconfig": "^8.4.5",
66
71
  "@theholocron/vitest-config": "^8.4.5",
@@ -75,7 +80,7 @@
75
80
  "tsx": "4.23.12",
76
81
  "typescript": "^5.9.3",
77
82
  "vitest": "^4.1.11",
78
- "@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.54"
83
+ "@theholocron/rollup-plugin-transform-template": "5.0.0-alpha.56"
79
84
  },
80
85
  "engines": {
81
86
  "node": ">=22.0.0"