Skip to content

Conversation

clydin
Copy link
Member

@clydin clydin commented Oct 16, 2025

This commit enhances the list_projects MCP tool by adding a styleLanguage field to the project output. This provides critical context for an AI model, enabling it to generate components with the correct stylesheet format (e.g., .scss, .css) without needing to parse additional configuration files. This makes the AI more autonomous and its code generation more accurate.

The detection logic uses a prioritized heuristic to determine the most likely style language:

  1. Checks for a project-specific schematic setting in angular.json.
  2. Checks for a workspace-level schematic setting.
  3. Infers from the build target's inlineStyleLanguage option.
  4. Infers from file extensions in the build target's styles array.
  5. As a future-proof fallback, checks for the existence of an implicit styles.{ext} file in the project's source root.

This commit enhances the `list_projects` MCP tool by adding a `styleLanguage` field to the project output. This provides critical context for an AI model, enabling it to generate components with the correct stylesheet format (e.g., `.scss`, `.css`) without needing to parse additional configuration files. This makes the AI more autonomous and its code generation more accurate.

The detection logic uses a prioritized heuristic to determine the most likely style language:
1.  Checks for a project-specific schematic setting in `angular.json`.
2.  Checks for a workspace-level schematic setting.
3.  Infers from the `build` target's `inlineStyleLanguage` option.
4.  Infers from file extensions in the `build` target's `styles` array.
5.  As a future-proof fallback, checks for the existence of an implicit `styles.{ext}` file in the project's source root.

The implementation was also refactored to use a single Zod schema as the source of truth for valid style languages, improving maintainability and eliminating repetitive code.
@clydin clydin added the target: major This PR is targeted for the next major release label Oct 16, 2025
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: @angular/cli labels Oct 16, 2025
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 16, 2025
import { McpToolContext, declareTool } from './tool-registry';

// Single source of truth for what constitutes a valid style language.
const styleLanguageSchema = z.enum(['css', 'scss', 'sass', 'less']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include tailwind here already or would that depend on support in the app creation flow first?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was going to handle tailwind separate since the heuristics are more complicated and i'm undecided on whether it should be represented here or in another form.

@clydin clydin added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 16, 2025
@clydin clydin merged commit 3040b77 into angular:main Oct 17, 2025
36 checks passed
@clydin clydin deleted the mcp/list_projects-style-lang branch October 17, 2025 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/cli detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants