@massu/core 0.6.3 → 0.8.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.
@@ -129,6 +129,44 @@ var RegressionConfigSchema = z.object({
129
129
  warning: z.number().default(50)
130
130
  }).optional()
131
131
  }).optional();
132
+ var AutoLearningConfigSchema = z.object({
133
+ enabled: z.boolean().default(true),
134
+ incidentDir: z.string().default("docs/incidents"),
135
+ memoryDir: z.string().default("memory"),
136
+ memoryIndexFile: z.string().default("MEMORY.md"),
137
+ enforcementHooksDir: z.string().default("scripts/hooks"),
138
+ fixDetection: z.object({
139
+ enabled: z.boolean().default(true),
140
+ lookbackDays: z.number().default(7),
141
+ signals: z.array(z.string()).default([
142
+ "removed_broken_code",
143
+ "added_error_handling",
144
+ "method_name_correction",
145
+ "auth_fix",
146
+ "nil_handling_fix",
147
+ "concurrency_fix",
148
+ "async_pattern_fix",
149
+ "added_missing_import"
150
+ ])
151
+ }).default({}),
152
+ failureClassification: z.object({
153
+ enabled: z.boolean().default(true),
154
+ thresholds: z.object({
155
+ known: z.number().default(5),
156
+ similar: z.number().default(3)
157
+ }).default({}),
158
+ scoring: z.object({
159
+ diffPatternWeight: z.number().default(3),
160
+ filePatternWeight: z.number().default(2),
161
+ promptKeywordWeight: z.number().default(2)
162
+ }).default({})
163
+ }).default({}),
164
+ pipeline: z.object({
165
+ requireIncidentReport: z.boolean().default(true),
166
+ requirePreventionRule: z.boolean().default(true),
167
+ requireEnforcement: z.boolean().default(true)
168
+ }).default({})
169
+ }).optional();
132
170
  var CloudConfigSchema = z.object({
133
171
  enabled: z.boolean().default(false),
134
172
  apiKey: z.string().optional(),
@@ -218,7 +256,8 @@ var RawConfigSchema = z.object({
218
256
  regression: RegressionConfigSchema,
219
257
  cloud: CloudConfigSchema,
220
258
  conventions: ConventionsConfigSchema,
221
- python: PythonConfigSchema
259
+ python: PythonConfigSchema,
260
+ autoLearning: AutoLearningConfigSchema
222
261
  }).passthrough();
223
262
  var _config = null;
224
263
  var _projectRoot = null;
@@ -131,6 +131,44 @@ var RegressionConfigSchema = z.object({
131
131
  warning: z.number().default(50)
132
132
  }).optional()
133
133
  }).optional();
