slopbrick 0.11.2 → 0.17.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/README.md +130 -824
- package/dist/engine/worker.cjs +39208 -5847
- package/dist/engine/worker.js +39263 -5896
- package/dist/index.cjs +50707 -14354
- package/dist/index.d.cts +186 -130
- package/dist/index.d.ts +186 -130
- package/dist/index.js +50613 -14313
- package/package.json +18 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import * as _usebrick_engine from '@usebrick/engine';
|
|
2
|
+
export * from '@usebrick/engine';
|
|
3
|
+
import * as _usebrick_core from '@usebrick/core';
|
|
4
|
+
import { SignalStrengthEntry } from '@usebrick/core';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Constitution declared by the user (or auto-detected from package.json).
|
|
3
8
|
* Each allow-list field is a list of canonical names — agents and
|
|
@@ -244,33 +249,55 @@ interface ScanFactsV2 {
|
|
|
244
249
|
_source?: string;
|
|
245
250
|
}
|
|
246
251
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
lastCalibratedAt: string;
|
|
258
|
-
/**
|
|
259
|
-
* v0.9.3: when `true`, the scan engine applies `'off'` to this rule by
|
|
260
|
-
* default — user must explicitly opt back in via
|
|
261
|
-
* `slopbrick.config.mjs`'s `rules:` block. Set for:
|
|
262
|
-
* - INVERTED rules (lift < 1.0 — fires MORE on human code than AI;
|
|
263
|
-
* actively misleading when surfaced as AI detectors)
|
|
264
|
-
* - NOISY rules (recall < 0.1 — fires too rarely on AI code to be
|
|
265
|
-
* a useful default; engineers will dismiss after the 3rd false
|
|
266
|
-
* sense of "it doesn't matter")
|
|
267
|
-
* User `rules: { 'rule/id': 'medium' }` overrides the default-off.
|
|
268
|
-
* Omitted (= undefined) means the rule keeps its factory default.
|
|
269
|
-
*/
|
|
270
|
-
defaultOff?: boolean;
|
|
271
|
-
}
|
|
252
|
+
/**
|
|
253
|
+
* v0.15.0+: The user-facing 3-bucket taxonomy. Maps engine verdicts
|
|
254
|
+
* (6 values, used for LR math and calibration) to UI buckets (3 values,
|
|
255
|
+
* used in the report and JSON output).
|
|
256
|
+
*
|
|
257
|
+
* Per the user's design intent ("INVERTED is basically HYGIENE"), INVERTED
|
|
258
|
+
* rules are in the same UI bucket as HYGIENE rules. The engine still
|
|
259
|
+
* distinguishes them (INVERTED has LR < 1, HYGIENE has LR ≈ 1).
|
|
260
|
+
*/
|
|
261
|
+
type Bucket = 'ai' | 'hygiene' | 'suppressed';
|
|
272
262
|
|
|
273
|
-
declare const VERSION
|
|
263
|
+
declare const VERSION: string;
|
|
264
|
+
/**
|
|
265
|
+
* Runtime shape of `.slopbrick/health.json`. The on-disk JSON
|
|
266
|
+
* matches `packages/core/schemas/v1/health.schema.json` (v3); this
|
|
267
|
+
* interface is the slopbrick-side runtime companion. Schema is the
|
|
268
|
+
* source of truth — keep this in sync with the codegen output in
|
|
269
|
+
* `packages/core/src/generated/health.ts` (RepositoryMemoryHealth).
|
|
270
|
+
*
|
|
271
|
+
* v3 dropped the single `slopIndex` headline in favor of four named
|
|
272
|
+
* scores:
|
|
273
|
+
* - `aiQuality` — AI-specific findings (USEFUL + OK verdicts)
|
|
274
|
+
* - `engineeringHygiene` — HYGIENE + INVERTED rules
|
|
275
|
+
* - `security` — security/* rules
|
|
276
|
+
* - `repositoryHealth` — composite (0.5*aiQ + 0.3*eng + 0.2*sec)
|
|
277
|
+
*
|
|
278
|
+
* Plus optional verdict + bucket distributions for agent-readable
|
|
279
|
+
* insight.
|
|
280
|
+
*/
|
|
281
|
+
interface HealthFile {
|
|
282
|
+
version: typeof _usebrick_core.STRUCTURE_SCHEMA_VERSION;
|
|
283
|
+
generatedAt: string;
|
|
284
|
+
workspace: string;
|
|
285
|
+
aiQuality: number;
|
|
286
|
+
engineeringHygiene: number;
|
|
287
|
+
security: number;
|
|
288
|
+
repositoryHealth: number;
|
|
289
|
+
verdictDistribution?: Record<_usebrick_core.Verdict, number>;
|
|
290
|
+
bucketDistribution?: Record<Bucket, number>;
|
|
291
|
+
categoryScores: Record<string, number>;
|
|
292
|
+
issueCounts: {
|
|
293
|
+
high: number;
|
|
294
|
+
medium: number;
|
|
295
|
+
low: number;
|
|
296
|
+
};
|
|
297
|
+
constitutionDrift?: number;
|
|
298
|
+
topOffenseIds?: string[];
|
|
299
|
+
scanDurationMs?: number;
|
|
300
|
+
}
|
|
274
301
|
/**
|
|
275
302
|
* Categorical bucket for the AI Maintenance Cost score.
|
|
276
303
|
*
|
|
@@ -301,7 +328,19 @@ interface MaintenanceAxisHealth {
|
|
|
301
328
|
}
|
|
302
329
|
/** Inputs to the pure `computeAiMaintenanceCost` function. Every axis is optional. */
|
|
303
330
|
interface MaintenanceAxes {
|
|
304
|
-
/** 0-100,
|
|
331
|
+
/** v0.15.0 U.4+: 0-100, higher = better. The new headline score
|
|
332
|
+
* that replaces slopIndex. Tests and callers should pass this
|
|
333
|
+
* going forward. */
|
|
334
|
+
aiQuality?: number;
|
|
335
|
+
/** v0.15.0 U.4+: 0-100, higher = better. */
|
|
336
|
+
engineeringHygiene?: number;
|
|
337
|
+
/** v0.15.0 U.4+: 0-100, higher = better. */
|
|
338
|
+
security?: number;
|
|
339
|
+
/** v0.15.0 U.4+: 0-100, higher = better. */
|
|
340
|
+
repositoryHealth?: number;
|
|
341
|
+
/** 0-100, lower = better. @deprecated v0.15.0: use aiQuality. Kept
|
|
342
|
+
* for backward compat with existing test fixtures and historical
|
|
343
|
+
* telemetry. The axis inverts it internally. */
|
|
305
344
|
slopIndex?: number;
|
|
306
345
|
/** 0-100, higher = better. From `buildArchitectureScore`. */
|
|
307
346
|
architectureConsistency?: number;
|
|
@@ -399,7 +438,18 @@ type AiDebt = 'low' | 'medium' | 'high' | 'critical';
|
|
|
399
438
|
declare const AI_SECURITY_NUMERIC: Record<'low' | 'medium' | 'high' | 'critical', number>;
|
|
400
439
|
/** Inputs to the pure `buildRepositoryHealth` function. Every input is optional. */
|
|
401
440
|
interface RepositoryHealthInputs {
|
|
402
|
-
/** 0-100,
|
|
441
|
+
/** v0.15.0 U.4+: 0-100, higher = better. The new headline score
|
|
442
|
+
* that replaces slopIndex. Tests and callers should pass this
|
|
443
|
+
* going forward. */
|
|
444
|
+
aiQuality?: number;
|
|
445
|
+
/** v0.15.0 U.4+: 0-100, higher = better. */
|
|
446
|
+
engineeringHygiene?: number;
|
|
447
|
+
/** v0.15.0 U.4+: 0-100, higher = better. */
|
|
448
|
+
security?: number;
|
|
449
|
+
/** v0.15.0 U.4+: 0-100, higher = better. */
|
|
450
|
+
repositoryHealth?: number;
|
|
451
|
+
/** 0-100, lower = better. Inverted to 100 - x for the composite.
|
|
452
|
+
* @deprecated v0.15.0: use aiQuality. Kept for backward compat. */
|
|
403
453
|
slopIndex?: number;
|
|
404
454
|
/** 0-100, higher = better. */
|
|
405
455
|
architectureConsistency?: number;
|
|
@@ -466,7 +516,7 @@ declare const REPOSITORY_HEALTH_WEIGHTS: {
|
|
|
466
516
|
|
|
467
517
|
type Severity = 'low' | 'medium' | 'high';
|
|
468
518
|
type RuleSeverity = Severity | 'auto';
|
|
469
|
-
type Category = 'visual' | 'typo' | 'wcag' | 'layout' | 'component' | 'logic' | 'arch' | 'perf' | 'security' | 'test' | 'docs' | 'db';
|
|
519
|
+
type Category = 'visual' | 'typo' | 'wcag' | 'layout' | 'component' | 'logic' | 'arch' | 'perf' | 'security' | 'test' | 'docs' | 'db' | 'ai' | 'context' | 'product' | 'i18n';
|
|
470
520
|
/**
|
|
471
521
|
* `react` covers `.tsx`, `.jsx`, `.ts`, `.js`. Other values are detected
|
|
472
522
|
* by file extension. Unknown extensions fall back to `'react'`.
|
|
@@ -493,7 +543,16 @@ interface Issue {
|
|
|
493
543
|
fixHint?: string;
|
|
494
544
|
fix?: FixSuggestion;
|
|
495
545
|
fixes?: FixSuggestion[];
|
|
496
|
-
signalStrength?:
|
|
546
|
+
signalStrength?: SignalStrengthEntry;
|
|
547
|
+
/**
|
|
548
|
+
* v0.17.0 — Optional rule-specific structured data that the
|
|
549
|
+
* orchestration layer promotes to typed finding fields (e.g.
|
|
550
|
+
* `DbFinding.table`, `DocFinding.package`). Conventions:
|
|
551
|
+
* - db/* rules: `{ table?: string, columnName?: string }`
|
|
552
|
+
* - docs/* rules: `{ package?: string, identifier?: string, link?: string }`
|
|
553
|
+
* Reporters and rules that don't need this can ignore it.
|
|
554
|
+
*/
|
|
555
|
+
extras?: Record<string, unknown>;
|
|
497
556
|
}
|
|
498
557
|
interface CachedFile {
|
|
499
558
|
hash: string;
|
|
@@ -744,6 +803,18 @@ interface FileScanResult {
|
|
|
744
803
|
/**
|
|
745
804
|
* `// slopbrick-disable` directive filtering. */
|
|
746
805
|
facts?: ScanFacts;
|
|
806
|
+
/**
|
|
807
|
+
* v0.14.6 — Composite AI-likelihood score for this file.
|
|
808
|
+
*
|
|
809
|
+
* Naive Bayes log-likelihood ratio combination of all triggered
|
|
810
|
+
* rules. `probability` in [0, 1] = P(AI-generated | rules fire);
|
|
811
|
+
* `confidenceTier` is one of LIKELY_HUMAN / INCONCLUSIVE / LIKELY_AI
|
|
812
|
+
* / VERY_LIKELY_AI per Jaeschke 1994 JAMA thresholds.
|
|
813
|
+
*
|
|
814
|
+
* Populated by the scan pipeline after rule execution. Undefined
|
|
815
|
+
* when no rules fired (probability stays at the prior prevalence).
|
|
816
|
+
*/
|
|
817
|
+
compositeScore?: _usebrick_engine.CompositeScore;
|
|
747
818
|
}
|
|
748
819
|
interface ComponentScore {
|
|
749
820
|
filePath: string;
|
|
@@ -762,9 +833,17 @@ interface ProjectReport {
|
|
|
762
833
|
version: string;
|
|
763
834
|
generatedAt: string;
|
|
764
835
|
configPath?: string;
|
|
765
|
-
slopIndex
|
|
836
|
+
/** v0.15.0 U.4+: replaces the legacy slopIndex. 0-100, higher is better. */
|
|
837
|
+
aiQuality: number;
|
|
838
|
+
engineeringHygiene: number;
|
|
839
|
+
security: number;
|
|
840
|
+
repositoryHealth: number;
|
|
766
841
|
assemblyHealth: number;
|
|
767
842
|
totalScore: number;
|
|
843
|
+
/** @deprecated v0.15.0: use aiQuality. Kept as optional for backward
|
|
844
|
+
* compat with existing test fixtures and historical telemetry. Will be
|
|
845
|
+
* removed in v0.16.0. */
|
|
846
|
+
slopIndex?: number;
|
|
768
847
|
categoryScores: Record<Category, number>;
|
|
769
848
|
/** Phase 2 §10: composite subscores. Each is in 0-100 (capped).
|
|
770
849
|
* slopIndex = 0.40 × boundaryScore + 0.35 × contextScore + 0.25 × visualScore. */
|
|
@@ -828,10 +907,6 @@ interface ProjectReport {
|
|
|
828
907
|
dbDrift?: DbDriftLevel;
|
|
829
908
|
/** Per-finding list behind the db-health score. */
|
|
830
909
|
dbFindings?: DbFinding[];
|
|
831
|
-
/** Phase 12 — Repository Health (composite 0-100). The endgame score
|
|
832
|
-
* that aggregates every prior sub-score into one number a manager
|
|
833
|
-
* reads in two seconds. Always informational; --strict for CI gating. */
|
|
834
|
-
repositoryHealth?: number;
|
|
835
910
|
/** Categorical AI Debt band, derived from `repositoryHealth`. */
|
|
836
911
|
aiDebt?: AiDebt;
|
|
837
912
|
/** Per-axis breakdown of the composite. */
|
|
@@ -923,6 +998,75 @@ interface ProjectReport {
|
|
|
923
998
|
prSlopScore?: number;
|
|
924
999
|
/** v0.10.1 — the git ref supplied to --diff <ref>. Undefined for full scans. */
|
|
925
1000
|
diffRef?: string;
|
|
1001
|
+
/**
|
|
1002
|
+
* v0.12.0 — Diagnostic stats from the new math engines. Surfaced in
|
|
1003
|
+
* HTML/JSON reporters under "v0.12 Calibration Diagnostics". Does
|
|
1004
|
+
* NOT affect slopIndex or any headline score; purely informational.
|
|
1005
|
+
*
|
|
1006
|
+
* bayesianPosterior: P(AI | fired_rules) computed via naive-Bayes
|
|
1007
|
+
* likelihood-ratio combination per Bento et al. 2024 *Neurocomputing*.
|
|
1008
|
+
* Range [0, 1]. > 0.5 = net AI signal; < 0.5 = net human signal.
|
|
1009
|
+
* survivingFiresCount: number of fires that survive Benjamini–Hochberg
|
|
1010
|
+
* FDR control at α = 0.05 across the full rule set. The "free rigor"
|
|
1011
|
+
* upgrade that converts the silent multi-testing problem into a
|
|
1012
|
+
* calibrated number.
|
|
1013
|
+
*/
|
|
1014
|
+
v012Stats?: {
|
|
1015
|
+
bayesianPosterior: number;
|
|
1016
|
+
bayesianMatchedRules: number;
|
|
1017
|
+
totalLogLr: number;
|
|
1018
|
+
survivingFiresCount: number;
|
|
1019
|
+
totalFiresCount: number;
|
|
1020
|
+
fdrAlpha: number;
|
|
1021
|
+
/**
|
|
1022
|
+
* v0.13.0 — Probabilistic AI detection across 3 evidence buckets.
|
|
1023
|
+
* Each file gets a P(AI | date, coding fires, general-practice fires)
|
|
1024
|
+
* via naive Bayes. Range [0, 1]. Buckets:
|
|
1025
|
+
* - 'likely_ai' : P >= 0.7
|
|
1026
|
+
* - 'uncertain' : 0.4 <= P < 0.7
|
|
1027
|
+
* - 'likely_human' : P < 0.4
|
|
1028
|
+
*/
|
|
1029
|
+
probabilisticAi?: {
|
|
1030
|
+
/** Per-file P(AI) averaged across the project, weighted by file size. */
|
|
1031
|
+
projectP_ai: number;
|
|
1032
|
+
/** Fraction of files in each bucket. */
|
|
1033
|
+
bucketDistribution: {
|
|
1034
|
+
likely_ai: number;
|
|
1035
|
+
uncertain: number;
|
|
1036
|
+
likely_human: number;
|
|
1037
|
+
};
|
|
1038
|
+
/** Date-based prior: P(AI | lastCommitDate), midpoint 2024-01-01. */
|
|
1039
|
+
datePrior: number;
|
|
1040
|
+
/** Evidence from AI-detector rules (markdown leakage, any density, etc.). */
|
|
1041
|
+
codingLogLr: number;
|
|
1042
|
+
/** Evidence from general-practice rules (low spacing entropy, etc.). */
|
|
1043
|
+
practiceLogLr: number;
|
|
1044
|
+
};
|
|
1045
|
+
/** v0.13.0 — Per-file P(AI) distribution (top 10 by file size). */
|
|
1046
|
+
topP_aiFiles?: Array<{
|
|
1047
|
+
filePath: string;
|
|
1048
|
+
p_ai: number;
|
|
1049
|
+
bucket: 'likely_ai' | 'uncertain' | 'likely_human';
|
|
1050
|
+
lastCommitDate: string;
|
|
1051
|
+
}>;
|
|
1052
|
+
};
|
|
1053
|
+
/** v0.14.5i — Count of issues auto-suppressed because their rule was
|
|
1054
|
+
* marked `defaultOff: true` in signal-strength.json (INVERTED or NOISY
|
|
1055
|
+
* rules that would erode trust in the tool if surfaced in CI). Surfaced
|
|
1056
|
+
* in the main scan output as a trust signal so the user can see that
|
|
1057
|
+
* the tool is calibrated, not just noisy. The user can opt back in
|
|
1058
|
+
* via `rules: { 'rule/id': 'medium' }` in slopbrick.config.mjs. */
|
|
1059
|
+
defaultOffSuppressedCount?: number;
|
|
1060
|
+
/** v0.14.5i — Number of distinct rules marked defaultOff. The ratio
|
|
1061
|
+
* suppressedCount / defaultOffRuleCount is the calibration coverage. */
|
|
1062
|
+
defaultOffRuleCount?: number;
|
|
1063
|
+
/** v0.14.5j — The previous run's Slop Index, if any. Used by
|
|
1064
|
+
* formatPretty to render a "±N from last run" delta so the user
|
|
1065
|
+
* can see the trajectory without grep'ing the run log. */
|
|
1066
|
+
previousSlopIndex?: number;
|
|
1067
|
+
/** v0.14.5j — ISO timestamp of the previous run, paired with
|
|
1068
|
+
* previousSlopIndex so the delta line can say "vs 2026-06-27". */
|
|
1069
|
+
previousRunTimestamp?: string;
|
|
926
1070
|
}
|
|
927
1071
|
interface TopOffender {
|
|
928
1072
|
filePath: string;
|
|
@@ -1099,6 +1243,11 @@ interface WizardAnswers {
|
|
|
1099
1243
|
styling: StylingSolution;
|
|
1100
1244
|
uiLibraries: UiLibrary[];
|
|
1101
1245
|
strictness: Strictness;
|
|
1246
|
+
stateManagement?: string;
|
|
1247
|
+
auth?: string;
|
|
1248
|
+
forms?: string;
|
|
1249
|
+
testing?: string;
|
|
1250
|
+
structure?: 'feature-based' | 'layer-based' | 'flat' | 'monorepo' | 'other';
|
|
1102
1251
|
}
|
|
1103
1252
|
declare const DEFAULT_CONFIG: ResolvedConfig;
|
|
1104
1253
|
|
|
@@ -1130,6 +1279,7 @@ interface ScanProjectOptions {
|
|
|
1130
1279
|
cache?: boolean;
|
|
1131
1280
|
telemetry?: boolean;
|
|
1132
1281
|
}
|
|
1282
|
+
|
|
1133
1283
|
declare function scanProject(options: ScanProjectOptions): Promise<ProjectReport>;
|
|
1134
1284
|
|
|
1135
1285
|
declare function runInitWizard(cwd: string, detected: Partial<ResolvedConfig>, options?: {
|
|
@@ -1190,98 +1340,4 @@ declare function formatBadge(report: ProjectReport): string;
|
|
|
1190
1340
|
/** Render an array of values as a Unicode sparkline (▁▂▃▄▅▆▇█). */
|
|
1191
1341
|
declare function formatSparkline(values: number[]): string;
|
|
1192
1342
|
|
|
1193
|
-
|
|
1194
|
-
* v0.10.1: `find_similar_function` engine.
|
|
1195
|
-
*
|
|
1196
|
-
* Given a function/component signature (name + parameter list + hooks
|
|
1197
|
-
* used), find the most similar existing implementations across the
|
|
1198
|
-
* codebase. Foundation for the GIR (Give-Implementation-Reference)
|
|
1199
|
-
* pattern in `slop_suggest` and the BRICK Platform.
|
|
1200
|
-
*
|
|
1201
|
-
* Algorithm (no LLMs, no embeddings — hash-based AST fingerprinting
|
|
1202
|
-
* per Chilowicz 2009, "Syntax Tree Fingerprinting for Code Clone
|
|
1203
|
-
* Detection"; also see Maurer 2017 for a modern take on the same
|
|
1204
|
-
* approach applied to JS/TS):
|
|
1205
|
-
*
|
|
1206
|
-
* 1. Walk the codebase and extract each function/component signature.
|
|
1207
|
-
* Signature = (name, normalized param list, hooks used, props).
|
|
1208
|
-
* 2. Compute a deterministic fingerprint per signature:
|
|
1209
|
-
* fingerprint = sha256(sorted(hooks) | sorted(props) | sorted(params))
|
|
1210
|
-
* 3. Given a query signature, compute Jaccard similarity to every
|
|
1211
|
-
* extracted signature over the union of (hooks ∪ props ∪ params).
|
|
1212
|
-
* 4. Return top-k matches sorted by similarity desc.
|
|
1213
|
-
*
|
|
1214
|
-
* Why this matters: AI agents writing new code ask "does this pattern
|
|
1215
|
-
* already exist?" before inventing new ones. `find_similar_function`
|
|
1216
|
-
* is the deterministic, citation-backed answer — no LLM hallucination,
|
|
1217
|
-
* no embedding dependency, fast even on 100k+ files.
|
|
1218
|
-
*/
|
|
1219
|
-
/**
|
|
1220
|
-
* Normalized signature for a single function/component in the codebase.
|
|
1221
|
-
*/
|
|
1222
|
-
interface ComponentSignature {
|
|
1223
|
-
/** Function/component name (PascalCase for components, camelCase for hooks). */
|
|
1224
|
-
name: string;
|
|
1225
|
-
/** Absolute path of the file the signature lives in. */
|
|
1226
|
-
file: string;
|
|
1227
|
-
/** Path relative to the workspace, for display in results. */
|
|
1228
|
-
fileRel: string;
|
|
1229
|
-
/** Line number (1-indexed) where the signature is defined. */
|
|
1230
|
-
line: number;
|
|
1231
|
-
/** Sorted, deduplicated parameter names (without `:` types). */
|
|
1232
|
-
params: string[];
|
|
1233
|
-
/** React hooks used (useState, useEffect, etc.). */
|
|
1234
|
-
hooks: string[];
|
|
1235
|
-
/** Component props accepted (for React components). */
|
|
1236
|
-
props: string[];
|
|
1237
|
-
}
|
|
1238
|
-
/** A single result from `findSimilarFunctions`. */
|
|
1239
|
-
interface SimilarMatch {
|
|
1240
|
-
/** The matched signature. */
|
|
1241
|
-
signature: ComponentSignature;
|
|
1242
|
-
/** Jaccard similarity in [0, 1]. 1 = identical feature set, 0 = disjoint. */
|
|
1243
|
-
similarity: number;
|
|
1244
|
-
/** Stable fingerprint hash. Two identical signatures always match. */
|
|
1245
|
-
fingerprint: string;
|
|
1246
|
-
}
|
|
1247
|
-
/** Query for `findSimilarFunctions`. */
|
|
1248
|
-
interface FindSimilarQuery {
|
|
1249
|
-
/** Optional name filter (exact match). */
|
|
1250
|
-
name?: string;
|
|
1251
|
-
/** Optional hooks filter (e.g., ['useState', 'useEffect']). */
|
|
1252
|
-
hooks?: string[];
|
|
1253
|
-
/** Optional props filter. */
|
|
1254
|
-
props?: string[];
|
|
1255
|
-
/** Optional params filter. */
|
|
1256
|
-
params?: string[];
|
|
1257
|
-
/** Top-k results to return. Default 10. Capped at 50. */
|
|
1258
|
-
limit?: number;
|
|
1259
|
-
/** Workspace directory to search. */
|
|
1260
|
-
workspaceDir: string;
|
|
1261
|
-
}
|
|
1262
|
-
/**
|
|
1263
|
-
* Extract every component/function signature from a single source string.
|
|
1264
|
-
* Pure function — no I/O.
|
|
1265
|
-
*/
|
|
1266
|
-
declare function extractSignatures(source: string, filePath: string, workspaceDir: string): ComponentSignature[];
|
|
1267
|
-
/** Stable fingerprint: sha256 over sorted feature set. */
|
|
1268
|
-
declare function fingerprintSignature(sig: Pick<ComponentSignature, 'hooks' | 'props' | 'params'>): string;
|
|
1269
|
-
/**
|
|
1270
|
-
* Jaccard similarity over the union of (hooks ∪ props ∪ params).
|
|
1271
|
-
* Returns 0..1. Identical sets → 1. Disjoint → 0.
|
|
1272
|
-
*/
|
|
1273
|
-
declare function signatureSimilarity(a: Pick<ComponentSignature, 'hooks' | 'props' | 'params'>, b: Pick<ComponentSignature, 'hooks' | 'props' | 'params'>): number;
|
|
1274
|
-
/**
|
|
1275
|
-
* Walk the workspace, extract signatures from every included file, and
|
|
1276
|
-
* return top-k matches sorted by Jaccard similarity desc.
|
|
1277
|
-
*
|
|
1278
|
-
* Pure-ish: the file walking uses async I/O but the similarity math is
|
|
1279
|
-
* synchronous (it's microseconds per signature, even on 10k files).
|
|
1280
|
-
*/
|
|
1281
|
-
declare function findSimilarFunctions(query: FindSimilarQuery, options?: {
|
|
1282
|
-
cwd?: string;
|
|
1283
|
-
include?: string[];
|
|
1284
|
-
exclude?: string[];
|
|
1285
|
-
}): Promise<SimilarMatch[]>;
|
|
1286
|
-
|
|
1287
|
-
export { AI_SECURITY_NUMERIC, type AiDebt, type AiMaintenanceCost, type AiMaintenanceCostResult, type AstroComponentFact, type AutoTunedRule, type BaselineCache, type BaselineMeta, type CachedFile, type Category, type ClassNameFact, type CommentFact, type ComponentFacts, type ComponentScore, type ComponentSignature, type ComponentSizeFact, type ConsoleCallFact, type Constitution, DEFAULT_CONFIG, type DangerouslySetInnerHtmlFact, type DbDriftLevel, type DbFinding, type DialogCallFact, type DisabledLintRuleFact, type DocDriftLevel, type DocFinding, type DomQueryFact, type ElementFact, type EvalCallFact, type ExplicitAnyFact, type FetchCallFact, type FileScanResult, type FindSimilarQuery, type FixSuggestion, type FlywheelOutput, type FlywheelState, type Framework$1 as Framework, type HookCallFact, type HookDependencyArrayFact, type HookFact, type ImportFact, type InlineEventHandlerFact, type Issue, type JsxAttributeStringLiteralFact, type JsxTextLiteralFact, type KeyPropFact, type LogicalExpressionFact, type MagicNumberSpacingConfig, type MaintenanceAxes, type MaintenanceAxisHealth, type NonNullAssertionFact, type OptimisticUpdateFact, type ProjectReport, type PropMutationFact, type PropPassThroughFact, REPOSITORY_HEALTH_WEIGHTS, type ReportReadResult, type RepositoryHealth, type RepositoryHealthInputs, type ResearchMetrics, type ResolvedConfig, type Rule, type RuleContext, type RuleSeverity, type RuleSuggestion, type ScanCache, type ScanFacts, type ScanProjectOptions, type Severity, type SimilarMatch, type SlopAuditRun, type StateBinding, type StateBindingFact, type StringLiteralFact, type StylePropFact, type TamaguiStylePropFact, type TopOffender, type UseEffectBodyFact, VERSION, baselineStatusMessage, colorForSlop, extractSignatures, failedThresholdCount, filterByDisabledDirectives, filterIssues, findSimilarFunctions, fingerprintSignature, formatBadge, formatReportFromFile, formatSparkline, loadConfig, readReportFile, runCli, runInitWizard, scanProject, serializeConfig, signatureSimilarity, stagedGating, thresholdExceeded };
|
|
1343
|
+
export { AI_SECURITY_NUMERIC, type AiDebt, type AiMaintenanceCost, type AiMaintenanceCostResult, type AstroComponentFact, type AutoTunedRule, type BaselineCache, type BaselineMeta, type CachedFile, type Category, type ClassNameFact, type CommentFact, type ComponentFacts, type ComponentScore, type ComponentSizeFact, type ConsoleCallFact, type Constitution, DEFAULT_CONFIG, type DangerouslySetInnerHtmlFact, type DbDriftLevel, type DbFinding, type DialogCallFact, type DisabledLintRuleFact, type DocDriftLevel, type DocFinding, type DomQueryFact, type ElementFact, type EvalCallFact, type ExplicitAnyFact, type FetchCallFact, type FileScanResult, type FixSuggestion, type FlywheelOutput, type FlywheelState, type Framework$1 as Framework, type HealthFile, type HookCallFact, type HookDependencyArrayFact, type HookFact, type ImportFact, type InlineEventHandlerFact, type Issue, type JsxAttributeStringLiteralFact, type JsxTextLiteralFact, type KeyPropFact, type LogicalExpressionFact, type MagicNumberSpacingConfig, type MaintenanceAxes, type MaintenanceAxisHealth, type NonNullAssertionFact, type OptimisticUpdateFact, type ProjectReport, type PropMutationFact, type PropPassThroughFact, REPOSITORY_HEALTH_WEIGHTS, type ReportReadResult, type RepositoryHealth, type RepositoryHealthInputs, type ResearchMetrics, type ResolvedConfig, type Rule, type RuleContext, type RuleSeverity, type RuleSuggestion, type ScanCache, type ScanFacts, type ScanProjectOptions, type Severity, type SlopAuditRun, type StateBinding, type StateBindingFact, type StringLiteralFact, type StylePropFact, type TamaguiStylePropFact, type TopOffender, type UseEffectBodyFact, VERSION, baselineStatusMessage, colorForSlop, failedThresholdCount, filterByDisabledDirectives, filterIssues, formatBadge, formatReportFromFile, formatSparkline, loadConfig, readReportFile, runCli, runInitWizard, scanProject, serializeConfig, stagedGating, thresholdExceeded };
|