@cxtmanager/core 1.0.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.
Files changed (42) hide show
  1. package/README.md +132 -0
  2. package/dist/context-manager.d.ts +55 -0
  3. package/dist/context-manager.d.ts.map +1 -0
  4. package/dist/context-manager.js +676 -0
  5. package/dist/context-manager.js.map +1 -0
  6. package/dist/file-watcher.d.ts +31 -0
  7. package/dist/file-watcher.d.ts.map +1 -0
  8. package/dist/file-watcher.js +121 -0
  9. package/dist/file-watcher.js.map +1 -0
  10. package/dist/git-hooks-manager.d.ts +40 -0
  11. package/dist/git-hooks-manager.d.ts.map +1 -0
  12. package/dist/git-hooks-manager.js +210 -0
  13. package/dist/git-hooks-manager.js.map +1 -0
  14. package/dist/git-repository.d.ts +65 -0
  15. package/dist/git-repository.d.ts.map +1 -0
  16. package/dist/git-repository.js +352 -0
  17. package/dist/git-repository.js.map +1 -0
  18. package/dist/index.d.ts +13 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +37 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/plan-manager.d.ts +55 -0
  23. package/dist/plan-manager.d.ts.map +1 -0
  24. package/dist/plan-manager.js +208 -0
  25. package/dist/plan-manager.js.map +1 -0
  26. package/dist/plan-templates.d.ts +15 -0
  27. package/dist/plan-templates.d.ts.map +1 -0
  28. package/dist/plan-templates.js +127 -0
  29. package/dist/plan-templates.js.map +1 -0
  30. package/dist/types/index.d.ts +143 -0
  31. package/dist/types/index.d.ts.map +1 -0
  32. package/dist/types/index.js +26 -0
  33. package/dist/types/index.js.map +1 -0
  34. package/dist/types.d.ts +176 -0
  35. package/dist/types.d.ts.map +1 -0
  36. package/dist/types.js +3 -0
  37. package/dist/types.js.map +1 -0
  38. package/dist/validation-engine.d.ts +26 -0
  39. package/dist/validation-engine.d.ts.map +1 -0
  40. package/dist/validation-engine.js +344 -0
  41. package/dist/validation-engine.js.map +1 -0
  42. package/package.json +63 -0
