Skip to main content

Overview

The CLI layer is the entry point for mint-tsdocs, responsible for parsing user commands and initiating the documentation generation process. Built on @rushstack/ts-command-line, it provides a robust, typed command-line interface.
Entry Point: src/start.ts creates the CLI instance and runs the parser

Component Architecture

The Executable Entry Point
src/start.ts
Responsibilities:
  • Display version banner
  • Create CLI parser instance
  • Execute command and handle errors

Execution Flow

Detailed Flow Breakdown

User runs the command:
  • Binary executes lib/start.js
  • Version banner is displayed
  • DocumenterCli instance is created
DocumenterCli.executeAsync() processes the command:
  • Identifies action: markdown
  • Validates required parameters
  • Parses all flags and values
  • Routes to MarkdownAction.onExecuteAsync()
BaseAction.buildApiModel() loads the API data:
MarkdownAction creates and configures the documenter:
Control passes to the generation layer:
The CLI layer’s work is complete - the generation layer takes over.

Parameter Validation

The CLI layer ensures all parameters are valid before proceeding:

Error Handling

The CLI layer provides early validation to fail fast with clear error messages
Common errors caught at the CLI layer:

Extending the CLI

Adding a New Parameter

1

Define in Action

2

Pass to Documenter

3

Update Interface

4

Use in Generation

Use the new option in MarkdownDocumenter logic

Adding a New Command

To add a new command (e.g., yaml):
  1. Create YamlAction.ts extending BaseAction
  2. Implement onExecuteAsync()
  3. Register in ApiDocumenterCommandLine._populateActions()

Generation Layer

See how the CLI hands off to the generation layer

Architecture Overview

Understand the full pipeline