-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Open
Labels
area: @angular/cligemini-triagedLabel noting that an issue has been triaged by geminiLabel noting that an issue has been triaged by gemini
Description
Command
other
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
The Angular CLI MCP list_projects tool incorrectly constructs the sourceRoot by joining it with project.root, even though sourceRoot is already workspace-relative in angular.json.
This results in invalid paths for projects in a standard multi-project workspace created with --no-create-application.
Minimal Reproduction
Steps to reproduce
ng new my-workspace --no-create-application
cd my-workspace
ng generate application app-oneThis produces the following in angular.json:
{
"root": "projects/app-one",
"sourceRoot": "projects/app-one/src"
}Run the Angular CLI MCP tool:
list_projects
Expected behavior
sourceRoot should be reported exactly as defined in angular.json:
projects/app-one/src
Actual behavior
sourceRoot is constructed as:
projects/app-one/projects/app-one/src
This appears to come from:
const sourceRoot = posix.join(project.root, project.sourceRoot ?? 'src');Impact
- Incorrect
sourceRootpaths returned bylist_projects - Downstream tools may fail to locate source files
- Causes incorrect assumptions about workspace structure (e.g. expecting a root
/src)
Proposed fix
Do not join project.root with project.sourceRoot, since sourceRoot is already workspace-relative:
const sourceRoot = project.sourceRoot ?? posix.join(project.root, 'src');Exception or Error
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI : 21.2.3
Angular : 21.2.5
Node.js : 24.10.0
Package Manager : npm 11.6.1
Operating System : darwin arm64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 21.2.3 │ ^21.2.3 │
│ @angular/cli │ 21.2.3 │ ^21.2.3 │
│ @angular/common │ 21.2.5 │ ^21.2.0 │
│ @angular/compiler │ 21.2.5 │ ^21.2.0 │
│ @angular/compiler-cli │ 21.2.5 │ ^21.2.0 │
│ @angular/core │ 21.2.5 │ ^21.2.0 │
│ @angular/forms │ 21.2.5 │ ^21.2.0 │
│ @angular/platform-browser │ 21.2.5 │ ^21.2.0 │
│ @angular/router │ 21.2.5 │ ^21.2.0 │
│ ng-packagr │ 21.2.1 │ ^21.2.0 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 5.9.3 │ ~5.9.2 │
│ vitest │ 4.1.0 │ ^4.0.8 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else relevant?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: @angular/cligemini-triagedLabel noting that an issue has been triaged by geminiLabel noting that an issue has been triaged by gemini