@@ -0,0 +1,176 @@
1
+ export interface PlanManagementConfig {
2
+ backup_on_switch: boolean;
3
+ template: 'minimal' | 'detailed' | 'custom';
4
+ auto_commit_ai_changes: boolean;
5
+ archive_completed: boolean;
6
+ }
7
+ export interface GitIntegrationConfig {
8
+ enabled: boolean;
9
+ hooks: {
10
+ post_checkout?: string;
11
+ pre_commit?: string;
12
+ post_merge?: string;
13
+ };
14
+ silent_mode: boolean;
15
+ auto_install_hooks: boolean;
16
+ track_in_git?: boolean;
17
+ }
18
+ export interface TemplateThresholds {
19
+ well_populated: number;
20
+ mild_warning: number;
21
+ critical: number;
22
+ }
23
+ export interface ContextUpdateConfig {
24
+ update_mode?: 'auto' | 'manual';
25
+ drift_detection?: boolean;
26
+ warn_threshold?: number;
27
+ template_thresholds?: TemplateThresholds;
28
+ show_in_changed_files?: boolean;
29
+ auto_commit_context_updates?: boolean;
30
+ }
31
+ export interface SyncPlanOptions {
32
+ silent?: boolean;
33
+ createIfMissing?: boolean;
34
+ template?: 'minimal' | 'detailed';
35
+ }
36
+ export interface SyncPlanResult {
37
+ previousBranch: string;
38
+ currentBranch: string;
39
+ restored: boolean;
40
+ created: boolean;
41
+ }
42
+ export interface CxtConfig {
43
+ version: string;
44
+ mode: 'auto' | 'manual';
45
+ mcp: {
46
+ enabled: boolean;
47
+ sources: {
48
+ local_files: {
49
+ enabled: boolean;
50
+ readme: boolean;
51
+ package_json: boolean;
52
+ git_history: boolean;
53
+ };
54
+ claude_desktop?: {
55
+ enabled: boolean;
56
+ auto_discovered: boolean;
57
+ };
58
+ github?: {
59
+ enabled: boolean;
60
+ repo: string | null;
61
+ include_issues: boolean;
62
+ include_prs: boolean;
63
+ };
64
+ external_apis?: {
65
+ notion: {
66
+ enabled: boolean;
67
+ api_key: string | null;
68
+ };
69
+ linear: {
70
+ enabled: boolean;
71
+ api_key: string | null;
72
+ };
73
+ };
74
+ };
75
+ };
76
+ context: {
77
+ auto_sync: boolean;
78
+ health_checks: boolean;
79
+ ai_attribution: boolean;
80
+ update_mode?: 'auto' | 'manual';
81
+ drift_detection?: boolean;
82
+ warn_threshold?: number;
83
+ template_thresholds?: TemplateThresholds;
84
+ show_in_changed_files?: boolean;
85
+ auto_commit_context_updates?: boolean;
86
+ };
87
+ template?: string;
88
+ ai_model?: string;
89
+ created: string;
90
+ git_integration?: GitIntegrationConfig;
91
+ plan_management?: PlanManagementConfig;
92
+ }
93
+ export interface ContextFile {
94
+ name: string;
95
+ path: string;
96
+ content: string;
97
+ lastModified: Date;
98
+ size: number;
99
+ }
100
+ export interface InitOptions {
101
+ mode: 'auto' | 'manual';
102
+ trackInGit?: boolean;
103
+ }
104
+ export interface GitInfo {
105
+ isRepo: boolean;
106
+ branch: string;
107
+ hasRemote: boolean;
108
+ remoteUrl?: string;
109
+ commitCount: number;
110
+ lastCommit?: {
111
+ hash: string;
112
+ message: string;
113
+ author: string;
114
+ date: Date;
115
+ };
116
+ }
117
+ export interface ProjectAnalysis {
118
+ packageJson: any | null;
119
+ readme: string;
120
+ structure: any;
121
+ gitInfo: GitInfo;
122
+ technologies: string[];
123
+ }
124
+ export interface ProjectStructure {
125
+ hasPackageJson: boolean;
126
+ hasSrc: boolean;
127
+ hasTests: boolean;
128
+ hasConfig: boolean;
129
+ directories: string[];
130
+ }
131
+ export interface AttributionInfo {
132
+ type: 'ai' | 'human' | 'code-triggered' | 'external';
133
+ author: string;
134
+ timestamp: Date;
135
+ source?: string;
136
+ }
137
+ export interface HealthStatus {
138
+ overall: 'healthy' | 'warning' | 'error';
139
+ lastChecked: Date;
140
+ issues: HealthIssue[];
141
+ suggestions: string[];
142
+ alignments: {
143
+ contextToPlan: string;
144
+ allToGuardrails: string;
145
+ };
146
+ }
147
+ export interface HealthIssue {
148
+ type: 'error' | 'warning';
149
+ file: string;
150
+ line?: number;
151
+ message: string;
152
+ suggestion?: string;
153
+ autoFixable: boolean;
154
+ }
155
+ export interface BlameInfo extends AttributionInfo {
156
+ line: number;
157
+ content: string;
158
+ }
159
+ export interface StatusInfo {
160
+ gitStatus: {
161
+ staged: string[];
162
+ modified: string[];
163
+ untracked: string[];
164
+ };
165
+ health: HealthStatus;
166
+ contextFiles: Array<{
167
+ file: string;
168
+ status: string;
169
+ staged: boolean;
170
+ contentStatus?: 'populated' | 'template-only' | 'empty';
171
+ templatePercentage?: number;
172
+ size?: number;
173
+ }>;
174
+ lastUpdated: Date;
175
+ }
176
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC5C,sBAAsB,EAAE,OAAO,CAAC;IAChC,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE;QACL,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAChC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,kBAAkB,CAAC;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,2BAA2B,CAAC,EAAE,OAAO,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EAAE,YAAY,CAAC;IACrB,YAAY,EAAE,KAAK,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,OAAO,CAAC;QAChB,aAAa,CAAC,EAAE,WAAW,GAAG,eAAe,GAAG,OAAO,CAAC;QACxD,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IACH,WAAW,EAAE,IAAI,CAAC;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import { HealthStatus, HealthIssue, TemplateThresholds } from './types';
2
+ export declare class ValidationEngine {
3
+ private cxtPath;
4
+ private templateThresholds;
5
+ constructor(cxtPath: string, templateThresholds?: TemplateThresholds);
6
+ checkHealth(quick?: boolean): Promise<HealthStatus>;
7
+ autoHeal(issues: HealthIssue[], dryRun?: boolean): Promise<string[]>;
8
+ private loadContextFiles;
9
+ private checkAlignments;
10
+ private checkCommonIssues;
11
+ /**
12
+ * Calculate template percentage and determine if content is template-only
13
+ */
14
+ private getTemplatePercentage;
15
+ /**
16
+ * Get human-readable purpose of each file
17
+ */
18
+ private getFilePurpose;
19
+ private checkOutdatedInfo;
20
+ private isMissingRequiredSections;
21
+ private generateSuggestions;
22
+ private applyFix;
23
+ private fixMissingSections;
24
+ private updateLastModifiedDate;
25
+ }
26
+ //# sourceMappingURL=validation-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-engine.d.ts","sourceRoot":"","sources":["../src/validation-engine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAExE,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,kBAAkB,CAAqB;gBAEnC,OAAO,EAAE,MAAM,EAAE,kBAAkB,CAAC,EAAE,kBAAkB;IAU9D,WAAW,CAAC,KAAK,GAAE,OAAe,GAAG,OAAO,CAAC,YAAY,CAAC;IA0C1D,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,MAAM,GAAE,OAAe,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;YAenE,gBAAgB;YAehB,eAAe;YAQf,iBAAiB;IAyE/B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA4D7B;;OAEG;IACH,OAAO,CAAC,cAAc;YASR,iBAAiB;IAyB/B,OAAO,CAAC,yBAAyB;IAWjC,OAAO,CAAC,mBAAmB;YAqDb,QAAQ;YAcR,kBAAkB;YASlB,sBAAsB;CAQrC"}
@@ -0,0 +1,344 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ValidationEngine = void 0;
37
+ const fs = __importStar(require("fs-extra"));
38
+ const path = __importStar(require("path"));
39
+ class ValidationEngine {
40
+ constructor(cxtPath, templateThresholds) {
41
+ this.cxtPath = cxtPath;
42
+ // Default thresholds if not provided
43
+ this.templateThresholds = templateThresholds || {
44
+ well_populated: 30,
45
+ mild_warning: 50,
46
+ critical: 70
47
+ };
48
+ }
49
+ async checkHealth(quick = false) {
50
+ const issues = [];
51
+ const suggestions = [];
52
+ // Load all context files
53
+ const contextFiles = await this.loadContextFiles();
54
+ // Check for basic issues
55
+ const basicIssues = await this.checkCommonIssues(contextFiles);
56
+ issues.push(...basicIssues);
57
+ // Check alignments between files
58
+ const alignments = await this.checkAlignments(contextFiles);
59
+ // In quick mode, skip outdated info check (faster)
60
+ if (!quick) {
61
+ // Check for outdated information
62
+ const outdatedIssues = await this.checkOutdatedInfo(contextFiles);
63
+ issues.push(...outdatedIssues);
64
+ }
65
+ // Generate suggestions
66
+ const healthSuggestions = this.generateSuggestions(issues);
67
+ suggestions.push(...healthSuggestions);
68
+ // Determine overall health
69
+ let overall = 'healthy';
70
+ if (issues.some(i => i.type === 'error')) {
71
+ overall = 'error';
72
+ }
73
+ else if (issues.length > 0) {
74
+ overall = 'warning';
75
+ }
76
+ return {
77
+ overall,
78
+ lastChecked: new Date(),
79
+ issues,
80
+ suggestions,
81
+ alignments
82
+ };
83
+ }
84
+ async autoHeal(issues, dryRun = false) {
85
+ const fixes = [];
86
+ for (const issue of issues) {
87
+ if (issue.autoFixable) {
88
+ const fix = await this.applyFix(issue, dryRun);
89
+ if (fix) {
90
+ fixes.push(fix);
91
+ }
92
+ }
93
+ }
94
+ return fixes;
95
+ }
96
+ async loadContextFiles() {
97
+ const files = new Map();
98
+ const fileNames = ['context.md', 'plan.md', 'guardrail.md'];
99
+ for (const fileName of fileNames) {
100
+ const filePath = path.join(this.cxtPath, fileName);
101
+ if (await fs.pathExists(filePath)) {
102
+ const content = await fs.readFile(filePath, 'utf-8');
103
+ files.set(fileName, content);
104
+ }
105
+ }
106
+ return files;
107
+ }
108
+ async checkAlignments(contextFiles) {
109
+ // Simple alignment checking - in real implementation, this would be more sophisticated
110
+ return {
111
+ contextToPlan: 'aligned',
112
+ allToGuardrails: 'aligned'
113
+ };
114
+ }
115
+ async checkCommonIssues(contextFiles) {
116
+ const issues = [];
117
+ // Check for missing required sections
118
+ for (const [fileName, content] of contextFiles) {
119
+ if (this.isMissingRequiredSections(fileName, content)) {
120
+ issues.push({
121
+ type: 'warning',
122
+ file: fileName,
123
+ message: 'Missing required sections',
124
+ suggestion: 'Add standard sections for this file type',
125
+ autoFixable: true
126
+ });
127
+ }
128
+ }
129
+ // Check for template-only content with graduated warnings
130
+ // Use configurable thresholds (defaults: 30%, 50%, 70%)
131
+ const WELL_POPULATED_THRESHOLD = this.templateThresholds.well_populated;
132
+ const MILD_WARNING_THRESHOLD = this.templateThresholds.mild_warning;
133
+ const CRITICAL_THRESHOLD = this.templateThresholds.critical;
134
+ for (const [fileName, content] of contextFiles) {
135
+ const templateInfo = this.getTemplatePercentage(content);
136
+ const percentage = templateInfo.percentage;
137
+ // Only create issues if template percentage is above well-populated threshold
138
+ if (percentage > WELL_POPULATED_THRESHOLD) {
139
+ const filePurpose = this.getFilePurpose(fileName);
140
+ if (percentage >= CRITICAL_THRESHOLD || templateInfo.isTemplateOnly) {
141
+ // Critical: 70%+ template or marked as template-only
142
+ issues.push({
143
+ type: 'error',
144
+ file: fileName,
145
+ message: `File contains ${percentage}% template/placeholder content`,
146
+ suggestion: `This file needs significant content. Consider populating ${fileName} with ${filePurpose}. The file contains helpful guidance comments explaining what to fill in.`,
147
+ autoFixable: false
148
+ });
149
+ }
150
+ else if (percentage >= MILD_WARNING_THRESHOLD) {
151
+ // Warning: 50-70% template
152
+ issues.push({
153
+ type: 'warning',
154
+ file: fileName,
155
+ message: `File contains ${percentage}% template content`,
156
+ suggestion: `Consider adding more project-specific content to ${fileName}. Currently ${percentage}% is template/guidance.`,
157
+ autoFixable: false
158
+ });
159
+ }
160
+ else {
161
+ // Mild suggestion: 30-50% template
162
+ issues.push({
163
+ type: 'warning',
164
+ file: fileName,
165
+ message: `File contains ${percentage}% template content`,
166
+ suggestion: `Consider adding more content to ${fileName} to make it more useful. Currently ${percentage}% is template/guidance.`,
167
+ autoFixable: false
168
+ });
169
+ }
170
+ }
171
+ else if (content.trim().length < 100 && percentage <= WELL_POPULATED_THRESHOLD) {
172
+ // Only warn about empty files if they're not already flagged for template content
173
+ issues.push({
174
+ type: 'warning',
175
+ file: fileName,
176
+ message: 'File appears to be mostly empty',
177
+ suggestion: 'Add content to properly document this aspect. See the guidance comments in the file for what to include.',
178
+ autoFixable: false
179
+ });
180
+ }
181
+ }
182
+ return issues;
183
+ }
184
+ /**
185
+ * Calculate template percentage and determine if content is template-only
186
+ */
187
+ getTemplatePercentage(content) {
188
+ if (!content || content.trim().length === 0) {
189
+ return { percentage: 100, isTemplateOnly: true };
190
+ }
191
+ const lines = content.split('\n');
192
+ let templateChars = 0;
193
+ let totalChars = 0;
194
+ // Analyze each line
195
+ for (const line of lines) {
196
+ const trimmed = line.trim();
197
+ if (trimmed.length === 0) {
198
+ continue; // Skip empty lines
199
+ }
200
+ totalChars += line.length;
201
+ // Check if line is template/guidance content
202
+ const isTemplateLine = trimmed.startsWith('<!--') ||
203
+ trimmed.includes('GUIDANCE:') ||
204
+ trimmed.includes('TIP:') ||
205
+ trimmed.includes('Example:') ||
206
+ (trimmed.startsWith('*') && (trimmed.includes('Last Updated') || trimmed.includes('References') || trimmed.includes('This file'))) ||
207
+ trimmed === '-->';
208
+ if (isTemplateLine) {
209
+ templateChars += line.length;
210
+ }
211
+ }
212
+ // Calculate percentage
213
+ const percentage = totalChars > 0
214
+ ? Math.round((templateChars / totalChars) * 100)
215
+ : 100;
216
+ // Check for very little actual content
217
+ const contentLines = lines.filter(line => {
218
+ const trimmed = line.trim();
219
+ return trimmed.length > 0 &&
220
+ !trimmed.startsWith('<!--') &&
221
+ !trimmed.startsWith('*') &&
222
+ !trimmed.startsWith('#') &&
223
+ trimmed !== '-->' &&
224
+ !trimmed.includes('GUIDANCE:') &&
225
+ !trimmed.includes('TIP:') &&
226
+ !trimmed.includes('Example:');
227
+ });
228
+ // Determine if template-only using configurable critical threshold
229
+ // Also consider template-only if very few content lines
230
+ const isTemplateOnly = percentage >= this.templateThresholds.critical || (contentLines.length <= 3 && percentage > this.templateThresholds.well_populated);
231
+ return { percentage, isTemplateOnly };
232
+ }
233
+ /**
234
+ * Get human-readable purpose of each file
235
+ */
236
+ getFilePurpose(fileName) {
237
+ const purposes = {
238
+ 'context.md': 'your project\'s purpose, goals, and background',
239
+ 'plan.md': 'implementation details and architecture decisions',
240
+ 'guardrail.md': 'project constraints and development rules'
241
+ };
242
+ return purposes[fileName] || 'project-specific information';
243
+ }
244
+ async checkOutdatedInfo(contextFiles) {
245
+ const issues = [];
246
+ // Check for old "Last Updated" dates
247
+ for (const [fileName, content] of contextFiles) {
248
+ const lastUpdatedMatch = content.match(/\*Last Updated: ([\d-]+)\*/);
249
+ if (lastUpdatedMatch) {
250
+ const lastUpdated = new Date(lastUpdatedMatch[1]);
251
+ const daysSince = (Date.now() - lastUpdated.getTime()) / (1000 * 60 * 60 * 24);
252
+ if (daysSince > 30) {
253
+ issues.push({
254
+ type: 'warning',
255
+ file: fileName,
256
+ message: `Last updated ${Math.round(daysSince)} days ago`,
257
+ suggestion: 'Consider updating this file with recent changes',
258
+ autoFixable: true
259
+ });
260
+ }
261
+ }
262
+ }
263
+ return issues;
264
+ }
265
+ isMissingRequiredSections(fileName, content) {
266
+ const requiredSections = {
267
+ 'context.md': ['Project Purpose', 'Core Problem', 'Solution', 'Target Users'],
268
+ 'plan.md': ['Architecture Overview', 'Development Phases', 'Technology Stack'],
269
+ 'guardrail.md': ['Code Standards', 'Architecture Rules']
270
+ };
271
+ const required = requiredSections[fileName] || [];
272
+ return required.some((section) => !content.includes(`## ${section}`));
273
+ }
274
+ generateSuggestions(issues) {
275
+ const suggestions = [];
276
+ // Only show template suggestions for files above well-populated threshold
277
+ const templateIssues = issues.filter(i => {
278
+ if (i.message.includes('% template')) {
279
+ const match = i.message.match(/(\d+)%/);
280
+ const percentage = match ? parseInt(match[1]) : 0;
281
+ return percentage > this.templateThresholds.well_populated;
282
+ }
283
+ return false;
284
+ });
285
+ if (templateIssues.length > 0) {
286
+ // Separate critical vs warning issues
287
+ const criticalIssues = templateIssues.filter(i => i.type === 'error');
288
+ const warningIssues = templateIssues.filter(i => i.type === 'warning');
289
+ if (criticalIssues.length > 0) {
290
+ const percentages = criticalIssues.map(i => {
291
+ const match = i.message.match(/(\d+)%/);
292
+ return match ? parseInt(match[1]) : 0;
293
+ });
294
+ const avgPercentage = Math.round(percentages.reduce((a, b) => a + b, 0) / percentages.length);
295
+ suggestions.push(`🔴 ${criticalIssues.length} file(s) are ${avgPercentage}%+ template content and need significant work.`);
296
+ }
297
+ if (warningIssues.length > 0) {
298
+ const percentages = warningIssues.map(i => {
299
+ const match = i.message.match(/(\d+)%/);
300
+ return match ? parseInt(match[1]) : 0;
301
+ });
302
+ const avgPercentage = Math.round(percentages.reduce((a, b) => a + b, 0) / percentages.length);
303
+ suggestions.push(`⚠️ ${warningIssues.length} file(s) contain ${avgPercentage}% template content. Consider adding more project-specific information.`);
304
+ }
305
+ suggestions.push('💡 TIP: The files contain helpful guidance comments (<!-- GUIDANCE: ... -->) explaining what to fill in.');
306
+ suggestions.push('💡 TIP: AI tools can read these files to better understand your project when providing assistance.');
307
+ }
308
+ const autoFixableCount = issues.filter(i => i.autoFixable).length;
309
+ if (autoFixableCount > 0) {
310
+ suggestions.push(`Run "cit auto-heal" to fix ${autoFixableCount} issue(s) automatically`);
311
+ }
312
+ const warningCount = issues.filter(i => i.type === 'warning').length;
313
+ if (warningCount > 3) {
314
+ suggestions.push('Consider reviewing and updating context files regularly');
315
+ }
316
+ return suggestions;
317
+ }
318
+ async applyFix(issue, dryRun) {
319
+ const filePath = path.join(this.cxtPath, issue.file);
320
+ if (issue.message.includes('Missing required sections')) {
321
+ return await this.fixMissingSections(filePath, issue.file, dryRun);
322
+ }
323
+ if (issue.message.includes('Last updated')) {
324
+ return await this.updateLastModifiedDate(filePath, dryRun);
325
+ }
326
+ return null;
327
+ }
328
+ async fixMissingSections(filePath, fileName, dryRun) {
329
+ if (dryRun) {
330
+ return `Would add missing sections to ${fileName}`;
331
+ }
332
+ // In a real implementation, we'd add the missing sections
333
+ return `Added missing sections to ${fileName}`;
334
+ }
335
+ async updateLastModifiedDate(filePath, dryRun) {
336
+ if (dryRun) {
337
+ return `Would update last modified date in ${path.basename(filePath)}`;
338
+ }
339
+ // In a real implementation, we'd update the date
340
+ return `Updated last modified date in ${path.basename(filePath)}`;
341
+ }
342
+ }
343
+ exports.ValidationEngine = ValidationEngine;
344
+ //# sourceMappingURL=validation-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-engine.js","sourceRoot":"","sources":["../src/validation-engine.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAC/B,2CAA6B;AAG7B,MAAa,gBAAgB;IAI3B,YAAY,OAAe,EAAE,kBAAuC;QAClE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,qCAAqC;QACrC,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,IAAI;YAC9C,cAAc,EAAE,EAAE;YAClB,YAAY,EAAE,EAAE;YAChB,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,QAAiB,KAAK;QACtC,MAAM,MAAM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CAAC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAC,EAAE,CAAC;YACxD,OAAO,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACrE,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;YAC3C,OAAO,MAAM,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC7D,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,KAAK,CAAC,kBAAkB,CAAC,QAAgB,EAAE,QAAgB,EAAE,MAAe;QAClF,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,iCAAiC,QAAQ,EAAE,CAAC;QACrD,CAAC;QAED,0DAA0D;QAC1D,OAAO,6BAA6B,QAAQ,EAAE,CAAC;IACjD,CAAC;IAEO,KAAK,CAAC,sBAAsB,CAAC,QAAgB,EAAE,MAAe;QACpE,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,sCAAsC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACzE,CAAC;QAED,iDAAiD;QACjD,OAAO,iCAAiC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;IACpE,CAAC;CACF;AA1WD,4CA0WC"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@cxtmanager/core",
3
+ "version": "1.0.0",
4
+ "description": "Core functionality for CxtManager - context file management and Git integration",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "dev": "tsc --watch",
14
+ "test": "jest",
15
+ "lint": "eslint src --ext .ts",
16
+ "clean": "rm -rf dist",
17
+ "prepublishOnly": "npm run build"
18
+ },
19
+ "dependencies": {
20
+ "simple-git": "^3.27.0",
21
+ "fs-extra": "^11.2.0",
22
+ "yaml": "^2.7.0",
23
+ "chalk": "^5.3.0"
24
+ },
25
+ "devDependencies": {
26
+ "typescript": "^5.9.3",
27
+ "@types/node": "^20.17.0",
28
+ "@types/fs-extra": "^11.0.0",
29
+ "jest": "^29.7.0",
30
+ "@types/jest": "^29.5.14",
31
+ "ts-jest": "^29.2.5"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/cxtmanager/cxtmanager.git",
39
+ "directory": "core"
40
+ },
41
+ "keywords": [
42
+ "ai",
43
+ "context",
44
+ "git",
45
+ "development",
46
+ "assistant",
47
+ "cursor",
48
+ "copilot",
49
+ "project-management",
50
+ "documentation"
51
+ ],
52
+ "author": "Digital Brew LLC <hello@digitalbrew.tech>",
53
+ "license": "AGPL-3.0",
54
+ "engines": {
55
+ "node": ">=18.0.0"
56
+ },
57
+ "homepage": "https://cxtmanager.dev",
58
+ "bugs": {
59
+ "url": "https://github.com/cxtmanager/cxtmanager/issues",
60
+ "email": "hello@digitalbrew.tech"
61
+ },
62
+ "packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad"
63
+ }