slopbrick 0.37.0 → 0.40.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/dist/index.d.cts CHANGED
@@ -843,15 +843,15 @@ interface ResolvedConfig {
843
843
  */
844
844
  prScoreThreshold?: number;
845
845
  /**
846
- * Phase 5 — Test Intelligence opt-in toggles. The four `test/*`
847
- * rules are safe-by-default (each rule short-circuits on non-test
848
- * files via `isTestFile()`), but `test/missing-edge-case` walks
849
- * production code to find untested branches. Off by default —
850
- * opt-in per project.
846
+ * Phase 5 — Test Intelligence opt-in toggles. The three remaining
847
+ * `test/*` rules (`test/weak-assertion`, `test/duplicate-setup`,
848
+ * `test/fake-placeholder`) are safe-by-default (each rule
849
+ * short-circuits on non-test files via `isTestFile()`). v0.38.0
850
+ * removed `test/missing-edge-case` as v10-DORMANT.
851
851
  */
852
852
  testIntelligence?: {
853
- /** Walk production AST to find branches without test coverage. */
854
- missingEdgeCase?: boolean;
853
+ /** Reserved for future test opt-ins. */
854
+ [key: string]: boolean | undefined;
855
855
  };
856
856
  /**
857
857
  * v0.25.0: self-scan exclude paths. Applied at scan time (in
@@ -1034,7 +1034,7 @@ interface DocFinding {
1034
1034
  type DbDriftLevel = 'low' | 'medium' | 'high' | 'critical';
1035
1035
  /** A single db-health finding — one rule firing on one table/file. */
1036
1036
  interface DbFinding {
1037
- ruleId: 'db/missing-fk-index' | 'db/duplicate-index' | 'db/missing-not-null' | 'db/enum-sprawl' | 'db/naming-inconsistency' | 'db/sql-concat';
1037
+ ruleId: 'db/sql-concat';
1038
1038
  severity: 'low' | 'medium' | 'high';
1039
1039
  dbFile: string;
1040
1040
  line: number;
@@ -1207,6 +1207,48 @@ interface AutoTunedRule {
1207
1207
  severity: Severity;
1208
1208
  reason: string;
1209
1209
  }
1210
+ /**
1211
+ * v0.40.0 (Sprint 2.1): reverse direction of the flywheel ratchet.
1212
+ *
1213
+ * The flywheel has historically been one-way — `severityBump()` raises
1214
+ * a rule's severity after 3 consecutive top-3 appearances. The
1215
+ * relaxed half tells users when the data suggests a rule is *less*
1216
+ * relevant to *this* repository than the corpus default — i.e.
1217
+ * a high-FP rule that the user keeps ignoring.
1218
+ *
1219
+ * Distinct from `AutoTunedRule` on purpose:
1220
+ * - `severity` widens to `Severity | 'off'` because the relaxation
1221
+ * ratchets past `'low'` into `'off'` (the floor). Once off, the
1222
+ * read-side skips the rule entirely (same as a user `'off'`
1223
+ * override).
1224
+ * - `reason` references the ignore-streak and the corpus prior
1225
+ * that motivated the relaxation, so users can audit the
1226
+ * decision later (read `.slopbrick/flywheel/auto-tuned.json`).
1227
+ * - `previousSeverity` makes it explicit what we ratcheted *from*
1228
+ * (vs `AutoTunedRule` whose `severity` is just the new value;
1229
+ * the bump is always `prev + 1` so the prior is implied).
1230
+ * - Schema carries `defaultPrior` so re-calibration can replay
1231
+ * the relaxation against fresh corpus data (the relaxation
1232
+ * was based on a specific prior — if the prior changes, the
1233
+ * relaxation decision may no longer hold).
1234
+ */
1235
+ interface AutoRelaxedRule {
1236
+ ruleId: string;
1237
+ /**
1238
+ * New effective severity. Floors at `'off'` (the ratchet
1239
+ * ultimate floor). Note the deliberate asymmetry with
1240
+ * `AutoTunedRule` which can never write `'off'` — the bump
1241
+ * direction saturates at `'high'`, but relaxation walks
1242
+ * out the other end.
1243
+ */
1244
+ severity: Severity | 'off';
1245
+ previousSeverity: Severity;
1246
+ reason: string;
1247
+ /** AI-corpus prevalence assumed when the relaxation was decided. */
1248
+ defaultPrior: number;
1249
+ /** When the relaxation was decided (ISO 8601). */
1250
+ relaxedAt: string;
1251
+ }
1210
1252
  interface RuleSuggestion {
1211
1253
  pattern: string;
1212
1254
  example: string;
@@ -1230,10 +1272,30 @@ interface FlywheelState {
1230
1272
  version: string;
1231
1273
  updatedAt: string;
1232
1274
  autoTuned: AutoTunedRule[];
1275
+ /**
1276
+ * v0.40.0+: rules the flywheel has *relaxed* based on observed
1277
+ * ignore behavior across consecutive scans. Mirrors `autoTuned`
1278
+ * in lifecycle and persistence shape, but represents a downward
1279
+ * (not upward) severity adjustment. The next scan reads both
1280
+ * lists and applies them on top of the corpus-default severity.
1281
+ *
1282
+ * Persisted to `.slopbrick/flywheel/auto-tuned.json` alongside
1283
+ * `autoTuned` for backward compat with v0.39.x consumers of
1284
+ * the file (they just ignore the unknown field). Migration to
1285
+ * v3 happens in `migrateFlywheelState`.
1286
+ */
1287
+ autoRelaxed: AutoRelaxedRule[];
1233
1288
  research?: ResearchMetrics;
1234
1289
  }
1235
1290
  interface FlywheelOutput {
1236
1291
  autoTuned: AutoTunedRule[];
1292
+ /**
1293
+ * v0.40.0+: relaxation candidates produced by the current scan.
1294
+ * Read by `persistRun.ts` which writes them into the next
1295
+ * persisted `FlywheelState`. Empty when no rule has hit the
1296
+ * `IGNORE_THRESHOLD` yet.
1297
+ */
1298
+ autoRelaxed: AutoRelaxedRule[];
1237
1299
  hotspotIssues: Issue[];
1238
1300
  suggestions: RuleSuggestion[];
1239
1301
  research?: ResearchMetrics;
@@ -1612,4 +1674,4 @@ declare function formatBadge(report: ProjectReport): string;
1612
1674
  /** Render an array of values as a Unicode sparkline (▁▂▃▄▅▆▇█). */
1613
1675
  declare function formatSparkline(values: number[]): string;
1614
1676
 
1615
- 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 ScanSelfScanConfig, 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 };
1677
+ export { AI_SECURITY_NUMERIC, type AiDebt, type AiMaintenanceCost, type AiMaintenanceCostResult, type AstroComponentFact, type AutoRelaxedRule, 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 ScanSelfScanConfig, 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 };
package/dist/index.d.ts CHANGED
@@ -843,15 +843,15 @@ interface ResolvedConfig {
843
843
  */
844
844
  prScoreThreshold?: number;
845
845
  /**
846
- * Phase 5 — Test Intelligence opt-in toggles. The four `test/*`
847
- * rules are safe-by-default (each rule short-circuits on non-test
848
- * files via `isTestFile()`), but `test/missing-edge-case` walks
849
- * production code to find untested branches. Off by default —
850
- * opt-in per project.
846
+ * Phase 5 — Test Intelligence opt-in toggles. The three remaining
847
+ * `test/*` rules (`test/weak-assertion`, `test/duplicate-setup`,
848
+ * `test/fake-placeholder`) are safe-by-default (each rule
849
+ * short-circuits on non-test files via `isTestFile()`). v0.38.0
850
+ * removed `test/missing-edge-case` as v10-DORMANT.
851
851
  */
852
852
  testIntelligence?: {
853
- /** Walk production AST to find branches without test coverage. */
854
- missingEdgeCase?: boolean;
853
+ /** Reserved for future test opt-ins. */
854
+ [key: string]: boolean | undefined;
855
855
  };
856
856
  /**
857
857
  * v0.25.0: self-scan exclude paths. Applied at scan time (in
@@ -1034,7 +1034,7 @@ interface DocFinding {
1034
1034
  type DbDriftLevel = 'low' | 'medium' | 'high' | 'critical';
1035
1035
  /** A single db-health finding — one rule firing on one table/file. */
1036
1036
  interface DbFinding {
1037
- ruleId: 'db/missing-fk-index' | 'db/duplicate-index' | 'db/missing-not-null' | 'db/enum-sprawl' | 'db/naming-inconsistency' | 'db/sql-concat';
1037
+ ruleId: 'db/sql-concat';
1038
1038
  severity: 'low' | 'medium' | 'high';
1039
1039
  dbFile: string;
1040
1040
  line: number;
@@ -1207,6 +1207,48 @@ interface AutoTunedRule {
1207
1207
  severity: Severity;
1208
1208
  reason: string;
1209
1209
  }
1210
+ /**
1211
+ * v0.40.0 (Sprint 2.1): reverse direction of the flywheel ratchet.
1212
+ *
1213
+ * The flywheel has historically been one-way — `severityBump()` raises
1214
+ * a rule's severity after 3 consecutive top-3 appearances. The
1215
+ * relaxed half tells users when the data suggests a rule is *less*
1216
+ * relevant to *this* repository than the corpus default — i.e.
1217
+ * a high-FP rule that the user keeps ignoring.
1218
+ *
1219
+ * Distinct from `AutoTunedRule` on purpose:
1220
+ * - `severity` widens to `Severity | 'off'` because the relaxation
1221
+ * ratchets past `'low'` into `'off'` (the floor). Once off, the
1222
+ * read-side skips the rule entirely (same as a user `'off'`
1223
+ * override).
1224
+ * - `reason` references the ignore-streak and the corpus prior
1225
+ * that motivated the relaxation, so users can audit the
1226
+ * decision later (read `.slopbrick/flywheel/auto-tuned.json`).
1227
+ * - `previousSeverity` makes it explicit what we ratcheted *from*
1228
+ * (vs `AutoTunedRule` whose `severity` is just the new value;
1229
+ * the bump is always `prev + 1` so the prior is implied).
1230
+ * - Schema carries `defaultPrior` so re-calibration can replay
1231
+ * the relaxation against fresh corpus data (the relaxation
1232
+ * was based on a specific prior — if the prior changes, the
1233
+ * relaxation decision may no longer hold).
1234
+ */
1235
+ interface AutoRelaxedRule {
1236
+ ruleId: string;
1237
+ /**
1238
+ * New effective severity. Floors at `'off'` (the ratchet
1239
+ * ultimate floor). Note the deliberate asymmetry with
1240
+ * `AutoTunedRule` which can never write `'off'` — the bump
1241
+ * direction saturates at `'high'`, but relaxation walks
1242
+ * out the other end.
1243
+ */
1244
+ severity: Severity | 'off';
1245
+ previousSeverity: Severity;
1246
+ reason: string;
1247
+ /** AI-corpus prevalence assumed when the relaxation was decided. */
1248
+ defaultPrior: number;
1249
+ /** When the relaxation was decided (ISO 8601). */
1250
+ relaxedAt: string;
1251
+ }
1210
1252
  interface RuleSuggestion {
1211
1253
  pattern: string;
1212
1254
  example: string;
@@ -1230,10 +1272,30 @@ interface FlywheelState {
1230
1272
  version: string;
1231
1273
  updatedAt: string;
1232
1274
  autoTuned: AutoTunedRule[];
1275
+ /**
1276
+ * v0.40.0+: rules the flywheel has *relaxed* based on observed
1277
+ * ignore behavior across consecutive scans. Mirrors `autoTuned`
1278
+ * in lifecycle and persistence shape, but represents a downward
1279
+ * (not upward) severity adjustment. The next scan reads both
1280
+ * lists and applies them on top of the corpus-default severity.
1281
+ *
1282
+ * Persisted to `.slopbrick/flywheel/auto-tuned.json` alongside
1283
+ * `autoTuned` for backward compat with v0.39.x consumers of
1284
+ * the file (they just ignore the unknown field). Migration to
1285
+ * v3 happens in `migrateFlywheelState`.
1286
+ */
1287
+ autoRelaxed: AutoRelaxedRule[];
1233
1288
  research?: ResearchMetrics;
1234
1289
  }
1235
1290
  interface FlywheelOutput {
1236
1291
  autoTuned: AutoTunedRule[];
1292
+ /**
1293
+ * v0.40.0+: relaxation candidates produced by the current scan.
1294
+ * Read by `persistRun.ts` which writes them into the next
1295
+ * persisted `FlywheelState`. Empty when no rule has hit the
1296
+ * `IGNORE_THRESHOLD` yet.
1297
+ */
1298
+ autoRelaxed: AutoRelaxedRule[];
1237
1299
  hotspotIssues: Issue[];
1238
1300
  suggestions: RuleSuggestion[];
1239
1301
  research?: ResearchMetrics;
@@ -1612,4 +1674,4 @@ declare function formatBadge(report: ProjectReport): string;
1612
1674
  /** Render an array of values as a Unicode sparkline (▁▂▃▄▅▆▇█). */
1613
1675
  declare function formatSparkline(values: number[]): string;
1614
1676
 
1615
- 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 ScanSelfScanConfig, 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 };
1677
+ export { AI_SECURITY_NUMERIC, type AiDebt, type AiMaintenanceCost, type AiMaintenanceCostResult, type AstroComponentFact, type AutoRelaxedRule, 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 ScanSelfScanConfig, 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 };