Skip to content

Enhance package management with new APIs, tools, and workflows#714

Merged
chrisgregan merged 22 commits into
mainfrom
workshop-api
Jun 18, 2026
Merged

Enhance package management with new APIs, tools, and workflows#714
chrisgregan merged 22 commits into
mainfrom
workshop-api

Conversation

@chrisgregan

Copy link
Copy Markdown
Contributor

This pull request introduces several improvements and new features to the credential and dialog systems, enhances resource key handling, and updates the file system and localization resources. The most significant changes include refactoring the Workshop credential terminology and API, adding support for masked secret input dialogs, extending dialog automation, and improving file system and resource key utilities. Additionally, the localization file receives comprehensive updates to support these features and clarify user messaging.

Credential and Workshop Key Refactoring:

  • Refactored all references from "Application Key" to "Workshop Key" for clarity and consistency, including renaming types and updating API methods in ICredentialService and related records. The API is now focused on handling just the secret key, not the full connection. (ICredentialService.cs, CredentialConstants.cs) [1] [2] [3]
  • Updated resource strings to use "Workshop Key" and improved user-facing messages for key management, connection status, and error handling. (Resources.resw)

Dialog and User Input Enhancements:

  • Added a new ISecretInputDialog interface for securely entering masked secrets, with corresponding factory and service methods for displaying secret input dialogs. (ISecretInputDialog.cs, IDialogFactory.cs, IDialogService.cs) [1] [2] [3]
  • Introduced DialogKind enum and dialog automation support, allowing scheduled automated answers for modal dialogs—useful for testing and automation scenarios. (IDialogService.cs, DialogMessages.cs) [1] [2] [3]

Resource Key and File System Improvements:

  • Added CombinePath method to ResourceKey for appending multi-segment relative paths, enhancing resource key manipulation. (ResourceKey.cs)
  • Extended file system attribute support to include detection of reparse points (symbolic links/junctions) in both the interface and implementation. (ILocalFileSystem.cs, LocalFileSystem.cs) [1] [2]

Localization and User Messaging:

  • Expanded and clarified resource strings for package and page publishing workflows, including new confirmation and error messages for actions like publish, install, replace, delete, and unpublish. (Resources.resw) [1] [2]

These changes collectively improve security, usability, and maintainability across credential handling, user dialogs, file system abstraction, and localization.

Migrate package model and workshop integration: replace package 'id' semantics with 'name' and introduce PackageConstants and a PackageName validator. Add richer IPackageApiClient types and methods to represent remote packages, versions, aliases and publish/download flows (workshop-style versioning instead of single-file registry). Move and extend PackageDiscoveryReport (rename fields to PackageName/ReservedNamePrefix) and surface package discovery in ProjectLoadReporter output. Update PackageInfo fields (Id -> Name, Name -> Author/Title, RequiresTools -> PermittedTools) and update tooling: package_list/install/publish to use workshop semantics, default packages folder constant, and validation via PackageName. Update docs to reflect [permissions].tools manifest section and workshop terminology; remove package_create tool and associated docs. Misc: adjust ToolAllowlist/ContributionToolsHandler messages, remove .gitignore entry for PackageApiCredentials.private.cs, and add tests and other supporting changes.
Introduce richer package management features and supporting helpers. Adds package tools: package_info, enhanced package_install (version/alias, destination, replace semantics and confirmations), package_publish (reads manifest, summary, writes HISTORY.md), and alias management docs/tools (set/remove). Adds PackageHistoryFile to format/parse HISTORY.md and writes history metadata beside manifests; install now generates HISTORY.md and publish refreshes it. Resource/FS updates: add FileSystemAttributes.ReparsePoint and map native reparse points in LocalFileSystem; add ResourceKey.CombinePath helper. Update guides and tests to reflect the new behaviors and parameters.
Introduce destructive package administration and status tooling plus related plumbing and docs.

- Add IPackageApiClient.DeleteVersionAsync and DeletePackageAsync and switch RemotePackageVersion.Tombstoned -> Deleted. API clients now model deleted versions (bytes removed) and server tombstones are not tracked by Celbridge.
- Implement package_delete, package_unpublish and package_status tools (with confirmations, irreversible behavior) and wire up JSON result types.
- Add PackageConstants.LatestAlias and use it where appropriate.
- Update PackageHistoryFile to render a [package_deleted] marker for deleted versions while preserving version metadata.
- Extend FileTools.Grep to search non-default roots (temp:, logs:) by walking the gateway, support explicit file lists, and add filename glob filtering for scoped walks.
- Update docs and guides (packages_overview, package namespace, tool pages) to document deletion, unpublish, and status behavior and confirmation semantics.
- Add and update unit tests to cover new APIs, tools, HISTORY formatting, grep behavior, and package load-failure reporting.

