Skip to content

feat: redesign extension source handling and actions#287

Merged
mcanouil merged 14 commits intomainfrom
feat/source-type-handling
Feb 22, 2026
Merged

feat: redesign extension source handling and actions#287
mcanouil merged 14 commits intomainfrom
feat/source-type-handling

Conversation

@mcanouil
Copy link
Copy Markdown
Owner

Summary

  • Add source-type field to extension manifests (github, url, local, registry) for explicit source type tracking.
  • Replace single "Open Source" command with four per-source-type commands showing appropriate icons: $(github), $(link-external), $(folder-opened), $(package).
  • Add "Reinstall" action for pinned sources (with @version), keep "Update" for unpinned sources.
  • Update context values to encode source type and pin status for accurate when clause matching.
  • Add getExtensionSourceUrl and getEffectiveSourceType helpers with legacy fallback logic.
  • Remove hardcoded https://github.com/ URL prefix from Open Source command.
  • Update "Update All" to use manifest source directly.

Test plan

  • Run npm run webpack to verify the build succeeds.
  • Run npm run lint to verify no lint errors.
  • Run core tests (cd packages/core && npx vitest run) to verify all 377 tests pass.
  • Run npm run test-compile to verify TypeScript compilation.
  • Manually verify GitHub extension (unpinned): $(github) Open Source + Update visible.
  • Manually verify GitHub extension (pinned): $(github) Open Source + Reinstall visible.
  • Manually verify URL extension: $(link-external) Open Source + Reinstall visible.
  • Manually verify Local extension: $(folder-opened) Open Source + Reinstall visible. Click prompts to open in new window.
  • Manually verify No-source extension: only Remove visible.
  • Verify _extension.yml after install contains source-type field.

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.
@mcanouil mcanouil added the Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses label Feb 21, 2026
@mcanouil mcanouil self-assigned this Feb 21, 2026
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.
…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.
@mcanouil mcanouil enabled auto-merge (squash) February 22, 2026 09:45
@mcanouil mcanouil disabled auto-merge February 22, 2026 09:45
@mcanouil mcanouil enabled auto-merge (squash) February 22, 2026 09:45
@mcanouil mcanouil merged commit 22c472e into main Feb 22, 2026
7 checks passed
@mcanouil mcanouil deleted the feat/source-type-handling branch February 22, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant