🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@isl-lang/errors

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isl-lang/errors - npm Package Compare versions

Comparing version
1.0.0
to
2.0.0
+60
dist/bridge.d.ts
import type { Diagnostic, SourceLocation, ErrorCategory } from './types.js';
/**
* Mapping from legacy parser error codes to unified codes.
*/
export declare const LEGACY_CODE_MAP: Record<string, string>;
/**
* Resolve a potentially legacy error code to a unified code.
* If the code is already a unified code (Exxxx), returns it as-is.
* If it's a legacy code (L00x, P00x), maps it to the unified equivalent.
*/
export declare function resolveErrorCode(code: string): string;
/**
* Determine the error category from a code string.
*/
export declare function categoryFromCode(code: string): ErrorCategory;
/**
* A legacy parser diagnostic (from @isl-lang/parser).
* This is the format the parser currently emits.
*/
export interface LegacyParserDiagnostic {
severity: 'error' | 'warning' | 'info' | 'hint';
code: string;
message: string;
location: SourceLocation;
source: string;
relatedInformation?: Array<{
message: string;
location: SourceLocation;
}>;
fix?: {
title: string;
edits: Array<{
range: {
start: {
line: number;
character: number;
};
end: {
line: number;
character: number;
};
};
newText: string;
}>;
isPreferred?: boolean;
};
tags?: Array<'unnecessary' | 'deprecated'>;
notes?: string[];
help?: string[];
}
/**
* Convert a legacy parser diagnostic to a unified diagnostic.
* Maps error codes and normalizes the structure.
*/
export declare function fromParserDiagnostic(legacy: LegacyParserDiagnostic): Diagnostic;
/**
* Convert multiple legacy parser diagnostics to unified diagnostics.
*/
export declare function fromParserDiagnostics(legacies: LegacyParserDiagnostic[]): Diagnostic[];
//# sourceMappingURL=bridge.d.ts.map
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAM5E;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,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E,sBAAsB,EAAE,GAAG,UAAU,EAAE,CAEtF"}
// ============================================================================
// ISL Error Code Bridge
// ============================================================================
//
// Maps legacy error codes from the parser (L001, P001) to unified
// error codes (E0001, E0100) and provides conversion utilities.
//
// This bridge enables gradual migration: existing packages can continue
// using their local codes while the errors package provides the unified
// formatting and catalog.
//
// ============================================================================
// ============================================================================
// LEGACY CODE MAPPING
// ============================================================================
/**
* Mapping from legacy parser error codes to unified codes.
*/
export const LEGACY_CODE_MAP = {
// Lexer errors (L00x -> E000x)
'L001': 'E0001', // UNEXPECTED_CHARACTER
'L002': 'E0002', // UNTERMINATED_STRING
'L003': 'E0003', // UNTERMINATED_REGEX
'L004': 'E0004', // INVALID_ESCAPE
'L005': 'E0005', // INVALID_NUMBER
'L006': 'E0006', // UNTERMINATED_COMMENT
// Parser errors (P00x -> E01xx)
'P001': 'E0100', // UNEXPECTED_TOKEN
'P002': 'E0101', // EXPECTED_TOKEN
'P003': 'E0102', // EXPECTED_IDENTIFIER
'P004': 'E0103', // EXPECTED_TYPE
'P005': 'E0104', // EXPECTED_EXPRESSION
'P006': 'E0105', // MISSING_CLOSING_BRACE
'P007': 'E0106', // MISSING_CLOSING_PAREN
'P008': 'E0107', // MISSING_CLOSING_BRACKET
'P009': 'E0108', // DUPLICATE_FIELD
'P010': 'E0109', // DUPLICATE_ENTITY
'P011': 'E0110', // DUPLICATE_BEHAVIOR
'P012': 'E0111', // DUPLICATE_TYPE
'P013': 'E0112', // MISSING_VERSION
'P014': 'E0113', // INVALID_CONSTRAINT
'P015': 'E0114', // INVALID_ANNOTATION
'P016': 'E0115', // INVALID_LIFECYCLE
'P017': 'E0116', // EXPECTED_STATEMENT
'P018': 'E0117', // INVALID_OPERATOR
'P019': 'E0118', // UNCLOSED_BLOCK
};
/**
* Resolve a potentially legacy error code to a unified code.
* If the code is already a unified code (Exxxx), returns it as-is.
* If it's a legacy code (L00x, P00x), maps it to the unified equivalent.
*/
export function resolveErrorCode(code) {
// Already a unified code
if (code.startsWith('E')) {
return code;
}
return LEGACY_CODE_MAP[code] ?? code;
}
/**
* Determine the error category from a code string.
*/
export function categoryFromCode(code) {
const unified = resolveErrorCode(code);
const num = parseInt(unified.slice(1), 10);
if (num < 100)
return 'lexer';
if (num < 200)
return 'parser';
if (num < 300)
return 'type';
if (num < 400)
return 'semantic';
if (num < 500)
return 'eval';
if (num < 600)
return 'verify';
if (num < 700)
return 'config';
return 'io';
}
/**
* Convert a legacy parser diagnostic to a unified diagnostic.
* Maps error codes and normalizes the structure.
*/
export function fromParserDiagnostic(legacy) {
const unifiedCode = resolveErrorCode(legacy.code);
return {
code: unifiedCode,
category: categoryFromCode(unifiedCode),
severity: legacy.severity,
message: legacy.message,
location: legacy.location,
source: legacy.source === 'parser' ? 'parser' : legacy.source,
relatedInformation: legacy.relatedInformation,
fix: legacy.fix ? {
title: legacy.fix.title,
edits: legacy.fix.edits.map(e => ({
range: {
start: { line: e.range.start.line, column: e.range.start.character },
end: { line: e.range.end.line, column: e.range.end.character },
},
newText: e.newText,
})),
isPreferred: legacy.fix.isPreferred,
} : undefined,
tags: legacy.tags,
notes: legacy.notes,
help: legacy.help,
};
}
/**
* Convert multiple legacy parser diagnostics to unified diagnostics.
*/
export function fromParserDiagnostics(legacies) {
return legacies.map(fromParserDiagnostic);
}
//# sourceMappingURL=bridge.js.map
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAC/E,EAAE;AACF,kEAAkE;AAClE,gEAAgE;AAChE,EAAE;AACF,wEAAwE;AACxE,wEAAwE;AACxE,0BAA0B;AAC1B,EAAE;AACF,+EAA+E;AAI/E,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAA2B;IACrD,+BAA+B;IAC/B,MAAM,EAAE,OAAO,EAAE,uBAAuB;IACxC,MAAM,EAAE,OAAO,EA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K,EAAE;oBACL,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE;oBACpE,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE;iBAC/D;gBACD,OAAO,EAAE,CAAC,CAAC,OAAO;aACnB,CAAC,CAAC;YACH,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,WAAW;SACpC,CAAC,CAAC,CAAC,SAAS;QACb,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,IAAI,EAAE,MAAM,CAAC,IAAI;KAClB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAkC;IACtE,OAAO,QAAQ,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAC5C,CAAC"}
/**
* Gate verdict: the binary SHIP or NO_SHIP decision
*/
export type Verdict = 'SHIP' | 'NO_SHIP';
/**
* Severity of a verdict violation
*/
export type ViolationSeverity = 'critical' | 'high' | 'medium' | 'low' | 'info';
/**
* A single violation found during verification
*/
export interface VerdictViolation {
/** File where the violation occurred */
file: string;
/** Line number in the ISL spec */
specLine?: number;
/** The ISL rule text that was violated */
rule: string;
/** Human-readable violation description */
message: string;
/** Severity level */
severity: ViolationSeverity;
/** Detailed explanation of why this matters */
explanation?: string;
/** Concrete code fix suggestion */
fix?: string;
/** Does this violation block shipping? */
blocking: boolean;
}
/**
* Complete gate verdict result
*/
export interface VerdictResult {
/** Binary verdict */
verdict: Verdict;
/** Overall score (0-100) */
score: number;
/** Human-readable summary */
summary: string;
/** All violations found */
violations: VerdictViolation[];
/** Duration of verification in milliseconds */
durationMs?: number;
/** Files that were verified */
filesChecked?: string[];
}
/**
* Options for verdict formatting
*/
export interface VerdictFormatOptions {
/** Enable ANSI colors (default: true) */
colors: boolean;
/** Show detailed explanations (default: true) */
showExplanations: boolean;
/** Show fix suggestions (default: true) */
showFixes: boolean;
/** Maximum violations to show (default: 10) */
maxViolations: number;
/** Show ISL spec source context (default: true) */
showSpecContext: boolean;
/** Terminal width for line drawing (default: 60) */
terminalWidth: number;
}
/**
* Format a complete gate verdict result into a beautiful string.
*
* Example output:
* ```
* ─── ISL Verify ─────────────────────────────────────────
*
* ✗ FAIL src/auth/login.ts
*
* ─── login.isl:22 ───
* │
* 22 │ must "return identical error for wrong email or password"
* │ ────────────────────────────────────────────────────────
* │
* Violation: Error messages differ based on failure reason
*
* Why this matters:
* Different error messages let attackers enumerate valid
* email addresses (user existence oracle).
*
* Fix:
* Return the same 401 status and message for both cases:
* return res.status(401).json({ error: "Invalid credentials" })
*
* ─────────────────────────────────────────────────────────
* Score: 45/100 Verdict: NO_SHIP
* 1 critical, 0 high, 0 medium violations
* ─────────────────────────────────────────────────────────
* ```
*/
export declare function formatVerdict(result: VerdictResult, options?: Partial<VerdictFormatOptions>): string;
/**
* Format a single violation as a standalone message.
* Useful for streaming output or individual violation reports.
*/
export declare function formatViolationMessage(violation: VerdictViolation, options?: Partial<VerdictFormatOptions>): string;
/**
* Format a compact verdict summary for CI environments.
*
* Example:
* ```
* ISL Gate: NO_SHIP (score: 45/100) - 1 critical, 2 high violations
* ```
*/
export declare function formatVerdictCompact(result: VerdictResult, options?: {
colors?: boolean;
}): string;
//# sourceMappingURL=verdict.d.ts.map
{"version":3,"file":"verdict.d.ts","sourceRoot":"","sources":["../src/verdict.ts"],"names":[],"mappings":"AAkBA;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AAEh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CAwDR;AA0LD;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,gBAAgB,EAC3B,OAAO,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAC1C,MAAM,CAKR;AAMD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,aAAa,EACrB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,MAAM,CAgBR"}
// ============================================================================
// ISL Gate Verdict Formatter
// ============================================================================
//
// Beautiful formatting for ISL Gate SHIP/NO_SHIP verdicts.
// Produces actionable, scannable output that tells developers exactly
// what went wrong and how to fix it.
//
// ============================================================================
import chalk from 'chalk';
import { getSource } from './formatter.js';
const DEFAULT_VERDICT_OPTIONS = {
colors: true,
showExplanations: true,
showFixes: true,
maxViolations: 10,
showSpecContext: true,
terminalWidth: 60,
};
const VERDICT_COLORS = {
ship: chalk.green.bold,
noShip: chalk.red.bold,
critical: chalk.red.bold,
high: chalk.red,
medium: chalk.yellow,
low: chalk.cyan,
info: chalk.blue,
header: chalk.bold,
muted: chalk.gray,
accent: chalk.cyan,
rule: chalk.white,
lineNumber: chalk.blue,
separator: chalk.blue,
};
const NO_VERDICT_COLORS = {
ship: chalk.reset,
noShip: chalk.reset,
critical: chalk.reset,
high: chalk.reset,
medium: chalk.reset,
low: chalk.reset,
info: chalk.reset,
header: chalk.reset,
muted: chalk.reset,
accent: chalk.reset,
rule: chalk.reset,
lineNumber: chalk.reset,
separator: chalk.reset,
};
// ============================================================================
// VERDICT FORMATTING
// ============================================================================
/**
* Format a complete gate verdict result into a beautiful string.
*
* Example output:
* ```
* ─── ISL Verify ─────────────────────────────────────────
*
* ✗ FAIL src/auth/login.ts
*
* ─── login.isl:22 ───
* │
* 22 │ must "return identical error for wrong email or password"
* │ ────────────────────────────────────────────────────────
* │
* Violation: Error messages differ based on failure reason
*
* Why this matters:
* Different error messages let attackers enumerate valid
* email addresses (user existence oracle).
*
* Fix:
* Return the same 401 status and message for both cases:
* return res.status(401).json({ error: "Invalid credentials" })
*
* ─────────────────────────────────────────────────────────
* Score: 45/100 Verdict: NO_SHIP
* 1 critical, 0 high, 0 medium violations
* ─────────────────────────────────────────────────────────
* ```
*/
export function formatVerdict(result, options = {}) {
const opts = { ...DEFAULT_VERDICT_OPTIONS, ...options };
const c = opts.colors ? VERDICT_COLORS : NO_VERDICT_COLORS;
const lines = [];
const divider = c.muted('\u2500'.repeat(opts.terminalWidth));
// Header
lines.push(c.muted('\u2500\u2500\u2500 ') + c.header('ISL Verify') + ' ' + c.muted('\u2500'.repeat(Math.max(0, opts.terminalWidth - 16))));
lines.push('');
// Verdict icon and files
if (result.verdict === 'SHIP') {
lines.push(' ' + c.ship('\u2713 PASS') + (result.summary ? ' ' + result.summary : ''));
}
else {
// Group violations by file
const fileViolations = groupViolationsByFile(result.violations);
for (const [file, violations] of fileViolations) {
lines.push(' ' + c.noShip('\u2717 FAIL') + ' ' + c.muted(file));
lines.push('');
const toShow = violations.slice(0, opts.maxViolations);
for (const violation of toShow) {
lines.push(...formatViolation(violation, c, opts));
lines.push('');
}
if (violations.length > opts.maxViolations) {
const remaining = violations.length - opts.maxViolations;
lines.push(' ' + c.muted(`... and ${remaining} more violation${remaining === 1 ? '' : 's'} in this file`));
lines.push('');
}
}
}
// Footer with score and verdict
lines.push(divider);
const scoreStr = formatScore(result.score, c);
const verdictStr = result.verdict === 'SHIP'
? c.ship('SHIP')
: c.noShip('NO_SHIP');
lines.push(` Score: ${scoreStr} Verdict: ${verdictStr}`);
// Violation summary
const summary = formatViolationSummary(result.violations, c);
if (summary) {
lines.push(' ' + summary);
}
// Duration
if (result.durationMs !== undefined) {
lines.push(' ' + c.muted(`Completed in ${formatDuration(result.durationMs)}`));
}
lines.push(divider);
return lines.join('\n');
}
/**
* Format a single verdict violation.
*/
function formatViolation(violation, c, opts) {
const lines = [];
const severityColor = getSeverityColor(violation.severity, c);
// Spec source context
if (opts.showSpecContext && violation.specLine !== undefined) {
const specFile = getSource(violation.file);
if (specFile) {
lines.push(...formatSpecSnippet(specFile, violation.specLine, violation.rule, c));
}
else {
// No source registered, show location reference
lines.push(' ' + c.muted(`\u2500\u2500\u2500 ${violation.file}:${violation.specLine} \u2500\u2500\u2500`));
lines.push(' ' + c.separator('\u2502'));
const gutterWidth = String(violation.specLine).length;
lines.push(' ' +
c.lineNumber(String(violation.specLine).padStart(gutterWidth)) +
' ' + c.separator('\u2502') + ' ' +
c.rule(violation.rule));
lines.push(' ' + c.separator('\u2502'));
}
}
// Violation message
lines.push(' ' + severityColor('Violation: ') + violation.message);
// Explanation
if (opts.showExplanations && violation.explanation) {
lines.push('');
lines.push(' ' + c.accent('Why this matters:'));
for (const expLine of wrapText(violation.explanation, opts.terminalWidth - 6)) {
lines.push(' ' + expLine);
}
}
// Fix suggestion
if (opts.showFixes && violation.fix) {
lines.push('');
lines.push(' ' + c.accent('Fix:'));
for (const fixLine of violation.fix.split('\n')) {
lines.push(' ' + fixLine);
}
}
return lines;
}
/**
* Format a spec file snippet showing the violated rule.
*/
function formatSpecSnippet(source, line, rule, c) {
const lines = [];
const gutterWidth = String(line).length;
lines.push(' ' + c.muted(`\u2500\u2500\u2500 ${source.path}:${line} \u2500\u2500\u2500`));
lines.push(' ' + ' '.repeat(gutterWidth + 1) + c.separator('\u2502'));
// Show the spec line
const specLine = source.lines[line - 1];
if (specLine !== undefined) {
lines.push(' ' +
c.lineNumber(String(line).padStart(gutterWidth)) +
' ' + c.separator('\u2502') +
' ' + c.rule(specLine));
// Underline the rule text
const ruleStart = specLine.indexOf(rule);
if (ruleStart >= 0) {
const padding = ' '.repeat(ruleStart + 3);
const underline = '\u2500'.repeat(rule.length);
lines.push(' ' +
' '.repeat(gutterWidth + 1) +
c.separator('\u2502') +
padding + c.noShip(underline));
}
else {
// Underline the full content
const contentStart = specLine.length - specLine.trimStart().length;
const underline = '\u2500'.repeat(specLine.trimEnd().length - contentStart);
lines.push(' ' +
' '.repeat(gutterWidth + 1) +
c.separator('\u2502') +
' ' + ' '.repeat(contentStart) + c.noShip(underline));
}
}
lines.push(' ' + ' '.repeat(gutterWidth + 1) + c.separator('\u2502'));
return lines;
}
// ============================================================================
// HELPERS
// ============================================================================
function groupViolationsByFile(violations) {
const map = new Map();
for (const v of violations) {
const existing = map.get(v.file) ?? [];
existing.push(v);
map.set(v.file, existing);
}
return map;
}
function formatScore(score, c) {
const colorFn = score >= 95 ? c.ship
: score >= 70 ? c.medium
: c.noShip;
return colorFn(`${score}/100`);
}
function formatViolationSummary(violations, c) {
const critical = violations.filter(v => v.severity === 'critical').length;
const high = violations.filter(v => v.severity === 'high').length;
const medium = violations.filter(v => v.severity === 'medium').length;
const low = violations.filter(v => v.severity === 'low').length;
const parts = [];
if (critical > 0)
parts.push(c.critical(`${critical} critical`));
if (high > 0)
parts.push(c.high(`${high} high`));
if (medium > 0)
parts.push(c.medium(`${medium} medium`));
if (low > 0)
parts.push(c.low(`${low} low`));
if (parts.length === 0)
return '';
return parts.join(', ') + ' violation' + (violations.length === 1 ? '' : 's');
}
function formatDuration(ms) {
if (ms < 1000)
return `${ms}ms`;
const seconds = (ms / 1000).toFixed(1);
return `${seconds}s`;
}
function getSeverityColor(severity, c) {
switch (severity) {
case 'critical': return c.critical;
case 'high': return c.high;
case 'medium': return c.medium;
case 'low': return c.low;
case 'info': return c.info;
}
}
function wrapText(text, maxWidth) {
const words = text.split(/\s+/);
const lines = [];
let currentLine = '';
for (const word of words) {
if (currentLine.length + word.length + 1 > maxWidth) {
if (currentLine)
lines.push(currentLine);
currentLine = word;
}
else {
currentLine = currentLine ? currentLine + ' ' + word : word;
}
}
if (currentLine)
lines.push(currentLine);
return lines;
}
// ============================================================================
// SINGLE VERDICT VIOLATION FORMATTER
// ============================================================================
/**
* Format a single violation as a standalone message.
* Useful for streaming output or individual violation reports.
*/
export function formatViolationMessage(violation, options = {}) {
const opts = { ...DEFAULT_VERDICT_OPTIONS, ...options };
const c = opts.colors ? VERDICT_COLORS : NO_VERDICT_COLORS;
return formatViolation(violation, c, opts).join('\n');
}
// ============================================================================
// VERDICT SUMMARY (compact, for CI output)
// ============================================================================
/**
* Format a compact verdict summary for CI environments.
*
* Example:
* ```
* ISL Gate: NO_SHIP (score: 45/100) - 1 critical, 2 high violations
* ```
*/
export function formatVerdictCompact(result, options = {}) {
const useColors = options.colors ?? true;
const c = useColors ? VERDICT_COLORS : NO_VERDICT_COLORS;
const verdictStr = result.verdict === 'SHIP'
? c.ship('SHIP')
: c.noShip('NO_SHIP');
const scoreStr = formatScore(result.score, c);
const summary = formatViolationSummary(result.violations, c);
let line = `ISL Gate: ${verdictStr} (score: ${scoreStr})`;
if (summary) {
line += ' - ' + summary;
}
return line;
}
//# sourceMappingURL=verdict.js.map
{"version":3,"file":"verdict.js","sourceRoot":"","sources":["../src/verdict.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,6BAA6B;AAC7B,+EAA+E;AAC/E,EAAE;AACF,2DAA2D;AAC3D,sEAAsE;AACtE,qCAAqC;AACrC,EAAE;AACF,+EAA+E;AAE/E,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA0E3C,MAAM,uBAAuB,GAAyB;IACpD,MAAM,EAAE,IAAI;IACZ,gBAAgB,EAAE,IAAI;IACtB,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,EAAE;IACjB,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE,EAAE;CAClB,CAAC;AAsBF,MAAM,cAAc,GAAkB;IACpC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI;IACtB,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI;IACtB,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI;IACxB,IAAI,EAAE,KAAK,CAAC,GAAG;IACf,MAAM,EAAE,KAAK,CAAC,MAAM;IACpB,GAAG,EAAE,KAAK,CAAC,IAAI;IACf,IAAI,EAAE,KAAK,C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AG,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,sBAAsB,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAE7D,IAAI,IAAI,GAAG,aAAa,UAAU,YAAY,QAAQ,GAAG,CAAC;IAC1D,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,IAAI,KAAK,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
# @isl-lang/errors
> TODO: Add description
## Installation
```bash
pnpm add @isl-lang/errors
```
## Usage
```typescript
import {} from '@isl-lang/errors';
```
## API
_TODO: Document public API._
## Development
```bash
pnpm build # Build the package
pnpm test # Run tests
pnpm typecheck # Type-check without emit
pnpm clean # Remove dist/
```
## License
MIT
+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAwyB/D,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAEzE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,aAAa,GAAG,gBAAgB,EAAE,CAErF"}
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CA2zC/D,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAEzE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,aAAa,GAAG,gBAAgB,EAAE,CAErF"}

@@ -448,2 +448,90 @@ // ============================================================================

},
E0301: {
code: 'E0301',
category: 'semantic',
title: 'Undefined entity',
explanation: `
You're referencing an entity that hasn't been defined in this domain.
Entities must be declared before they can be used in behaviors, types, or
other entities.
`.trim(),
causes: [
'Typo in entity name',
'Entity defined in a different domain (missing import)',
"Entity was renamed but references weren't updated",
'Case sensitivity issue (entity names are case-sensitive)',
],
solutions: [
'Check spelling of the entity name',
'Import the entity from the correct domain if it exists elsewhere',
'Define the entity before using it',
'Use correct casing (entities start with uppercase)',
],
badExample: {
code: `behavior Transfer {
preconditions {
Account.exists(senderId) // ← Account not defined
}
}`,
description: 'Referencing undefined entity',
},
goodExample: {
code: `entity Account {
id: UUID
}
behavior Transfer {
preconditions {
Account.exists(senderId) // ← Account is now defined
}
}`,
description: 'Entity defined before use',
},
seeAlso: ['E0300', 'E0302'],
},
E0302: {
code: 'E0302',
category: 'semantic',
title: 'Undefined behavior',
explanation: `
You're referencing a behavior that hasn't been defined in this domain.
Behaviors must be declared before they can be referenced in scenarios,
policies, or other behaviors.
`.trim(),
causes: [
'Typo in behavior name',
'Behavior defined in a different domain (missing import)',
"Behavior was renamed but references weren't updated",
'Case sensitivity issue',
],
solutions: [
'Check spelling of the behavior name',
'Import the behavior from the correct domain if it exists elsewhere',
'Define the behavior before referencing it',
'Use correct casing (behaviors start with uppercase)',
],
badExample: {
code: `scenario "test" {
given {
Transfer(amount: 100) // ← Transfer not defined
}
}`,
description: 'Referencing undefined behavior',
},
goodExample: {
code: `behavior Transfer {
input {
amount: Decimal
}
}
scenario "test" {
given {
Transfer(amount: 100) // ← Transfer is now defined
}
}`,
description: 'Behavior defined before use',
},
seeAlso: ['E0300', 'E0301'],
},
E0304: {

@@ -526,2 +614,189 @@ code: 'E0304',

},
E0310: {
code: 'E0310',
category: 'semantic',
title: 'Unsatisfiable precondition',
explanation: `
The preconditions contain contradictory constraints that can never all
be satisfied simultaneously. This means the behavior can never be
invoked legally.
`.trim(),
causes: [
'Contradictory numeric bounds (e.g., x > 5 and x < 2)',
'Mutually exclusive conditions combined with AND',
'Copy-paste errors creating conflicting constraints',
'Overly strict validation that rejects all inputs',
],
solutions: [
'Review the preconditions and remove contradictory constraints',
'Change AND to OR if conditions should be alternatives',
'Use consistent bounds (lower bound < upper bound)',
'Remove redundant or conflicting checks',
],
badExample: {
code: `behavior Transfer {
preconditions {
amount > 1000 and amount < 100 // ← impossible
}
}`,
description: 'Contradictory bounds that can never be satisfied',
},
goodExample: {
code: `behavior Transfer {
preconditions {
amount > 0 and amount <= 10000 // ← valid range
}
}`,
description: 'Consistent bounds that define a valid range',
},
seeAlso: ['E0311', 'E0500'],
},
E0311: {
code: 'E0311',
category: 'semantic',
title: 'Output referenced in precondition',
explanation: `
A precondition references 'result' or 'output', but these values don't
exist until after the behavior executes. Preconditions are checked
BEFORE execution, so they can only reference inputs and existing state.
`.trim(),
causes: [
'Confusing preconditions with postconditions',
'Copy-paste error from a postcondition',
'Misunderstanding of contract evaluation order',
],
solutions: [
'Move the check to a postcondition if validating output',
'Reference input fields instead of output fields',
'Use old() in postconditions to compare pre/post state',
],
badExample: {
code: `behavior Transfer {
preconditions {
result.success == true // ← result doesn't exist yet
}
}`,
description: 'Referencing result in a precondition',
},
goodExample: {
code: `behavior Transfer {
preconditions {
amount > 0 // ← validates input
}
postconditions {
success implies result.transferred == amount
}
}`,
description: 'Preconditions check inputs, postconditions check results',
},
seeAlso: ['E0305', 'E0310'],
},
E0312: {
code: 'E0312',
category: 'semantic',
title: 'Undefined result field',
explanation: `
A postcondition references a field on 'result' that is not declared
in the output type. This will cause a runtime error when the
postcondition is evaluated.
`.trim(),
causes: [
'Typo in field name',
'Field was renamed in output but not in postcondition',
'Referencing a field from a different behavior',
'Forgetting to add a field to the output type',
],
solutions: [
'Check the spelling of the field name',
'Add the missing field to the output type',
'Use a field that exists in the declared output',
],
badExample: {
code: `behavior Transfer {
output {
success: transferred: Decimal
}
postconditions {
result.ammount > 0 // ← typo: 'ammount' not in output
}
}`,
description: 'Referencing non-existent field in output',
},
goodExample: {
code: `behavior Transfer {
output {
success: transferred: Decimal
}
postconditions {
result.transferred > 0 // ← correct field name
}
}`,
description: 'Referencing a declared output field',
},
seeAlso: ['E0202', 'E0313'],
},
E0313: {
code: 'E0313',
category: 'semantic',
title: 'Undefined invariant variable',
explanation: `
An invariant references a variable that is not defined in the current
scope. Invariants can only reference entities, types, fields, and
bound variables from quantifiers.
`.trim(),
causes: [
'Typo in variable or field name',
'Variable defined in a different scope',
'Missing quantifier binding',
'Entity or type not defined before the invariant',
],
solutions: [
'Check the spelling of the variable name',
'Define the entity or type before the invariant',
'Use a quantifier (all, any) to bind iteration variables',
'Reference fields using entity.field syntax',
],
badExample: {
code: `invariant "balance check" {
account.balence >= 0 // ← typo: 'balence'
}`,
description: 'Typo in field name',
},
goodExample: {
code: `invariant "balance check" {
all a in Account: a.balance >= 0 // ← correct with quantifier
}`,
description: 'Proper variable binding with quantifier',
},
seeAlso: ['E0300', 'E0312'],
},
E0314: {
code: 'E0314',
category: 'semantic',
title: 'Contradictory bounds',
explanation: `
The specified bounds for a variable are contradictory - the lower bound
is greater than the upper bound, making it impossible for any value to
satisfy both constraints.
`.trim(),
causes: [
'Swapped comparison operators (< vs >)',
'Numeric typo in bound values',
'Copy-paste error with wrong variable',
],
solutions: [
'Ensure lower bound < upper bound',
'Check comparison operators are correct',
'Verify numeric values are as intended',
],
badExample: {
code: `type Age = Int where min(100) and max(0) // ← min > max`,
description: 'Minimum bound greater than maximum',
},
goodExample: {
code: `type Age = Int where min(0) and max(120) // ← valid range`,
description: 'Valid minimum and maximum bounds',
},
seeAlso: ['E0310', 'E0200'],
},
// ==========================================================================

@@ -598,2 +873,117 @@ // EVALUATION ERRORS (E0400-E0499)

},
E0403: {
code: 'E0403',
category: 'eval',
title: 'Undefined property',
explanation: `
An expression tried to access a property that doesn't exist on the value.
This is a runtime error that occurs when accessing fields, methods, or
other properties that aren't defined.
`.trim(),
causes: [
'Typo in property name',
'Property exists on a different type',
"Property was renamed but usages weren't updated",
'Accessing property on wrong object',
],
solutions: [
'Check spelling of the property name',
'Verify the property exists on the type being accessed',
'Use autocomplete or check type definitions',
'Check if property needs to be accessed differently',
],
badExample: {
code: `entity Account {
balance: Decimal
}
postconditions {
account.balace > 0 // ← typo: "balace"
}`,
description: 'Typo in property name',
},
goodExample: {
code: `entity Account {
balance: Decimal
}
postconditions {
account.balance > 0 // ← correct spelling
}`,
description: 'Correct property name',
},
seeAlso: ['E0202', 'E0401'],
},
E0404: {
code: 'E0404',
category: 'eval',
title: 'Invalid operation',
explanation: `
An operation was attempted that is not valid for the given values or
context. This is a catch-all for various runtime errors that don't fit
into more specific categories.
`.trim(),
causes: [
'Operation not supported for the value type',
'Invalid state for the operation',
'Missing required context or parameters',
'Operation failed due to constraints',
],
solutions: [
'Check the operation is valid for the value type',
'Verify the system is in a valid state',
'Ensure all required parameters are provided',
'Review constraints and preconditions',
],
badExample: {
code: `postconditions {
"hello".length() // ← strings don't have length() method
}`,
description: 'Invalid operation on type',
},
goodExample: {
code: `postconditions {
"hello".length > 0 // ← use property, not method
}`,
description: 'Correct operation',
},
seeAlso: ['E0204', 'E0400'],
},
E0408: {
code: 'E0408',
category: 'eval',
title: 'Type coercion failed',
explanation: `
An attempt to convert a value from one type to another failed because
the conversion is not possible or the value is invalid for the target type.
`.trim(),
causes: [
'Converting incompatible types (e.g., String to Int)',
'Invalid format for conversion (e.g., "abc" to Int)',
'Value out of range for target type',
'Null/undefined value cannot be coerced',
],
solutions: [
'Ensure the value can be converted to the target type',
'Use proper conversion functions (parseInt, toString, etc.)',
'Validate the value format before conversion',
'Handle null/undefined cases explicitly',
],
badExample: {
code: `postconditions {
parseInt("not a number") // ← invalid format
}`,
description: 'Invalid conversion',
},
goodExample: {
code: `preconditions {
input.value.matches(/^\\d+$/) // ← validate format first
}
postconditions {
parseInt(input.value) > 0 // ← safe conversion
}`,
description: 'Validating before conversion',
},
seeAlso: ['E0200', 'E0403'],
},
// ==========================================================================

