Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
1 change: 0 additions & 1 deletion CONTRIBUTING.MD
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ This is an Nx monorepo with the following structure:
│ ├── minimal-repo/ # Test fixtures and examples
│ └── shared/ # Shared libraries
│ ├── angular-ast-utils/ # Angular AST parsing
│ ├── angular-cli-utils/ # Angular CLI utilities
│ ├── ds-component-coverage/ # Design system analysis
│ ├── models/ # Core types and schemas
│ ├── styles-ast-utils/ # CSS/SCSS AST parsing
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ A Model Context Protocol (MCP) server that provides Angular project analysis and

### Prerequisites

- Node.js (version 18 or higher)
- Node.js (version 18 or higher) with ESM support

### Installation & Setup

Expand Down Expand Up @@ -108,7 +108,7 @@ const dsComponents = [
}
];

module.exports = dsComponents;
export default dsComponents;
```

### Example Project Structure
Expand Down
1 change: 0 additions & 1 deletion docs/architecture-internal-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ Validation is handled via **Zod** in `angular-mcp-server-options.schema.ts`.
models (types & schemas)
├─ utils
├─ styles-ast-utils
├─ angular-cli-utils
└─ angular-ast-utils
└─ ds-component-coverage (top-level plugin)
```
Expand Down
3 changes: 0 additions & 3 deletions jest.preset.js

This file was deleted.

3 changes: 3 additions & 0 deletions jest.preset.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import nxPreset from '@nx/jest/preset';

export default { ...nxPreset };
98 changes: 54 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@push-based/source",
"version": "0.0.0",
"type": "module",
"license": "MIT",
"scripts": {},
"private": true,
Expand Down Expand Up @@ -61,12 +62,11 @@
"@angular-devkit/schematics": "~19.2.0",
"@angular/cli": "~19.2.0",
"@angular/compiler": "~19.2.0",
"@code-pushup/core": "^0.69.0",
"@code-pushup/eslint-plugin": "^0.69.0",
"@code-pushup/models": "^0.69.0",
"@code-pushup/utils": "^0.69.0",
"@code-pushup/core": "^0.75.0",
"@code-pushup/eslint-plugin": "^0.75.0",
"@code-pushup/models": "^0.75.0",
"@code-pushup/utils": "^0.75.0",
"@modelcontextprotocol/sdk": "^1.12.1",
"@push-based/angular-cli-utils": "^0.0.1",
"@push-based/ds-component-coverage": "^0.0.1",
"@push-based/models": "^0.0.1",
"@push-based/utils": "^0.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-mcp-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@push-based/angular-mcp-server",
"version": "0.0.1",
"private": true,
"type": "commonjs",
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-mcp-server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './lib/angular-mcp-server';
export * from './lib/angular-mcp-server.js';
10 changes: 5 additions & 5 deletions packages/angular-mcp-server/src/lib/angular-mcp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import {
ListResourcesResult,
ListToolsRequestSchema,
} from '@modelcontextprotocol/sdk/types.js';
import { TOOLS } from './tools/tools';
import { toolNotFound } from './tools/utils';
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 {
AngularMcpServerOptionsSchema,
AngularMcpServerOptions,
} from './validation/angular-mcp-server-options.schema';
import { validateAngularMcpServerFilesExist } from './validation/file-existence';
import { validateDeprecatedCssClassesFile } from './validation/ds-components-file.validation';
} from './validation/angular-mcp-server-options.schema.js';
import { validateAngularMcpServerFilesExist } from './validation/file-existence.js';
import { validateDeprecatedCssClassesFile } from './validation/ds-components-file.validation.js';

