feat: redesign extension source handling and actions#287
Merged
Conversation
Add sourceType to ExtensionManifest and source-type to RawManifest. Update normaliseManifest to parse the field, updateManifestSource and writeManifest to persist it, and writeExtensionToDisk/installSingleExtension to propagate the install source type into the manifest on disk.
Replace single openSource command with four source-type-specific commands (GitHub, URL, Local, Registry) each showing the appropriate icon. Add reinstall command for pinned sources. Update context values to encode source type and pin status. Update getExtensionRepository to respect source type, add getExtensionSourceUrl and getEffectiveSourceType helpers. Remove Repository detail line from tree view. Update existing update and updateAll commands to use manifest source.
Add openSourceGithub, openSourceUrl, openSourceLocal, openSourceRegistry, and reinstall commands with appropriate icons. Update when clauses to use regex matching against source-type context values. Hide new commands from command palette.
Reduce context values from 8 to 4 (Details, NoSource, Item, Pinned) and consolidate four per-source-type openSource commands into a single command that branches on effectiveSourceType. Replace regex when clauses in package.json with exact match conditions.
Legacy manifests with a source field that does not match any known pattern (URL, local path, owner/repo) now return "registry" instead of undefined for backward compatibility.
…sed sources" This reverts commit f130684.
…eType Legacy manifests with an owner/repo source pattern but no explicit source-type field now infer "registry" instead of "github". Explicit source-type: github is still honoured.
Eliminate the breaking changes section to streamline the changelog and focus on new features and bug fixes.
- Add parentheses to when clauses in package.json for correct
operator precedence with OR conditions.
- Fix hasPinnedVersion detection to compare stripped source against
original instead of naive includes("@") which false-positives on
URLs and paths containing @.
- Add missing dot-prefix guard in getEffectiveSourceType to prevent
relative paths like ./.github/issue matching as owner/repo.
- Export SourceType alias from @quarto-wizard/core and use it across
all files instead of duplicating the string literal union.
Show error message in reinstall command when source is missing instead of silently returning, consistent with the update command. Return undefined from getExtensionSourceUrl for unrecognised source patterns instead of the raw string.
Show the update button only for github source types (always) and registry source types with a detected update. Add a new quartoExtensionItemUpToDate context value for extensions that are current or use url/local sources, keeping remove, open source, and reveal actions available. Also simplify legacy source-type inference: strip the @Version ref before pattern matching and treat any owner/repo pattern as registry rather than falling back to local.
Remove redundant startsWith("./") and startsWith("../") checks
subsumed by startsWith(".") in isLocalSourcePath. Merge the two
identical url/local branches in getExtensionSourceUrl. Add a comment
in checkForUpdates explaining why @ref stripping is unconditional.
Enhance the test suite by adding a test to ensure that local sources are not inferred from backslashes in non-path sources. Additionally, improve error handling for unsupported URL schemes when opening external sources.
Update the GITHUB_REPOSITORY_PATTERN to properly escape backslashes, ensuring accurate matching of repository paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
source-typefield to extension manifests (github,url,local,registry) for explicit source type tracking.$(github),$(link-external),$(folder-opened),$(package).@version), keep "Update" for unpinned sources.whenclause matching.getExtensionSourceUrlandgetEffectiveSourceTypehelpers with legacy fallback logic.https://github.com/URL prefix from Open Source command.Test plan
npm run webpackto verify the build succeeds.npm run lintto verify no lint errors.cd packages/core && npx vitest run) to verify all 377 tests pass.npm run test-compileto verify TypeScript compilation.$(github)Open Source + Update visible.$(github)Open Source + Reinstall visible.$(link-external)Open Source + Reinstall visible.$(folder-opened)Open Source + Reinstall visible. Click prompts to open in new window._extension.ymlafter install containssource-typefield.