cli: name validated folders with the derived plugin publisher (#36296)

This commit is contained in:
Neil
2026-10-30 01:11:12 -07:00
committed by GitHub
parent 756d623955
commit ce7ca7f9a0
2 changed files with 22 additions and 2 deletions
@@ -14,6 +14,10 @@ import {
} from '../../shared/plugins/approval/plugin-cli-approval'
import { strictPluginArtifactErrors } from '../../shared/plugins/authoring/plugin-strict-artifact-checks'
import { validatePluginFile } from '../../shared/plugins/installation/plugin-file-validation'
import {
localPluginPublisher,
withPluginPublisher
} from '../../shared/plugins/installation/plugin-publisher-derivation'
import {
PLUGIN_MANIFEST_FILENAME,
parsePluginManifest,
@@ -114,7 +118,10 @@ export async function validatePluginTarget(target: string): Promise<PluginValida
valid: errors.length === 0,
errors,
plugin: {
pluginKey: qualifiedPluginKey(manifest),
// Why derived: a folder loads under its declared publisher, else `local`, like dev discovery.
pluginKey: qualifiedPluginKey(
withPluginPublisher(manifest, localPluginPublisher(manifest.publisher))
),
name: manifest.name,
version: manifest.version,
needsApproval: pluginNeedsCliApproval(manifest),
@@ -1,4 +1,4 @@
import { mkdtemp, rm, writeFile } from 'node:fs/promises'
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, describe, expect, it } from 'vitest'
@@ -64,6 +64,19 @@ describe('orca plugin validate', () => {
expect(report.errors.join('\n')).toContain('contributes.themes')
})
it('names a folder without a publisher the way Orca loads it', async () => {
const dir = join(await tempRoot(), 'nopub')
await createPluginFromTemplate({ dir, template: 'theme', publisher: 'acme' })
const manifestPath = join(dir, 'orca-plugin.json')
const manifest = JSON.parse(await readFile(manifestPath, 'utf8'))
delete manifest.publisher
manifest.engines.orca = '>=1.4.246'
await writeFile(manifestPath, JSON.stringify(manifest))
const report = await validatePluginTarget(dir)
expect(report.errors).toEqual([])
expect(report.plugin?.pluginKey).toBe('local.nopub')
})
it('reports a missing panel entry', async () => {
const dir = join(await tempRoot(), 'panel')
await createPluginFromTemplate({ dir, template: 'panel', publisher: 'acme' })