134
+ var AutoLearningConfigSchema = z.object({
135
+ enabled: z.boolean().default(true),
136
+ incidentDir: z.string().default("docs/incidents"),
137
+ memoryDir: z.string().default("memory"),
138
+ memoryIndexFile: z.string().default("MEMORY.md"),
139
+ enforcementHooksDir: z.string().default("scripts/hooks"),
140
+ fixDetection: z.object({
141
+ enabled: z.boolean().default(true),
142
+ lookbackDays: z.number().default(7),
143
+ signals: z.array(z.string()).default([
144
+ "removed_broken_code",
145
+ "added_error_handling",
146
+ "method_name_correction",
147
+ "auth_fix",
148
+ "nil_handling_fix",
149
+ "concurrency_fix",
150
+ "async_pattern_fix",
151
+ "added_missing_import"
152
+ ])
153
+ }).default({}),
154
+ failureClassification: z.object({
155
+ enabled: z.boolean().default(true),
156
+ thresholds: z.object({
157
+ known: z.number().default(5),
158
+ similar: z.number().default(3)
159
+ }).default({}),
160
+ scoring: z.object({
161
+ diffPatternWeight: z.number().default(3),
162
+ filePatternWeight: z.number().default(2),
163
+ promptKeywordWeight: z.number().default(2)
164
+ }).default({})
165
+ }).default({}),
166
+ pipeline: z.object({
167
+ requireIncidentReport: z.boolean().default(true),
168
+ requirePreventionRule: z.boolean().default(true),
169
+ requireEnforcement: z.boolean().default(true)
170
+ }).default({})
171
+ }).optional();
134
172
  var CloudConfigSchema = z.object({
135
173
  enabled: z.boolean().default(false),
136
174
  apiKey: z.string().optional(),
@@ -220,7 +258,8 @@ var RawConfigSchema = z.object({
220
258
  regression: RegressionConfigSchema,
221
259
  cloud: CloudConfigSchema,
222
260
  conventions: ConventionsConfigSchema,
223
- python: PythonConfigSchema
261
+ python: PythonConfigSchema,
262
+ autoLearning: AutoLearningConfigSchema
224
263
  }).passthrough();
225
264
  var _config = null;
226
265
  var _projectRoot = null;
@@ -821,6 +860,25 @@ function initMemorySchema(db) {
821
860
  features TEXT DEFAULT '[]'
822
861
  );
823
862
  `);
863
+ db.exec(`
864
+ CREATE TABLE IF NOT EXISTS failure_classes (
865
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
866
+ name TEXT NOT NULL UNIQUE,
867
+ description TEXT NOT NULL,
868
+ diff_patterns TEXT NOT NULL DEFAULT '[]',
869
+ file_patterns TEXT NOT NULL DEFAULT '[]',
870
+ prompt_keywords TEXT NOT NULL DEFAULT '[]',
871
+ incidents TEXT NOT NULL DEFAULT '[]',
872
+ rules TEXT NOT NULL DEFAULT '[]',
873
+ scanner_checks TEXT NOT NULL DEFAULT '[]',
874
+ known_message TEXT NOT NULL DEFAULT '',
875
+ needs_review INTEGER NOT NULL DEFAULT 0,
876
+ created_at TEXT DEFAULT (datetime('now')),
877
+ updated_at TEXT DEFAULT (datetime('now'))
878
+ );
879
+ CREATE INDEX IF NOT EXISTS idx_fc_name ON failure_classes(name);
880
+ CREATE INDEX IF NOT EXISTS idx_fc_needs_review ON failure_classes(needs_review);
881
+ `);
824
882
  }
825
883
  function assignImportance(type, vrResult) {
826
884
  switch (type) {
@@ -131,6 +131,44 @@ var RegressionConfigSchema = z.object({
131
131
  warning: z.number().default(50)
132
132
  }).optional()
133
133
  }).optional();
134
+ var AutoLearningConfigSchema = z.object({
135
+ enabled: z.boolean().default(true),
136
+ incidentDir: z.string().default("docs/incidents"),
137
+ memoryDir: z.string().default("memory"),
138
+ memoryIndexFile: z.string().default("MEMORY.md"),
139
+ enforcementHooksDir: z.string().default("scripts/hooks"),
140
+ fixDetection: z.object({
141
+ enabled: z.boolean().default(true),
142
+ lookbackDays: z.number().default(7),
143
+ signals: z.array(z.string()).default([
144
+ "removed_broken_code",
145
+ "added_error_handling",
146
+ "method_name_correction",
147
+ "auth_fix",
148
+ "nil_handling_fix",
149
+ "concurrency_fix",
150
+ "async_pattern_fix",
151
+ "added_missing_import"
152
+ ])
153
+ }).default({}),
154
+ failureClassification: z.object({
155
+ enabled: z.boolean().default(true),
156
+ thresholds: z.object({
157
+ known: z.number().default(5),
158
+ similar: z.number().default(3)
159
+ }).default({}),
160
+ scoring: z.object({
161
+ diffPatternWeight: z.number().default(3),
162
+ filePatternWeight: z.number().default(2),
163
+ promptKeywordWeight: z.number().default(2)
164
+ }).default({})
165
+ }).default({}),
166
+ pipeline: z.object({
167
+ requireIncidentReport: z.boolean().default(true),
168
+ requirePreventionRule: z.boolean().default(true),
169
+ requireEnforcement: z.boolean().default(true)
170
+ }).default({})
171
+ }).optional();
134
172
  var CloudConfigSchema = z.object({
135
173
  enabled: z.boolean().default(false),
136
174
  apiKey: z.string().optional(),
@@ -220,7 +258,8 @@ var RawConfigSchema = z.object({
220
258
  regression: RegressionConfigSchema,
221
259
  cloud: CloudConfigSchema,
222
260
  conventions: ConventionsConfigSchema,
223
- python: PythonConfigSchema
261
+ python: PythonConfigSchema,
262
+ autoLearning: AutoLearningConfigSchema
224
263
  }).passthrough();
225
264
  var _config = null;
226
265
  var _projectRoot = null;
@@ -821,6 +860,25 @@ function initMemorySchema(db) {
821
860
  features TEXT DEFAULT '[]'
822
861
  );
823
862
  `);
863
+ db.exec(`
864
+ CREATE TABLE IF NOT EXISTS failure_classes (
865
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
866
+ name TEXT NOT NULL UNIQUE,
867
+ description TEXT NOT NULL,
868
+ diff_patterns TEXT NOT NULL DEFAULT '[]',
869
+ file_patterns TEXT NOT NULL DEFAULT '[]',
870
+ prompt_keywords TEXT NOT NULL DEFAULT '[]',
871
+ incidents TEXT NOT NULL DEFAULT '[]',
872
+ rules TEXT NOT NULL DEFAULT '[]',
873
+ scanner_checks TEXT NOT NULL DEFAULT '[]',
874
+ known_message TEXT NOT NULL DEFAULT '',
875
+ needs_review INTEGER NOT NULL DEFAULT 0,
876
+ created_at TEXT DEFAULT (datetime('now')),
877
+ updated_at TEXT DEFAULT (datetime('now'))
878
+ );
879
+ CREATE INDEX IF NOT EXISTS idx_fc_name ON failure_classes(name);
880
+ CREATE INDEX IF NOT EXISTS idx_fc_needs_review ON failure_classes(needs_review);
881
+ `);
824
882
  }
