PackagesCore
core
core package overview
npm package: @forge-ts/core
Installation
npm install @forge-ts/coreDescription
The core package.
Quick Usage
import { getCurrentUser } from "@forge-ts/core/audit";
const user = getCurrentUser(); // e.g. "alice"Functions & Classes
| Symbol | Kind | Description |
|---|---|---|
getCurrentUser() | function | Returns the current OS username, or "unknown" if unavailable. |
appendAuditEvent() | function | Appends a single audit event to the .forge-audit.jsonl file. |
readAuditLog() | function | Reads the .forge-audit.jsonl file and returns parsed audit events. |
formatAuditEvent() | function | Formats a single audit event as a human-readable string. |
createBypass() | function | Creates a new bypass record, writes it to .forge-bypass.json, and appends a... |
getActiveBypasses() | function | Returns all currently active (non-expired) bypass records. |
isRuleBypassed() | function | Checks whether a specific rule has an active bypass. |
getRemainingBudget() | function | Returns the number of bypass budget slots remaining for today. |
expireOldBypasses() | function | Removes expired bypass records from .forge-bypass.json. |
defineConfig() | function | Type-safe helper for defining a partial forge-ts configuration. |
defaultConfig() | function | Constructs a sensible default ForgeConfig rooted at rootDir. |
loadConfig() | function | Loads the forge-ts configuration for a project. |
readLockFile() | function | Reads the .forge-lock.json file from the given project root. |
writeLockFile() | function | Writes a ForgeLockManifest to .forge-lock.json in the project root. |
removeLockFile() | function | Removes the .forge-lock.json file from the project root. |
createLockManifest() | function | Creates a ForgeLockManifest from the current project config. |
validateAgainstLock() | function | Validates the current config against a locked manifest. |
resolveVisibility() | function | Determines the visibility level of a symbol from its TSDoc release tags. |
meetsVisibility() | function | Returns whether candidate meets or exceeds the required minimum visibility. |
filterByVisibility() | function | Filters an array of ForgeSymbol objects to only include symbols whose visib... |
clearTSDocConfigCache() | function | Clears the TSDoc configuration cache. Intended for use in tests only. |
loadTSDocConfiguration() | function | Resolve the TSDoc configuration to use when parsing comments in files under... |
createWalker() | function | Creates an ASTWalker configured for the given forge config. |
Types & Interfaces
| Symbol | Kind | Description |
|---|---|---|
AuditEventType | type | Discriminated event types recorded in the audit trail. |
AuditEvent | interface | A single audit event recorded in the forge-ts audit trail. |
ReadAuditOptions | interface | Options for reading the audit log. |
BypassConfig | interface | Configuration for the bypass budget system. |
BypassRecord | interface | A single bypass record stored in .forge-bypass.json. |
Visibility | enum | Visibility levels for exported symbols. Derived from TSDoc release tags (... |
ForgeSymbol | interface | A single extracted and annotated symbol from the TypeScript AST. |
RuleSeverity | type | Severity level for an individual enforcement rule. - "error" — violation fa... |
EnforceRules | interface | Per-rule severity configuration for the TSDoc enforcer. 40 rules across 5 lay... |
ForgeConfig | interface | Full configuration for a forge-ts run. |
ForgeResult | interface | The result of a forge-ts compilation pass. |
ForgeError | interface | A diagnostic error produced during a forge-ts run. |
ForgeWarning | interface | A diagnostic warning produced during a forge-ts run. |
ForgeLockManifest | interface | Manifest stored in .forge-lock.json. Captures a point-in-time snapshot of t... |
LockViolation | interface | A single violation found when comparing current config against the lock. |
OpenAPISchemaObject | interface | OpenAPI 3.2 schema object. |
OpenAPIInfoObject | interface | OpenAPI 3.2 info object. |
OpenAPITagObject | interface | OpenAPI 3.2 tag object. |
OpenAPIPathItemObject | interface | OpenAPI 3.2 path item object. |
OpenAPIOperationObject | interface | OpenAPI 3.2 operation object. |
OpenAPIParameterObject | interface | OpenAPI 3.2 parameter object. |
OpenAPIEncodingObject | interface | OpenAPI 3.2 encoding object. |
OpenAPIMediaTypeObject | interface | OpenAPI 3.2 media type object. |
OpenAPIResponseObject | interface | OpenAPI 3.2 response object. |
OpenAPIDocument | interface | Complete OpenAPI 3.2 document. |
ASTWalker | interface | The return type of createWalker. |
Other Exports
| Symbol | Kind | Description |
|---|---|---|
audit.ts | file | Append-only audit trail for forge-ts configuration and governance events. Ev... |
bypass.ts | file | Bypass budget system for forge-ts config governance. Allows agents to tempor... |
types.ts | file | |
RULE_GROUP_MAP | variable | Maps each rule key in EnforceRules to its TSDoc standardisation group. - *... |
config.ts | file | |
lock.ts | file | Config locking system for forge-ts. Prevents LLM agents from silently weaken... |
openapi-types.ts | file | |
visibility.ts | file | |
walker.ts | file | |
index.ts | file | Foundation package for the forge-ts toolchain — shared types, config loader,... |
tsup.config.ts | file | |
audit.test.ts | file | |
bypass.test.ts | file | |
e2e.test.ts | file | |
lock.test.ts | file |