export class AngularMcpServerWrapper {
private readonly mcpServer: McpServer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { buildComponentContract } from './utils/build-contract.js';
import { generateContractSummary } from '../shared/utils/contract-file-ops.js';
import { ContractResult } from './models/types.js';
import { resolveCrossPlatformPath } from '../../shared/utils/cross-platform-path.js';
import { createHash } from 'node:crypto';

interface BuildComponentContractOptions extends BaseHandlerOptions {
saveLocation: string;
Expand Down Expand Up @@ -52,10 +53,7 @@ export const buildComponentContractHandler = createHandler<
);

const contractString = JSON.stringify(contract, null, 2);
const hash = require('node:crypto')
.createHash('sha256')
.update(contractString)
.digest('hex');
const hash = createHash('sha256').update(contractString).digest('hex');

const effectiveSaveLocation = resolveCrossPlatformPath(cwd, saveLocation);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ToolSchemaOptions } from '@push-based/models';
import { COMMON_ANNOTATIONS } from '../../../shared';
import { COMMON_ANNOTATIONS } from '../../../shared/index.js';

/**
* Schema for building component contracts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ToolSchemaOptions } from '@push-based/models';
import { COMMON_ANNOTATIONS } from '../../../shared';
import { COMMON_ANNOTATIONS } from '../../../shared/index.js';

/**
* Schema for diffing component contracts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SourceFileLocation } from '@push-based/models';
import { SourceFileLocation } from '@code-pushup/models';

export interface DependencyInfo {
path: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';
import { toUnixPath } from '@push-based/utils';
import { buildText } from '../../shared/utils/output.utils';
import { toUnixPath } from '@code-pushup/utils';
import { buildText } from '../../shared/utils/output.utils.js';
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
import {
DependencyGraphResult,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as path from 'path';
import { toUnixPath, findAllFiles } from '@push-based/utils';
import { toUnixPath } from '@code-pushup/utils';
import { findAllFiles } from '@push-based/utils';
import {
BuildComponentUsageGraphOptions,
ComponentUsageGraphResult,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs';
import * as path from 'path';
import { toUnixPath } from '@push-based/utils';
import { toUnixPath } from '@code-pushup/utils';
import { DEPENDENCY_ANALYSIS_CONFIG } from '../models/config.js';

const { resolveExtensions, indexFiles } = DEPENDENCY_ANALYSIS_CONFIG;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import * as ts from 'typescript';
import { toUnixPath } from '@push-based/utils';
import { toUnixPath } from '@code-pushup/utils';

import {
DependencyInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const getDeprecatedCssClassesHandler = createHandler<
'Missing ds.deprecatedCssClassesPath. Provide --ds.deprecatedCssClassesPath in mcp.json file.',
);
}
return getDeprecatedCssClasses(
return await getDeprecatedCssClasses(
componentName,
deprecatedCssClassesPath,
cwd,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fs from 'fs';
import { resolveCrossPlatformPath } from '../../shared/utils/cross-platform-path.js';
import { loadDefaultExport } from '@push-based/utils';

export interface DeprecatedCssComponent {
componentName: string;
Expand All @@ -14,11 +15,11 @@ export interface DeprecatedCssComponent {
* @returns Array of deprecated CSS classes for the component
* @throws Error if file not found, invalid format, or component not found
*/
export function getDeprecatedCssClasses(
export async function getDeprecatedCssClasses(
componentName: string,
deprecatedCssClassesPath: string,
cwd: string,
): string[] {
): Promise<string[]> {
if (
!deprecatedCssClassesPath ||
typeof deprecatedCssClassesPath !== 'string'
Expand All @@ -31,11 +32,8 @@ export function getDeprecatedCssClasses(
throw new Error(`File not found at deprecatedCssClassesPath: ${absPath}`);
}

const module = require(absPath);

// Handle both ES modules (export default) and CommonJS (module.exports)
// Support: export default dsComponents, module.exports = { dsComponents }, or direct module.exports = dsComponents
const dsComponents = module.default || module.dsComponents || module;
const dsComponents =
await loadDefaultExport<DeprecatedCssComponent[]>(absPath);

if (!Array.isArray(dsComponents)) {
throw new Error('Invalid export: expected dsComponents to be an array');
Expand Down
Loading