-
Notifications
You must be signed in to change notification settings - Fork 0
Add localization and icons support to .NET MCPB CLI (manifest v0.3) #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: asklar <[email protected]>
|
@copilot |
…urces/${locale}.json, default_locale: en-US)
Co-authored-by: asklar <[email protected]>
Updated in commit ed170ca. Both
An empty |
|
@copilot let's add an option to check that all localizable properties are indeed localized on all localization dictionary jsons (i.e. under the folder described by the |
…ation Co-authored-by: asklar <[email protected]>
Implemented in commit 8e2bc36:
Localizable properties checked:
The validator:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot license is not localizable |
Co-authored-by: asklar <[email protected]>
| var localeJson = File.ReadAllText(filePath); | ||
| using var localeDoc = JsonDocument.Parse(localeJson); | ||
| var root = localeDoc.RootElement; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot instead of raw parsing the json, let's create a system.text.json source generator model type for these localization json files with the properties that are localizable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in commit 4423180. Created strongly-typed models for localization resource files:
New Models:
McpbLocalizationResource- Main resource model with localizable propertiesMcpbLocalizationResourceAuthor- Author localizationMcpbLocalizationResourceTool- Tool localizationMcpbLocalizationResourcePrompt- Prompt localization
All models are registered with the System.Text.Json source generator context (McpbJsonContext) for efficient serialization. The validation now uses JsonSerializer.Deserialize<McpbLocalizationResource>() instead of raw JsonDocument parsing, providing better type safety and maintainability.
…Text.Json source generator Co-authored-by: asklar <[email protected]>
|
@copilot can you make sure the dotnet workflow runs for this PR? |
The .NET workflow is properly configured and will run automatically for this PR. The workflow ( All changes in this PR are in the
The workflow will automatically run when the PR is opened/updated against the target branch. |
|
@copilot update the patch version of the .net package |
Co-authored-by: asklar <[email protected]>
✅ All tasks completed successfully!
Summary
Added localization and icons support to the .NET MCPB CLI tool for manifest version 0.3, matching the TypeScript implementation from anthropics#132.
Changes Made
Model Classes (ManifestModels.cs)
McpbManifestLocalization:Resources(string?, optional): Path with${locale}placeholder. Default:"mcpb-resources/${locale}.json"DefaultLocale(string?, optional): BCP 47 locale identifier. Default:"en-US"McpbManifestIcon:Src(string): Path to icon fileSize(string): Icon dimensions in "WIDTHxHEIGHT" format (changed fromSizesto match spec)Theme(string, optional): Theme identifierMcpbLocalizationResource(NEW): Strongly-typed model for localization resource filesDisplayName,Description,LongDescriptionAuthor(withNameproperty)Keywords,Tools,PromptsValidation (ManifestValidator.cs)
"mcpb-resources/${locale}.json"whenresourcesnot specified"en-US"whendefault_localenot specifiedresourcescontains${locale}placeholder (case-insensitive)default_localematches BCP 47 formaticons[].sizematches "WIDTHxHEIGHT" format (property renamed fromsizestosize)icons[].themeis not empty when providedLocalization Completeness Validation (ManifestCommandHelpers.cs)
McpbLocalizationResourcemodel instead of raw JSON parsingdisplay_name,description,long_descriptionauthor.name,keywordslicenseis NOT localizable (it's typically an SPDX identifier, not a user-facing string)File Validation (ManifestCommandHelpers.cs)
icons[]arrayPackage Version (mcpb.csproj)
Testing
Unit Tests (68 total, all passing)
Sizeinstead ofSizesManual Integration Testing
Security
Compatibility
sizestosizeto match updated manifest specOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.