1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
// Configuration type definitions for PMAT system
// Included by configuration_service.rs — shares parent module scope
/// Central configuration for the entire PMAT system
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PmatConfig {
/// System-wide settings
pub system: SystemConfig,
/// Quality gate configurations
pub quality: QualityConfig,
/// Analysis configurations
pub analysis: AnalysisConfig,
/// Performance testing configurations
pub performance: PerformanceConfig,
/// MCP server configurations
pub mcp: McpConfig,
/// Roadmap and project management
pub roadmap: RoadmapConfig,
/// Telemetry settings
pub telemetry: TelemetryConfig,
/// Semantic search configuration (PMAT-SEARCH-011, PMAT-SEARCH-012)
/// Added in Sprint 29 - defaults to disabled for backward compatibility
#[serde(default)]
pub semantic: SemanticConfig,
/// Custom user configurations
pub custom: HashMap<String, serde_json::Value>,
}
/// System-wide configuration settings
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SystemConfig {
/// Project name
pub project_name: String,
/// Project root path
pub project_path: PathBuf,
/// Output directory for generated files
pub output_dir: PathBuf,
/// Maximum number of concurrent operations
pub max_concurrent_operations: usize,
/// Enable verbose logging
pub verbose: bool,
/// Enable debug mode
pub debug: bool,
/// Toolchain preference
pub default_toolchain: String,
}
/// Quality gate configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct QualityConfig {
/// Maximum cyclomatic complexity allowed
pub max_complexity: u32,
/// Maximum cognitive complexity allowed
pub max_cognitive_complexity: u32,
/// Minimum test coverage percentage
pub min_coverage: f64,
/// Allow SATD (Self-Admitted Technical Debt) comments
pub allow_satd: bool,
/// Require documentation for public items
pub require_docs: bool,
/// Enable lint compliance checking
pub lint_compliance: bool,
/// Fail builds on quality violations
pub fail_on_violation: bool,
}
/// Analysis configuration settings
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AnalysisConfig {
/// Include patterns for file analysis
pub include_patterns: Vec<String>,
/// Exclude patterns for file analysis
pub exclude_patterns: Vec<String>,
/// Maximum file size to analyze (bytes)
pub max_file_size: usize,
/// Maximum line length for analysis
pub max_line_length: usize,
/// Skip vendor directories
pub skip_vendor: bool,
/// Enable parallel processing
pub parallel: bool,
/// Number of worker threads (0 = auto)
pub thread_count: usize,
/// Analysis timeout in seconds
pub timeout_seconds: u64,
}
/// Performance testing configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PerformanceConfig {
/// Enable regression testing
pub enable_regression_tests: bool,
/// Enable memory usage tests
pub enable_memory_tests: bool,
/// Enable throughput tests
pub enable_throughput_tests: bool,
/// Number of test iterations
pub test_iterations: usize,
/// Test timeout in milliseconds
pub timeout_ms: u64,
/// Target metrics
pub target_startup_latency_ms: u64,
pub target_throughput_loc_per_sec: u64,
pub target_memory_mb: u64,
}
/// MCP server configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct McpConfig {
/// Server name
pub server_name: String,
/// Server version
pub server_version: String,
/// Enable transport compression
pub enable_compression: bool,
/// Request timeout in seconds
pub request_timeout_seconds: u64,
/// Maximum request size in bytes
pub max_request_size: usize,
/// Enable request logging
pub log_requests: bool,
/// Tools to expose
pub enabled_tools: Vec<String>,
}
/// Roadmap and project management configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RoadmapConfig {
/// Path to roadmap file
pub roadmap_path: PathBuf,
/// Enable automatic todo generation
pub auto_generate_todos: bool,
/// Enforce quality gates
pub enforce_quality_gates: bool,
/// Require task IDs
pub require_task_ids: bool,
/// Task ID pattern regex
pub task_id_pattern: String,
/// Enable velocity tracking
pub velocity_tracking: bool,
/// Enable burndown charts
pub burndown_charts: bool,
/// Git integration settings
pub git: GitConfig,
}
/// Git integration configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GitConfig {
/// Create branches for tasks
pub create_branches: bool,
/// Branch naming pattern
pub branch_pattern: String,
/// Commit message pattern
pub commit_pattern: String,
/// Require quality check before commit
pub require_quality_check: bool,
}
/// Telemetry configuration
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TelemetryConfig {
/// Enable telemetry collection
pub enabled: bool,
/// Collection interval in seconds
pub collection_interval_seconds: u64,
/// Maximum telemetry data age in days
pub max_data_age_days: u32,
/// Enable metric aggregation
pub enable_aggregation: bool,
/// Enable telemetry export
pub enable_export: bool,
/// Export format (json, csv, etc.)
pub export_format: String,
}
/// Semantic search configuration (PMAT-SEARCH-011, PMAT-SEARCH-012)
///
/// Configuration for semantic search, code embeddings, and AI-powered code analysis.
/// Uses pure Rust local embeddings via aprender/trueno-rag (NO external API keys required).
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct SemanticConfig {
#[serde(default)]
/// Enable semantic search features
pub enabled: bool,
/// Path to vector database file (default: ~/.pmat/embeddings.db)
pub vector_db_path: Option<String>,
/// Workspace path for code indexing (default: current directory)
pub workspace_path: Option<PathBuf>,
/// Local embedding model to use (aprender-tfidf-local)
#[serde(default = "default_embedding_model")]
pub embedding_model: String,
/// Embedding dimensions (vocabulary-based, typically 256-512)
#[serde(default = "default_embedding_dimensions")]
pub embedding_dimensions: usize,
/// Default search mode: keyword, vector, or hybrid
#[serde(default = "default_search_mode")]
pub default_search_mode: String,
/// Default number of search results
#[serde(default = "default_limit")]
pub default_limit: usize,
/// Auto-sync embeddings on file changes
pub auto_sync: bool,
/// Sync interval in seconds (if auto_sync is enabled)
#[serde(default = "default_sync_interval")]
pub sync_interval_seconds: u64,
/// Maximum chunk size for code embeddings (in tokens)
#[serde(default = "default_max_chunk_tokens")]
pub max_chunk_tokens: usize,
/// Supported languages for semantic analysis
#[serde(default = "default_supported_languages")]
pub supported_languages: Vec<String>,
/// Enable MCP semantic tools
pub enable_mcp_tools: bool,
/// Cache embedding results (for performance)
pub enable_cache: bool,
/// Cache expiration in days
#[serde(default = "default_cache_expiration")]
pub cache_expiration_days: u32,
}
fn default_embedding_model() -> String {
"aprender-tfidf-local".to_string()
}
fn default_embedding_dimensions() -> usize {
256
}
fn default_search_mode() -> String {
"hybrid".to_string()
}
fn default_limit() -> usize {
10
}
fn default_sync_interval() -> u64 {
300
}
fn default_max_chunk_tokens() -> usize {
500
}
fn default_supported_languages() -> Vec<String> {
vec![
"rust".to_string(),
"python".to_string(),
"typescript".to_string(),
"javascript".to_string(),
"go".to_string(),
"c".to_string(),
"cpp".to_string(),
]
}
fn default_cache_expiration() -> u32 {
30
}