diff --git a/tools/azsdk-cli/Azure.Sdk.Tools.Cli.Tests/Services/Languages/GoLanguageSpecificChecksTests.cs b/tools/azsdk-cli/Azure.Sdk.Tools.Cli.Tests/Services/Languages/GoLanguageSpecificChecksTests.cs
index 4dfcf953e95..ab8870701d7 100644
--- a/tools/azsdk-cli/Azure.Sdk.Tools.Cli.Tests/Services/Languages/GoLanguageSpecificChecksTests.cs
+++ b/tools/azsdk-cli/Azure.Sdk.Tools.Cli.Tests/Services/Languages/GoLanguageSpecificChecksTests.cs
@@ -133,15 +133,15 @@ func main() {
}
[Test]
- public void TestGetSDKPackagePath()
+ public async Task TestGetSDKPackageName()
{
Assert.That(
- LangService.GetSDKPackagePath(Path.Combine("/hello", "world", "az") + Path.DirectorySeparatorChar, Path.Combine("/hello", "world", "az", "sdk", "messaging", "azservicebus")),
+ await LangService.GetSDKPackageName(Path.Combine("/hello", "world", "az") + Path.DirectorySeparatorChar, Path.Combine("/hello", "world", "az", "sdk", "messaging", "azservicebus")),
Is.EqualTo(Path.Combine("sdk", "messaging", "azservicebus"))
);
Assert.That(
- LangService.GetSDKPackagePath(Path.Combine("/hello", "world", "az"), Path.Combine("/hello", "world", "az", "sdk", "messaging", "azservicebus")),
+ await LangService.GetSDKPackageName(Path.Combine("/hello", "world", "az"), Path.Combine("/hello", "world", "az", "sdk", "messaging", "azservicebus")),
Is.EqualTo(Path.Combine("sdk", "messaging", "azservicebus")));
}
}
diff --git a/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Azure.Sdk.Tools.Cli.csproj b/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Azure.Sdk.Tools.Cli.csproj
index b78c05d4365..1007dcf2ef8 100644
--- a/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Azure.Sdk.Tools.Cli.csproj
+++ b/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Azure.Sdk.Tools.Cli.csproj
@@ -11,7 +11,7 @@
ASP0000;CS8603;CS8618;CS8625;CS8604
true
azsdk
- 0.5.2
+ 0.5.3
See CHANGELOG.md for release notes
diff --git a/tools/azsdk-cli/Azure.Sdk.Tools.Cli/CHANGELOG.md b/tools/azsdk-cli/Azure.Sdk.Tools.Cli/CHANGELOG.md
index 575c266d820..3d7ba512f5f 100644
--- a/tools/azsdk-cli/Azure.Sdk.Tools.Cli/CHANGELOG.md
+++ b/tools/azsdk-cli/Azure.Sdk.Tools.Cli/CHANGELOG.md
@@ -1,5 +1,11 @@
# Release History
+## 0.5.3 (Unreleased)
+
+### Bugs Fixed
+
+- Added a language specific way to get package name for validation checks, to account for different language naming (JS uses package.json name)
+
## 0.5.2 (2025-10-13)
### Features
diff --git a/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/GoLanguageSpecificChecks.cs b/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/GoLanguageSpecificChecks.cs
index 3210bfe5a6a..27168b60724 100644
--- a/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/GoLanguageSpecificChecks.cs
+++ b/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/GoLanguageSpecificChecks.cs
@@ -149,7 +149,7 @@ public async Task BuildProjectAsync(string packagePath, Cancel
}
}
- public string GetSDKPackagePath(string repo, string packagePath)
+ public async Task GetSDKPackageName(string repo, string packagePath, CancellationToken cancellationToken = default)
{
if (!repo.EndsWith(Path.DirectorySeparatorChar))
{
@@ -157,7 +157,9 @@ public string GetSDKPackagePath(string repo, string packagePath)
}
// ex: sdk/messaging/azservicebus/
- return packagePath.Replace(repo, "");
+ var relativePath = packagePath.Replace(repo, "");
+ // Ensure forward slashes for Go package names
+ return await Task.FromResult(relativePath.Replace(Path.DirectorySeparatorChar, '/'));
}
public async Task UpdateSnippetsAsync(string packagePath, bool fixCheckErrors = false, CancellationToken cancellationToken = default)
diff --git a/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/ILanguageSpecificChecks.cs b/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/ILanguageSpecificChecks.cs
index 96ef3c20d5e..5a7a37b20c2 100644
--- a/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/ILanguageSpecificChecks.cs
+++ b/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/ILanguageSpecificChecks.cs
@@ -54,4 +54,17 @@ Task FormatCodeAsync(string packagePath, bool fixCheckErrors =
{
return Task.FromResult(new CLICheckResponse(1, "", "Not implemented for this language."));
}
+
+ ///
+ /// Gets the SDK package name.
+ ///
+ /// Repository root path
+ /// Package path
+ /// Cancellation token
+ /// SDK package name
+ Task GetSDKPackageName(string repo, string packagePath, CancellationToken cancellationToken = default)
+ {
+ // Default implementation: use the directory name as the package path
+ return Task.FromResult(Path.GetFileName(packagePath));
+ }
}
\ No newline at end of file
diff --git a/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/JavaScriptLanguageSpecificChecks.cs b/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/JavaScriptLanguageSpecificChecks.cs
index 2dcc094e35c..993e39b70f3 100644
--- a/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/JavaScriptLanguageSpecificChecks.cs
+++ b/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/JavaScriptLanguageSpecificChecks.cs
@@ -1,3 +1,4 @@
+using System.Text.Json;
using Azure.Sdk.Tools.Cli.Helpers;
using Azure.Sdk.Tools.Cli.Models;
@@ -132,4 +133,33 @@ public async Task FormatCodeAsync(string packagePath, bool fix
return new CLICheckResponse(1, "", $"Error formatting code: {ex.Message}");
}
}
-}
\ No newline at end of file
+
+ public async Task GetSDKPackageName(string repo, string packagePath, CancellationToken cancellationToken = default)
+ {
+ // For JavaScript packages, read the package name from package.json
+ var packageJsonPath = Path.Combine(packagePath, "package.json");
+ if (File.Exists(packageJsonPath))
+ {
+ try
+ {
+ var packageJsonContent = await File.ReadAllTextAsync(packageJsonPath, cancellationToken);
+ using var document = JsonDocument.Parse(packageJsonContent);
+ if (document.RootElement.TryGetProperty("name", out var nameProperty))
+ {
+ var packageName = nameProperty.GetString();
+ if (!string.IsNullOrEmpty(packageName))
+ {
+ return packageName;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogWarning(ex, "Failed to parse package.json at {PackageJsonPath}. Falling back to directory name.", packageJsonPath);
+ }
+ }
+
+ // Fallback to directory name if package.json reading fails
+ return Path.GetFileName(packagePath);
+ }
+}
diff --git a/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/LanguageChecks.cs b/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/LanguageChecks.cs
index 70fe5aae558..a15beab2f23 100644
--- a/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/LanguageChecks.cs
+++ b/tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/LanguageChecks.cs
@@ -76,14 +76,6 @@ public interface ILanguageChecks
/// Cancellation token
/// Result of the code formatting operation
Task FormatCodeAsync(string packagePath, bool fixCheckErrors = false, CancellationToken ct = default);
-
- ///
- /// Gets the SDK package path for the given repository and package path.
- ///
- /// Repository root path
- /// Package path
- /// SDK package path
- string GetSDKPackagePath(string repo, string packagePath);
}
///
@@ -233,6 +225,12 @@ protected async Task ValidateChangelogCommonAsync(string packa
return errorResponse;
}
+ var languageSpecificCheck = await _languageSpecificChecks.Resolve(packagePath);
+ if (languageSpecificCheck == null)
+ {
+ return new CLICheckResponse(1, "", $"No language-specific check handler found for package at {packagePath}. Supported languages may not include this package type.");
+ }
+
// Construct the path to the PowerShell script in the SDK repository
var scriptPath = Path.Combine(packageRepoRoot, "eng", "common", "scripts", "Verify-ChangeLog.ps1");
@@ -242,7 +240,7 @@ protected async Task ValidateChangelogCommonAsync(string packa
}
var command = "pwsh";
- var args = new[] { "-File", scriptPath, "-PackageName", this.GetSDKPackagePath(packageRepoRoot, packagePath) };
+ var args = new[] { "-File", scriptPath, "-PackageName", await languageSpecificCheck.GetSDKPackageName(packageRepoRoot, packagePath, ct) };
// Use a longer timeout for changelog validation - 5 minutes should be sufficient
var timeout = TimeSpan.FromMinutes(5);
@@ -370,11 +368,6 @@ protected async Task CheckSpellingCommonAsync(string packagePa
}
}
- public virtual string GetSDKPackagePath(string repo, string packagePath)
- {
- return Path.GetFileName(packagePath);
- }
-
///
/// Result of the spelling fix microagent operation.
///