825
883
  function assignImportance(type, vrResult) {
826
884
  switch (type) {
@@ -130,6 +130,44 @@ var RegressionConfigSchema = z.object({
130
130
  warning: z.number().default(50)
131
131
  }).optional()
132
132
  }).optional();
133
+ var AutoLearningConfigSchema = z.object({
134
+ enabled: z.boolean().default(true),
135
+ incidentDir: z.string().default("docs/incidents"),
136
+ memoryDir: z.string().default("memory"),
137
+ memoryIndexFile: z.string().default("MEMORY.md"),
138
+ enforcementHooksDir: z.string().default("scripts/hooks"),
139
+ fixDetection: z.object({
140
+ enabled: z.boolean().default(true),
141
+ lookbackDays: z.number().default(7),
142
+ signals: z.array(z.string()).default([
143
+ "removed_broken_code",
144
+ "added_error_handling",
145
+ "method_name_correction",
146
+ "auth_fix",
147
+ "nil_handling_fix",
148
+ "concurrency_fix",
149
+ "async_pattern_fix",
150
+ "added_missing_import"
151
+ ])
152
+ }).default({}),
153
+ failureClassification: z.object({
154
+ enabled: z.boolean().default(true),
155
+ thresholds: z.object({
156
+ known: z.number().default(5),
157
+ similar: z.number().default(3)
158
+ }).default({}),
159
+ scoring: z.object({
160
+ diffPatternWeight: z.number().default(3),
161
+ filePatternWeight: z.number().default(2),
162
+ promptKeywordWeight: z.number().default(2)
163
+ }).default({})
164
+ }).default({}),
165
+ pipeline: z.object({
166
+ requireIncidentReport: z.boolean().default(true),
167
+ requirePreventionRule: z.boolean().default(true),
168
+ requireEnforcement: z.boolean().default(true)
169
+ }).default({})
170
+ }).optional();
133
171
  var CloudConfigSchema = z.object({
134
172
  enabled: z.boolean().default(false),
135
173
  apiKey: z.string().optional(),
@@ -219,7 +257,8 @@ var RawConfigSchema = z.object({
219
257
  regression: RegressionConfigSchema,
220
258
  cloud: CloudConfigSchema,
221
259
  conventions: ConventionsConfigSchema,
222
- python: PythonConfigSchema
260
+ python: PythonConfigSchema,
261
+ autoLearning: AutoLearningConfigSchema
223
262
  }).passthrough();
224
263
  var _config = null;
225
264
  var _projectRoot = null;
@@ -131,6 +131,44 @@ var RegressionConfigSchema = z.object({
131
131
  warning: z.number().default(50)
132
132
  }).optional()
133
133
  }).optional();
