- 设置页侧边栏内容/文件预览两个网格末尾各增虚线卡片,弹出对应 kind 的插件弹窗 - 弹窗:GitHub topic 按钮(新标签页)+ 推荐插件目录(plugins-tabs.ts / plugins-viewers.ts) - 每条目「跳转」(window.open 新标签页直达仓库)与「复制」(writeClipboard + 已复制反馈) - 不做终端预填流:不关闭弹窗、不打开终端、无失败路径(install/installNotice/installError* 文案删除) - 内置 Office 预览(docx/xlsx/pptx)整体移除,chunk 白名单 5→2(terminal/editor) - 文案「内置插件」→「推荐插件」;AGENTS.md/README/设计文档同步
56 lines
2.0 KiB
JavaScript
56 lines
2.0 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Assemble the plugin-registry installable root (`registry/`) from the built
|
|
* `lib/` output. Run after `pnpm build`:
|
|
*
|
|
* pnpm build
|
|
* node scripts/package-registry.mjs
|
|
* dsh registry install ./registry
|
|
* dsh registry enable dsh-external/dsh-better-sidebar
|
|
*
|
|
* The registry install copies the whole source directory (`cp -r`), so
|
|
* installing the repo root would drag in `node_modules/` (machine-local
|
|
* `link:` devDependency symlinks, node-pty binaries) and `.git/`. This
|
|
* staging directory carries exactly the files the manifest references plus
|
|
* the docs — same layout as the dsh-subagent-tree `registry/` pattern. It is
|
|
* gitignored and rebuilt from scratch on every run.
|
|
*/
|
|
import { cpSync, existsSync, mkdirSync, rmSync } from 'node:fs'
|
|
import { dirname, join, resolve } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
const root = resolve(fileURLToPath(import.meta.url), '..', '..')
|
|
const out = join(root, 'registry')
|
|
|
|
/** Files copied into registry/, preserving relative paths (lib/ stays lib/). */
|
|
const files = [
|
|
'dsh.plugin.json',
|
|
'lib/index.js',
|
|
'lib/invariant.js',
|
|
'lib/client-registry.js',
|
|
'lib/client-registry.js.map',
|
|
// Lazy chunks: the client fetches these from the host's /sidebar/bundle
|
|
// route on first use (see src/client/chunk-loader.ts / src/bundle-route.ts).
|
|
'lib/client-terminal.js',
|
|
'lib/client-terminal.js.map',
|
|
'lib/client-editor.js',
|
|
'lib/client-editor.js.map',
|
|
'README.md',
|
|
'LICENSE',
|
|
]
|
|
|
|
rmSync(out, { recursive: true, force: true })
|
|
mkdirSync(out, { recursive: true })
|
|
for (const file of files) {
|
|
const source = join(root, file)
|
|
if (!existsSync(source)) {
|
|
console.error(`missing ${file} — run \`pnpm build\` first`)
|
|
process.exit(1)
|
|
}
|
|
const target = join(out, file)
|
|
mkdirSync(dirname(target), { recursive: true })
|
|
cpSync(source, target)
|
|
}
|
|
console.log(`registry/ assembled (${files.length} files)`)
|
|
console.log('next: dsh registry install ./registry && dsh registry enable dsh-external/dsh-better-sidebar')
|