Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions packages/angular-mcp-server/src/lib/angular-mcp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { TOOLS } from './tools/tools.js';
import { toolNotFound } from './tools/utils.js';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { fileURLToPath } from 'node:url';
import {
AngularMcpServerOptionsSchema,
AngularMcpServerOptions,
Expand Down Expand Up @@ -94,11 +95,11 @@ export class AngularMcpServerWrapper {

// Try to read the llms.txt file from the package root (optional)
try {
const filePath = path.resolve(__dirname, '../../llms.txt');
const currentDir = path.dirname(fileURLToPath(import.meta.url));
const filePath = path.resolve(currentDir, '../../llms.txt');

// Only attempt to read if file exists
if (fs.existsSync(filePath)) {
console.log('Reading llms.txt from:', filePath);
const content = fs.readFileSync(filePath, 'utf-8');
const lines = content.split('\n');

Expand Down Expand Up @@ -143,13 +144,9 @@ export class AngularMcpServerWrapper {
});
}
}
} else {
console.log('llms.txt not found at:', filePath, '(skipping)');
}
} catch (ctx: unknown) {
if (ctx instanceof Error) {
console.error('Error reading llms.txt (non-fatal):', ctx.message);
}
} catch {
// Silently ignore errors reading llms.txt (non-fatal)
}

// Scan available design system components to add them as discoverable resources
Expand Down Expand Up @@ -183,13 +180,8 @@ export class AngularMcpServerWrapper {
}
}
}
} catch (ctx: unknown) {
if (ctx instanceof Error) {
console.error(
'Error scanning DS components (non-fatal):',
ctx.message,
);
}
} catch {
// Silently ignore errors scanning DS components (non-fatal)
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ export { reportViolationsTools } from './report-violations.tool.js';
export { reportAllViolationsTools } from './report-all-violations.tool.js';

export type {
ReportViolationsOptions,
ViolationResult,
ViolationIssue,
ViolationAudit,
FileViolation,
FileViolationGroup,
FileViolationGroups,
FolderViolationSummary,
FolderViolationGroups,
ViolationEntry,
ComponentViolationReport,
AllViolationsEntry,
AllViolationsComponentReport,
AllViolationsReport,
ComponentViolationInFile,
FileViolationReport,
AllViolationsReportByFile,
} from './models/types.js';
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
import {
BaseViolationOptions,
BaseViolationResult,
BaseViolationIssue,
BaseViolationAudit,
} from '../../shared/violation-analysis/types.js';

export interface ReportViolationsOptions extends BaseViolationOptions {
groupBy?: 'file' | 'folder';
// Types for report-violations (single component, no replacement field needed)
export interface ViolationEntry {
file: string;
lines: number[];
violation: string;
}

export type ViolationResult = BaseViolationResult;
export type ViolationIssue = BaseViolationIssue;
export type ViolationAudit = BaseViolationAudit;
export interface ComponentViolationReport {
component: string;
violations: ViolationEntry[];
}

// File-specific types (when groupBy: 'file')
export interface FileViolation {
fileName: string;
message: string;
// Types for report-all-violations (multiple components, replacement field needed)
export interface AllViolationsEntry {
file: string;
lines: number[];
violation: string;
replacement: string;
}

export interface FileViolationGroup {
message: string;
lines: number[];
export interface AllViolationsComponentReport {
component: string;
violations: AllViolationsEntry[];
}

export interface FileViolationGroups {
[fileName: string]: FileViolationGroup;
export interface AllViolationsReport {
components: AllViolationsComponentReport[];
}

// File-grouped output types for report-all-violations
export interface ComponentViolationInFile {
component: string;
lines: number[];
violation: string;
replacement: string;
}

// Folder-specific types (when groupBy: 'folder')
export interface FolderViolationSummary {
violations: number;
files: string[];
export interface FileViolationReport {
file: string;
components: ComponentViolationInFile[];
}

export interface FolderViolationGroups {
[folderPath: string]: FolderViolationSummary;
export interface AllViolationsReportByFile {
files: FileViolationReport[];
}
Loading