@ipation/specbridge 1.0.6 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -103,7 +103,15 @@ interface Violation {
103
103
  */
104
104
  interface ViolationFix {
105
105
  description: string;
106
- patch: string;
106
+ edits: TextEdit[];
107
+ }
108
+ /**
109
+ * Text edit (0-based offsets into the file content)
110
+ */
111
+ interface TextEdit {
112
+ start: number;
113
+ end: number;
114
+ text: string;
107
115
  }
108
116
  /**
109
117
  * A pattern detected during inference
@@ -903,7 +911,8 @@ declare const defaultConfig: SpecBridgeConfigType;
903
911
  declare class SpecBridgeError extends Error {
904
912
  readonly code: string;
905
913
  readonly details?: Record<string, unknown> | undefined;
906
- constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
914
+ readonly suggestion?: string | undefined;
915
+ constructor(message: string, code: string, details?: Record<string, unknown> | undefined, suggestion?: string | undefined);
907
916
  }
908
917
  /**
909
918
  * Configuration errors
@@ -1383,6 +1392,7 @@ interface VerificationOptions {
1383
1392
  declare class VerificationEngine {
1384
1393
  private registry;
1385
1394
  private project;
1395
+ private astCache;
1386
1396
  constructor(registry?: Registry);
1387
1397
  /**
1388
1398
  * Run verification
@@ -1396,10 +1406,6 @@ declare class VerificationEngine {
1396
1406
  * Verify multiple files
1397
1407
  */
1398
1408
  private verifyFiles;
1399
- /**
1400
- * Check if file is excepted from constraint
1401
- */
1402
- private isExcepted;
1403
1409
  /**
1404
1410
  * Get registry
1405
1411
  */
@@ -1410,6 +1416,26 @@ declare class VerificationEngine {
1410
1416
  */
1411
1417
  declare function createVerificationEngine(registry?: Registry): VerificationEngine;
1412
1418
 
1419
+ declare class AstCache {
1420
+ private cache;
1421
+ get(filePath: string, project: Project): Promise<SourceFile | null>;
1422
+ clear(): void;
1423
+ }
1424
+
1425
+ declare function getChangedFiles(cwd: string): Promise<string[]>;
1426
+
1427
+ /**
1428
+ * Shared constraint applicability helpers
1429
+ */
1430
+
1431
+ declare function isConstraintExcepted(filePath: string, constraint: Constraint, cwd: string): boolean;
1432
+ declare function shouldApplyConstraintToFile(params: {
1433
+ filePath: string;
1434
+ constraint: Constraint;
1435
+ cwd: string;
1436
+ severityFilter?: Severity[];
1437
+ }): boolean;
1438
+
1413
1439
  /**
1414
1440
  * Base verifier interface
1415
1441
  */
@@ -1473,10 +1499,6 @@ declare class NamingVerifier implements Verifier {
1473
1499
  verify(ctx: VerificationContext): Promise<Violation[]>;
1474
1500
  }
1475
1501
 
1476
- /**
1477
- * Import pattern verifier
1478
- */
1479
-
1480
1502
  declare class ImportsVerifier implements Verifier {
1481
1503
  readonly id = "imports";
1482
1504
  readonly name = "Import Pattern Verifier";
@@ -1506,6 +1528,34 @@ declare class RegexVerifier implements Verifier {
1506
1528
  verify(ctx: VerificationContext): Promise<Violation[]>;
1507
1529
  }
1508
1530
 
1531
+ declare class DependencyVerifier implements Verifier {
1532
+ readonly id = "dependencies";
1533
+ readonly name = "Dependency Verifier";
1534
+ readonly description = "Checks dependency constraints, import depth, and circular dependencies";
1535
+ verify(ctx: VerificationContext): Promise<Violation[]>;
1536
+ }
1537
+
1538
+ declare class ComplexityVerifier implements Verifier {
1539
+ readonly id = "complexity";
1540
+ readonly name = "Complexity Verifier";
1541
+ readonly description = "Checks cyclomatic complexity, file size, parameters, and nesting depth";
1542
+ verify(ctx: VerificationContext): Promise<Violation[]>;
1543
+ }
1544
+
1545
+ declare class SecurityVerifier implements Verifier {
1546
+ readonly id = "security";
1547
+ readonly name = "Security Verifier";
1548
+ readonly description = "Detects common security footguns (secrets, eval, XSS/SQL injection heuristics)";
1549
+ verify(ctx: VerificationContext): Promise<Violation[]>;
1550
+ }
1551
+
1552
+ declare class ApiVerifier implements Verifier {
1553
+ readonly id = "api";
1554
+ readonly name = "API Consistency Verifier";
1555
+ readonly description = "Checks basic REST endpoint naming conventions in common frameworks";
1556
+ verify(ctx: VerificationContext): Promise<Violation[]>;
1557
+ }
1558
+
1509
1559
  /**
1510
1560
  * Verifier exports
1511
1561
  */
@@ -1527,6 +1577,25 @@ declare function getVerifierIds(): string[];
1527
1577
  */
1528
1578
  declare function selectVerifierForConstraint(rule: string, specifiedVerifier?: string): Verifier | null;
1529
1579
 
1580
+ interface AutofixPatch {
1581
+ filePath: string;
1582
+ description: string;
1583
+ start: number;
1584
+ end: number;
1585
+ originalText: string;
1586
+ fixedText: string;
1587
+ }
1588
+ interface AutofixResult {
1589
+ applied: AutofixPatch[];
1590
+ skipped: number;
1591
+ }
1592
+ declare class AutofixEngine {
1593
+ applyFixes(violations: Violation[], options?: {
1594
+ dryRun?: boolean;
1595
+ interactive?: boolean;
1596
+ }): Promise<AutofixResult>;
1597
+ }
1598
+
1530
1599
  /**
1531
1600
  * Dependency graph for impact analysis
1532
1601
  */
@@ -1708,6 +1777,34 @@ declare class AgentContextGenerator {
1708
1777
  }): any[];
1709
1778
  }
1710
1779
 
1780
+ /**
1781
+ * Prompt templates for AI agents
1782
+ */
1783
+
1784
+ interface PromptTemplate {
1785
+ name: string;
1786
+ description: string;
1787
+ generate: (context: AgentContext, options?: Record<string, unknown>) => string;
1788
+ }
1789
+ declare const templates: Record<string, PromptTemplate>;
1790
+
1791
+ interface McpServerOptions {
1792
+ cwd: string;
1793
+ version: string;
1794
+ }
1795
+ declare class SpecBridgeMcpServer {
1796
+ private server;
1797
+ private cwd;
1798
+ private config;
1799
+ private registry;
1800
+ constructor(options: McpServerOptions);
1801
+ initialize(): Promise<void>;
1802
+ startStdio(): Promise<void>;
1803
+ private getReady;
1804
+ private registerResources;
1805
+ private registerTools;
1806
+ }
1807
+
1711
1808
  /**
1712
1809
  * Check if a path exists
1713
1810
  */
@@ -1808,4 +1905,4 @@ declare function matchesAnyPattern(filePath: string, patterns: string[], options
1808
1905
  cwd?: string;
1809
1906
  }): boolean;
