@prata.ma/anvil-commit
v0.2.8
Published
Shared commitlint configuration for Anvil-governed workspaces.
Readme
@prata.ma/anvil-commit
Shared commitlint configuration for Anvil-governed workspaces.
Overview
@prata.ma/anvil-commit owns the reusable commitlint setup used across this workspace. It combines the conventional commitlint base config with Anvil- or vault-derived commit types and scopes, and it exposes helpers for loading that config from a repo root.
Within the monorepo and for external consumers, this package is the supported boundary for commit-message rules and prompt metadata. Consumers should import @prata.ma/anvil-commit rather than rebuilding commitlint behavior from anvil.yaml, vault.yaml, or workspace manifests directly.
Installation
Install the package from npm when using the shared commitlint surface outside this monorepo.
npm
{
"dependencies": {
"@prata.ma/anvil-commit": "^0.0.0"
}
}Usage
The main usage path is to re-export the package default from a repo-level commitlint.config.ts. Library consumers can also call the exported helpers directly when they need to inspect or assemble commit config programmatically.
Library
import config, {
createCommitlintConfig,
resolveCommitScopes,
resolveCommitTypes,
} from '@prata.ma/anvil-commit'
export default config
const custom = createCommitlintConfig({ cwd: process.cwd() })
const scopes = await resolveCommitScopes(process.cwd())
const types = resolveCommitTypes(process.cwd())Patterns
Use the package from the workspace root so scope resolution can read pnpm-workspace.yaml, anvil.yaml, or the legacy vault.yaml fallback correctly.
External consumers can re-export the package directly from a repo-level commitlint.config.ts. This repo keeps a local-source import in its own root config so fresh GitHub runners do not need the package to be built before commit hooks run.
import config from '@prata.ma/anvil-commit'
export default configAPI
@prata.ma/anvil-commit exposes one documented import path and a small set of helpers for building commitlint config from observable workspace files.
Exports
@prata.ma/anvil-commit- default commitlint config plus exported helper functions and typescreateCommitlintConfig(options)- builds a commitlintUserConfigfor a target working directoryresolveCommitTypes(cwd)- merges built-in commit types with manifest-defined additionsresolveCommitScopes(cwd)- resolves scopes from the root package name, workspace package names, manifest-defined scopes, and*loadCommitConfig(cwd)- loads commit config fromanvil.yaml, thenvault.yaml, or returns an empty resultloadVaultConfig(cwd)- reads legacyvault.yamlcommit config directlyresolveWorkspaceProjectNames(cwd)- resolves workspace project names frompnpm-workspace.yamlor root-package fallback- Exported types:
CommitConfigLoadResult,CommitType,CreateCommitlintConfigOptions,PromptTypeOption, andVaultConfig
Configuration
anvil.yamlis the preferred config source when present.vault.yamlremains the fallback for older vault-style repos.- the root
package.jsonname contributes the repo-root scope when present. pnpm-workspace.yamlpackage patterns drive workspace package scope discovery when available.- Built-in commit types from
src/defaults.tsare always present unless a consumer post-processes the returned config itself.
Development
Use the package-local scripts while working in @packages/anvil-commit, and keep commitlint behavior in importable functions rather than burying it inside repo-local config files.
This package now participates in the repo's Changesets, npm publish, and GitHub Release automation as a package-scoped public surface. The package-local release:check script remains the focused validation contract for this package.
Commands
pnpm --filter @prata.ma/anvil-commit release:check
pnpm --filter @prata.ma/anvil-commit build
pnpm --filter @prata.ma/anvil-commit lint
pnpm --filter @prata.ma/anvil-commit test
pnpm --filter @prata.ma/anvil-commit test:typeTesting
The Vitest coverage focuses on manifest loading, anvil.yaml versus vault.yaml precedence, workspace package-name discovery, and dynamic scope generation.
Conventions
- Keep the default export aligned with
createCommitlintConfig()so the package remains usable as a drop-incommitlint.config.tssource. - Treat
anvil.yamlas the primary config surface and preservevault.yamlsupport only as an explicit compatibility fallback. - Keep workspace-scope discovery deterministic because it feeds commitlint validation and prompt choices.
Status
This package is active and supports the workspace's shared commit configuration boundary.
Maturity
@prata.ma/anvil-commit is active and publish-prepared as a reusable package.
Scope
The package currently supports commitlint config generation, manifest-backed type and scope loading, and workspace package-name discovery. It does not own Husky hooks, lint-staged orchestration, or git workflow policy beyond the commitlint configuration it exports.
Notes
@prata.ma/anvil-commitnow ships a packageCHANGELOG.mdand participates in the repo's multi-package release workflow alongside@prata.ma/anvil.- The only documented import path is
@prata.ma/anvil-commit; internal source files and non-exported internal types are not stable public API. - This repo's root
commitlint.config.tsstill imports./@packages/anvil-commit/src/indexdirectly as a fresh-runner bootstrap optimization for CI and release PR hooks. - Repo state currently records a known
@prata.ma/anvil-committest assertion around workspace project-name ordering during broader test runs.
