core

core package overview

npm package: @forge-ts/core

Installation

npm install @forge-ts/core

Description

The core package.

Quick Usage

import { getCurrentUser } from "@forge-ts/core/audit";
const user = getCurrentUser(); // e.g. "alice"

Functions & Classes

SymbolKindDescription
getCurrentUser()functionReturns the current OS username, or "unknown" if unavailable.
appendAuditEvent()functionAppends a single audit event to the .forge-audit.jsonl file.
readAuditLog()functionReads the .forge-audit.jsonl file and returns parsed audit events.
formatAuditEvent()functionFormats a single audit event as a human-readable string.
createBypass()functionCreates a new bypass record, writes it to .forge-bypass.json, and appends a...
getActiveBypasses()functionReturns all currently active (non-expired) bypass records.
isRuleBypassed()functionChecks whether a specific rule has an active bypass.
getRemainingBudget()functionReturns the number of bypass budget slots remaining for today.
expireOldBypasses()functionRemoves expired bypass records from .forge-bypass.json.
defineConfig()functionType-safe helper for defining a partial forge-ts configuration.
defaultConfig()functionConstructs a sensible default ForgeConfig rooted at rootDir.
loadConfig()functionLoads the forge-ts configuration for a project.
readLockFile()functionReads the .forge-lock.json file from the given project root.
writeLockFile()functionWrites a ForgeLockManifest to .forge-lock.json in the project root.
removeLockFile()functionRemoves the .forge-lock.json file from the project root.
createLockManifest()functionCreates a ForgeLockManifest from the current project config.
validateAgainstLock()functionValidates the current config against a locked manifest.
resolveVisibility()functionDetermines the visibility level of a symbol from its TSDoc release tags.
meetsVisibility()functionReturns whether candidate meets or exceeds the required minimum visibility.
filterByVisibility()functionFilters an array of ForgeSymbol objects to only include symbols whose visib...
clearTSDocConfigCache()functionClears the TSDoc configuration cache. Intended for use in tests only.
loadTSDocConfiguration()functionResolve the TSDoc configuration to use when parsing comments in files under...
createWalker()functionCreates an ASTWalker configured for the given forge config.

Types & Interfaces

SymbolKindDescription
AuditEventTypetypeDiscriminated event types recorded in the audit trail.
AuditEventinterfaceA single audit event recorded in the forge-ts audit trail.
ReadAuditOptionsinterfaceOptions for reading the audit log.
BypassConfiginterfaceConfiguration for the bypass budget system.
BypassRecordinterfaceA single bypass record stored in .forge-bypass.json.
VisibilityenumVisibility levels for exported symbols. Derived from TSDoc release tags (...
ForgeSymbolinterfaceA single extracted and annotated symbol from the TypeScript AST.
RuleSeveritytypeSeverity level for an individual enforcement rule. - "error" — violation fa...
EnforceRulesinterfacePer-rule severity configuration for the TSDoc enforcer. 40 rules across 5 lay...
ForgeConfiginterfaceFull configuration for a forge-ts run.
ForgeResultinterfaceThe result of a forge-ts compilation pass.
ForgeErrorinterfaceA diagnostic error produced during a forge-ts run.
ForgeWarninginterfaceA diagnostic warning produced during a forge-ts run.
ForgeLockManifestinterfaceManifest stored in .forge-lock.json. Captures a point-in-time snapshot of t...
LockViolationinterfaceA single violation found when comparing current config against the lock.
OpenAPISchemaObjectinterfaceOpenAPI 3.2 schema object.
OpenAPIInfoObjectinterfaceOpenAPI 3.2 info object.
OpenAPITagObjectinterfaceOpenAPI 3.2 tag object.
OpenAPIPathItemObjectinterfaceOpenAPI 3.2 path item object.
OpenAPIOperationObjectinterfaceOpenAPI 3.2 operation object.
OpenAPIParameterObjectinterfaceOpenAPI 3.2 parameter object.
OpenAPIEncodingObjectinterfaceOpenAPI 3.2 encoding object.
OpenAPIMediaTypeObjectinterfaceOpenAPI 3.2 media type object.
OpenAPIResponseObjectinterfaceOpenAPI 3.2 response object.
OpenAPIDocumentinterfaceComplete OpenAPI 3.2 document.
ASTWalkerinterfaceThe return type of createWalker.

Other Exports

SymbolKindDescription
audit.tsfileAppend-only audit trail for forge-ts configuration and governance events. Ev...
bypass.tsfileBypass budget system for forge-ts config governance. Allows agents to tempor...
types.tsfile
RULE_GROUP_MAPvariableMaps each rule key in EnforceRules to its TSDoc standardisation group. - *...
config.tsfile
lock.tsfileConfig locking system for forge-ts. Prevents LLM agents from silently weaken...
openapi-types.tsfile
visibility.tsfile
walker.tsfile
index.tsfileFoundation package for the forge-ts toolchain — shared types, config loader,...
tsup.config.tsfile
audit.test.tsfile
bypass.test.tsfile
e2e.test.tsfile
lock.test.tsfile

On this page