@@ -796,2 +1186,129 @@ // VERIFICATION ERRORS (E0500-E0599)

},
// ==========================================================================
// MODULE RESOLUTION ERRORS (E0710-E0799)
// ==========================================================================
E0710: {
code: 'E0710',
category: 'io',
title: 'Module not found',
explanation: `
The module specified in the use statement could not be found.
ISL searches for modules in this order:
1. Relative paths (./local.isl)
2. Project root and intents/ folder
3. Standard library (stdlib-*)
4. External packages (@org/module)
`.trim(),
causes: [
'Typo in module name',
'Module file does not exist',
'Missing stdlib package installation',
'Incorrect relative path',
'Wrong file extension',
],
solutions: [
'Check spelling of module name',
'Verify the file exists at the expected path',
'Install @isl-lang/stdlib if using stdlib modules',
'Use correct relative path syntax (./)',
'Ensure file has .isl extension',
],
badExample: {
code: `use stdlib-autth // ← typo: "autth" instead of "auth"`,
description: 'Typo in stdlib module name',
},
goodExample: {
code: `use stdlib-auth // ← correct spelling`,
description: 'Correct stdlib module name',
},
seeAlso: ['E0705', 'E0711'],
},
E0711: {
code: 'E0711',
category: 'semantic',
title: 'Circular import detected',
explanation: `
A circular dependency was detected in the module graph.
Module A imports B, which imports C, which imports A again.
Circular imports are not allowed as they create ambiguous load order
and can cause initialization issues.
ISL detects these cycles during module graph construction using
Tarjan's algorithm for finding strongly connected components.
`.trim(),
causes: [
'Two modules importing each other directly',
'Indirect cycle through multiple modules (A → B → C → A)',
'Shared types placed in a module that imports them',
'Refactoring that accidentally introduced a cycle',
],
solutions: [
'Extract shared types to a common module that both can import',
'Restructure modules to break the cycle',
'Use interface segregation - split large modules',
'Create a dedicated "types" module for shared definitions',
],
badExample: {
code: `// auth.isl
use "./session" // imports session
// session.isl
use "./auth" // imports auth → CYCLE!`,
description: 'Two modules importing each other',
},
goodExample: {
code: `// types.isl (shared types)
entity User { ... }
// auth.isl
use "./types" // imports shared types
// session.isl
use "./types" // imports shared types (no cycle)`,
description: 'Extracting shared types to break the cycle',
},
seeAlso: ['E0710', 'E0712'],
},
E0712: {
code: 'E0712',
category: 'semantic',
title: 'Module version conflict',
explanation: `
The same module is imported with different version constraints that
cannot be satisfied simultaneously.
When you use versioned imports like 'use stdlib-auth@1.0.0', ISL tracks
all version constraints and reports conflicts when the same module is
requested with incompatible versions.
`.trim(),
causes: [
'Different files require incompatible versions of the same module',
'Transitive dependencies with version mismatch',
'Copy-paste error with different version numbers',
'Upgrading one import but forgetting others',
],
solutions: [
'Align version constraints across all files',
'Update all imports to use the same compatible version',
'Remove version constraints to use latest compatible version',
'Check transitive dependencies for version requirements',
],
badExample: {
code: `// file-a.isl
use stdlib-auth@1.0.0
// file-b.isl
use stdlib-auth@2.0.0 // ← conflicts with file-a.isl!`,
description: 'Same module with conflicting versions',
},
goodExample: {
code: `// file-a.isl
use stdlib-auth@2.0.0
// file-b.isl
use stdlib-auth@2.0.0 // ← same version, no conflict`,
description: 'Aligned version constraints',
},
seeAlso: ['E0710', 'E0711'],
},
};