1810
1907
 
1811
- export { type AffectedFile, type AgentContext, AgentContextGenerator, AlreadyInitializedError, type Analyzer, AnalyzerNotFoundError, type ApplicableConstraint, type ApplicableDecision, CodeScanner, type ComplianceReport, ConfigError, type Constraint, type ConstraintException, ConstraintExceptionSchema, type ConstraintExceptionSchema_, ConstraintSchema, type ConstraintSchema_, type ConstraintType, ConstraintTypeSchema, type ConstraintTypeSchema_, type ContextOptions, type Decision, type DecisionCompliance, type DecisionContent, DecisionContentSchema, type DecisionContentSchema_, type DecisionFilter, type DecisionMetadata, DecisionMetadataSchema, type DecisionMetadataSchema_, DecisionNotFoundError, DecisionSchema, type DecisionStatus, DecisionStatusSchema, type DecisionStatusSchema_, type DecisionTypeSchema, DecisionValidationError, type DependencyGraph, ErrorsAnalyzer, ErrorsVerifier, FileSystemError, type GlobOptions, type GraphNode, HookError, type ImpactAnalysis, ImportsAnalyzer, ImportsVerifier, InferenceEngine, InferenceError, type InferenceOptions, type InferenceResult, type LevelConfig, LinksSchema, type LoadError, type LoadResult, type LoadedDecision, type MigrationStep, NamingAnalyzer, NamingVerifier, NotInitializedError, type Pattern, type PatternExample, PropagationEngine, type PropagationOptions, RegexVerifier, Registry, type RegistryConstraintMatch, RegistryError, type RegistryOptions, type ReportOptions, Reporter, type ScanOptions, type ScanResult, type ScannedFile, type Severity, SeveritySchema, type SeveritySchema_, type SpecBridgeConfig, SpecBridgeConfigSchema, type SpecBridgeConfigType, SpecBridgeError, StructureAnalyzer, type TrendData, type VerificationConfig, VerificationConfigSchema, type VerificationConfigSchema_, type VerificationContext, VerificationEngine, VerificationError, type VerificationFrequency, VerificationFrequencySchema, type VerificationFrequencySchema_, type VerificationLevel, type VerificationOptions, type VerificationResult, type Verifier, VerifierNotFoundError, type Violation, type ViolationFix, buildDependencyGraph, builtinAnalyzers, builtinVerifiers, calculateConfidence, checkDegradation, createInferenceEngine, createPattern, createPropagationEngine, createRegistry, createScannerFromConfig, createVerificationEngine, createViolation, defaultConfig, ensureDir, extractSnippet, formatConsoleReport, formatContextAsJson, formatContextAsMarkdown, formatContextAsMcp, formatError, formatMarkdownReport, formatValidationErrors, generateContext, generateFormattedContext, generateReport, getAffectedFiles, getAffectingDecisions, getAnalyzer, getAnalyzerIds, getConfigPath, getDecisionsDir, getInferredDir, getReportsDir, getSpecBridgeDir, getTransitiveDependencies, getVerifier, getVerifierIds, getVerifiersDir, glob, isDirectory, loadConfig, loadDecisionFile, loadDecisionsFromDir, matchesAnyPattern, matchesPattern, mergeWithDefaults, normalizePath, parseYaml, parseYamlDocument, pathExists, readFilesInDir, readTextFile, runInference, selectVerifierForConstraint, stringifyYaml, updateYamlDocument, validateConfig, validateDecision, validateDecisionFile, writeTextFile };
1908
+ export { type AffectedFile, type AgentContext, AgentContextGenerator, AlreadyInitializedError, type Analyzer, AnalyzerNotFoundError, ApiVerifier, type ApplicableConstraint, type ApplicableDecision, AstCache, AutofixEngine, type AutofixPatch, type AutofixResult, CodeScanner, ComplexityVerifier, type ComplianceReport, ConfigError, type Constraint, type ConstraintException, ConstraintExceptionSchema, type ConstraintExceptionSchema_, ConstraintSchema, type ConstraintSchema_, type ConstraintType, ConstraintTypeSchema, type ConstraintTypeSchema_, type ContextOptions, type Decision, type DecisionCompliance, type DecisionContent, DecisionContentSchema, type DecisionContentSchema_, type DecisionFilter, type DecisionMetadata, DecisionMetadataSchema, type DecisionMetadataSchema_, DecisionNotFoundError, DecisionSchema, type DecisionStatus, DecisionStatusSchema, type DecisionStatusSchema_, type DecisionTypeSchema, DecisionValidationError, type DependencyGraph, DependencyVerifier, ErrorsAnalyzer, ErrorsVerifier, FileSystemError, type GlobOptions, type GraphNode, HookError, type ImpactAnalysis, ImportsAnalyzer, ImportsVerifier, InferenceEngine, InferenceError, type InferenceOptions, type InferenceResult, type LevelConfig, LinksSchema, type LoadError, type LoadResult, type LoadedDecision, type McpServerOptions, type MigrationStep, NamingAnalyzer, NamingVerifier, NotInitializedError, type Pattern, type PatternExample, type PromptTemplate, PropagationEngine, type PropagationOptions, RegexVerifier, Registry, type RegistryConstraintMatch, RegistryError, type RegistryOptions, type ReportOptions, Reporter, type ScanOptions, type ScanResult, type ScannedFile, SecurityVerifier, type Severity, SeveritySchema, type SeveritySchema_, type SpecBridgeConfig, SpecBridgeConfigSchema, type SpecBridgeConfigType, SpecBridgeError, SpecBridgeMcpServer, StructureAnalyzer, type TextEdit, type TrendData, type VerificationConfig, VerificationConfigSchema, type VerificationConfigSchema_, type VerificationContext, VerificationEngine, VerificationError, type VerificationFrequency, VerificationFrequencySchema, type VerificationFrequencySchema_, type VerificationLevel, type VerificationOptions, type VerificationResult, type Verifier, VerifierNotFoundError, type Violation, type ViolationFix, buildDependencyGraph, builtinAnalyzers, builtinVerifiers, calculateConfidence, checkDegradation, createInferenceEngine, createPattern, createPropagationEngine, createRegistry, createScannerFromConfig, createVerificationEngine, createViolation, defaultConfig, ensureDir, extractSnippet, formatConsoleReport, formatContextAsJson, formatContextAsMarkdown, formatContextAsMcp, formatError, formatMarkdownReport, formatValidationErrors, generateContext, generateFormattedContext, generateReport, getAffectedFiles, getAffectingDecisions, getAnalyzer, getAnalyzerIds, getChangedFiles, getConfigPath, getDecisionsDir, getInferredDir, getReportsDir, getSpecBridgeDir, getTransitiveDependencies, getVerifier, getVerifierIds, getVerifiersDir, glob, isConstraintExcepted, isDirectory, loadConfig, loadDecisionFile, loadDecisionsFromDir, matchesAnyPattern, matchesPattern, mergeWithDefaults, normalizePath, parseYaml, parseYamlDocument, pathExists, readFilesInDir, readTextFile, runInference, selectVerifierForConstraint, shouldApplyConstraintToFile, stringifyYaml, templates, updateYamlDocument, validateConfig, validateDecision, validateDecisionFile, writeTextFile };