CLI & API Usage
@masumdev/tscheck can be used via the command-line interface (CLI) or imported as a library in your scripts.
CLI Commands & Flags
Run tscheck in the root of your project or monorepo:
tscheckCommand-Line Flags
| Flag | Description | Default |
|---|---|---|
-c, --config <path> | Path to custom configuration file (.json, .yaml, .ts) | Auto-detected |
-o, --output <dir> | Custom directory to write audit reports | .temp/tscheck |
-s, --serve [port] | Start local HTTP server to host and inspect interactive HTML reports | false (port: 5500) |
-p, --port <number> | Port for the local HTML report server | 5500 |
--no-serve | Disable starting local HTTP report server after audit | true |
-O, --open | Automatically open the HTML report in your default browser | false |
--editor <editor> | Default editor scheme (vscode, cursor, antigravity, windsurf, zed, webstorm, sublime) | vscode |
--ai | Output token-efficient AI prompt markdown to stdout | false |
--staged | Only scan files currently staged in Git (pre-commit mode) | false |
--since <ref> | Only scan files changed since a specific git branch/commit | |
--fix | Automatically fix safe issues like prefixing unused identifiers with _ | false |
-f, --format <format> | Output format: pretty (default), json, github, or ai | pretty |
-i, --interactive | Launch interactive terminal search dashboard with live filtering | false |
--no-deprecated | Disable deprecated API usages check | false |
--no-unused | Disable unused variables and imports check | false |
--no-any | Disable explicit any usages check | false |
--no-circular | Disable circular module dependencies check | false |
--fail-on-warning | Exit with non-zero exit code if violations are found | false |
--json | Output pure JSON to stdout without Ink UI (shorthand for --format json) | false |
-V, --version | Output version number | |
-h, --help | Display help screen |
Practical Examples & Workflows
1. Launch Local Report Server & Open in Browser (-O / --serve)
View the full interactive report in Google Chrome / your default browser:
# Audit and immediately open report in browsertscheck -O
# Start server on custom port 3000 and auto-opentscheck --serve 3000 --open2. Generate Dense AI Remediation Context (--ai)
Generate token-efficient instructions for Claude, ChatGPT, Gemini, or Antigravity:
tscheck --ai3. Git Staged Pre-Commit Hook (--staged)
Integrate tscheck into husky or lint-staged for sub-second pre-commit validations:
# In package.json scripts or .husky/pre-commitnpx tscheck --staged --fail-on-warning4. CI Pull Request Audits with GitHub Actions (--format github)
Output native GitHub annotations so issues render directly on PR diffs:
# In your GitHub Actions workflow step (.github/workflows/ci.yml)npx tscheck --format github --fail-on-warning5. Auto-Fix Safe Issues (--fix)
Automatically rename unused parameters and variables with an underscore prefix _ to satisfy TypeScript standards without breaking runtime code:
npx tscheck --fix6. Interactive Search Explorer Mode (-i)
Launch the interactive terminal UI with live search:
tscheck -iProgrammatic API
You can import @masumdev/tscheck into your TypeScript or JavaScript scripts:
import { audit, writeAuditReports, emitGitHubAnnotations, applyAutoFixes, generateAiPrompt, startReportServer, openInBrowser,} from "@masumdev/tscheck";
// 1. Run audit programmaticallyconst report = await audit({ rootDir: process.cwd(), rules: { deprecated: true, unused: true, noExplicitAny: true, circular: true, },});
console.log(`Files scanned: ${report.summary.filesScanned}`);console.log(`Deprecated usages: ${report.summary.totalDeprecatedUsages}`);
// 2. Generate AI prompt stringconst aiPrompt = generateAiPrompt(report);
// 3. Write JSON, Markdown, AI Prompt & HTML reports to diskconst files = writeAuditReports(report, { reporters: { outputDir: ".temp/tscheck", json: true, markdown: true, html: true, ai: true, },});
// 4. Start local HTTP report serverconst server = await startReportServer(".temp/tscheck/audit-report.html", 5500);openInBrowser(server.url);