These changes add irreversible delete/unpublish operations (always prompt) and expose package_status for local project inspection; they also improve grep scope handling and ensure deleted versions remain verifiable via retained metadata.
Introduce structured HISTORY.md entries: headings now use a name@version token and a compact bracketed metadata line (time, author, short hash, deleted). PackageHistoryFile.Format was changed to accept packageName, emits RFC3339 UTC timestamps and a 12-char short hash, and provides TryReadInstalledReference and IsStaleBase helpers. Package publish/install logic updated to read the installed reference, warn/confirm on stale or unreadable install records, and include an optional warning in publish results; tests and localization strings were updated accordingly to cover the new format and checks.
Introduce a pages subsystem (publish-only static sites) and add an Author field to workshop credentials and publishing flows. Changes include: new IPageApiClient, PageConstants, and PageTools (page_publish, page_list, page_info, page_unpublish) with archive building, manifest handling, and confirmation flows; PublishAuthor helper and AgentToolBase.ShowAlertAsync for user alerts; Require Author for package and page publishes and pass it to the API (IPackageApiClient.PublishVersionAsync updated); WorkshopConnection record extended with Author and CredentialService normalized for older entries; Settings UI and viewmodel updated to capture Author; many documentation/guide pages and localization strings added; tests adjusted to reflect removal of manifest-level package author. Several workspace service stubs added for page API integration. The commit enforces that an Author is configured in Settings before publishing and documents the publish-only nature of pages.
Introduce a test automation surface that can schedule automated answers for modal dialogs. Adds DialogKinds and DialogAnswerMessage types and a ScheduleAnswer method to IDialogService. Implements DialogAnswerScheduler and wires it into DialogService; confirmation and input-text dialogs now listen for scheduled answers and self-close with the provided payload. Adds a debug-only MCP tool (app_answer_dialog) gated by the new feature flag "answer-dialog", documentation for the tool, and troubleshooting notes. Includes unit tests for the scheduler behavior and end-to-end Python integration tests and ensures schedules are cleared on workspace unload.
Add support for automatic dialog answers through a messenger. DialogKind now includes Alert and ResourcePicker, and DialogService notifies the answer scheduler when those dialogs are shown. AlertDialog and ResourcePickerDialog acquire ILogger and IMessengerService, register for DialogAnswerMessage, and unregister in a finally block. AlertDialog hides itself when an auto-answer arrives; ResourcePickerDialog validates the payload as a ResourceKey, selects the matching item, marks confirmation, logs outcomes, and returns appropriate Result values on success or cancellation.
Refactor and expand integration tests for package publishing. Introduces constants and a temporary manifest workaround for server validation, plus helper functions (_build_integration_package, _drop_integration_package_if_published) and tighter workspace cleanup. Replaces skipped uninstall tests with a full publish -> install -> delete flow (confirm handling updated via confirmWithUser and app.answer_dialog), strengthens list() assertions, and adds a test for publishing an invalid package name. Also updates the built wheel asset (rebuilt celbridge-0.1.0 wheel).
Introduce session-mid package rescans and optional file hashing, improve alias parsing, and tidy related semantics and docs.

- Add IPackageService.RescanProjectPackagesAsync and implement it to re-run discovery and refresh the load report without firing PackagesInitializedMessage (enables package_status refresh without full reload).
- Add computeHash:boolean to file_get_info and return uppercase-hex SHA-256 when requested; implement ComputeFileHashAsync and surface hash in the FileInfoResult.
- Make package_publish warning a non-null string (empty when none) and adjust BuildPublishWarning accordingly.
- In PackageTools.Status add a refresh parameter to opt-in to rescan behavior.
- Update PackageApiClient to accept alias name under either "name" or "alias" and return a clearer error when setting an alias to a nonexistent version (maps 404 to a helpful message). Add tests for alias parsing and SetAlias error handling.
- Fix CopyPathMenuOption to resolve resource paths via ResolveResourcePath and bail on failure.
- Update numerous guides to document computeHash, package list/info semantics, and the prompting/irreversibility wording.

Includes small XML/doc tweaks and unit tests to cover the new behaviors.
Remove the Guides/Tools/app_answer_dialog.md embedded resource for non-Debug configurations in the Celbridge.Tools project. This matches the tool's debug-only (#if DEBUG) gating and keeps the loader's tool-coverage validator happy; the change adds a conditional EmbeddedResource Remove entry and an explanatory comment in the .csproj.
Upgrade esbuild devDependency from ^0.25.0 to ^0.28.1 in lib/build/package.json and update the generated tiptap.js bundle accordingly (rebuilt/minified output changed). Also add package-lock.json.
Add dialog kind routing and robustness for automated dialog answers, plus a few ancillary fixes.

