From 52c3b628cb23d8eb240f9df2713cc17aaf874a79 Mon Sep 17 00:00:00 2001 From: Tom Davidson Date: Sun, 10 May 2026 19:36:46 -0600 Subject: [PATCH 1/2] feat: add installCommand field and second cmd row per plugin card MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - build-jsonld.ts: add installCommand to Plugin type, toPlugin, and toPluginEntry - web/index.html: rename makeCmdRow→makeAddRow, add makeInstallRow, update buildCard --- scripts/build-jsonld.ts | 5 ++++- web/index.html | 32 ++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 7 deletions(-) mode change 100755 => 100644 scripts/build-jsonld.ts diff --git a/scripts/build-jsonld.ts b/scripts/build-jsonld.ts old mode 100755 new mode 100644 index a2b74d0..e560146 --- a/scripts/build-jsonld.ts +++ b/scripts/build-jsonld.ts @@ -20,6 +20,7 @@ type Plugin = { versionSource: string hasPackages: boolean addCommand: string + installCommand: string } const DEFAULT_OSES = ['Linux', 'macOS', 'Windows'] @@ -131,6 +132,7 @@ const toPlugin = (baseUrl: string) => (file: string, raw: Raw): Plugin => { versionSource: detectVersionSource(resolveBlock), hasPackages: isObject(raw.packages), addCommand: `proto plugin add ${id} "${fileUrl}"`, + installCommand: `proto install --pin -c local ${id} latest`, } } @@ -152,6 +154,7 @@ const toPluginEntry = (repoUrl: string, schemaUrl: string) => (plugin: Plugin) = versionSource: plugin.versionSource, hasPackages: plugin.hasPackages, addCommand: plugin.addCommand, + installCommand: plugin.installCommand, }) const toCatalog = ( @@ -192,7 +195,7 @@ const files = (await readdir(pluginsDir)).filter(file => PLUGIN_EXTENSIONS.has(e const plugins = await Promise.all(files.map(async file => { const text = await readFile(join(pluginsDir, file), 'utf8') - const raw = parsePluginFile(file, text) + const raw = parsePluginFile(file, raw) return toPlugin(baseUrl)(file, raw) })) diff --git a/web/index.html b/web/index.html index 380d587..4ee097a 100644 --- a/web/index.html +++ b/web/index.html @@ -196,6 +196,12 @@ display: none; } + .cmd-rows { + display: flex; + flex-direction: column; + gap: 0.375rem; + } + .cmd-row { display: flex; align-items: center; @@ -427,21 +433,33 @@

return host } - const makeCopyButton = plugin => { + const makeCopyButton = (cmd, label) => { const btn = makeEl('button', 'copy-btn') btn.type = 'button' - btn.dataset.cmd = plugin.addCommand ?? '' - btn.setAttribute('aria-label', `Copy command for ${plugin.identifier ?? ''}`) + btn.dataset.cmd = cmd + btn.setAttribute('aria-label', label) setIcon(btn, iconCopyTpl) return btn } - const makeCmdRow = plugin => { + const makeCmdRow = (cmd, ariaLabel) => { const row = makeEl('div', 'cmd-row') - row.append(makeEl('code', '', plugin.addCommand ?? ''), makeCopyButton(plugin)) + row.append(makeEl('code', '', cmd), makeCopyButton(cmd, ariaLabel)) return row } + const makeAddRow = plugin => + makeCmdRow( + plugin.addCommand ?? '', + `Copy add command for ${plugin.identifier ?? ''}`, + ) + + const makeInstallRow = plugin => + makeCmdRow( + plugin.installCommand ?? '', + `Copy install command for ${plugin.identifier ?? ''}`, + ) + const makePluginFileLink = plugin => { const link = makeEl('a', 'plugin-file-link', pluginFileName(plugin)) link.href = pluginFileUrl(plugin) @@ -460,10 +478,12 @@

const buildCard = plugin => { const card = makeEl('article', 'card') + const cmdRows = makeEl('div', 'cmd-rows') + cmdRows.append(makeAddRow(plugin), makeInstallRow(plugin)) card.append( makeHead(plugin), makeEl('p', 'card-desc', plugin.description ?? ''), - makeCmdRow(plugin), + cmdRows, makePluginFileLink(plugin), ) return card From 255e45bd00b063d25322f542b05f1640df8cb8ee Mon Sep 17 00:00:00 2001 From: Tom Davidson Date: Sun, 10 May 2026 21:13:08 -0600 Subject: [PATCH 2/2] fix: parsePluginFile(file, raw) -> parsePluginFile(file, text) --- scripts/build-jsonld.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-jsonld.ts b/scripts/build-jsonld.ts index e560146..accd295 100644 --- a/scripts/build-jsonld.ts +++ b/scripts/build-jsonld.ts @@ -195,7 +195,7 @@ const files = (await readdir(pluginsDir)).filter(file => PLUGIN_EXTENSIONS.has(e const plugins = await Promise.all(files.map(async file => { const text = await readFile(join(pluginsDir, file), 'utf8') - const raw = parsePluginFile(file, raw) + const raw = parsePluginFile(file, text) return toPlugin(baseUrl)(file, raw) }))