@@ -798,0 +1315,0 @@ /**

@@ -1,1 +0,1 @@

{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gCAAgC;AAChC,+EAA+E;AAC/E,EAAE;AACF,2EAA2E;AAC3E,yDAAyD;AACzD,EAAE;AACF,+EAA+E;AAI/E;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAqC;IAClE,6EAA6E;IAC7E,6BAA6B;IAC7B,6EAA6E;IA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,CAyCR;AA6BD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,OAAc,GAAG,MAAM,CA8DjF;AAeD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,GAAE,OAAc,GAAG,MAAM,CA8BrE"}
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,UAAU,EAEV,aAAa,EAEb,UAAU,EAEV,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,sBAAsB,EAAE,CAAC;AA0ElC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAMlE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAE9D;AAMD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM,GACnC,MAAM,CA2ER;AA6KD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,UAAU,EAAE,EACzB,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM,GACnC,MAAM,CAyCR;AA6BD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,GAAE,OAAc,GAAG,MAAM,CA8DjF;AAeD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,GAAE,OAAc,GAAG,MAAM,CA8BrE"}

@@ -128,12 +128,26 @@ // ============================================================================

}
// Notes
if (opts.showHelp && diagnostic.notes && diagnostic.notes.length > 0) {
for (const note of diagnostic.notes) {
// Get explanation from catalog if available
const explanation = getExplanation(diagnostic.code);
// Notes - "why" explanation
if (opts.showHelp) {
// Use notes from diagnostic, or fall back to explanation from catalog
const notes = diagnostic.notes && diagnostic.notes.length > 0
? diagnostic.notes
: explanation
? [explanation.explanation.trim()]
: [];
for (const note of notes) {
lines.push(formatAnnotation('note', note, colors));
}
}
// Help suggestions
if (opts.showHelp && diagnostic.help && diagnostic.help.length > 0) {
for (const help of diagnostic.help) {
lines.push(formatAnnotation('help', help, colors));
// Help suggestions - "how to fix"
if (opts.showHelp) {
// Use help from diagnostic, or fall back to solutions from catalog
const help = diagnostic.help && diagnostic.help.length > 0
? diagnostic.help
: explanation && explanation.solutions.length > 0
? explanation.solutions
: [];
for (const helpText of help) {
lines.push(formatAnnotation('help', helpText, colors));
}

@@ -140,0 +154,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../src/formatter.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAC/E,EAAE;AACF,8EAA8E;AAC9E,YAAY;AACZ,uCAAuC;AACvC,+CAA+C;AAC/C,iCAAiC;AACjC,sCAAsC;AACtC,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAE/E,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA0B9C,MAAM,MAAM,GAAgB;IAC1B,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI;IACrB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;IAC1B,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI;IACrB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI;IACrB,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,UAAU,EAAE,KAAK,CAAC,IAAI;IACtB,SAAS,EAAE,KAAK,CAAC,IAAI;IACr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EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE;QAC5E,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sBAAsB,EAAE;QAC7E,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,wBAAwB,EAAE;KAC7E,CAAC;IAEF,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CACR,KAAK,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG;YAC/C,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG;YACtC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CACnC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC,CAAC;IAE/E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}

@@ -8,2 +8,4 @@ export type { SourceLocation, Position, DiagnosticSeverity, RelatedInformation, CodeFix, TextEdit, ErrorCategory, Diagnostic, DiagnosticTag, ErrorExplanation, SourceFile, FormatOptions, DiagnosticResult, } from './types.js';

export { DiagnosticBuilder, diagnostic, errorDiag, warningDiag, DiagnosticCollector, } from './builder.js';
export { formatVerdict, formatViolationMessage, formatVerdictCompact, type Verdict, type ViolationSeverity, type VerdictViolation, type VerdictResult, type VerdictFormatOptions, } from './verdict.js';
export { LEGACY_CODE_MAP, resolveErrorCode, categoryFromCode, fromParserDiagnostic, fromParserDiagnostics, type LegacyParserDiagnostic, } from './bridge.js';
/**

@@ -10,0 +12,0 @@ * Create a new source location

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,YAAY,EACV,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACP,QAAQ,EACR,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGpD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,WAAW,EACX,eAAe,EACf,WAAW,EACX,aAAa,EACb,aAAa,EACb,SAAS,EACT,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,WAAW,EACX,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAMtB;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,YAAY,EAAE,cAAc,CAQrC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,YAAY,EAAE,cAAc,GAAG,MAAM,CAErF"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAkBA,YAAY,EACV,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACP,QAAQ,EACR,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,UAAU,EACV,aAAa,EACb,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAGpD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,WAAW,EACX,eAAe,EACf,WAAW,EACX,aAAa,EACb,aAAa,EACb,SAAS,EACT,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,WAAW,EACX,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,OAAO,EACZ,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,oBAAoB,GAC1B,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,KAAK,sBAAsB,GAC5B,MAAM,aAAa,CAAC;AAMrB;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,YAAY,EAAE,cAAc,CAQrC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,YAAY,EAAE,cAAc,GAAG,MAAM,CAErF"}

@@ -28,2 +28,6 @@ // ============================================================================

export { DiagnosticBuilder, diagnostic, errorDiag, warningDiag, DiagnosticCollector, } from './builder.js';
// Verdict formatter
export { formatVerdict, formatViolationMessage, formatVerdictCompact, } from './verdict.js';
// Bridge (legacy code mapping)
export { LEGACY_CODE_MAP, resolveErrorCode, categoryFromCode, fromParserDiagnostic, fromParserDiagnostics, } from './bridge.js';
// ============================================================================

@@ -30,0 +34,0 @@ // CONVENIENCE RE-EXPORTS

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,0DAA0D;AAC1D,+EAA+E;AAC/E,EAAE;AACF,sDAAsD;AACtD,EAAE;AACF,YAAY;AACZ,wCAAwC;AACxC,8CAA8C;AAC9C,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AM,UAAU,oBAAoB,CAAC,GAAwC;IAC3E,OAAO,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;AACjD,CAAC"}
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,0DAA0D;AAC1D,+EAA+E;AAC/E,EAAE;AACF,sDAAsD;AACtD,EAAE;AACF,YAAY;AACZ,wCAAwC;AACxC,8CAA8C;AAC9C,6DAA6D;AAC7D,qDAAqD;AACrD,kDAAkD;AAClD,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAmB/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,cAAc;AACd,OAAO,EACL,YAAY,EACZ,aAAa,EACb,WAAW,EACX,eAAe,EACf,WAAW,EACX,aAAa,EACb,aAAa,EACb,SAAS,EACT,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,kBAAkB,GAInB,MAAM,YAAY,CAAC;AAEpB,+BAA+B;AAC/B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAEtB,cAAc;AACd,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,cAAc,GAIf,MAAM,kBAAkB,CAAC;AAE1B,YAAY;AACZ,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,UAAU;AACV,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,WAAW,EACX,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,oBAAoB;AACpB,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,oBAAoB,GAMrB,MAAM,cAAc,CAAC;AAEtB,+BAA+B;AAC/B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,GAEtB,MAAM,aAAa,CAAC;AAErB,+EAA+E;AAC/E,yBAAyB;AACzB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,IAAY,EACZ,MAAc,EACd,OAAgB,EAChB,SAAkB;IAElB,OAAO;QACL,IAAI;QACJ,IAAI;QACJ,MAAM;QACN,OAAO,EAAE,OAAO,IAAI,IAAI;QACxB,SAAS,EAAE,SAAS,IAAI,MAAM;KAC/B,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAwC;IAC3E,OAAO,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;AACjD,CAAC"}
{
"name": "@isl-lang/errors",
"version": "1.0.0",
"version": "2.0.0",
"description": "Unified error infrastructure for the ISL toolchain - best-in-class error messages",

@@ -45,3 +45,5 @@ "main": "dist/index.js",

"typescript": "^5.3.0",
"vitest": "^1.1.0"
"vitest": "^1.1.0",
"tsup": "^8.0.1",
"rimraf": "^5.0.5"
},

@@ -56,2 +58,8 @@ "repository": {

},
"sideEffects": false,
"files": [
"dist",
"README.md",
"LICENSE"
],
"scripts": {

@@ -61,4 +69,7 @@ "build": "tsc",

"test:coverage": "vitest --coverage",
"lint": "eslint src/"
"lint": "eslint src/",
"typecheck": "tsc --noEmit",
"clean": "rimraf dist",
"test:unit": "vitest run --passWithNoTests"
}
}
> @isl-lang/errors@1.0.0 build C:\Users\mevla\OneDrive\Desktop\IntentOS\packages\errors
> tsc
// ============================================================================
// ISL Diagnostic Builder
// ============================================================================
//
// Fluent API for building diagnostics with all the bells and whistles.
//
// ============================================================================
import type {
Diagnostic,
DiagnosticSeverity,
SourceLocation,
RelatedInformation,
CodeFix,
TextEdit,
DiagnosticTag,
ErrorCategory,
} from './types.js';
import { ERROR_CODES, formatErrorMessage, type ErrorCodeKey } from './codes.js';
import { findSimilar, getContextualHelp } from './suggestions.js';
/**
* Builder for creating diagnostics with a fluent API.
*
* Example:
* ```ts
* const diag = new DiagnosticBuilder()
* .error('E0200')
* .message('Type mismatch: expected Number, got String')
* .at(location)
* .note('The field is declared as Number')
* .help('Use parseInt() to convert the string')
* .related('Field declared here', fieldLocation)
* .build();
* ```
*/
export class DiagnosticBuilder {
private _code: string = 'E0000';
private _category: ErrorCategory = 'parser';
private _severity: DiagnosticSeverity = 'error';
private _message: string = '';
private _location: SourceLocation = {
file: '',
line: 1,
column: 1,
endLine: 1,
endColumn: 1,
};
private _source: Diagnostic['source'] = 'parser';
private _related: RelatedInformation[] = [];
private _notes: string[] = [];
private _help: string[] = [];
private _tags: DiagnosticTag[] = [];
private _fix?: CodeFix;
/**
* Set error code and severity to 'error'
*/
error(code: string | ErrorCodeKey): this {
const def = typeof code === 'string' && code.startsWith('E')
? undefined
: ERROR_CODES[code as ErrorCodeKey];
if (def) {
this._code = def.code;
this._category = def.category;
} else {
this._code = code as string;
}
this._severity = 'error';
return this;
}
/**
* Set warning code and severity to 'warning'
*/
warning(code: string): this {
this._code = code;
this._severity = 'warning';
return this;
}
/**
* Set info code and severity to 'info'
*/
info(code: string): this {
this._code = code;
this._severity = 'info';
return this;
}
/**
* Set hint code and severity to 'hint'
*/
hint(code: string): this {
this._code = code;
this._severity = 'hint';
return this;
}
/**
* Set severity explicitly
*/
severity(sev: DiagnosticSeverity): this {
this._severity = sev;
return this;
}
/**
* Set error message
*/
message(msg: string): this {
this._message = msg;
return this;
}
/**
* Set error message using template and values
*/
messageTemplate(template: string, values: Record<string, string | number>): this {
this._message = formatErrorMessage(template, values);
return this;
}
/**
* Set source location
*/
at(location: SourceLocation): this {
this._location = location;
return this;
}
/**
* Set source location from line/column (useful for testing)
*/
atPosition(
file: string,
line: number,
column: number,
endLine?: number,
endColumn?: number
): this {
this._location = {
file,
line,
column,
endLine: endLine ?? line,
endColumn: endColumn ?? column,
};
return this;
}
/**
* Set component source
*/
from(source: Diagnostic['source']): this {
this._source = source;
return this;
}
/**
* Add a note
*/
note(text: string): this {
this._notes.push(text);
return this;
}
/**
* Add a help suggestion
*/
help(text: string): this {
this._help.push(text);
return this;
}
/**
* Add "Did you mean?" suggestion if similar value found
*/
suggestSimilar(input: string, candidates: string[]): this {
const suggestions = findSimilar(input, candidates);
if (suggestions.length > 0) {
const names = suggestions.map(s => `'${s.value}'`).join(', ');
this._help.push(`Did you mean ${names}?`);
}
return this;
}
/**
* Add contextual help based on error patterns
*/
addContextualHelp(context: Record<string, unknown> = {}): this {
const helps = getContextualHelp(this._code, this._message, context);
this._help.push(...helps);
return this;
}
/**
* Add related information
*/
related(message: string, location: SourceLocation): this {
this._related.push({ message, location });
return this;
}
/**
* Mark as unnecessary code
*/
unnecessary(): this {
this._tags.push('unnecessary');
return this;
}
/**
* Mark as deprecated
*/
deprecated(): this {
this._tags.push('deprecated');
return this;
}
/**
* Add a quick fix
*/
fix(title: string, edits: TextEdit[], isPreferred?: boolean): this {
this._fix = { title, edits, isPreferred };
return this;
}
/**
* Add a simple replacement fix
*/
fixReplace(
title: string,
startLine: number,
startCol: number,
endLine: number,
endCol: number,
newText: string
): this {
this._fix = {
title,
edits: [{
range: {
start: { line: startLine, column: startCol },
end: { line: endLine, column: endCol },
},
newText,
}],
isPreferred: true,
};
return this;
}
/**
* Build the diagnostic
*/
build(): Diagnostic {
return {
code: this._code,
category: this._category,
severity: this._severity,
message: this._message,
location: this._location,
source: this._source,
relatedInformation: this._related.length > 0 ? this._related : undefined,
notes: this._notes.length > 0 ? this._notes : undefined,
help: this._help.length > 0 ? this._help : undefined,
tags: this._tags.length > 0 ? this._tags : undefined,
fix: this._fix,
};
}
}
/**
* Create a diagnostic builder
*/
export function diagnostic(): DiagnosticBuilder {
return new DiagnosticBuilder();
}
// ============================================================================
// QUICK DIAGNOSTIC FACTORIES
// ============================================================================
/**
* Create an error diagnostic quickly
*/
export function errorDiag(
code: string,
message: string,
location: SourceLocation,
source: Diagnostic['source'] = 'parser'
): Diagnostic {
return diagnostic()
.error(code)
.message(message)
.at(location)
.from(source)
.build();
}
/**
* Create a warning diagnostic quickly
*/
export function warningDiag(
code: string,
message: string,
location: SourceLocation,
source: Diagnostic['source'] = 'parser'
): Diagnostic {
return diagnostic()
.warning(code)
.message(message)
.at(location)
.from(source)
.build();
}
// ============================================================================
// ERROR COLLECTOR
// ============================================================================
/**
* Collects multiple diagnostics during parsing/type checking.
* Supports a maximum error limit to avoid overwhelming output.
*/
export class DiagnosticCollector {
private diagnostics: Diagnostic[] = [];
private readonly maxErrors: number;
constructor(maxErrors: number = 100) {
this.maxErrors = maxErrors;
}
/**
* Add a diagnostic
*/
add(diagnostic: Diagnostic): void {
if (this.diagnostics.length < this.maxErrors) {
this.diagnostics.push(diagnostic);
}
}
/**
* Add multiple diagnostics
*/
addAll(diagnostics: Diagnostic[]): void {
for (const d of diagnostics) {
this.add(d);
}
}
/**
* Check if any errors exist
*/
hasErrors(): boolean {
return this.diagnostics.some(d => d.severity === 'error');
}
/**
* Get all errors
*/
getErrors(): Diagnostic[] {
return this.diagnostics.filter(d => d.severity === 'error');
}
/**
* Get all warnings
*/
getWarnings(): Diagnostic[] {
return this.diagnostics.filter(d => d.severity === 'warning');
}
/**
* Get all diagnostics
*/
getAll(): Diagnostic[] {
return [...this.diagnostics];
}
/**
* Get error count
*/
errorCount(): number {
return this.diagnostics.filter(d => d.severity === 'error').length;
}
/**
* Get warning count
*/
warningCount(): number {
return this.diagnostics.filter(d => d.severity === 'warning').length;
}
/**
* Get total count
*/
count(): number {
return this.diagnostics.length;
}
/**
* Check if at max capacity
*/
isFull(): boolean {
return this.diagnostics.length >= this.maxErrors;
}
/**
* Clear all diagnostics
*/
clear(): void {
this.diagnostics = [];
}
}
// ============================================================================
// ISL Error Explanation Catalog
// ============================================================================
//
// Detailed explanations for each error code, used by `isl explain <code>`.
// Inspired by Rust's --explain and Elm's error messages.
//
// ============================================================================
import type { ErrorCategory, ErrorExplanation } from './types.js';
/**
* Complete error explanation catalog
*/
export const ERROR_EXPLANATIONS: Record<string, ErrorExplanation> = {
// ==========================================================================
// LEXER ERRORS (E0001-E0099)
// ==========================================================================
E0001: {
code: 'E0001',
category: 'lexer',
title: 'Unexpected character',
explanation: `
The lexer encountered a character that is not valid in ISL source code.
This often happens when copying code from a word processor or website,
which may insert special characters like curly quotes or non-breaking spaces.
`.trim(),
causes: [
'Copying code from a word processor (Word, Google Docs) with smart quotes',
'Using special Unicode characters instead of ASCII equivalents',
'Accidental keyboard shortcuts inserting special characters',
'File encoding issues',
],
solutions: [
'Replace curly quotes "" with straight quotes ""',
'Replace special dashes (—, –) with regular dashes (-)',
'Ensure the file is saved as UTF-8',
'Use a plain text editor to verify the file contents',
],
badExample: {
code: `entity Account {
name: "String" // ← curly quotes
}`,
description: 'Using curly/smart quotes instead of straight quotes',
},
goodExample: {
code: `entity Account {
name: String // ← no quotes needed for types
}`,
description: 'Using proper ISL syntax',
},
seeAlso: ['E0002', 'E0004'],
},
E0002: {
code: 'E0002',
category: 'lexer',
title: 'Unterminated string literal',
explanation: `
A string literal was started with a quote but never closed. In ISL,
strings must be enclosed in matching double quotes ("...") or single
quotes ('...').
`.trim(),
causes: [
'Missing closing quote at the end of a string',
'Newline inside a string (use \\n for multi-line)',
'Using the wrong type of closing quote',
],
solutions: [
'Add the missing closing quote',
'For multi-line strings, use triple quotes """..."""',
'Escape special characters with backslash',
],
badExample: {
code: `description: "This is a long description
that spans multiple lines`,
description: 'String with missing closing quote',
},
goodExample: {
code: `description: """
This is a long description
that spans multiple lines
"""`,
description: 'Using triple quotes for multi-line strings',
},
},
E0006: {
code: 'E0006',
category: 'lexer',
title: 'Unterminated block comment',
explanation: `
A block comment was started with /* but never closed with */.
Block comments can span multiple lines but must be properly closed.
`.trim(),
causes: [
'Missing closing */ for a block comment',
'Accidentally deleted the closing */',
'Nested block comments (not supported)',
],
solutions: [
'Add the missing */ at the end of the comment',
'If you need nested comments, use multiple single-line comments (//) instead',
],
badExample: {
code: `/* This comment
never ends
entity Account {
id: UUID
}`,
description: 'Block comment missing closing */',
},
goodExample: {
code: `/* This comment
is properly closed */
entity Account {
id: UUID
}`,
description: 'Block comment with proper closing',
},
},
// ==========================================================================
// PARSER ERRORS (E0100-E0199)
// ==========================================================================
E0100: {
code: 'E0100',
category: 'parser',
title: 'Unexpected token',
explanation: `
The parser encountered a token that doesn't fit the expected syntax.
This often indicates a typo, missing punctuation, or misunderstanding
of ISL syntax.
`.trim(),
causes: [
'Typo in a keyword (e.g., "entiy" instead of "entity")',
'Missing colon between field name and type',
'Extra or missing braces',
'Using operators incorrectly',
],
solutions: [
'Check for typos in keywords',
'Verify the syntax matches ISL specification',
'Use proper punctuation (colons, braces, parentheses)',
],
badExample: {
code: `entiy Account { // ← typo: "entiy"
id UUID // ← missing colon
}`,
description: 'Multiple syntax errors',
},
goodExample: {
code: `entity Account {
id: UUID
}`,
description: 'Correct ISL syntax',
},
seeAlso: ['E0101', 'E0102'],
},
E0105: {
code: 'E0105',
category: 'parser',
title: 'Missing closing brace',
explanation: `
A block was opened with { but the matching closing brace } was not found.
Every opening brace must have a corresponding closing brace.
`.trim(),
causes: [
'Forgot to add closing brace',
'Braces are mismatched due to copy-paste errors',
'Deleted closing brace by accident',
],
solutions: [
'Add the missing closing brace',
'Use an editor with bracket matching to find unmatched braces',
'Format the code to make nesting levels clear',
],
badExample: {
code: `entity Account {
id: UUID
fields {
name: String
email: String
// ← missing } for fields
// ← missing } for entity`,
description: 'Missing closing braces',
},
goodExample: {
code: `entity Account {
id: UUID
fields {
name: String
email: String
}
}`,
description: 'Properly matched braces',
},
seeAlso: ['E0106', 'E0107', 'E0118'],
},
E0109: {
code: 'E0109',
category: 'parser',
title: 'Duplicate entity',
explanation: `
An entity with this name has already been defined. Each entity in a
domain must have a unique name.
`.trim(),
causes: [
'Copy-paste error creating a duplicate',
'Same entity defined in multiple imported files',
'Forgot to rename after copying',
],
solutions: [
'Rename one of the duplicate entities',
'Remove the duplicate definition',
'If importing, use namespacing or aliases',
],
badExample: {
code: `entity User {
id: UUID
}
entity User { // ← duplicate!
name: String
}`,
description: 'Entity defined twice',
},
goodExample: {
code: `entity User {
id: UUID
name: String
}`,
description: 'Single entity definition with all fields',
},
seeAlso: ['E0110', 'E0111', 'E0309'],
},
// ==========================================================================
// TYPE ERRORS (E0200-E0299)
// ==========================================================================
E0200: {
code: 'E0200',
category: 'type',
title: 'Type mismatch',
explanation: `
The type of a value doesn't match what was expected. ISL is statically
typed, so types must be consistent throughout your specification.
`.trim(),
causes: [
'Assigning a value of the wrong type to a field',
'Comparing values of different types',
'Returning wrong type from an expression',
'Using wrong field on an entity',
],
solutions: [
'Check the expected type and adjust the value',
'Use type conversion functions if needed (parseInt, toString)',
'Verify field names and types in entity definitions',
],
badExample: {
code: `entity Account {
balance: Decimal
}
behavior Transfer {
postconditions {
// Error: comparing Decimal with String
sender.balance == "100.00"
}
}`,
description: 'Comparing Decimal with String',
},
goodExample: {
code: `entity Account {
balance: Decimal
}
behavior Transfer {
postconditions {
sender.balance == 100.00 // ← Decimal literal
}
}`,
description: 'Using matching types',
},
seeAlso: ['E0203', 'E0210'],
},
E0201: {
code: 'E0201',
category: 'type',
title: 'Undefined type',
explanation: `
The type referenced in your code has not been defined. This could be
a built-in type with a typo, or a custom type that hasn't been declared.
Built-in types: String, Int, Decimal, Boolean, UUID, Timestamp, Duration,
List<T>, Map<K,V>, Set<T>, Optional<T>
`.trim(),
causes: [
'Typo in type name (e.g., "Intger" instead of "Int")',
'Using a type before defining it',
'Missing import for a type from another domain',
'Case sensitivity issue (types are case-sensitive)',
],
solutions: [
'Check spelling of the type name',
'Define the type before using it',
'Import the type from the correct module',
'Use correct casing (types start with uppercase)',
],
badExample: {
code: `entity User {
id: uuid // ← should be UUID (case-sensitive)
age: Intger // ← typo: should be Int
role: Rol // ← undefined custom type
}`,
description: 'Various undefined type errors',
},
goodExample: {
code: `enum Role { Admin, User, Guest }
entity User {
id: UUID
age: Int
role: Role
}`,
description: 'All types properly defined',
},
},
E0202: {
code: 'E0202',
category: 'type',
title: 'Undefined field',
explanation: `
You're trying to access a field that doesn't exist on this type.
This is often caused by typos in field names.
`.trim(),
causes: [
'Typo in field name',
'Field exists on a different entity',
'Field was renamed but not all usages were updated',
'Accessing a field on the wrong variable',
],
solutions: [
'Check the entity definition for available fields',
'Correct the typo in the field name',
'Use autocomplete in your editor to see available fields',
],
badExample: {
code: `entity Account {
balance: Decimal
}
behavior Check {
preconditions {
account.balace > 0 // ← typo: "balace"
}
}`,
description: 'Typo in field name',
},
goodExample: {
code: `entity Account {
balance: Decimal
}
behavior Check {
preconditions {
account.balance > 0 // ← correct spelling
}
}`,
description: 'Correct field name',
},
},
E0210: {
code: 'E0210',
category: 'type',
title: 'Incompatible comparison',
explanation: `
You're trying to compare values that cannot be meaningfully compared.
While some type comparisons are allowed (like comparing numbers), others
don't make sense (like comparing a String with a Boolean).
`.trim(),
causes: [
'Comparing values of unrelated types',
'Using wrong operator for comparison',
'Type coercion confusion',
],
solutions: [
'Ensure both sides of comparison have compatible types',
'Convert types explicitly if needed',
'Use appropriate comparison methods for complex types',
],
badExample: {
code: `postconditions {
user.name == user.age // ← String == Int
}`,
description: 'Comparing incompatible types',
},
goodExample: {
code: `postconditions {
user.age >= 18 // ← Int >= Int
}`,
description: 'Comparing compatible types',
},
seeAlso: ['E0200', 'E0203'],
},
// ==========================================================================
// SEMANTIC ERRORS (E0300-E0399)
// ==========================================================================
E0300: {
code: 'E0300',
category: 'semantic',
title: 'Undefined variable',
explanation: `
You're using a variable that hasn't been declared in the current scope.
Variables must be declared before use, either as input parameters,
local bindings, or in parent scopes.
`.trim(),
causes: [
'Typo in variable name',
'Variable declared in a different scope',
'Forgot to declare the variable',
'Using a reserved word as a variable name',
],
solutions: [
'Check spelling of the variable name',
'Declare the variable in the appropriate scope',
'Check if the variable should be an input parameter',
],
badExample: {
code: `behavior Transfer {
input {
amount: Decimal
}
preconditions {
ammount > 0 // ← typo: "ammount"
}
}`,
description: 'Typo in variable name',
},
goodExample: {
code: `behavior Transfer {
input {
amount: Decimal
}
preconditions {
amount > 0 // ← correct spelling
}
}`,
description: 'Correct variable reference',
},
seeAlso: ['E0301', 'E0302'],
},
E0304: {
code: 'E0304',
category: 'semantic',
title: 'old() outside postcondition',
explanation: `
The old() function captures the value of an expression before a behavior
executes. It only makes sense in postconditions, where you're comparing
the state before and after execution.
`.trim(),
causes: [
'Using old() in a precondition',
'Using old() in an invariant',
'Misunderstanding when old() is valid',
],
solutions: [
'Move the expression to a postcondition',
'In preconditions, reference values directly without old()',
],
badExample: {
code: `behavior Transfer {
preconditions {
old(sender.balance) >= amount // ← old() invalid here
}
}`,
description: 'old() used in precondition',
},
goodExample: {
code: `behavior Transfer {
preconditions {
sender.balance >= amount // ← direct reference
}
postconditions {
sender.balance == old(sender.balance) - amount // ← old() valid here
}
}`,
description: 'old() correctly used in postcondition',
},
seeAlso: ['E0305'],
},
E0305: {
code: 'E0305',
category: 'semantic',
title: 'result outside postcondition',
explanation: `
The 'result' keyword refers to the return value of a behavior. It only
exists after the behavior completes, so it can only be used in
postconditions.
`.trim(),
causes: [
'Using result in a precondition',
'Using result in behavior body instead of output',
],
solutions: [
'Move the expression to a postcondition',
'Use output fields to define what the behavior returns',
],
badExample: {
code: `behavior CalculateTotal {
preconditions {
result > 0 // ← result doesn't exist yet
}
}`,
description: 'result used in precondition',
},
goodExample: {
code: `behavior CalculateTotal {
output {
total: Decimal
}
postconditions {
result.total > 0 // ← result valid in postcondition
}
}`,
description: 'result correctly used in postcondition',
},
seeAlso: ['E0304'],
},
// ==========================================================================
// EVALUATION ERRORS (E0400-E0499)
// ==========================================================================
E0400: {
code: 'E0400',
category: 'eval',
title: 'Division by zero',
explanation: `
An expression attempted to divide by zero, which is undefined in
mathematics. This often occurs when a divisor variable is zero.
`.trim(),
causes: [
'Literal division by zero',
'Variable divisor that happens to be zero',
'Missing zero-check before division',
],
solutions: [
'Add a precondition to ensure divisor is non-zero',
'Use a default value or handle the zero case',
'Check for zero before dividing',
],
badExample: {
code: `postconditions {
average == total / count // ← count might be 0
}`,
description: 'Division without checking for zero',
},
goodExample: {
code: `preconditions {
count > 0 // ← ensure count is non-zero
}
postconditions {
average == total / count
}`,
description: 'Adding precondition to prevent division by zero',
},
},
E0401: {
code: 'E0401',
category: 'eval',
title: 'Null reference',
explanation: `
An expression tried to access a property or call a method on a null
value. This is one of the most common runtime errors.
`.trim(),
causes: [
'Accessing a field on an optional value without checking',
'Entity lookup returned null',
'Uninitialized variable',
],
solutions: [
'Check for null before accessing properties',
'Use optional chaining (?.) for safe access',
'Add preconditions to verify values exist',
],
badExample: {
code: `postconditions {
account.balance > 0 // ← account might be null
}`,
description: 'Accessing property without null check',
},
goodExample: {
code: `preconditions {
Account.exists(id) // ← verify account exists
}
postconditions {
account?.balance > 0 // ← optional chaining
}`,
description: 'Safe property access with null checks',
},
},
// ==========================================================================
// VERIFICATION ERRORS (E0500-E0599)
// ==========================================================================
E0500: {
code: 'E0500',
category: 'verify',
title: 'Precondition failed',
explanation: `
A precondition was not satisfied when the behavior was invoked.
Preconditions define the valid states under which a behavior can execute.
If a precondition fails, it means the caller violated the contract.
`.trim(),
causes: [
'Caller provided invalid input',
'System state doesn\'t meet requirements',
'Missing validation before calling behavior',
],
solutions: [
'Validate inputs before invoking the behavior',
'Ensure system is in correct state',
'Review the preconditions and adjust if too strict',
],
badExample: {
code: `// Precondition: amount > 0
// Actual call:
transfer({ amount: -50 }) // ← negative amount`,
description: 'Calling with invalid input',
},
goodExample: {
code: `// Validate first
if (amount <= 0) {
throw InvalidAmountError()
}
transfer({ amount: 50 }) // ← valid amount`,
description: 'Validating before calling',
},
seeAlso: ['E0501', 'E0502'],
},
E0501: {
code: 'E0501',
category: 'verify',
title: 'Postcondition failed',
explanation: `
A postcondition was not satisfied after the behavior executed.
Postconditions define what must be true after successful execution.
If a postcondition fails, the implementation has a bug.
`.trim(),
causes: [
'Implementation doesn\'t match specification',
'Edge case not handled correctly',
'State wasn\'t updated as expected',
'Side effect from another operation',
],
solutions: [
'Review the implementation logic',
'Add missing state updates',
'Check for edge cases',
'Verify no concurrent modifications',
],
badExample: {
code: `// Postcondition: sender.balance == old(sender.balance) - amount
// But implementation forgot to update sender
receiver.balance += amount
// sender.balance unchanged!`,
description: 'Implementation missing state update',
},
goodExample: {
code: `// Correct implementation
sender.balance -= amount
receiver.balance += amount
// Both postconditions satisfied`,
description: 'Complete implementation',
},
seeAlso: ['E0500', 'E0502'],
},
E0502: {
code: 'E0502',
category: 'verify',
title: 'Invariant violated',
explanation: `
An invariant — a condition that must always be true — was violated.
Invariants are checked before and after every behavior execution.
This indicates a critical error in the system logic.
`.trim(),
causes: [
'Behavior left system in invalid state',
'Concurrent modification bypassed checks',
'Invariant is too strict for actual requirements',
'Initial state was invalid',
],
solutions: [
'Review the behavior implementation',
'Check for race conditions',
'Ensure all state transitions maintain invariants',
'Consider if invariant definition is correct',
],
badExample: {
code: `// Invariant: balance >= 0
// After overdraft:
account.balance = -100 // ← violates invariant`,
description: 'Behavior violating balance invariant',
},
goodExample: {
code: `// Check before allowing operation
if (account.balance < amount) {
throw InsufficientFunds()
}
account.balance -= amount // ← invariant preserved`,
description: 'Checking before modification',
},
},
// ==========================================================================
// CONFIGURATION ERRORS (E0600-E0699)
// ==========================================================================
E0600: {
code: 'E0600',
category: 'config',
title: 'Invalid configuration file',
explanation: `
The configuration file (isl.config.json or isl.config.yaml) could not
be parsed. This is usually due to syntax errors in the file.
`.trim(),
causes: [
'Invalid JSON/YAML syntax',
'Missing required fields',
'Invalid field values',
'Encoding issues',
],
solutions: [
'Validate your JSON/YAML syntax using a linter',
'Check for missing commas, brackets, or quotes',
'Refer to documentation for required fields',
],
badExample: {
code: `{
"version": 1
"strict": true // ← missing comma after 1
}`,
description: 'Invalid JSON syntax',
},
goodExample: {
code: `{
"version": 1,
"strict": true
}`,
description: 'Valid JSON syntax',
},
},
E0700: {
code: 'E0700',
category: 'io',
title: 'File not found',
explanation: `
The specified file could not be found. Check that the path is correct
and the file exists.
`.trim(),
causes: [
'Typo in file path',
'File was moved or deleted',
'Wrong working directory',
'Case sensitivity on some file systems',
],
solutions: [
'Verify the file path is correct',
'Check the current working directory',
'Use absolute paths if relative paths are ambiguous',
],
},
E0705: {
code: 'E0705',
category: 'io',
title: 'Import not found',
explanation: `
The import statement references a module that cannot be found. This
could be a built-in module, a package, or a local file.
`.trim(),
causes: [
'Typo in module name',
'Package not installed',
'Incorrect import path',
'Module doesn\'t export the requested item',
],
solutions: [
'Check spelling of module name',
'Install missing packages',
'Verify import path is correct',
'Check what the module actually exports',
],
badExample: {
code: `import { Auth } from "@isl-lang/stdlib/auht" // ← typo`,
description: 'Typo in module path',
},
goodExample: {
code: `import { Auth } from "@isl-lang/stdlib/auth" // ← correct`,
description: 'Correct import path',
},
},
};
/**
* Get explanation for an error code
*/
export function getExplanation(code: string): ErrorExplanation | undefined {
return ERROR_EXPLANATIONS[code];
}
/**
* Get all error codes that have explanations
*/
export function getAllExplainedCodes(): string[] {
return Object.keys(ERROR_EXPLANATIONS).sort();
}
/**
* Check if an error code has an explanation
*/
export function hasExplanation(code: string): boolean {
return code in ERROR_EXPLANATIONS;
}
/**
* Get explanations by category
*/
export function getExplanationsByCategory(category: ErrorCategory): ErrorExplanation[] {
return Object.values(ERROR_EXPLANATIONS).filter(e => e.category === category);
}
// ============================================================================
// ISL Unified Error Code Catalog
// ============================================================================
//
// Error Code Ranges:
// E0001-E0099: Lexer errors (tokenization)
// E0100-E0199: Parser errors (syntax)
// E0200-E0299: Type errors (type checking)
// E0300-E0399: Semantic errors (name resolution, scoping)
// E0400-E0499: Evaluation errors (runtime)
// E0500-E0599: Verification errors (pre/post conditions)
// E0600-E0699: Configuration errors
// E0700-E0799: I/O errors
// E0800-E0899: LSP/IDE errors
// E0900-E0999: Reserved for future use
//
// ============================================================================
import type { ErrorCategory, ErrorExplanation } from './types.js';
/**
* Error code definition
*/
export interface ErrorCodeDef {
code: string;
category: ErrorCategory;
title: string;
messageTemplate: string;
}
// ============================================================================
// LEXER ERRORS (E0001-E0099)
// ============================================================================
export const LEXER_ERRORS = {
UNEXPECTED_CHARACTER: {
code: 'E0001',
category: 'lexer' as ErrorCategory,
title: 'Unexpected character',
messageTemplate: "Unexpected character '{char}'",
},
UNTERMINATED_STRING: {
code: 'E0002',
category: 'lexer' as ErrorCategory,
title: 'Unterminated string literal',
messageTemplate: 'Unterminated string literal',
},
UNTERMINATED_REGEX: {
code: 'E0003',
category: 'lexer' as ErrorCategory,
title: 'Unterminated regular expression',
messageTemplate: 'Unterminated regular expression',
},
INVALID_ESCAPE: {
code: 'E0004',
category: 'lexer' as ErrorCategory,
title: 'Invalid escape sequence',
messageTemplate: "Invalid escape sequence '\\{char}'",
},
INVALID_NUMBER: {
code: 'E0005',
category: 'lexer' as ErrorCategory,
title: 'Invalid number literal',
messageTemplate: "Invalid number literal '{value}'",
},
UNTERMINATED_COMMENT: {
code: 'E0006',
category: 'lexer' as ErrorCategory,
title: 'Unterminated block comment',
messageTemplate: 'Unterminated block comment',
},
INVALID_UNICODE: {
code: 'E0007',
category: 'lexer' as ErrorCategory,
title: 'Invalid Unicode escape',
messageTemplate: "Invalid Unicode escape sequence '\\u{value}'",
},
} as const;
// ============================================================================
// PARSER ERRORS (E0100-E0199)
// ============================================================================
export const PARSER_ERRORS = {
UNEXPECTED_TOKEN: {
code: 'E0100',
category: 'parser' as ErrorCategory,
title: 'Unexpected token',
messageTemplate: "Unexpected token '{token}'",
},
EXPECTED_TOKEN: {
code: 'E0101',
category: 'parser' as ErrorCategory,
title: 'Expected token',
messageTemplate: "Expected {expected}, got '{got}'",
},
EXPECTED_IDENTIFIER: {
code: 'E0102',
category: 'parser' as ErrorCategory,
title: 'Expected identifier',
messageTemplate: "Expected identifier, got '{got}'",
},
EXPECTED_TYPE: {
code: 'E0103',
category: 'parser' as ErrorCategory,
title: 'Expected type annotation',
messageTemplate: 'Expected type annotation',
},
EXPECTED_EXPRESSION: {
code: 'E0104',
category: 'parser' as ErrorCategory,
title: 'Expected expression',
messageTemplate: 'Expected expression',
},
MISSING_CLOSING_BRACE: {
code: 'E0105',
category: 'parser' as ErrorCategory,
title: 'Missing closing brace',
messageTemplate: "Expected '}' to close block",
},
MISSING_CLOSING_PAREN: {
code: 'E0106',
category: 'parser' as ErrorCategory,
title: 'Missing closing parenthesis',
messageTemplate: "Expected ')' to close group",
},
MISSING_CLOSING_BRACKET: {
code: 'E0107',
category: 'parser' as ErrorCategory,
title: 'Missing closing bracket',
messageTemplate: "Expected ']' to close list",
},
DUPLICATE_FIELD: {
code: 'E0108',
category: 'parser' as ErrorCategory,
title: 'Duplicate field',
messageTemplate: "Duplicate field '{name}'",
},
DUPLICATE_ENTITY: {
code: 'E0109',
category: 'parser' as ErrorCategory,
title: 'Duplicate entity',
messageTemplate: "Entity '{name}' is already defined",
},
DUPLICATE_BEHAVIOR: {
code: 'E0110',
category: 'parser' as ErrorCategory,
title: 'Duplicate behavior',
messageTemplate: "Behavior '{name}' is already defined",
},
DUPLICATE_TYPE: {
code: 'E0111',
category: 'parser' as ErrorCategory,
title: 'Duplicate type',
messageTemplate: "Type '{name}' is already defined",
},
MISSING_VERSION: {
code: 'E0112',
category: 'parser' as ErrorCategory,
title: 'Missing version',
messageTemplate: "Domain is missing required 'version' field",
},
INVALID_CONSTRAINT: {
code: 'E0113',
category: 'parser' as ErrorCategory,
title: 'Invalid constraint',
messageTemplate: "Invalid constraint '{constraint}'",
},
INVALID_ANNOTATION: {
code: 'E0114',
category: 'parser' as ErrorCategory,
title: 'Invalid annotation',
messageTemplate: "Invalid annotation '@{name}'",
},
INVALID_LIFECYCLE: {
code: 'E0115',
category: 'parser' as ErrorCategory,
title: 'Invalid lifecycle definition',
messageTemplate: 'Invalid lifecycle definition',
},
EXPECTED_STATEMENT: {
code: 'E0116',
category: 'parser' as ErrorCategory,
title: 'Expected statement',
messageTemplate: 'Expected statement',
},
INVALID_OPERATOR: {
code: 'E0117',
category: 'parser' as ErrorCategory,
title: 'Invalid operator',
messageTemplate: "Invalid operator '{op}'",
},
UNCLOSED_BLOCK: {
code: 'E0118',
category: 'parser' as ErrorCategory,
title: 'Unclosed block',
messageTemplate: "Unclosed {kind} block",
},
UNEXPECTED_KEYWORD: {
code: 'E0119',
category: 'parser' as ErrorCategory,
title: 'Unexpected keyword',
messageTemplate: "Unexpected keyword '{keyword}' in this context",
},
INVALID_DOMAIN_STRUCTURE: {
code: 'E0120',
category: 'parser' as ErrorCategory,
title: 'Invalid domain structure',
messageTemplate: 'Invalid domain structure',
},
} as const;
// ============================================================================
// TYPE ERRORS (E0200-E0299)
// ============================================================================
export const TYPE_ERRORS = {
TYPE_MISMATCH: {
code: 'E0200',
category: 'type' as ErrorCategory,
title: 'Type mismatch',
messageTemplate: "Type mismatch: expected '{expected}', got '{actual}'",
},
UNDEFINED_TYPE: {
code: 'E0201',
category: 'type' as ErrorCategory,
title: 'Undefined type',
messageTemplate: "Type '{name}' is not defined",
},
UNDEFINED_FIELD: {
code: 'E0202',
category: 'type' as ErrorCategory,
title: 'Undefined field',
messageTemplate: "Field '{field}' does not exist on type '{type}'",
},
INCOMPATIBLE_TYPES: {
code: 'E0203',
category: 'type' as ErrorCategory,
title: 'Incompatible types',
messageTemplate: "Cannot apply operator '{op}' to types '{left}' and '{right}'",
},
INVALID_OPERATOR_FOR_TYPE: {
code: 'E0204',
category: 'type' as ErrorCategory,
title: 'Invalid operator for type',
messageTemplate: "Operator '{op}' cannot be applied to type '{type}'",
},
WRONG_NUMBER_OF_ARGUMENTS: {
code: 'E0205',
category: 'type' as ErrorCategory,
title: 'Wrong number of arguments',
messageTemplate: "Expected {expected} argument(s), got {actual}",
},
INVALID_ARGUMENT_TYPE: {
code: 'E0206',
category: 'type' as ErrorCategory,
title: 'Invalid argument type',
messageTemplate: "Argument {index}: expected '{expected}', got '{actual}'",
},
CIRCULAR_TYPE_REFERENCE: {
code: 'E0207',
category: 'type' as ErrorCategory,
title: 'Circular type reference',
messageTemplate: "Circular type reference: {cycle}",
},
INVALID_GENERIC_ARGUMENT: {
code: 'E0208',
category: 'type' as ErrorCategory,
title: 'Invalid generic argument',
messageTemplate: "Invalid generic argument for '{type}'",
},
MISSING_GENERIC_ARGUMENT: {
code: 'E0209',
category: 'type' as ErrorCategory,
title: 'Missing generic argument',
messageTemplate: "Type '{type}' requires {count} generic argument(s)",
},
INCOMPATIBLE_COMPARISON: {
code: 'E0210',
category: 'type' as ErrorCategory,
title: 'Incompatible comparison',
messageTemplate: "Cannot compare '{left}' with '{right}'",
},
NOT_CALLABLE: {
code: 'E0211',
category: 'type' as ErrorCategory,
title: 'Not callable',
messageTemplate: "Type '{type}' is not callable",
},
NOT_INDEXABLE: {
code: 'E0212',
category: 'type' as ErrorCategory,
title: 'Not indexable',
messageTemplate: "Type '{type}' is not indexable",
},
INVALID_RETURN_TYPE: {
code: 'E0213',
category: 'type' as ErrorCategory,
title: 'Invalid return type',
messageTemplate: "Return type mismatch: expected '{expected}', got '{actual}'",
},
NULLABLE_ACCESS: {
code: 'E0214',
category: 'type' as ErrorCategory,
title: 'Nullable access',
messageTemplate: "Value may be null. Use optional chaining (?.) or null check",
},
} as const;
// ============================================================================
// SEMANTIC ERRORS (E0300-E0399)
// ============================================================================
export const SEMANTIC_ERRORS = {
UNDEFINED_VARIABLE: {
code: 'E0300',
category: 'semantic' as ErrorCategory,
title: 'Undefined variable',
messageTemplate: "Variable '{name}' is not defined",
},
UNDEFINED_ENTITY: {
code: 'E0301',
category: 'semantic' as ErrorCategory,
title: 'Undefined entity',
messageTemplate: "Entity '{name}' is not defined",
},
UNDEFINED_BEHAVIOR: {
code: 'E0302',
category: 'semantic' as ErrorCategory,
title: 'Undefined behavior',
messageTemplate: "Behavior '{name}' is not defined",
},
UNDEFINED_ENUM_VARIANT: {
code: 'E0303',
category: 'semantic' as ErrorCategory,
title: 'Undefined enum variant',
messageTemplate: "Enum '{enum}' does not have variant '{variant}'",
},
OLD_OUTSIDE_POSTCONDITION: {
code: 'E0304',
category: 'semantic' as ErrorCategory,
title: 'old() outside postcondition',
messageTemplate: "'old()' can only be used in postconditions",
},
RESULT_OUTSIDE_POSTCONDITION: {
code: 'E0305',
category: 'semantic' as ErrorCategory,
title: 'result outside postcondition',
messageTemplate: "'result' can only be used in postconditions",
},
INPUT_INVALID_FIELD: {
code: 'E0306',
category: 'semantic' as ErrorCategory,
title: 'Invalid input field',
messageTemplate: "Input field '{field}' is not defined in behavior '{behavior}'",
},
INVALID_LIFECYCLE_STATE: {
code: 'E0307',
category: 'semantic' as ErrorCategory,
title: 'Invalid lifecycle state',
messageTemplate: "'{state}' is not a valid lifecycle state for entity '{entity}'",
},
INVALID_LIFECYCLE_TRANSITION: {
code: 'E0308',
category: 'semantic' as ErrorCategory,
title: 'Invalid lifecycle transition',
messageTemplate: "Cannot transition from '{from}' to '{to}' for entity '{entity}'",
},
DUPLICATE_DEFINITION: {
code: 'E0309',
category: 'semantic' as ErrorCategory,
title: 'Duplicate definition',
messageTemplate: "{kind} '{name}' is already defined",
},
SHADOWED_VARIABLE: {
code: 'E0310',
category: 'semantic' as ErrorCategory,
title: 'Shadowed variable',
messageTemplate: "Variable '{name}' shadows a variable in outer scope",
},
UNUSED_VARIABLE: {
code: 'E0311',
category: 'semantic' as ErrorCategory,
title: 'Unused variable',
messageTemplate: "Variable '{name}' is declared but never used",
},
UNUSED_ENTITY: {
code: 'E0312',
category: 'semantic' as ErrorCategory,
title: 'Unused entity',
messageTemplate: "Entity '{name}' is declared but never used",
},
MISSING_REQUIRED_FIELD: {
code: 'E0313',
category: 'semantic' as ErrorCategory,
title: 'Missing required field',
messageTemplate: "Required field '{field}' is missing from '{type}'",
},
INVALID_CONSTRAINT_VALUE: {
code: 'E0314',
category: 'semantic' as ErrorCategory,
title: 'Invalid constraint value',
messageTemplate: "Constraint '{constraint}' expects type '{expected}'",
},
INVALID_REFERENCE: {
code: 'E0315',
category: 'semantic' as ErrorCategory,
title: 'Invalid reference',
messageTemplate: "Cannot reference '{name}' in this context",
},
} as const;
// ============================================================================
// EVALUATION ERRORS (E0400-E0499)
// ============================================================================
export const EVAL_ERRORS = {
DIVISION_BY_ZERO: {
code: 'E0400',
category: 'eval' as ErrorCategory,
title: 'Division by zero',
messageTemplate: 'Division by zero',
},
NULL_REFERENCE: {
code: 'E0401',
category: 'eval' as ErrorCategory,
title: 'Null reference',
messageTemplate: "Cannot read property '{property}' of null",
},
INDEX_OUT_OF_BOUNDS: {
code: 'E0402',
category: 'eval' as ErrorCategory,
title: 'Index out of bounds',
messageTemplate: "Index {index} is out of bounds for array of length {length}",
},
UNDEFINED_PROPERTY: {
code: 'E0403',
category: 'eval' as ErrorCategory,
title: 'Undefined property',
messageTemplate: "Property '{property}' is undefined",
},
INVALID_OPERATION: {
code: 'E0404',
category: 'eval' as ErrorCategory,
title: 'Invalid operation',
messageTemplate: "{operation}",
},
STACK_OVERFLOW: {
code: 'E0405',
category: 'eval' as ErrorCategory,
title: 'Stack overflow',
messageTemplate: 'Maximum call stack exceeded (possible infinite recursion)',
},
TIMEOUT: {
code: 'E0406',
category: 'eval' as ErrorCategory,
title: 'Evaluation timeout',
messageTemplate: 'Evaluation exceeded maximum time limit of {limit}ms',
},
MEMORY_LIMIT: {
code: 'E0407',
category: 'eval' as ErrorCategory,
title: 'Memory limit exceeded',
messageTemplate: 'Evaluation exceeded memory limit',
},
TYPE_COERCION_FAILED: {
code: 'E0408',
category: 'eval' as ErrorCategory,
title: 'Type coercion failed',
messageTemplate: "Cannot coerce '{actual}' to '{expected}'",
},
INVALID_REGEX: {
code: 'E0409',
category: 'eval' as ErrorCategory,
title: 'Invalid regular expression',
messageTemplate: "Invalid regular expression: {reason}",
},
ENTITY_NOT_FOUND: {
code: 'E0410',
category: 'eval' as ErrorCategory,
title: 'Entity not found',
messageTemplate: "Entity '{entity}' with id '{id}' not found",
},
IMMUTABLE_MODIFICATION: {
code: 'E0411',
category: 'eval' as ErrorCategory,
title: 'Immutable modification',
messageTemplate: "Cannot modify immutable value '{name}'",
},
} as const;
// ============================================================================
// VERIFICATION ERRORS (E0500-E0599)
// ============================================================================
export const VERIFY_ERRORS = {
PRECONDITION_FAILED: {
code: 'E0500',
category: 'verify' as ErrorCategory,
title: 'Precondition failed',
messageTemplate: "Precondition failed: {condition}",
},
POSTCONDITION_FAILED: {
code: 'E0501',
category: 'verify' as ErrorCategory,
title: 'Postcondition failed',
messageTemplate: "Postcondition failed: {condition}",
},
INVARIANT_VIOLATED: {
code: 'E0502',
category: 'verify' as ErrorCategory,
title: 'Invariant violated',
messageTemplate: "Invariant violated: {invariant}",
},
ASSERTION_FAILED: {
code: 'E0503',
category: 'verify' as ErrorCategory,
title: 'Assertion failed',
messageTemplate: "Assertion failed: {assertion}",
},
CONSTRAINT_VIOLATED: {
code: 'E0504',
category: 'verify' as ErrorCategory,
title: 'Constraint violated',
messageTemplate: "Constraint '{constraint}' violated: {reason}",
},
TEMPORAL_VIOLATION: {
code: 'E0505',
category: 'verify' as ErrorCategory,
title: 'Temporal constraint violation',
messageTemplate: "Temporal constraint violated: {constraint}",
},
SECURITY_POLICY_VIOLATED: {
code: 'E0506',
category: 'verify' as ErrorCategory,
title: 'Security policy violation',
messageTemplate: "Security policy violated: {policy}",
},
STATE_INVARIANT_VIOLATED: {
code: 'E0507',
category: 'verify' as ErrorCategory,
title: 'State invariant violated',
messageTemplate: "State invariant violated for entity '{entity}': {invariant}",
},
} as const;
// ============================================================================
// CONFIGURATION ERRORS (E0600-E0699)
// ============================================================================
export const CONFIG_ERRORS = {
INVALID_CONFIG_FILE: {
code: 'E0600',
category: 'config' as ErrorCategory,
title: 'Invalid configuration file',
messageTemplate: "Invalid configuration file: {reason}",
},
MISSING_CONFIG: {
code: 'E0601',
category: 'config' as ErrorCategory,
title: 'Missing configuration',
messageTemplate: "Missing required configuration: {name}",
},
INVALID_CONFIG_VALUE: {
code: 'E0602',
category: 'config' as ErrorCategory,
title: 'Invalid configuration value',
messageTemplate: "Invalid value for '{key}': {reason}",
},
CONFLICTING_CONFIG: {
code: 'E0603',
category: 'config' as ErrorCategory,
title: 'Conflicting configuration',
messageTemplate: "Configuration conflict: '{key1}' and '{key2}' cannot both be set",
},
DEPRECATED_CONFIG: {
code: 'E0604',
category: 'config' as ErrorCategory,
title: 'Deprecated configuration',
messageTemplate: "Configuration '{key}' is deprecated. Use '{replacement}' instead",
},
} as const;
// ============================================================================
// I/O ERRORS (E0700-E0799)
// ============================================================================
export const IO_ERRORS = {
FILE_NOT_FOUND: {
code: 'E0700',
category: 'io' as ErrorCategory,
title: 'File not found',
messageTemplate: "File not found: {path}",
},
FILE_READ_ERROR: {
code: 'E0701',
category: 'io' as ErrorCategory,
title: 'File read error',
messageTemplate: "Failed to read file '{path}': {reason}",
},
FILE_WRITE_ERROR: {
code: 'E0702',
category: 'io' as ErrorCategory,
title: 'File write error',
messageTemplate: "Failed to write file '{path}': {reason}",
},
PERMISSION_DENIED: {
code: 'E0703',
category: 'io' as ErrorCategory,
title: 'Permission denied',
messageTemplate: "Permission denied: {path}",
},
INVALID_PATH: {
code: 'E0704',
category: 'io' as ErrorCategory,
title: 'Invalid path',
messageTemplate: "Invalid path: {path}",
},
IMPORT_NOT_FOUND: {
code: 'E0705',
category: 'io' as ErrorCategory,
title: 'Import not found',
messageTemplate: "Cannot find module '{module}'",
},
CIRCULAR_IMPORT: {
code: 'E0706',
category: 'io' as ErrorCategory,
title: 'Circular import',
messageTemplate: "Circular import detected: {cycle}",
},
} as const;
// ============================================================================
// ALL ERROR CODES
// ============================================================================
export const ERROR_CODES = {
...LEXER_ERRORS,
...PARSER_ERRORS,
...TYPE_ERRORS,
...SEMANTIC_ERRORS,
...EVAL_ERRORS,
...VERIFY_ERRORS,
...CONFIG_ERRORS,
...IO_ERRORS,
} as const;
export type ErrorCodeKey = keyof typeof ERROR_CODES;
export type ErrorCode = (typeof ERROR_CODES)[ErrorCodeKey]['code'];
/**
* Get error code definition by code string
*/
export function getErrorDef(code: string): ErrorCodeDef | undefined {
for (const def of Object.values(ERROR_CODES)) {
if (def.code === code) {
return def;
}
}
return undefined;
}
/**
* Get all error codes in a category
*/
export function getErrorsByCategory(category: ErrorCategory): ErrorCodeDef[] {
return Object.values(ERROR_CODES).filter(def => def.category === category);
}
/**
* Format an error message using a template and values
*/
export function formatErrorMessage(
template: string,
values: Record<string, string | number>
): string {
let message = template;
for (const [key, value] of Object.entries(values)) {
message = message.replace(`{${key}}`, String(value));
}
return message;
}
// ============================================================================
// ISL Error Formatter
// ============================================================================
//
// Beautiful, human-friendly error formatting inspired by Elm, Rust, and Deno.
// Features:
// - Code snippets with context lines
// - Colored underlines pointing to the error
// - Notes and help suggestions
// - Support for related information
// - Works with and without colors (CI-friendly)
//
// ============================================================================
import chalk from 'chalk';
import type {
Diagnostic,
DiagnosticSeverity,
FormatOptions,
RelatedInformation,
SourceFile,
SourceLocation,
DEFAULT_FORMAT_OPTIONS,
} from './types.js';
import { getErrorDef } from './codes.js';
import { getExplanation } from './catalog.js';
// Re-export for convenience
export { DEFAULT_FORMAT_OPTIONS };
// ============================================================================
// COLOR CONFIGURATION
// ============================================================================
type ChalkFn = typeof chalk.red;
interface ColorScheme {
error: ChalkFn;
warning: ChalkFn;
info: ChalkFn;
hint: ChalkFn;
note: ChalkFn;
help: ChalkFn;
lineNumber: ChalkFn;
separator: ChalkFn;
code: ChalkFn;
highlight: ChalkFn;
path: ChalkFn;
muted: ChalkFn;
}
const COLORS: ColorScheme = {
error: chalk.red.bold,
warning: chalk.yellow.bold,
info: chalk.blue.bold,
hint: chalk.cyan.bold,
note: chalk.cyan,
help: chalk.cyan,
lineNumber: chalk.blue,
separator: chalk.blue,
code: chalk.white,
highlight: chalk.red,
path: chalk.cyan,
muted: chalk.gray,
};
const NO_COLORS: ColorScheme = {
error: chalk.reset,
warning: chalk.reset,
info: chalk.reset,
hint: chalk.reset,
note: chalk.reset,
help: chalk.reset,
lineNumber: chalk.reset,
separator: chalk.reset,
code: chalk.reset,
highlight: chalk.reset,
path: chalk.reset,
muted: chalk.reset,
};
// ============================================================================
// SEVERITY LABELS
// ============================================================================
const SEVERITY_LABELS: Record<DiagnosticSeverity, string> = {
error: 'error',
warning: 'warning',
info: 'info',
hint: 'hint',
};
function getSeverityColor(severity: DiagnosticSeverity, colors: ColorScheme): ChalkFn {
return colors[severity];
}
// ============================================================================
// SOURCE FILE CACHE
// ============================================================================
const sourceCache = new Map<string, SourceFile>();
/**
* Register source file content for error formatting.
* This must be called before formatting errors to show code snippets.
*/
export function registerSource(path: string, content: string): void {
sourceCache.set(path, {
path,
content,
lines: content.split('\n'),
});
}
/**
* Clear the source cache
*/
export function clearSourceCache(): void {
sourceCache.clear();
}
/**
* Get a source file from cache
*/
export function getSource(path: string): SourceFile | undefined {
return sourceCache.get(path);
}
// ============================================================================
// DIAGNOSTIC FORMATTING
// ============================================================================
/**
* Format a single diagnostic into a beautiful string.
*
* Example output:
* ```
* error[E0200]: Type mismatch
* --> specs/payment.isl:7:9
* |
* 7 | post: sender.balance == old(sender.balance) - amount
* | ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^
* | String Number
* |
* = note: sender.balance is typed as String but compared with Number
* = help: Did you mean to use sender.balanceAmount? (Number field)
* ```
*/
export function formatDiagnostic(
diagnostic: Diagnostic,
options: Partial<FormatOptions> = {}
): string {
const opts: FormatOptions = {
colors: true,
contextLines: 2,
showCodes: true,
showHelp: true,
maxErrors: 10,
showRelated: true,
terminalWidth: 80,
...options,
};
const colors = opts.colors ? COLORS : NO_COLORS;
const lines: string[] = [];
// Header line: error[E0200]: Type mismatch
const header = formatHeader(diagnostic, colors, opts.showCodes);
lines.push(header);
// Location line: --> specs/payment.isl:7:9
const locationLine = formatLocation(diagnostic.location, colors);
lines.push(locationLine);
// Code snippet with underlines
const source = getSource(diagnostic.location.file);
if (source) {
const snippet = formatCodeSnippet(
source,
diagnostic.location,
colors,
opts.contextLines
);
lines.push(...snippet);
}
// Notes
if (opts.showHelp && diagnostic.notes && diagnostic.notes.length > 0) {
for (const note of diagnostic.notes) {
lines.push(formatAnnotation('note', note, colors));
}
}
// Help suggestions
if (opts.showHelp && diagnostic.help && diagnostic.help.length > 0) {
for (const help of diagnostic.help) {
lines.push(formatAnnotation('help', help, colors));
}
}
// Related information
if (opts.showRelated && diagnostic.relatedInformation) {
for (const related of diagnostic.relatedInformation) {
lines.push('');
lines.push(formatRelated(related, colors, opts.contextLines));
}
}
return lines.join('\n');
}
/**
* Format header line: error[E0200]: Type mismatch
*/
function formatHeader(
diagnostic: Diagnostic,
colors: ColorScheme,
showCode: boolean
): string {
const severityColor = getSeverityColor(diagnostic.severity, colors);
const label = SEVERITY_LABELS[diagnostic.severity];
let header = severityColor(label);
if (showCode) {
header += severityColor(`[${diagnostic.code}]`);
}
header += severityColor(': ');
// Get title from error definition or use message
const errorDef = getErrorDef(diagnostic.code);
const title = errorDef?.title || diagnostic.message.split('\n')[0];
header += severityColor(title!);
return header;
}
/**
* Format location line: --> specs/payment.isl:7:9
*/
function formatLocation(location: SourceLocation, colors: ColorScheme): string {
const path = colors.path(location.file);
const pos = `${location.line}:${location.column}`;
return ` ${colors.separator('-->')} ${path}:${pos}`;
}
/**
* Format code snippet with context and underlines
*/
function formatCodeSnippet(
source: SourceFile,
location: SourceLocation,
colors: ColorScheme,
contextLines: number
): string[] {
const lines: string[] = [];
// Calculate line range
const startLine = Math.max(1, location.line - contextLines);
const endLine = Math.min(source.lines.length, location.endLine + contextLines);
// Calculate gutter width
const gutterWidth = String(endLine).length;
// Empty gutter line
lines.push(`${' '.repeat(gutterWidth + 1)}${colors.separator('|')}`);
// Print each line
for (let lineNum = startLine; lineNum <= endLine; lineNum++) {
const lineContent = source.lines[lineNum - 1] || '';
const lineNumStr = String(lineNum).padStart(gutterWidth);
// Is this an error line?
const isErrorLine = lineNum >= location.line && lineNum <= location.endLine;
// Format line number and separator
const gutter = isErrorLine
? colors.lineNumber(`${lineNumStr} ${colors.separator('|')}`)
: colors.muted(`${lineNumStr} ${colors.separator('|')}`);
lines.push(`${gutter} ${lineContent}`);
// Add underline for error lines
if (isErrorLine) {
const underline = createUnderline(
lineContent,
lineNum,
location,
colors
);
if (underline) {
lines.push(`${' '.repeat(gutterWidth + 1)}${colors.separator('|')} ${underline}`);
}
}
}
// Closing gutter line
lines.push(`${' '.repeat(gutterWidth + 1)}${colors.separator('|')}`);
return lines;
}
/**
* Create underline string for an error location
*/
function createUnderline(
lineContent: string,
lineNum: number,
location: SourceLocation,
colors: ColorScheme
): string | null {
let startCol: number;
let endCol: number;
if (lineNum === location.line && lineNum === location.endLine) {
// Error on single line
startCol = location.column - 1;
endCol = location.endColumn - 1;
} else if (lineNum === location.line) {
// First line of multi-line error
startCol = location.column - 1;
endCol = lineContent.length;
} else if (lineNum === location.endLine) {
// Last line of multi-line error
startCol = 0;
endCol = location.endColumn - 1;
} else {
// Middle line of multi-line error
startCol = 0;
endCol = lineContent.length;
}
// Ensure bounds are valid
startCol = Math.max(0, Math.min(startCol, lineContent.length));
endCol = Math.max(startCol, Math.min(endCol, lineContent.length));
if (endCol <= startCol) {
return null;
}
const padding = ' '.repeat(startCol);
const carets = colors.highlight('^'.repeat(endCol - startCol));
return padding + carets;
}
/**
* Format annotation line (note or help)
*/
function formatAnnotation(
type: 'note' | 'help',
text: string,
colors: ColorScheme
): string {
const prefix = colors[type](` = ${type}: `);
return prefix + text;
}
/**
* Format related information
*/
function formatRelated(
related: RelatedInformation,
colors: ColorScheme,
contextLines: number
): string {
const locationStr = `${related.location.file}:${related.location.line}:${related.location.column}`;
const header = `${colors.note('note')}: ${related.message}`;
const loc = ` ${colors.separator('-->')} ${colors.path(locationStr)}`;
const source = getSource(related.location.file);
if (source) {
const snippet = formatCodeSnippet(source, related.location, colors, 0);
return [header, loc, ...snippet].join('\n');
}
return [header, loc].join('\n');
}
// ============================================================================
// MULTIPLE DIAGNOSTICS
// ============================================================================
/**
* Format multiple diagnostics with summary
*/
export function formatDiagnostics(
diagnostics: Diagnostic[],
options: Partial<FormatOptions> = {}
): string {
const opts: FormatOptions = {
colors: true,
contextLines: 2,
showCodes: true,
showHelp: true,
maxErrors: 10,
showRelated: true,
terminalWidth: 80,
...options,
};
const colors = opts.colors ? COLORS : NO_COLORS;
if (diagnostics.length === 0) {
return colors.muted('No errors found.');
}
const lines: string[] = [];
// Format each diagnostic (up to maxErrors)
const toShow = diagnostics.slice(0, opts.maxErrors);
for (let i = 0; i < toShow.length; i++) {
if (i > 0) {
lines.push(''); // Empty line between diagnostics
}
lines.push(formatDiagnostic(toShow[i]!, opts));
}
// Show how many more errors if truncated
if (diagnostics.length > opts.maxErrors) {
const remaining = diagnostics.length - opts.maxErrors;
lines.push('');
lines.push(colors.muted(`... and ${remaining} more error${remaining === 1 ? '' : 's'}`));
}
// Summary line
lines.push('');
lines.push(formatSummary(diagnostics, colors));
return lines.join('\n');
}
/**
* Format summary line
*/
function formatSummary(diagnostics: Diagnostic[], colors: ColorScheme): string {
const errors = diagnostics.filter(d => d.severity === 'error').length;
const warnings = diagnostics.filter(d => d.severity === 'warning').length;
const parts: string[] = [];
if (errors > 0) {
parts.push(colors.error(`${errors} error${errors === 1 ? '' : 's'}`));
}
if (warnings > 0) {
parts.push(colors.warning(`${warnings} warning${warnings === 1 ? '' : 's'}`));
}
if (parts.length === 0) {
return colors.muted('No issues found.');
}
return parts.join(', ') + ' generated';
}
// ============================================================================
// EXPLANATION FORMATTING (for `isl explain`)
// ============================================================================
/**
* Format an error explanation for `isl explain <code>`
*/
export function formatExplanation(code: string, useColors: boolean = true): string {
const colors = useColors ? COLORS : NO_COLORS;
const explanation = getExplanation(code);
if (!explanation) {
return colors.error(`No explanation available for error code '${code}'.\n`) +
colors.muted(`Use 'isl explain --list' to see all error codes.`);
}
const lines: string[] = [];
// Header
lines.push(colors.error.bold(`${code}: ${explanation.title}`));
lines.push('');
// Explanation
lines.push(explanation.explanation);
lines.push('');
// Common causes
if (explanation.causes.length > 0) {
lines.push(colors.note.bold('Common causes:'));
for (const cause of explanation.causes) {
lines.push(` • ${cause}`);
}
lines.push('');
}
// Solutions
if (explanation.solutions.length > 0) {
lines.push(colors.help.bold('How to fix:'));
for (const solution of explanation.solutions) {
lines.push(` • ${solution}`);
}
lines.push('');
}
// Bad example
if (explanation.badExample) {
lines.push(colors.error.bold('✗ Incorrect:'));
lines.push(colors.muted(explanation.badExample.description));
lines.push('');
lines.push(formatCodeBlock(explanation.badExample.code, colors));
lines.push('');
}
// Good example
if (explanation.goodExample) {
lines.push(colors.hint.bold('✓ Correct:'));
lines.push(colors.muted(explanation.goodExample.description));
lines.push('');
lines.push(formatCodeBlock(explanation.goodExample.code, colors));
lines.push('');
}
// See also
if (explanation.seeAlso && explanation.seeAlso.length > 0) {
lines.push(colors.muted.bold('See also: ') +
colors.muted(explanation.seeAlso.join(', ')));
}
return lines.join('\n');
}
/**
* Format a code block with line numbers
*/
function formatCodeBlock(code: string, colors: ColorScheme): string {
const codeLines = code.split('\n');
const gutterWidth = String(codeLines.length).length;
return codeLines.map((line, i) => {
const lineNum = String(i + 1).padStart(gutterWidth);
return `${colors.lineNumber(lineNum)} ${colors.separator('│')} ${line}`;
}).join('\n');
}
/**
* Format a list of all error codes
*/
export function formatErrorCodeList(useColors: boolean = true): string {
const colors = useColors ? COLORS : NO_COLORS;
const lines: string[] = [];
lines.push(colors.hint.bold('ISL Error Code Reference'));
lines.push('');
const categories = [
{ range: 'E0001-E0099', name: 'Lexer', description: 'Tokenization errors' },
{ range: 'E0100-E0199', name: 'Parser', description: 'Syntax errors' },
{ range: 'E0200-E0299', name: 'Type', description: 'Type checking errors' },
{ range: 'E0300-E0399', name: 'Semantic', description: 'Name resolution, scoping' },
{ range: 'E0400-E0499', name: 'Eval', description: 'Runtime evaluation errors' },
{ range: 'E0500-E0599', name: 'Verify', description: 'Verification errors' },
{ range: 'E0600-E0699', name: 'Config', description: 'Configuration errors' },
{ range: 'E0700-E0799', name: 'I/O', description: 'File and import errors' },
];
for (const cat of categories) {
lines.push(
` ${colors.lineNumber(cat.range.padEnd(14))} ` +
`${colors.note(cat.name.padEnd(10))} ` +
`${colors.muted(cat.description)}`
);
}
lines.push('');
lines.push(colors.muted(`Run 'isl explain <CODE>' for detailed information.`));
return lines.join('\n');
}
// ============================================================================
// @isl-lang/errors - Unified Error Infrastructure for ISL
// ============================================================================
//
// Best-in-class error messages for the ISL toolchain.
//
// Features:
// - Unified error codes (E0001-E0999)
// - Beautiful formatting with code snippets
// - "Did you mean?" suggestions using Levenshtein distance
// - Detailed explanations via `isl explain <code>`
// - Works with and without colors (CI-friendly)
//
// Inspired by: Elm, Rust, and Deno error messages
//
// ============================================================================
// Types
export type {
SourceLocation,
Position,
DiagnosticSeverity,
RelatedInformation,
CodeFix,
TextEdit,
ErrorCategory,
Diagnostic,
DiagnosticTag,
ErrorExplanation,
SourceFile,
FormatOptions,
DiagnosticResult,
} from './types.js';
export { DEFAULT_FORMAT_OPTIONS } from './types.js';
// Error codes
export {
LEXER_ERRORS,
PARSER_ERRORS,
TYPE_ERRORS,
SEMANTIC_ERRORS,
EVAL_ERRORS,
VERIFY_ERRORS,
CONFIG_ERRORS,
IO_ERRORS,
ERROR_CODES,
getErrorDef,
getErrorsByCategory,
formatErrorMessage,
type ErrorCodeDef,
type ErrorCodeKey,
type ErrorCode,
} from './codes.js';
// Error catalog (explanations)
export {
ERROR_EXPLANATIONS,
getExplanation,
getAllExplainedCodes,
hasExplanation,
getExplanationsByCategory,
} from './catalog.js';
// Suggestions
export {
levenshteinDistance,
damerauLevenshteinDistance,
findSimilar,
formatDidYouMean,
formatDidYouMeanMultiple,
suggestKeyword,
suggestType,
suggestField,
suggestEntity,
suggestBehavior,
getContextualHelp,
ISL_KEYWORDS,
ISL_BUILTIN_TYPES,
ERROR_PATTERNS,
type SuggestionOptions,
type Suggestion,
type ErrorPattern,
} from './suggestions.js';
// Formatter
export {
registerSource,
clearSourceCache,
getSource,
formatDiagnostic,
formatDiagnostics,
formatExplanation,
formatErrorCodeList,
} from './formatter.js';
// Builder
export {
DiagnosticBuilder,
diagnostic,
errorDiag,
warningDiag,
DiagnosticCollector,
} from './builder.js';
// ============================================================================
// CONVENIENCE RE-EXPORTS
// ============================================================================
/**
* Create a new source location
*/
export function createLocation(
file: string,
line: number,
column: number,
endLine?: number,
endColumn?: number
): import('./types.js').SourceLocation {
return {
file,
line,
column,
endLine: endLine ?? line,
endColumn: endColumn ?? column,
};
}
/**
* Format a location as a string: file:line:column
*/
export function formatLocationString(loc: import('./types.js').SourceLocation): string {
return `${loc.file}:${loc.line}:${loc.column}`;
}
// ============================================================================
// ISL Error Suggestions
// ============================================================================
//
// Provides intelligent suggestions for common errors using string similarity
// and context-aware recommendations.
//
// ============================================================================
/**
* Calculate Levenshtein distance between two strings.
* This measures the minimum number of single-character edits (insertions,
* deletions, or substitutions) required to transform one string into another.
*/
export function levenshteinDistance(a: string, b: string): number {
// Handle edge cases
if (a === b) return 0;
if (a.length === 0) return b.length;
if (b.length === 0) return a.length;
// Create distance matrix
const matrix: number[][] = [];
// Initialize first row and column
for (let i = 0; i <= a.length; i++) {
matrix[i] = [i];
}
for (let j = 0; j <= b.length; j++) {
matrix[0]![j] = j;
}
// Fill in the rest of the matrix
for (let i = 1; i <= a.length; i++) {
for (let j = 1; j <= b.length; j++) {
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
matrix[i]![j] = Math.min(
matrix[i - 1]![j]! + 1, // deletion
matrix[i]![j - 1]! + 1, // insertion
matrix[i - 1]![j - 1]! + cost // substitution
);
}
}
return matrix[a.length]![b.length]!;
}
/**
* Calculate Damerau-Levenshtein distance (includes transpositions).
* More accurate for detecting typos like "teh" -> "the".
*/
export function damerauLevenshteinDistance(a: string, b: string): number {
if (a === b) return 0;
if (a.length === 0) return b.length;
if (b.length === 0) return a.length;
const matrix: number[][] = [];
for (let i = 0; i <= a.length; i++) {
matrix[i] = [i];
}
for (let j = 0; j <= b.length; j++) {
matrix[0]![j] = j;
}
for (let i = 1; i <= a.length; i++) {
for (let j = 1; j <= b.length; j++) {
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
let min = Math.min(
matrix[i - 1]![j]! + 1,
matrix[i]![j - 1]! + 1,
matrix[i - 1]![j - 1]! + cost
);
// Check for transposition
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
min = Math.min(min, matrix[i - 2]![j - 2]! + cost);
}
matrix[i]![j] = min;
}
}
return matrix[a.length]![b.length]!;
}
/**
* Options for finding similar strings
*/
export interface SuggestionOptions {
/** Maximum edit distance to consider (default: 3) */
maxDistance?: number;
/** Maximum number of suggestions to return (default: 3) */
maxSuggestions?: number;
/** Case-insensitive comparison (default: true) */
caseInsensitive?: boolean;
/** Use Damerau-Levenshtein (includes transpositions) (default: true) */
includeTranspositions?: boolean;
}
const DEFAULT_OPTIONS: Required<SuggestionOptions> = {
maxDistance: 3,
maxSuggestions: 3,
caseInsensitive: true,
includeTranspositions: true,
};
/**
* Suggestion result with distance information
*/
export interface Suggestion {
/** The suggested value */
value: string;
/** Edit distance from the input */
distance: number;
}
/**
* Find similar strings from a list of candidates.
* Returns suggestions sorted by edit distance (closest first).
*/
export function findSimilar(
input: string,
candidates: string[],
options: SuggestionOptions = {}
): Suggestion[] {
const opts = { ...DEFAULT_OPTIONS, ...options };
const distanceFn = opts.includeTranspositions
? damerauLevenshteinDistance
: levenshteinDistance;
const normalizedInput = opts.caseInsensitive ? input.toLowerCase() : input;
const suggestions: Suggestion[] = [];
for (const candidate of candidates) {
const normalizedCandidate = opts.caseInsensitive
? candidate.toLowerCase()
: candidate;
const distance = distanceFn(normalizedInput, normalizedCandidate);
if (distance <= opts.maxDistance && distance > 0) {
suggestions.push({ value: candidate, distance });
}
}
// Sort by distance, then alphabetically for ties
suggestions.sort((a, b) => {
if (a.distance !== b.distance) {
return a.distance - b.distance;
}
return a.value.localeCompare(b.value);
});
return suggestions.slice(0, opts.maxSuggestions);
}
/**
* Format a "Did you mean?" message for a single suggestion.
*/
export function formatDidYouMean(input: string, suggestion: string): string {
return `Did you mean '${suggestion}'?`;
}
/**
* Format a "Did you mean?" message for multiple suggestions.
*/
export function formatDidYouMeanMultiple(input: string, suggestions: string[]): string {
if (suggestions.length === 0) {
return '';
}
if (suggestions.length === 1) {
return formatDidYouMean(input, suggestions[0]!);
}
const last = suggestions.pop();
return `Did you mean ${suggestions.map(s => `'${s}'`).join(', ')} or '${last}'?`;
}
// ============================================================================
// ISL-SPECIFIC SUGGESTIONS
// ============================================================================
/**
* ISL keywords for typo detection
*/
export const ISL_KEYWORDS = [
'domain', 'entity', 'behavior', 'type', 'enum', 'view', 'policy',
'input', 'output', 'preconditions', 'postconditions', 'invariants',
'scenarios', 'chaos', 'temporal', 'security', 'lifecycle', 'fields',
'effects', 'events', 'version', 'description', 'import', 'export',
'from', 'as', 'extends', 'implements', 'where', 'with', 'for',
'if', 'else', 'match', 'when', 'then', 'and', 'or', 'not',
'true', 'false', 'null', 'old', 'result', 'forall', 'exists',
'unique', 'some', 'none', 'all', 'any', 'let', 'in',
];
/**
* ISL built-in types
*/
export const ISL_BUILTIN_TYPES = [
'String', 'Int', 'Decimal', 'Boolean', 'UUID', 'Timestamp', 'Duration',
'Date', 'Time', 'DateTime', 'Email', 'URL', 'PhoneNumber',
'List', 'Set', 'Map', 'Optional', 'Result', 'Either',
'Void', 'Never', 'Unknown', 'Any',
];
/**
* Find keyword suggestions for a mistyped keyword.
*/
export function suggestKeyword(input: string): Suggestion[] {
return findSimilar(input, ISL_KEYWORDS, { caseInsensitive: true });
}
/**
* Find type suggestions for a mistyped type name.
*/
export function suggestType(input: string, customTypes: string[] = []): Suggestion[] {
return findSimilar(input, [...ISL_BUILTIN_TYPES, ...customTypes], {
caseInsensitive: false, // Types are case-sensitive
maxDistance: 3,
});
}
/**
* Find field suggestions for a mistyped field name.
*/
export function suggestField(input: string, availableFields: string[]): Suggestion[] {
return findSimilar(input, availableFields, { caseInsensitive: false });
}
/**
* Find entity suggestions for a mistyped entity name.
*/
export function suggestEntity(input: string, availableEntities: string[]): Suggestion[] {
return findSimilar(input, availableEntities, { caseInsensitive: false });
}
/**
* Find behavior suggestions for a mistyped behavior name.
*/
export function suggestBehavior(input: string, availableBehaviors: string[]): Suggestion[] {
return findSimilar(input, availableBehaviors, { caseInsensitive: false });
}
// ============================================================================
// CONTEXTUAL HELP SUGGESTIONS
// ============================================================================
/**
* Common error patterns and their fixes
*/
export interface ErrorPattern {
/** Pattern identifier */
id: string;
/** Condition to match */
match: (errorCode: string, message: string, context: Record<string, unknown>) => boolean;
/** Generate help message */
help: (context: Record<string, unknown>) => string;
}
export const ERROR_PATTERNS: ErrorPattern[] = [
{
id: 'missing_colon',
match: (code, message) => code === 'E0101' && message.includes("expected ':'"),
help: () => 'Field declarations require a colon between the name and type: fieldName: Type',
},
{
id: 'lowercase_type',
match: (code, message, ctx) => {
const typeName = ctx['typeName'] as string | undefined;
return code === 'E0201' && !!typeName && /^[a-z]/.test(typeName);
},
help: (ctx) => {
const typeName = ctx['typeName'] as string;
const capitalized = typeName.charAt(0).toUpperCase() + typeName.slice(1);
return `Type names start with uppercase. Did you mean '${capitalized}'?`;
},
},
{
id: 'common_typos',
match: (code) => code === 'E0100' || code === 'E0102',
help: () => 'Check for typos in keywords. Common mistakes: entiy→entity, behaviur→behavior',
},
{
id: 'old_in_precondition',
match: (code) => code === 'E0304',
help: () => 'old() captures pre-execution state and only makes sense in postconditions. In preconditions, just reference values directly.',
},
{
id: 'unclosed_block',
match: (code) => code === 'E0105' || code === 'E0118',
help: () => 'Every { must have a matching }. Check for missing closing braces in nested blocks.',
},
];
/**
* Get contextual help for an error.
*/
export function getContextualHelp(
errorCode: string,
message: string,
context: Record<string, unknown> = {}
): string[] {
const helps: string[] = [];
for (const pattern of ERROR_PATTERNS) {
if (pattern.match(errorCode, message, context)) {
helps.push(pattern.help(context));
}
}
return helps;
}
// ============================================================================
// ISL Unified Error Types
// ============================================================================
/**
* Source location information for error reporting
*/
export interface SourceLocation {
file: string;
line: number;
column: number;
endLine: number;
endColumn: number;
}
/**
* Position in a file (1-indexed)
*/
export interface Position {
line: number;
column: number;
}
/**
* Diagnostic severity levels
*/
export type DiagnosticSeverity = 'error' | 'warning' | 'info' | 'hint';
/**
* Related information for an error (e.g., "previously defined here")
*/
export interface RelatedInformation {
message: string;
location: SourceLocation;
}
/**
* Suggested code fix
*/
export interface CodeFix {
/** Title shown in IDE */
title: string;
/** Text edits to apply */
edits: TextEdit[];
/** Is this the preferred fix? */
isPreferred?: boolean;
}
/**
* Text edit for a code fix
*/
export interface TextEdit {
range: { start: Position; end: Position };
newText: string;
}
/**
* Error category for grouping
*/
export type ErrorCategory =
| 'lexer' // L: Lexical analysis errors
| 'parser' // P: Syntax/parsing errors
| 'type' // T: Type checking errors
| 'semantic' // S: Semantic analysis errors
| 'eval' // E: Runtime evaluation errors
| 'verify' // V: Verification errors (pre/post conditions)
| 'config' // C: Configuration errors
| 'io'; // I: Input/output errors
/**
* Unified diagnostic interface for all ISL errors
*/
export interface Diagnostic {
/** Unique error code (e.g., E0012) */
code: string;
/** Error category */
category: ErrorCategory;
/** Severity level */
severity: DiagnosticSeverity;
/** Human-readable error message */
message: string;
/** Source location */
location: SourceLocation;
/** Component that generated the error */
source: 'lexer' | 'parser' | 'typechecker' | 'evaluator' | 'verifier' | 'cli' | 'lsp';
/** Related information (e.g., "defined here") */
relatedInformation?: RelatedInformation[];
/** Suggested fix */
fix?: CodeFix;
/** Additional notes (displayed with "= note:") */
notes?: string[];
/** Help suggestions (displayed with "= help:") */
help?: string[];
/** Tags for IDE features */
tags?: DiagnosticTag[];
}
export type DiagnosticTag = 'unnecessary' | 'deprecated';
/**
* Error explanation for `isl explain <code>`
*/
export interface ErrorExplanation {
/** Error code */
code: string;
/** Category */
category: ErrorCategory;
/** Short title */
title: string;
/** Detailed explanation */
explanation: string;
/** Common causes */
causes: string[];
/** How to fix */
solutions: string[];
/** Example of problematic code */
badExample?: {
code: string;
description: string;
};
/** Example of correct code */
goodExample?: {
code: string;
description: string;
};
/** See also (related error codes) */
seeAlso?: string[];
}
/**
* Source file content for snippet extraction
*/
export interface SourceFile {
path: string;
content: string;
lines: string[];
}
/**
* Options for error formatting
*/
export interface FormatOptions {
/** Enable ANSI colors */
colors: boolean;
/** Number of context lines before/after error */
contextLines: number;
/** Show error codes */
showCodes: boolean;
/** Show notes and help */
showHelp: boolean;
/** Maximum errors to show */
maxErrors: number;
/** Show related information */
showRelated: boolean;
/** Terminal width for wrapping */
terminalWidth: number;
}
/**
* Default format options
*/
export const DEFAULT_FORMAT_OPTIONS: FormatOptions = {
colors: true,
contextLines: 2,
showCodes: true,
showHelp: true,
maxErrors: 10,
showRelated: true,
terminalWidth: 80,
};
/**
* Result of parsing with collected errors
*/
export interface DiagnosticResult<T> {
/** The parsed value (may be partial on error) */
value?: T;
/** Collected diagnostics */
diagnostics: Diagnostic[];
/** Whether parsing/checking succeeded */
success: boolean;
}
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "tests"]
}