Experiment: UI for linking external plugins and themes#3128
Draft
cbravobernal wants to merge 8 commits intoadd-plugin-theme-link-clifrom
Draft
Experiment: UI for linking external plugins and themes#3128cbravobernal wants to merge 8 commits intoadd-plugin-theme-link-clifrom
cbravobernal wants to merge 8 commits intoadd-plugin-theme-link-clifrom
Conversation
…inked telemetry - Reject plugin/theme names containing path separators in unlink to prevent lstat/readlink/unlink from escaping the plugins/themes directory. - Wire PluginCommandLoggerAction.LIST_LINKED and ThemeCommandLoggerAction.LIST_LINKED through Logger.reportStart/reportSuccess/reportError so telemetry fires and UX matches other list commands (e.g. preview list). - Add unit tests for traversal inputs and update list-linked tests to assert on logger messages.
Guard against edge cases where path.basename(absoluteSourcePath) resolves to '', '.', or '..' (e.g. source = filesystem root). Without this check targetPath collapses to the plugins/themes directory itself and produces confusing downstream errors. Emit a clear LoggerError instead.
ca99957 to
9cd4c47
Compare
…-link-ui # Conflicts: # apps/cli/README.md # apps/cli/commands/plugin/link.ts # apps/cli/commands/plugin/tests/link.test.ts # apps/cli/commands/plugin/tests/list-linked.test.ts # apps/cli/commands/theme/link.ts # apps/cli/commands/theme/tests/link.test.ts # apps/cli/commands/theme/tests/list-linked.test.ts
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.
Goal
Fixes #1728
Mirror the CLI feature (
studio plugin/theme link|unlink|list-linked) with a UI surface so non-CLI users can manage symlinks from the Studio app.ui.mp4
Surfaces added
showErrorMessageBox/showNotification.Architecture
UI delegates entirely to the CLI via a child process — no duplicated symlink/validation logic in the main process. Mirrors the pattern established for import/export in #3129 (
execute-import-command.ts/execute-export-command.ts).apps/studio/src/modules/cli/lib/execute-link-command.ts— thin wrapper overexecuteCliCommandthat shells out tostudio plugin|theme link|unlink|list-linkedand awaits completion. Parseslist-linked --format jsonstdout, surfaces CLI errors viaCliCommandError.message.apps/studio/src/ipc-handlers.ts(6 of them) now do nothing but resolve the site path and call the wrapper. Zero business logic in main.Files
apps/studio/src/modules/cli/lib/execute-link-command.ts— new. CLI wrapper +LinkedExtensiontype.apps/studio/src/ipc-handlers.ts— 6 handlers:linkPlugin,unlinkPlugin,listLinkedPlugins+ theme equivalents. All async, takesiteId, fork the CLI.apps/studio/src/preload.ts— exposes the 6 handlers viaipcRendererInvoke.apps/studio/src/stores/linked-extensions-api.ts— RTK Query slice withuseGet*QueryanduseLink*/useUnlink*Mutationhooks; auto-invalidates list on mutation.queryFnwraps IPC calls in try/catch and returns structured{ error }so.unwrap()rejects with a readable message instead of[object Object].apps/studio/src/stores/index.ts— registers slice in store + middleware.apps/studio/src/hooks/use-content-tabs.tsx— adds'linked-extensions'tab between Previews and Import / Export.apps/studio/src/components/site-content-tabs.tsx— conditional render for the new tab.apps/studio/src/components/content-tab-linked-extensions.tsx— the tab UI itself.Removed in the refactor:
apps/studio/src/lib/plugin-theme-link.ts(231 lines) and its test file (167 lines). Net −356 lines.Status
npx eslint --fixon all touched files)npx tsc -p apps/studio/tsconfig.json --noEmit)/tmp/test-pluginand/tmp/test-themefixtures.PluginCommandLoggerAction/ThemeCommandLoggerAction; UI side relies on CLI telemetry via child process).What this is NOT
This is a vibe-coded spike to validate the UI shape and IPC surface. Architecture, error UX, and string copy are starting points, not merge-ready polish.