# author/ Interactive commit authoring session. ## Overview Step-sequenced session that accumulates a conventional commit draft field-by-field (type → scope → subject → body → breaking → issues), renders a preview, and (by default) executes `git commit`. Each step is a small pure-ish function operating over a shared [`SessionContext`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-SessionContext); the runner walks the list, honors [`goto`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-goto) jumps (used by the preview's "commit this message? no" restart), and surfaces Ctrl-C as a [`cancelled`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-cancelled) outcome. ```mermaid flowchart LR subgraph Config CL[config-loader] RC[resolve-config] end subgraph Resolvers SP[staged-paths] SD[scope-discovery] DS[default-scope] end subgraph Steps RS[resolve-scope] T[type] S[scope] SUB[subject] B[body] BR[breaking] I[issues] P[preview] C[commit] end subgraph Runner CS[create-session] RUN[run-session] end CL --> RC --> CS CS --> RUN RS --> T --> S --> SUB --> B --> BR --> I --> P --> C P -. "no → goto" .-> T RS -.uses.-> SP RS -.uses.-> SD RS -.uses.-> DS ``` ## API | Export | Description | | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [`createAuthorSession`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-createAuthorSession) | Build a session from a partial config (steps default to [`conventionalPreset`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-conventionalPreset)) | | [`runAuthorSession`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-runAuthorSession) | Execute the session; returns `{ status: 'committed' \| 'cancelled', message? }` | | [`loadCommitConfig`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-loadCommitConfig) | Discover `commit.config.{js,mjs,cjs}` upward from [`cwd`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-LoadCommitConfigOptions-prop-cwd) | | [`resolveSessionConfig`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-resolveSessionConfig) | Overlay a partial config on the built-in defaults | | [`conventionalPreset`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-conventionalPreset) | Default ordered step list (D8) | | Individual steps | [`resolveScopeStep`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-resolveScopeStep), [`typeStep`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-typeStep), [`scopeStep`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-scopeStep), [`subjectStep`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-subjectStep), [`bodyStep`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-bodyStep), [`breakingStep`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-breakingStep), [`issuesStep`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-issuesStep), [`previewStep`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-previewStep), [`commitStep`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-commitStep) | | [`SessionConfig`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-SessionConfig) | Fully resolved config type consumed by the runner | | [`SessionContext`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-SessionContext) | Mutable container threaded through every step | ## Configuration The `commit.config.{js,mjs,cjs}` file exports a [`PartialSessionConfig`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-PartialSessionConfig): ```javascript // commit.config.cjs module.exports = { types: [ { name: 'feat', description: 'A new feature' }, { name: 'fix', description: 'A bug fix' }, ], scopeMulti: false, scopeOptional: false, // Filter discovered projects; receives { path, name } per candidate scopeFilter: ({ path }) => !path.includes('/__fixtures__/'), headerMaxLength: 72, // Ruleset reused by the `cl` validator bin and the preview step validateRuleset: { 'type-enum': ['error', { types: ['feat', 'fix', 'docs', 'chore'] }], 'subject-empty': ['error'], 'header-max-length': ['warn', { maxLength: 72 }], 'imperative-mood': ['warn'], }, skipCommit: false, } ``` Key fields: | Field | Behaviour | | ----------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [`types`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-SessionConfig-prop-types) | Conventional types shown in the `type` step (falls back to the 11-entry Conventional list) | | [`scopeFilter`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-SessionConfig-prop-scopeFilter) | Exclude discovered projects from the scope picker by [`path`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-ScopeFilterContext-prop-path)/[`name`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-ScopeFilterContext-prop-name) | | [`headerMaxLength`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-SessionConfig-prop-headerMaxLength) | Drives the live countdown in the [`subject`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-subjectStep) step (green → yellow → red); `null` disables | | [`validateRuleset`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-SessionConfig-prop-validateRuleset) | Shared with [`cl`](https://github.com/AndrewRedican/hyperfrontend/blob/main/libs/versioning/src/bin/cl.ts) and the preview step; see `commits/validate` presets | | [`skipCommit`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-SessionConfig-prop-skipCommit) | When true, the session returns the formatted message without touching the git index | | [`commitExecutor`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-SessionConfig-prop-commitExecutor) | Inject a custom executor (e.g. signed commits, alternate cwd) instead of the default | Resolution: 1. `--config ` override (relative paths resolve against [`cwd`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-LoadCommitConfigOptions-prop-cwd)) 2. Walk upward from [`cwd`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-LoadCommitConfigOptions-prop-cwd) looking for one of `commit.config.{js,mjs,cjs}` 3. Stop at a workspace boundary (`.git/`, `pnpm-workspace.yaml`) ## Usage ```typescript import { createAuthorSession, runAuthorSession } from '@hyperfrontend/versioning/commits/author' const session = createAuthorSession({ config: { skipCommit: false } }) const outcome = await runAuthorSession(session) if (outcome.status === 'committed') { console.log('Committed:', outcome.message) } else { console.error('Cancelled:', outcome.error?.message ?? '') process.exit(130) } ``` ## Design Decisions - **D8**: Step order: `resolve-scope → type → scope → subject → body → breaking → issues → preview → commit` - **D15c**: Commit execution is default-on; inject [`skipCommit`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-SessionConfig-prop-skipCommit) / [`commitExecutor`](https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/#api-SessionConfig-prop-commitExecutor) to override - **D17a**: Config file lives at workspace root (not in `package.json`) - **E1a**: Empty staging refuses with an error; bins translate that to a non-zero exit code ## API Reference ### Functions #### cancelled ```typescript function cancelled(error?: Error): StepResult ``` Helper for building a `cancelled` result with an optional error. **Parameters** | Name | Type | Description | | --- | --- | --- | | `error?` | `Error` | Cause of cancellation attached to the result (omit when the user aborted cleanly) | **Returns** `StepResult`: Step result that stops the session **Example: Cancelling after an executor throws** ```typescript try { await executor() } catch (err) { return cancelled(err as Error) } ``` #### createAuthorSession ```typescript function createAuthorSession(options: CreateAuthorSessionOptions): AuthorSession ``` Prepares an authoring session without executing it. The returned object carries a resolved `config` (defaults filled in) and the effective step list, allowing bin wrappers to introspect before running. **Parameters** | Name | Type | Description | | --- | --- | --- | | `options` | `CreateAuthorSessionOptions` | Optional overrides for steps and partial config (default: `{}`) | **Returns** `AuthorSession`: Session description consumable by `runAuthorSession` **Example: Using the conventional preset and default config** ```typescript const session = createAuthorSession() await runAuthorSession(session) ``` **Example: Overriding only the validate ruleset** ```typescript createAuthorSession({ config: { validateRuleset: customRuleset } }) ``` #### createSessionContext ```typescript function createSessionContext(config: SessionConfig): SessionContext ``` Creates a fresh session context seeded with an empty draft. **Parameters** | Name | Type | Description | | --- | --- | --- | | `config` | `SessionConfig` | Resolved session configuration | **Returns** `SessionContext`: Session context ready for the first step **Example: Creating a bare context** ```typescript createSessionContext(config) // => { draft: {}, candidateScopes: [], defaultScope: undefined, config } ``` #### defaultScope ```typescript function defaultScope(candidates: unknown): string ``` Computes the default scope to pre-select in the `scope` step. Algorithm (matches locked decision D3): 1. A single candidate wins outright. 2. Otherwise, if one candidate's path is a prefix of every other candidate's path, that nearest common ancestor wins. 3. Otherwise, there is no default. **Parameters** | Name | Type | Description | | --- | --- | --- | | `candidates` | `unknown` | Scopes produced by `discoverScopes` | **Returns** `string`: Scope name to pre-select, or undefined when no default is resolvable **Example: Single owner wins** ```typescript defaultScope([{ name: 'alpha', path: '/repo/libs/alpha' }]) // => 'alpha' ``` **Example: Common ancestor wins** ```typescript defaultScope([ { name: 'root', path: '/repo' }, { name: 'alpha', path: '/repo/libs/alpha' }, ]) // => 'root' ``` **Example: Disjoint ownership has no default** ```typescript defaultScope([ { name: 'alpha', path: '/repo/libs/alpha' }, { name: 'beta', path: '/repo/libs/beta' }, ]) // => undefined ``` #### discoverScopes ```typescript function discoverScopes(stagedPaths: unknown, options: DiscoverScopesOptions): unknown ``` Resolves each staged path to its owning project by walking upward to the nearest `project.json` / `package.json`, reads the `name` field, and returns the unique set as `DiscoveredScope` entries. Entries inside `node_modules` or `.git` are dropped before walking; the caller's `scopeFilter` is applied after collection. **Parameters** | Name | Type | Description | | --- | --- | --- | | `stagedPaths` | `unknown` | Paths emitted by the staged-paths provider (relative or absolute) | | `options` | `DiscoverScopesOptions` | Filter + cwd configuration | **Returns** `unknown`: Unique scopes in staging order (first appearance wins) **Example: Discovering scopes for a set of staged files** ```typescript discoverScopes(['libs/versioning/src/a.ts', 'libs/questions/src/b.ts'], { cwd: '/repo' }) // => [ // { name: '@hyperfrontend/versioning', path: '/repo/libs/versioning' }, // { name: '@hyperfrontend/questions', path: '/repo/libs/questions' }, // ] ``` #### done ```typescript function done(): StepResult ``` Helper for building a `done` result. **Returns** `StepResult`: Step result that advances the runner to the next step **Example: Returning done from a step** ```typescript async run(): Promise { return done() } ``` #### getStagedPaths ```typescript function getStagedPaths(options: StagedPathsOptions): unknown ``` Default staged-paths provider. Resolves the repository root via `git rev-parse --show-toplevel`, reads `git diff --cached --name-only -z`, and returns each staged path as an absolute path anchored at that root. Git emits staged paths relative to the repository root no matter which directory the command runs from, so anchoring here keeps downstream project-root discovery correct when the session cwd is a subdirectory. **Parameters** | Name | Type | Description | | --- | --- | --- | | `options` | `StagedPathsOptions` | Resolver options (cwd, optional timeout) | **Returns** `unknown`: Absolute staged file paths **Example: Reading the current staging area from a subdirectory** ```typescript getStagedPaths({ cwd: '/repo/apps/demo' }) // => ['/repo/libs/versioning/src/commits/author/index.ts'] ``` #### goto ```typescript function goto(stepId: string): StepResult ``` Helper for building a `goto` result pointing at the supplied step id. **Parameters** | Name | Type | Description | | --- | --- | --- | | `stepId` | `string` | Target step id the runner should jump to | **Returns** `StepResult`: Step result that redirects the runner to the named step **Example: Sending the runner back to the `type` step** ```typescript return goto('type') ``` #### loadCommitConfig ```typescript function loadCommitConfig(options: LoadCommitConfigOptions): Promise ``` Loads the user's commit config. Resolution: 1. `overridePath` wins when set 2. Otherwise walk upward from `cwd` looking for one of `CONFIG_FILE_NAMES` until a workspace boundary marker (`.git`, `pnpm-workspace.yaml`) is hit 3. Missing config is not an error: `config` becomes `{}` **Parameters** | Name | Type | Description | | --- | --- | --- | | `options` | `LoadCommitConfigOptions` | Search inputs | **Returns** `Promise`: Loaded partial config plus the file it came from (if any) **Example: Auto-discovery from cwd** ```typescript const { config, sourcePath } = await loadCommitConfig({ cwd: process.cwd() }) ``` #### normalizeSubject ```typescript function normalizeSubject(raw: string): string ``` Applies subject normalisation rules (decision D10): trim edges and strip a single trailing period. **Parameters** | Name | Type | Description | | --- | --- | --- | | `raw` | `string` | Subject string as entered by the user | **Returns** `string`: Normalized subject **Example: Stripping whitespace and a trailing period** ```typescript normalizeSubject(' add login flow. ') // => 'add login flow' ``` #### parseReferences ```typescript function parseReferences(raw: string): unknown ``` Parses a free-form references string into issue footers. Accepts commas, semicolons, or whitespace between entries; ignores tokens that don't match the `keyword #number` shape. **Parameters** | Name | Type | Description | | --- | --- | --- | | `raw` | `string` | Raw user input from the issues prompt | **Returns** `unknown`: Footers matching each recognized reference **Example: Parsing a mixed references string** ```typescript parseReferences('fixes #123, re #456') // => [ // { key: 'Fixes', value: '123', separator: ' #' }, // { key: 'Re', value: '456', separator: ' #' }, // ] ``` #### resolveSessionConfig ```typescript function resolveSessionConfig(overrides: PartialSessionConfig): SessionConfig ``` Overlays a partial config over the built-in defaults, producing a fully populated `SessionConfig` usable by the runner. **Parameters** | Name | Type | Description | | --- | --- | --- | | `overrides` | `PartialSessionConfig` | Partial config supplied by the caller (may be undefined) (default: `{}`) | **Returns** `SessionConfig`: Fully resolved configuration **Example: Resolving with no overrides** ```typescript resolveSessionConfig() // => { types: DEFAULT_SESSION_TYPES, scopeOptional: false, ... } ``` #### runAuthorSession ```typescript function runAuthorSession(session: AuthorSession): Promise ``` Executes the session step-by-step. Handles `goto` jumps, surfaces Ctrl-C cancellations as `{ status: 'cancelled' }` outcomes, and (on success) returns the final formatted message alongside the `committed` status. **Parameters** | Name | Type | Description | | --- | --- | --- | | `session` | `AuthorSession` | Session description produced by `createAuthorSession` | **Returns** `Promise`: Terminal outcome describing how the session ended **Example: Running a session to completion** ```typescript const session = createAuthorSession({ config: { skipCommit: true } }) const outcome = await runAuthorSession(session) // => { status: 'committed', message: 'feat: ...' } ``` #### typeToChoice ```typescript function typeToChoice(type: SessionType): Choice ``` Maps a `SessionType` to a `Choice` usable by the `select` prompt. **Parameters** | Name | Type | Description | | --- | --- | --- | | `type` | `SessionType` | Session type entry to render as a selectable choice | **Returns** `Choice`: Choice with the type name as both label and value, plus an optional hint **Example: Rendering the feat type as a select choice** ```typescript typeToChoice({ name: 'feat', description: 'A new feature' }) // => { label: 'feat', value: 'feat', hint: 'A new feature' } ``` ### Interfaces #### AuthorSession Prepared session ready to be handed to `runAuthorSession`. Contains the fully resolved config and the ordered step list that will be executed. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly steps` | `unknown` | Ordered step list the runner will iterate | | `readonly config` | `SessionConfig` | Fully resolved session configuration | #### CreateAuthorSessionOptions Inputs accepted by `createAuthorSession`: the caller may supply their own step list; anything missing is resolved against the defaults used by the conventional preset. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly steps?` | `unknown` | Override for the step sequence; defaults to `conventionalPreset` | | `readonly config?` | `PartialSessionConfig` | Partial configuration overlaid on the built-in defaults | #### DiscoveredScope Single discovered scope with the project root it came from. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly name` | `string` | Scope identifier (the project's `name` field) | | `readonly path` | `string` | Absolute path to the owning project root | #### DiscoverScopesOptions Options controlling `discoverScopes`. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly scopeFilter?` | `(context: ScopeFilterContext) => boolean` | Optional caller-provided filter; applied after built-in exclusions | | `readonly cwd` | `string` | Working directory that staged paths are resolved against | #### LoadCommitConfigOptions Inputs accepted by `loadCommitConfig`. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly cwd` | `string` | Directory to start the upward search from | | `readonly overridePath?` | `string` | Explicit override path from `--config `, resolved against `cwd` when relative | #### LoadedCommitConfig Return shape of `loadCommitConfig`. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly config` | `PartialSessionConfig` | Resolved configuration (empty object when no config was found) | | `readonly sourcePath?` | `string` | Absolute path of the config file that was loaded (undefined when nothing was found) | #### ScopeFilterContext Signature for the scope filter passed in `SessionConfig.scopeFilter`. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly path` | `string` | Absolute path to the discovered project root | | `readonly name` | `string` | `name` field read from `project.json` (or `package.json` as fallback) | #### SessionConfig Fully resolved authoring session configuration. Consumers typically supply a partial shape: the config loader (or `createAuthorSession`) fills the gaps with defaults before handing the result to the runner. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly types` | `unknown` | Commit type enum shown in the `type` step | | `readonly scopeFilter?` | `(context: ScopeFilterContext) => boolean` | Optional filter applied to discovered scopes; receives `{ path, name }` | | `readonly scopeOptional` | `boolean` | When true, the `scope` step may be skipped even if no candidates are found | | `readonly scopeMulti` | `boolean` | When true, the `scope` step collects multiple scopes via multiselect | | `readonly stagedPathsProvider` | `StagedPathsProvider` | Resolver for the staged file list; defaults to `git diff --cached --name-only -z` | | `readonly cwd` | `string` | Working directory used for git operations and scope discovery | | `readonly headerMaxLength` | `number` | Maximum header length used by the subject countdown (null disables) | | `readonly imperativeWordlist` | `Readonly>` | Wordlist used by the imperative-mood rule in inline validation | | `readonly skipCommit` | `boolean` | When true, the final `commit` step is a no-op (session returns the message only) | | `readonly commitExecutor?` | `CommitExecutor` | Overrides the default `git commit` executor | | `readonly validateRuleset` | `Ruleset` | Validation ruleset used for inline and preview-time warnings | | `readonly input?` | `ReadStream` | Optional stream override passed to every prompt in the session | | `readonly output?` | `WriteStream` | Optional stream override passed to every prompt in the session | #### SessionContext Mutable container threaded through every step. The `draft` field accumulates the in-progress commit message; `candidateScopes`/`defaultScope` are filled by the `resolve-scope` step and consumed by later steps. `config` is the fully resolved `SessionConfig` shared across the session. **Properties** | Name | Type | Description | | --- | --- | --- | | `draft` | `CommitDraft` | In-progress commit draft accumulated as steps execute | | `candidateScopes` | `unknown` | Scopes discovered from the staged file set (may be empty) | | `defaultScope` | `string` | Default scope pre-selected by the `scope` step (undefined = no default) | | `readonly config` | `SessionConfig` | Resolved configuration for the session | #### SessionOutcome Terminal outcome returned by `runAuthorSession`. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly status` | `SessionStatus` | Status tag describing how the session ended | | `readonly message?` | `string` | Formatted commit message (populated whenever the draft reached the preview step) | | `readonly error?` | `Error` | Error attached when the session cancelled due to an explicit failure | #### SessionType Conventional-commit type entry shown in the `type` step's choice list. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly name` | `string` | Bare identifier (e.g. `feat`, `fix`) | | `readonly description?` | `string` | Short description rendered as a prompt hint | #### StagedPathsOptions Options accepted by the default staged-paths provider. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly cwd` | `string` | Working directory used as the git command cwd | | `readonly timeout?` | `number` | Timeout in milliseconds (default: 30000) | #### Step A named step in an authoring session. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly id` | `string` | Stable identifier used by `goto` and for debugging | ##### run ```typescript run(ctx: SessionContext): Promise ``` Runs the step against the session context; may mutate `ctx.draft` **Parameters** | Name | Type | Description | | --- | --- | --- | | `ctx` | `SessionContext` | | #### StepResult Outcome produced by a step implementation. **Properties** | Name | Type | Description | | --- | --- | --- | | `readonly status` | `StepStatus` | Status tag used by the runner to decide how to proceed | | `readonly gotoStepId?` | `string` | Target step id when `status === 'goto'` | | `readonly error?` | `Error` | Error attached when `status === 'cancelled'` | ### Types #### CommitExecutor Signature for executing the final git commit. ```typescript type CommitExecutor = (message: string) => void | Promise ``` #### PartialSessionConfig Partial shape accepted by `createAuthorSession`/`loadCommitConfig`. ```typescript type PartialSessionConfig = Partial ``` #### SessionStatus Session outcome status constants. ```typescript type SessionStatus = Readonly<{ Cancelled: "cancelled"; Committed: "committed" }> ``` #### StagedPathsProvider Signature for resolving the staged file paths the session operates on. ```typescript type StagedPathsProvider = (options: StagedPathsProviderOptions) => unknown ``` #### StepStatus Result status constants returned by steps. ```typescript type StepStatus = Readonly<{ Cancelled: "cancelled"; Done: "done"; Goto: "goto" }> ``` ### Variables #### bodyStep Step that prompts for an optional commit body. Empty input leaves `draft.body` unset (the formatter then omits the body section). ```typescript const bodyStep: Step ``` **Value** `...` #### breakingStep Step that asks whether the commit introduces a breaking change. A positive answer follows up with a description prompt; the description is written to `draft.breakingDescription` and is eventually synthesized into a `BREAKING CHANGE:` footer by `formatCommitMessage`. ```typescript const breakingStep: Step ``` **Value** `...` #### commitStep Step that renders the draft one last time and hands the message to the configured commit executor. When `config.skipCommit` is true the step short-circuits so the caller receives the formatted message without touching the working tree. ```typescript const commitStep: Step ``` **Value** `...` #### CONFIG_FILE_NAMES Supported config file names, searched in this order per directory. ```typescript const CONFIG_FILE_NAMES: unknown ``` **Value** `...` #### conventionalStepPreset Default ordered step list used by `createAuthorSession` when the caller does not supply their own sequence. Matches decision D8: `resolve-scope → type → scope → subject → body → breaking → issues → preview → commit`. ```typescript const conventionalStepPreset: unknown ``` **Value** `...` #### DEFAULT_SESSION_TYPES Default type enum rendered by the `type` step when the caller does not supply their own list. Each conventional type is paired with a short hint. ```typescript const DEFAULT_SESSION_TYPES: unknown ``` **Value** `...` #### EMPTY_STAGING_MESSAGE Error thrown to the runner when the staging area is empty. ```typescript const EMPTY_STAGING_MESSAGE: "No staged changes; stage something first." ``` **Value** `'No staged changes; stage something first.'` #### issuesStep Step that optionally collects issue references (e.g. `fixes #123, re #456`) and appends them to `draft.footers` using the ` #` separator form. The step is additive: existing footers stay, and any breaking-change footer synthesized later by the formatter is unaffected. ```typescript const issuesStep: Step ``` **Value** `...` #### NO_SCOPE_CANDIDATES_MESSAGE Error thrown when the scope step cannot proceed because no candidates were found. ```typescript const NO_SCOPE_CANDIDATES_MESSAGE: "No scope candidates were discovered. Either stage a file under a project or set scopeOptional: true." ``` **Value** `'No scope candidates were discovered. Either stage a file under a project or set scopeOptional: true.'` #### PREVIEW_RESTART_STEP_ID Step id the preview jumps back to when the user rejects the draft. ```typescript const PREVIEW_RESTART_STEP_ID: "type" ``` **Value** `'type'` #### previewStep Step that renders the accumulated draft as the final commit message and asks the user to confirm. A negative answer jumps back to the `type` step while keeping the draft intact for round-trip editing. Validation warnings are printed before the prompt. ```typescript const previewStep: Step ``` **Value** `...` #### resolveScopeStep Non-prompt step that computes the candidate scope list and default scope. Calls `config.stagedPathsProvider()` → `discoverScopes` → `defaultScope` and writes the results into the context. Cancels the session when the staging area is empty (decision E1a). ```typescript const resolveScopeStep: Step ``` **Value** `...` #### scopeStep Step that prompts the user to pick the commit scope(s) from the candidate list discovered by `resolve-scope`. Respects `scopeOptional` (cancels with an actionable error when no candidates exist and scope is required) and `scopeMulti` (multiselect vs. single-select). ```typescript const scopeStep: Step ``` **Value** `...` #### subjectStep Step that prompts for the commit subject. Strips the trailing period, trims edges, and enforces a non-empty subject. When `headerMaxLength` is set, a live countdown re-renders on every keystroke (green → yellow → red as the remaining budget shrinks). ```typescript const subjectStep: Step ``` **Value** `...` #### typeStep Step that prompts the user for the commit type. Uses the searchable select prompt and seeds the cursor from any existing `ctx.draft.type` (so a preview → cancel restart re-opens on the previous choice). ```typescript const typeStep: Step ``` **Value** `...` --- Canonical page: https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author/ This file: https://www.hyperfrontend.dev/docs/libraries/versioning/commits/author.md Documentation index: https://www.hyperfrontend.dev/llms.txt