134
+ var AutoLearningConfigSchema = z.object({
135
+ enabled: z.boolean().default(true),
136
+ incidentDir: z.string().default("docs/incidents"),
137
+ memoryDir: z.string().default("memory"),
138
+ memoryIndexFile: z.string().default("MEMORY.md"),
139
+ enforcementHooksDir: z.string().default("scripts/hooks"),
140
+ fixDetection: z.object({
141
+ enabled: z.boolean().default(true),
142
+ lookbackDays: z.number().default(7),
143
+ signals: z.array(z.string()).default([
144
+ "removed_broken_code",
145
+ "added_error_handling",
146
+ "method_name_correction",
147
+ "auth_fix",
148
+ "nil_handling_fix",
149
+ "concurrency_fix",
150
+ "async_pattern_fix",
151
+ "added_missing_import"
152
+ ])
153
+ }).default({}),
154
+ failureClassification: z.object({
155
+ enabled: z.boolean().default(true),
156
+ thresholds: z.object({
157
+ known: z.number().default(5),
158
+ similar: z.number().default(3)
159
+ }).default({}),
160
+ scoring: z.object({
161
+ diffPatternWeight: z.number().default(3),
162
+ filePatternWeight: z.number().default(2),
163
+ promptKeywordWeight: z.number().default(2)
164
+ }).default({})
165
+ }).default({}),
166
+ pipeline: z.object({
167
+ requireIncidentReport: z.boolean().default(true),
168
+ requirePreventionRule: z.boolean().default(true),
169
+ requireEnforcement: z.boolean().default(true)
170
+ }).default({})
171
+ }).optional();
134
172
  var CloudConfigSchema = z.object({
135
173
  enabled: z.boolean().default(false),
136
174
  apiKey: z.string().optional(),
@@ -220,7 +258,8 @@ var RawConfigSchema = z.object({
220
258
  regression: RegressionConfigSchema,
221
259
  cloud: CloudConfigSchema,
222
260
  conventions: ConventionsConfigSchema,
223
- python: PythonConfigSchema
261
+ python: PythonConfigSchema,
262
+ autoLearning: AutoLearningConfigSchema
224
263
  }).passthrough();
225
264
  var _config = null;
226
265
  var _projectRoot = null;
@@ -821,6 +860,25 @@ function initMemorySchema(db) {
821
860
  features TEXT DEFAULT '[]'
822
861
  );
823
862
  `);
863
+ db.exec(`
864
+ CREATE TABLE IF NOT EXISTS failure_classes (
865
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
866
+ name TEXT NOT NULL UNIQUE,
867
+ description TEXT NOT NULL,
868
+ diff_patterns TEXT NOT NULL DEFAULT '[]',
869
+ file_patterns TEXT NOT NULL DEFAULT '[]',
870
+ prompt_keywords TEXT NOT NULL DEFAULT '[]',
871
+ incidents TEXT NOT NULL DEFAULT '[]',
872
+ rules TEXT NOT NULL DEFAULT '[]',
873
+ scanner_checks TEXT NOT NULL DEFAULT '[]',
874
+ known_message TEXT NOT NULL DEFAULT '',
875
+ needs_review INTEGER NOT NULL DEFAULT 0,
876
+ created_at TEXT DEFAULT (datetime('now')),
877
+ updated_at TEXT DEFAULT (datetime('now'))
878
+ );
879
+ CREATE INDEX IF NOT EXISTS idx_fc_name ON failure_classes(name);
880
+ CREATE INDEX IF NOT EXISTS idx_fc_needs_review ON failure_classes(needs_review);
881
+ `);
824
882
  }
825
883
 
826
884
  // src/hooks/quality-event.ts