- Dialog: DialogAnswerMessage now carries a DialogKind; DialogAnswerScheduler and all dialog views use the kind to target answers and the scheduler yields before broadcasting to avoid missing handlers. Unit tests updated to assert the Kind.
- Tools/File: ComputeHashAsync result is checked for failure and the returned SHA-256 is normalized to lowercase to match git/sha256sum/workshop conventions.
- Tools/Package: Before duplicate-checking an install, rescan project packages so the registry reflects packages installed earlier in the session; added required project service using.
- PackageService: RescanProjectPackagesAsync simplified to refresh discovery only and documented why it does not re-fire initialization messages or rewrite project-load state.
- Python tests: replace the skipped/placeholder test with an integration test asserting the tool rejects an invalid dialog kind.

These changes improve test automation reliability and make package/hash behavior consistent across tools.
Migrate Workshop credential storage from a standalone file to user-scoped IEditorSettings: WorkshopKeyProtected (ciphertext) and WorkshopKeyHint (non-secret display hint). Rename ApplicationKey concepts to WorkshopKey across APIs and resources; update ICredentialService methods (summary/get/set/clear) to operate on the Workshop Key string and add clearer error messages. Introduce fixed entropy bound for credential protection and require an entropy parameter on ICredentialProtector (and DPAPI implementation) so ciphertexts are scoped. Refactor CredentialService to use IEditorSettings and ICredentialProtector Protect/Unprotect helpers, remove the JSON store logic, and add helper methods for base64 protection/unprotection. Add StatusSeverity enum and converter, add Workshop settings view/viewmodel/tests, update service registrations to use WorkshopSettingsViewModel, and change publish-author resolution to read WorkshopAuthor from IEditorSettings (remove PublishAuthor helper). Adjust package version resolution semantics and update related docs and resource strings (various wording and key renames). Update tests and client/service code to match the new credential handling and naming.
Add BuildNameMatcher to GlobHelper and centralize glob-to-regex logic across the codebase. Replace duplicated local implementations with GlobHelper.GlobToRegex / GlobHelper.BuildNameMatcher in FileTools, SearchService, ArchiveHelper, and tests, and remove now-unnecessary helper methods. Also trim a couple of class XML summaries (PackageTools, PageTools). This reduces duplicated code and ensures consistent glob semantics for include/exclude matching.
Update file_get_info documentation to specify the file hash is a lowercase-hex SHA-256 (was previously documented as uppercase) and adjust the in-source XML summary for FileInfoResult to a shorter, higher-level description that refers to the tool guide. This aligns the docs with the codebase hash convention and removes implementation-detail text from the code comment.
Rename PackageHistoryFile to PackageHistoryHelper and update its API to return Result<string> from Format, returning a failure when no version is at or below the installed version. Update all call sites (PackageTools.Install/Publish) to handle the new Result, log failures, and only write HISTORY.md on success. Also adjust PageTools imports to use ILocalizerService via added using, and rename related tests to PackageHistoryHelperTests while updating assertions and adding a new test for the Format failure case.
Refine comments in IPackageApiClient.cs to clarify semantics and authentication:
- RemotePackageVersion: reworded Deleted explanation to say it becomes true when the version's content is removed and that the record/hash remain verifiable.
- IPackageApiClient: updated auth description to state callers do not supply credentials and requests use ambient workshop configuration; removed tombstone wording.
- DeleteVersionAsync: clarified that deleting a version removes its content while reserving the version number and content hash, and is irreversible from the client.

These are documentation-only wording improvements to make behavior clearer; no functional changes.
Introduce a masked Secret Input dialog for entering Workshop Keys and wire it into the dialog factory/service and UI. Added ISecretInputDialog, SecretInputDialog view + code-behind, and SecretInputDialogViewModel; registered the view model in ServiceConfiguration and implemented Create/Show methods in DialogFactory and DialogService. Refactored WorkshopSettingsViewModel and its view to use Change/Remove key commands (removing the inline password entry and replace/cancel flow), updated localization keys/strings for set/change/remove actions and dialog texts, and adjusted unit tests to stub the new IDialogService behavior. Overall this centralizes secret entry, improves UX for key management, and cleans up the stored-key UI state.
Introduce a dedicated connection probe to distinguish a rejected API key from an unreachable workshop and surface clearer UI feedback. Added ConnectionCheckOutcome enum and IPackageApiClient.CheckConnectionAsync, implemented by PackageApiClient and WorkshopApiSender (which was refactored to BuildRequestAsync to share request construction). WorkshopApiSender.CheckConnectionAsync classifies 401 as Unauthorized, success as Connected, and network/server errors as Unreachable. Updated WorkshopSettingsViewModel to use the new outcome to show distinct localized messages (SettingsPage_WorkshopKeyRejected, SettingsPage_ConnectionUnverified) and removed the key-prefix validation helper. Updated resource strings and revised unit tests: added PackageApiClient connection-check tests and adjusted UI tests to assert the new behaviors and messages.
@chrisgregan chrisgregan merged commit b07b9c3 into main Jun 18, 2026
6 checks passed
@chrisgregan chrisgregan deleted the workshop-api branch June 18, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant