From cecec7505fe5e92efbb2415c4b3774c85bfd0285 Mon Sep 17 00:00:00 2001 From: Fahri Gedik Date: Thu, 30 Oct 2025 14:36:29 +0300 Subject: [PATCH] Trim targetProject input before lookup Ensures that leading and trailing whitespace is removed from the targetProject option before attempting to retrieve the project from the workspace. This prevents errors when users accidentally include extra spaces in the project name. --- .../packages/schematics/src/commands/ai-config/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/schematics/src/commands/ai-config/index.ts b/npm/ng-packs/packages/schematics/src/commands/ai-config/index.ts index 5b510af111..9f1606c885 100644 --- a/npm/ng-packs/packages/schematics/src/commands/ai-config/index.ts +++ b/npm/ng-packs/packages/schematics/src/commands/ai-config/index.ts @@ -38,10 +38,11 @@ export default function (options: AiConfigSchema): Rule { let targetPath = '/'; if (options.targetProject) { - const project = workspace.projects.get(options.targetProject); + const trimmedTargetProject = options.targetProject.trim(); + const project = workspace.projects.get(trimmedTargetProject); if (!project) { throw new SchematicsException( - `Project "${options.targetProject}" not found in workspace.` + `Project "${trimmedTargetProject}" not found in workspace.` ); } targetPath = normalize(project.root);