cli

cli package overview

npm package: @forge-ts/cli

Installation

npm install @forge-ts/cli

Description

The cli package.

Quick Usage

import { configureLogger, forgeLogger } from "./forge-logger.js";
configureLogger({ quiet: args.quiet, json: args.json, verbose: args.verbose });
forgeLogger.info("This respects the configured level");

Functions & Classes

SymbolKindDescription
configureLogger()functionConfigures the global forgeLogger based on CLI flags. Call this once at th...
emitResult()functionWraps a command result in a LAFS envelope and emits it. Output format is det...
resolveExitCode()functionReturns the LAFS-compliant exit code for a command output.
runAudit()functionReads the audit log and returns a typed command output.
runBarometer()functionRuns the barometer generation pass. Loads the project config, walks the symb...
runBarometerScore()functionScores agent answers against the barometer answer key.
runBuild()functionRuns the full build pipeline and returns a typed command output.
runBypassCreate()functionRuns the bypass creation: creates a new bypass record with budget enforcement.
runBypassStatus()functionRuns the bypass status query: shows active bypasses and remaining budget.
getStagedFiles()functionReturns the list of staged .ts/.tsx files (relative paths) by querying git. R...
runCheck()functionRuns the TSDoc enforcement pass and returns a typed command output.
runDocsDev()functionStarts the local dev server for the configured SSG target. Reads...
readPkgJson()functionRead and parse package.json from a project root. Detects indent style and tr...
serializePkgJson()functionSerialize a package.json object preserving original formatting.
writePkgJson()functionWrite a modified package.json back to disk, preserving formatting.
addScripts()functionAdd scripts to package.json idempotently. Only adds scripts where the key do...
detectHookManager()functionDetects which hook manager is present in the project. Checks for: - husky:...
generateHuskyHook()functionGenerates the husky pre-commit hook file content (modern husky v9+).
generateHuskyPrePushHook()functionGenerates the husky pre-push hook file content (modern husky v9+).
generateLefthookBlock()functionGenerates the lefthook block with both pre-commit and pre-push sections.
detectVersionGuard()functionChecks whether a versionguard config file exists in the project root. When d...
runInitHooks()functionScaffolds git hook integration for the project. Detects the hook manager (hu...
detectEnvironment()functionDetects the project environment by checking for files and dependencies.
buildTsdocContent()functionBuilds tsdoc.json content, merging in customTags from the forge config. When...
runInitProject()functionRuns the full project init flow.
runDoctor()functionRuns the doctor integrity check flow.
runInitDocs()functionScaffolds a documentation site for the target SSG platform. Resolves the tar...
runLock()functionRuns the lock command: reads current config and creates .forge-lock.json.
runPrepublish()functionRuns the prepublish safety gate: check then build. If the check step fails,...
runTest()functionRuns the doctest pipeline and returns a typed command output.
runUnlock()functionRuns the unlock command: removes .forge-lock.json with a mandatory reason.

Types & Interfaces

SymbolKindDescription
ForgeLoggerOptionsinterfaceOptions for configuring the forge-ts logger at CLI startup.
CommandOutputinterfaceTyped result from a forge-ts command.
ForgeCliErrorinterfaceStructured error for CLI commands.
ForgeCliWarninginterfaceStructured warning for CLI commands.
OutputFlagsinterfaceOutput format flags passed through from citty args.
AuditArgsinterfaceArguments for the audit command.
AuditResultinterfaceTyped result for the audit command.
BarometerSourceinterfaceSource provenance for a barometer question.
BarometerQuestioninterfaceA single barometer question with its ground-truth answer.
BarometerRatingBandinterfaceA single rating band in the barometer scoring rubric.
BarometerInstructionsinterfaceAgent instructions included in --questions-only output.
BarometerResultinterfaceFull barometer output written to .forge/barometer.json.
BarometerScoredAnswerinterfaceA single scored answer in the barometer score output.
BarometerScoreResultinterfaceFull barometer score output.
BarometerArgsinterfaceArguments for the barometer command.
BuildArgsinterfaceArguments for the build command.
BuildStepinterfaceA single step in the build pipeline.
BuildResultinterfaceTyped result for the build command.
BypassCreateResultinterfaceTyped result for the bypass command when creating a bypass.
BypassStatusResultinterfaceTyped result for the bypass --status command.
CheckArgsinterfaceArguments for the check command.
CheckFileErrorinterfaceA single error entry within a file group.
CheckFileWarninginterfaceA single warning entry within a file group.
CheckFileGroupinterfaceErrors and warnings grouped by file.
CheckRuleCountinterfaceError breakdown by rule code, sorted by count descending.
CheckTriageinterfaceTriage data for prioritizing fixes. Always present when the check has errors,...
CheckPageinterfacePagination metadata for byFile results.
CheckResultinterfaceTyped result for the check command.
PkgJsoninterfaceParsed package.json with formatting metadata for lossless round-tripping.
HookManagertypeDetected hook manager in the project.
InitHooksResultinterfaceResult of the init hooks command.
InitHooksArgsinterfaceArguments for the init hooks command.
InitProjectEnvironmentinterfaceDetected project environment from Step 1 of the init flow.
InitProjectResultinterfaceResult of the init (project setup) command.
InitProjectArgsinterfaceArguments for the init (project setup) command.
DoctorCheckStatustypeStatus of a single doctor check.
DoctorCheckResultinterfaceResult of a single doctor check.
DoctorResultinterfaceResult of the doctor command.
DoctorArgsinterfaceArguments for the doctor command.
InitDocsResultinterfaceResult of the init docs command.
InitDocsArgsinterfaceArguments for the init docs command.
LockResultinterfaceTyped result for the lock command.
PrepublishResultinterfaceTyped result for the prepublish command.
PrepublishArgsinterfaceArguments for the prepublish command.
TestArgsinterfaceArguments for the test command.
TestFailureinterfaceA single test failure entry, included at standard and full MVI levels.
TestResultinterfaceTyped result for the test command.
UnlockResultinterfaceTyped result for the unlock command.

Other Exports

SymbolKindDescription
tsup.config.tsfile
forgeLoggervariablePre-configured consola instance branded for forge-ts.
forge-logger.tsfileForge-ts branded logger built on consola from the UnJS ecosystem. Provides a...
output.tsfileCentral output layer for forge-ts CLI. Wraps all command results in LAFS env...
auditCommandvariableCitty command definition for forge-ts audit.
audit.tsfileCLI command for reading the forge-ts audit trail. Reads .forge-audit.jsonl...
barometerCommandvariableCitty command definition for forge-ts barometer. Generates a documentation...
barometer.tsfileforge-ts barometer command — documentation effectiveness test generator. A...
buildCommandvariableCitty command definition for forge-ts build.
build.tsfile
bypassCommandvariableCitty command definition for forge-ts bypass.
bypass.tsfileforge-ts bypass command — create or inspect temporary rule bypasses. Bypas...
checkCommandvariableCitty command definition for forge-ts check.
check.tsfile
docsDevCommandvariableCitty command definition for forge-ts docs dev.
docs-dev.tsfileThe forge-ts docs dev command — starts a local doc preview server. Reads t...
pkg-json.tsfileShared utilities for idempotent package.json read-modify-write operations. E...
initHooksCommandvariableCitty command definition for forge-ts init hooks. Scaffolds git hook integ...
init-hooks.tsfileforge-ts init hooks command — scaffolds git hook integration. Detects husk...
initProjectCommandvariableCitty command definition for forge-ts init (bare — full project setup). De...
init-project.tsfileforge-ts init command — full project setup. Detects the project environmen...
doctorCommandvariableCitty command definition for forge-ts doctor. Performs project integrity c...
doctor.tsfileforge-ts doctor command — project integrity check and repair. Validates th...
initDocsCommandvariableCitty command definition for forge-ts init docs. Scaffolds a complete docu...
initCommandvariableCitty command definition for forge-ts init. Exposes subcommands for scaffo...
init-docs.tsfile
lockCommandvariableCitty command definition for forge-ts lock.
lock.tsfileforge-ts lock command — snapshots the current config and creates...
prepublishCommandvariableCitty command definition for forge-ts prepublish. Runs check then build as...
prepublish.tsfileforge-ts prepublish command — safety gate for npm publish. Runs...
testCommandvariableCitty command definition for forge-ts test.
test.tsfile
unlockCommandvariableCitty command definition for forge-ts unlock.
unlock.tsfileforge-ts unlock command — removes .forge-lock.json with a mandatory reaso...
index.tsfileUnified command-line interface for the forge-ts toolchain. Provides the...
cli.test.tsfile
doctor.test.tsfile
init-docs.test.tsfile
init-hooks.test.tsfile
init-project.test.tsfile
prepublish.test.tsfile

On this page