@ipation/specbridge 2.1.0 → 2.2.0
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/CHANGELOG.md +96 -0
- package/README.md +1 -1
- package/dist/cli.js +149 -5199
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +181 -7
- package/dist/index.js +1464 -5716
- package/dist/index.js.map +1 -1
- package/package.json +12 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { SourceFile, Project } from 'ts-morph';
|
|
3
3
|
import { Document } from 'yaml';
|
|
4
|
+
import { Application } from 'express';
|
|
4
5
|
export { minimatch } from 'minimatch';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -1885,6 +1886,23 @@ interface ReportOptions {
|
|
|
1885
1886
|
/** Use v1.3 compliance formula instead of v2.0 severity-weighted formula */
|
|
1886
1887
|
legacyCompliance?: boolean;
|
|
1887
1888
|
}
|
|
1889
|
+
/**
|
|
1890
|
+
* Generic verification result shape for Reporter class
|
|
1891
|
+
* Supports various result formats from different verification engines
|
|
1892
|
+
*/
|
|
1893
|
+
interface ReporterResult {
|
|
1894
|
+
violations?: Violation[];
|
|
1895
|
+
summary?: {
|
|
1896
|
+
totalViolations?: number;
|
|
1897
|
+
decisionsChecked?: number;
|
|
1898
|
+
filesChecked?: number;
|
|
1899
|
+
critical?: number;
|
|
1900
|
+
high?: number;
|
|
1901
|
+
medium?: number;
|
|
1902
|
+
low?: number;
|
|
1903
|
+
duration?: number;
|
|
1904
|
+
};
|
|
1905
|
+
}
|
|
1888
1906
|
/**
|
|
1889
1907
|
* Generate a compliance report
|
|
1890
1908
|
*/
|
|
@@ -1903,7 +1921,7 @@ declare class Reporter {
|
|
|
1903
1921
|
/**
|
|
1904
1922
|
* Generate formatted report from verification result
|
|
1905
1923
|
*/
|
|
1906
|
-
generate(result:
|
|
1924
|
+
generate(result: ReporterResult, options?: {
|
|
1907
1925
|
format?: 'table' | 'json' | 'markdown';
|
|
1908
1926
|
includePassedChecks?: boolean;
|
|
1909
1927
|
groupBy?: 'severity' | 'file';
|
|
@@ -1912,7 +1930,7 @@ declare class Reporter {
|
|
|
1912
1930
|
/**
|
|
1913
1931
|
* Generate compliance overview from multiple results
|
|
1914
1932
|
*/
|
|
1915
|
-
generateComplianceReport(results:
|
|
1933
|
+
generateComplianceReport(results: ReporterResult[]): string;
|
|
1916
1934
|
private formatAsTable;
|
|
1917
1935
|
private formatAsTableGrouped;
|
|
1918
1936
|
private formatAsMarkdown;
|
|
@@ -2085,7 +2103,7 @@ declare class AgentContextGenerator {
|
|
|
2085
2103
|
* Generate context from decisions
|
|
2086
2104
|
*/
|
|
2087
2105
|
generateContext(options: {
|
|
2088
|
-
decisions:
|
|
2106
|
+
decisions: Decision[];
|
|
2089
2107
|
filePattern?: string;
|
|
2090
2108
|
format?: 'markdown' | 'plain' | 'json';
|
|
2091
2109
|
concise?: boolean;
|
|
@@ -2096,15 +2114,15 @@ declare class AgentContextGenerator {
|
|
|
2096
2114
|
* Generate prompt suffix for AI agents
|
|
2097
2115
|
*/
|
|
2098
2116
|
generatePromptSuffix(options: {
|
|
2099
|
-
decisions:
|
|
2117
|
+
decisions: Decision[];
|
|
2100
2118
|
}): string;
|
|
2101
2119
|
/**
|
|
2102
2120
|
* Extract relevant decisions for a specific file
|
|
2103
2121
|
*/
|
|
2104
2122
|
extractRelevantDecisions(options: {
|
|
2105
|
-
decisions:
|
|
2123
|
+
decisions: Decision[];
|
|
2106
2124
|
filePath: string;
|
|
2107
|
-
}):
|
|
2125
|
+
}): Decision[];
|
|
2108
2126
|
}
|
|
2109
2127
|
|
|
2110
2128
|
/**
|
|
@@ -2235,4 +2253,160 @@ declare function matchesAnyPattern(filePath: string, patterns: string[], options
|
|
|
2235
2253
|
cwd?: string;
|
|
2236
2254
|
}): boolean;
|
|
2237
2255
|
|
|
2238
|
-
|
|
2256
|
+
/**
|
|
2257
|
+
* Analytics engine - Provide insights into compliance trends and decision impact
|
|
2258
|
+
*/
|
|
2259
|
+
|
|
2260
|
+
interface DecisionMetrics {
|
|
2261
|
+
decisionId: string;
|
|
2262
|
+
title: string;
|
|
2263
|
+
totalViolations: number;
|
|
2264
|
+
violationsByFile: Map<string, number>;
|
|
2265
|
+
violationsBySeverity: Record<Severity, number>;
|
|
2266
|
+
mostViolatedConstraint: {
|
|
2267
|
+
id: string;
|
|
2268
|
+
count: number;
|
|
2269
|
+
} | null;
|
|
2270
|
+
averageComplianceScore: number;
|
|
2271
|
+
trendDirection: 'up' | 'down' | 'stable';
|
|
2272
|
+
history: Array<{
|
|
2273
|
+
date: string;
|
|
2274
|
+
compliance: number;
|
|
2275
|
+
violations: number;
|
|
2276
|
+
}>;
|
|
2277
|
+
}
|
|
2278
|
+
interface Insight {
|
|
2279
|
+
type: 'warning' | 'info' | 'success';
|
|
2280
|
+
category: 'compliance' | 'trend' | 'hotspot' | 'suggestion';
|
|
2281
|
+
message: string;
|
|
2282
|
+
details?: string;
|
|
2283
|
+
decisionId?: string;
|
|
2284
|
+
}
|
|
2285
|
+
interface AnalyticsSummary {
|
|
2286
|
+
totalDecisions: number;
|
|
2287
|
+
averageCompliance: number;
|
|
2288
|
+
overallTrend: 'up' | 'down' | 'stable';
|
|
2289
|
+
criticalIssues: number;
|
|
2290
|
+
topDecisions: Array<{
|
|
2291
|
+
decisionId: string;
|
|
2292
|
+
title: string;
|
|
2293
|
+
compliance: number;
|
|
2294
|
+
}>;
|
|
2295
|
+
bottomDecisions: Array<{
|
|
2296
|
+
decisionId: string;
|
|
2297
|
+
title: string;
|
|
2298
|
+
compliance: number;
|
|
2299
|
+
}>;
|
|
2300
|
+
insights: Insight[];
|
|
2301
|
+
}
|
|
2302
|
+
/**
|
|
2303
|
+
* Analytics engine for compliance data
|
|
2304
|
+
*/
|
|
2305
|
+
declare class AnalyticsEngine {
|
|
2306
|
+
/**
|
|
2307
|
+
* Analyze a specific decision across historical reports
|
|
2308
|
+
*/
|
|
2309
|
+
analyzeDecision(decisionId: string, history: StoredReport[]): Promise<DecisionMetrics>;
|
|
2310
|
+
/**
|
|
2311
|
+
* Generate insights from historical data
|
|
2312
|
+
*/
|
|
2313
|
+
generateInsights(history: StoredReport[]): Promise<Insight[]>;
|
|
2314
|
+
/**
|
|
2315
|
+
* Generate analytics summary
|
|
2316
|
+
*/
|
|
2317
|
+
generateSummary(history: StoredReport[]): Promise<AnalyticsSummary>;
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
/**
|
|
2321
|
+
* Dashboard server - Compliance dashboard backend with REST API
|
|
2322
|
+
*/
|
|
2323
|
+
|
|
2324
|
+
interface DashboardOptions {
|
|
2325
|
+
cwd: string;
|
|
2326
|
+
config: SpecBridgeConfig;
|
|
2327
|
+
}
|
|
2328
|
+
/**
|
|
2329
|
+
* Dashboard Server with caching
|
|
2330
|
+
*/
|
|
2331
|
+
declare class DashboardServer {
|
|
2332
|
+
private app;
|
|
2333
|
+
private cwd;
|
|
2334
|
+
private config;
|
|
2335
|
+
private registry;
|
|
2336
|
+
private reportStorage;
|
|
2337
|
+
private cachedReport;
|
|
2338
|
+
private cacheTimestamp;
|
|
2339
|
+
private readonly CACHE_TTL;
|
|
2340
|
+
private refreshInterval;
|
|
2341
|
+
constructor(options: DashboardOptions);
|
|
2342
|
+
/**
|
|
2343
|
+
* Start the server with background cache refresh
|
|
2344
|
+
*/
|
|
2345
|
+
start(): Promise<void>;
|
|
2346
|
+
/**
|
|
2347
|
+
* Stop the server and clear intervals
|
|
2348
|
+
*/
|
|
2349
|
+
stop(): void;
|
|
2350
|
+
/**
|
|
2351
|
+
* Refresh the cached report
|
|
2352
|
+
*/
|
|
2353
|
+
private refreshCache;
|
|
2354
|
+
/**
|
|
2355
|
+
* Get the Express app instance
|
|
2356
|
+
*/
|
|
2357
|
+
getApp(): Application;
|
|
2358
|
+
/**
|
|
2359
|
+
* Setup middleware
|
|
2360
|
+
*/
|
|
2361
|
+
private setupMiddleware;
|
|
2362
|
+
/**
|
|
2363
|
+
* Setup all routes
|
|
2364
|
+
*/
|
|
2365
|
+
private setupRoutes;
|
|
2366
|
+
/**
|
|
2367
|
+
* Setup report-related routes
|
|
2368
|
+
*/
|
|
2369
|
+
private setupReportRoutes;
|
|
2370
|
+
/**
|
|
2371
|
+
* Setup decision-related routes
|
|
2372
|
+
*/
|
|
2373
|
+
private setupDecisionRoutes;
|
|
2374
|
+
/**
|
|
2375
|
+
* Setup analytics-related routes
|
|
2376
|
+
*/
|
|
2377
|
+
private setupAnalyticsRoutes;
|
|
2378
|
+
/**
|
|
2379
|
+
* Setup health check route
|
|
2380
|
+
*/
|
|
2381
|
+
private setupHealthRoute;
|
|
2382
|
+
/**
|
|
2383
|
+
* Setup static file serving
|
|
2384
|
+
*/
|
|
2385
|
+
private setupStaticFiles;
|
|
2386
|
+
}
|
|
2387
|
+
/**
|
|
2388
|
+
* Create and configure the dashboard server (factory function)
|
|
2389
|
+
* @returns DashboardServer instance
|
|
2390
|
+
*/
|
|
2391
|
+
declare function createDashboardServer(options: DashboardOptions): DashboardServer;
|
|
2392
|
+
|
|
2393
|
+
interface LspServerOptions {
|
|
2394
|
+
cwd: string;
|
|
2395
|
+
verbose?: boolean;
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
declare function startLspServer(options: LspServerOptions): Promise<void>;
|
|
2399
|
+
|
|
2400
|
+
/**
|
|
2401
|
+
* GitHub integration helpers (optional)
|
|
2402
|
+
*/
|
|
2403
|
+
|
|
2404
|
+
interface GitHubPrCommentOptions {
|
|
2405
|
+
repo: string;
|
|
2406
|
+
pr: number;
|
|
2407
|
+
token: string;
|
|
2408
|
+
}
|
|
2409
|
+
declare function formatViolationsForGitHub(violations: Violation[], limit?: number): string;
|
|
2410
|
+
declare function postPrComment(violations: Violation[], options: GitHubPrCommentOptions): Promise<void>;
|
|
2411
|
+
|
|
2412
|
+
export { type AffectedFile, type AgentContext, AgentContextGenerator, AlreadyInitializedError, AnalyticsEngine, type AnalyticsSummary, type Analyzer, AnalyzerNotFoundError, ApiVerifier, type ApplicableConstraint, type ApplicableDecision, AstCache, AutofixEngine, type AutofixPatch, type AutofixResult, CodeScanner, ComplexityVerifier, type ComplianceReport, ConfigError, type Constraint, type ConstraintCheck, ConstraintCheckSchema, type ConstraintCheckSchema_, type ConstraintException, ConstraintExceptionSchema, type ConstraintExceptionSchema_, ConstraintSchema, type ConstraintSchema_, type ConstraintType, ConstraintTypeSchema, type ConstraintTypeSchema_, type ContextOptions, DashboardServer, type Decision, type DecisionCompliance, type DecisionContent, DecisionContentSchema, type DecisionContentSchema_, type DecisionFilter, type DecisionMetadata, DecisionMetadataSchema, type DecisionMetadataSchema_, type DecisionMetrics, DecisionNotFoundError, DecisionSchema, type DecisionStatus, DecisionStatusSchema, type DecisionStatusSchema_, type DecisionTypeSchema, DecisionValidationError, type DependencyGraph, DependencyVerifier, type DriftAnalysis, ErrorsAnalyzer, ErrorsVerifier, FileSystemError, type GitHubPrCommentOptions, type GlobOptions, type GraphNode, HookError, type ImpactAnalysis, ImportsAnalyzer, ImportsVerifier, InferenceEngine, InferenceError, type InferenceOptions, type InferenceResult, type Insight, type LevelConfig, LinksSchema, type LoadError, type LoadResult, type LoadedDecision, type McpServerOptions, type MigrationStep, NamingAnalyzer, NamingVerifier, NotInitializedError, type OverallDrift, type Pattern, type PatternExample, type PromptTemplate, PropagationEngine, type PropagationOptions, RegexVerifier, Registry, type RegistryConstraintMatch, RegistryError, type RegistryOptions, type ReportOptions, ReportStorage, Reporter, type ReporterResult, type ScanOptions, type ScanResult, type ScannedFile, SecurityVerifier, type Severity, SeveritySchema, type SeveritySchema_, type SpecBridgeConfig, SpecBridgeConfigSchema, type SpecBridgeConfigType, SpecBridgeError, SpecBridgeMcpServer, type StoredReport, StructureAnalyzer, type TextEdit, type TrendAnalysis, type TrendData, type TrendDirection, type VerificationConfig, VerificationConfigSchema, type VerificationConfigSchema_, type VerificationContext, VerificationEngine, VerificationError, type VerificationFrequency, VerificationFrequencySchema, type VerificationFrequencySchema_, type VerificationIssue, type VerificationLevel, type VerificationOptions, type VerificationResult, type VerificationWarning, type Verifier, VerifierNotFoundError, type VerifierPlugin, type VerifierPluginMetadata, type Violation, type ViolationFix, analyzeTrend, buildDependencyGraph, builtinAnalyzers, builtinVerifiers, calculateConfidence, checkDegradation, clearVerifierPool, createDashboardServer, createInferenceEngine, createPattern, createPropagationEngine, createRegistry, createScannerFromConfig, createVerificationEngine, createViolation, defaultConfig, defineVerifierPlugin, detectDrift, ensureDir, extractSnippet, formatConsoleReport, formatContextAsJson, formatContextAsMarkdown, formatContextAsMcp, formatError, formatMarkdownReport, formatValidationErrors, formatViolationsForGitHub, 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, postPrComment, readFilesInDir, readTextFile, runInference, selectVerifierForConstraint, shouldApplyConstraintToFile, startLspServer, stringifyYaml, templates, updateYamlDocument, validateConfig, validateDecision, validateDecisionFile, writeTextFile };
|