359e09fd65
Adds a reviewable in-app install path for Hermes plugins: hermes://plugin/install?repo=owner/repo (and Settings -> Plugins -> Install from Git) opens a confirmation modal showing the repo identity and source links, shallow-clones to probe for agent and/or desktop plugin artifacts, lets the user pick components, then installs — agent side through the gateway's new plugins.manage `install` action (wrapping the existing dashboard_install_plugin), desktop side through a new Electron git-install module with subdir-escape guards, a 60s clone timeout, non-interactive git env, and insecure-scheme warnings. Never auto-installs; hybrid repos get one dialog. Legacy plugin-agent / plugin-desktop deeplinks route into the same modal. Salvaged from PR #82735 by @serefyarar (net diff applied onto current main as a single authored commit; the branch carried merge commits). The preview screenshot PNG from the original branch was intentionally not carried over — images live in PR bodies, not the repo.
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { resolvePluginSourceLinks } from './plugin-source-urls'
|
|
|
|
describe('resolvePluginSourceLinks', () => {
|
|
it('maps owner/repo to github browse and clone urls', () => {
|
|
expect(resolvePluginSourceLinks('NousResearch/hermes-example-plugins')).toEqual({
|
|
gitUrl: 'https://github.com/NousResearch/hermes-example-plugins.git',
|
|
browseUrl: 'https://github.com/NousResearch/hermes-example-plugins',
|
|
subdir: null
|
|
})
|
|
})
|
|
|
|
it('includes monorepo subdir in browse url', () => {
|
|
expect(resolvePluginSourceLinks('owner/repo/plugins/foo')).toEqual({
|
|
gitUrl: 'https://github.com/owner/repo.git',
|
|
browseUrl: 'https://github.com/owner/repo/tree/HEAD/plugins/foo',
|
|
subdir: 'plugins/foo'
|
|
})
|
|
})
|
|
|
|
it('supports git@ github urls', () => {
|
|
expect(resolvePluginSourceLinks('git@github.com:owner/my-plugin.git')).toEqual({
|
|
gitUrl: 'git@github.com:owner/my-plugin.git',
|
|
browseUrl: 'https://github.com/owner/my-plugin',
|
|
subdir: null
|
|
})
|
|
})
|
|
|
|
it('returns null for invalid identifiers', () => {
|
|
expect(resolvePluginSourceLinks('not-a-repo')).toBeNull()
|
|
})
|
|
})
|