universal-plugin-hub 1.0.50 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,10 +3,11 @@
3
3
  * DSH's native user-dsh root. Directory bundles use junctions on Windows (and
4
4
  * directory symlinks elsewhere); a bare SKILL.md is copied as <name>.md.
5
5
  */
6
- import { cpSync, copyFileSync, existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, symlinkSync } from 'node:fs'
6
+ import { cpSync, copyFileSync, existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, symlinkSync } from 'node:fs'
7
7
  import { createHash } from 'node:crypto'
8
8
  import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path'
9
- import { dshSkillsDir, readState, safeRmDir, uploadedSkillsDir, writeState } from './store.js'
9
+ import { homedir } from 'node:os'
10
+ import { dshSkillsDir, installedDir, readState, safeRmDir, uploadedSkillsDir, writeState } from './store.js'
10
11
 
11
12
  const SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/
12
13
 
@@ -16,6 +17,15 @@ function samePath(a, b) {
16
17
  return process.platform === 'win32' ? left.toLowerCase() === right.toLowerCase() : left === right
17
18
  }
18
19
 
20
+ function canonical(path) {
21
+ try { return realpathSync.native(path) } catch { return resolve(path) }
22
+ }
23
+
24
+ function pathKey(path) {
25
+ const value = canonical(path)
26
+ return process.platform === 'win32' ? value.toLowerCase() : value
27
+ }
28
+
19
29
  /**
20
30
  * The switch state is keyed by this hash (see skillId in skills.js), and the
21
31
  * junction means the discovered path resolves to the private original, so both
@@ -92,25 +102,107 @@ function readFileSyncSafe(file) {
92
102
  try { return readFileSync(file, 'utf8') } catch { return '' }
93
103
  }
94
104
 
105
+ /**
106
+ * Every name that already answers to a skill, scanned once per import. The
107
+ * name a skill answers to is its frontmatter `name` — the directory is only a
108
+ * fallback, exactly as the Skills tab reads it — so a collection member can
109
+ * be detected even when its folder is named differently.
110
+ */
111
+ export function takenSkillNames() {
112
+ return collectTakenNames(pluginMirrorPaths())
113
+ }
114
+
115
+ function collectTakenNames(mirrors) {
116
+ const names = new Set()
117
+ for (const record of readState().uploadedSkills || []) names.add(record.name)
118
+ for (const root of [dshSkillsDir(), join(process.env.DSH_AGENTS_HOME || join(homedir(), '.agents'), 'skills')]) {
119
+ let children
120
+ try { children = readdirSync(root, { withFileTypes: true }) } catch { continue }
121
+ for (const entry of children) {
122
+ const path = join(root, entry.name)
123
+ try {
124
+ // A junction reads as a link, not a directory, so the entry alone
125
+ // cannot decide the shape — the stat the Skills tab uses does.
126
+ const stat = entry.isSymbolicLink() ? statSync(path) : entry
127
+ if (stat.isDirectory()) {
128
+ if (mirrors.has(pathKey(path))) continue
129
+ const manifest = readdirSync(path).find((file) => /^skill\.md$/i.test(file))
130
+ if (!manifest) continue
131
+ names.add(declaredName(readFileSyncSafe(join(path, manifest))) || entry.name)
132
+ } else if (stat.isFile() && /\.md$/i.test(entry.name)) {
133
+ names.add(declaredName(readFileSyncSafe(path)) || entry.name.replace(/\.md$/i, ''))
134
+ }
135
+ } catch {}
136
+ }
137
+ }
138
+ return names
139
+ }
140
+
141
+ /**
142
+ * A plugin's skills are mirrored into the user-dsh root by the plugin pipeline.
143
+ * The Skills tab hides them, so reporting one as taken would offer an overwrite
144
+ * that permanently costs the plugin its own copy. Ownership is decided the way
145
+ * the tab decides it: the mirror is a byte copy of the plugin's SKILL.md.
146
+ *
147
+ * This reads files, so it is scanned once per batch and passed down rather
148
+ * than cached module-wide: nothing would tell such a cache when to expire.
149
+ */
150
+ function pluginMirrorPaths() {
151
+ const owned = new Set()
152
+ for (const plugin of readState().plugins || []) {
153
+ let children
154
+ try { children = readdirSync(join(installedDir(plugin.name), 'skills'), { withFileTypes: true }) } catch { continue }
155
+ for (const child of children) {
156
+ try {
157
+ const source = readFileSync(join(installedDir(plugin.name), 'skills', child.name, 'SKILL.md'), 'utf8')
158
+ const target = join(dshSkillsDir(), child.name)
159
+ if (isUploadedSkillTarget(target)) continue
160
+ if (readFileSyncSafe(join(target, 'SKILL.md')) !== source) continue
161
+ owned.add(pathKey(target))
162
+ } catch {}
163
+ }
164
+ }
165
+ return owned
166
+ }
167
+
168
+ function declaredName(raw) {
169
+ const frontmatter = raw.match(/^\uFEFF?---\r?\n([\s\S]*?)\r?\n---/)
170
+ if (!frontmatter) return ''
171
+ return (frontmatter[1].match(/^name:\s*(.+)$/m)?.[1] || '').trim().replace(/^['"]|['"]$/g, '')
172
+ }
173
+
174
+ /** Both shapes a skill can be exposed as, since one name may leave a stale other. */
175
+ function targetPaths(name) {
176
+ return [recordPaths(name, 'directory').target, recordPaths(name, 'file').target]
177
+ }
178
+
95
179
  /** Every rejection this import can raise, so a batch can be checked up front. */
96
- function preflight(entry, { overwrite, singleFile, fileDir = null }) {
180
+ function preflight(entry, { overwrite, overwriteNames, singleFile, fileDir = null, taken = null }) {
97
181
  const { name, file } = validateEntry(entry)
98
182
  const kind = singleFile ? 'file' : 'directory'
99
183
  const paths = recordPaths(name, kind)
100
184
  const previous = uploadedSkillRecord(name)
101
- if (previous && !overwrite) throw new Error(`已存在同名 Skill「${name}」`)
102
- if (!previous && pathExists(paths.target)) {
185
+ // Overwriting one clashing member of a collection must not silently replace
186
+ // the others, so a named list wins over the blanket flag: it names exactly
187
+ // what the user was shown.
188
+ const replace = Array.isArray(overwriteNames) && overwriteNames.length
189
+ ? overwriteNames.includes(name)
190
+ : overwrite === true
191
+ if (!replace && (taken || takenSkillNames()).has(name)) throw new Error(`已存在同名 Skill「${name}」`)
192
+ // A recorded upload is already in `taken`, so reaching here means nothing
193
+ // answers to the name yet and whatever sits at the target is the user's own.
194
+ if (!replace && targetPaths(name).some(pathExists)) {
103
195
  throw new Error(`DSH Skills 目录已存在「${name}」,为避免覆盖你的文件,本次未导入`)
104
196
  }
105
197
  const source = resolve(entry.dir)
106
198
  if (contains(uploadedSkillsDir(), source) || contains(source, uploadedSkillsDir())) {
107
199
  throw new Error('导入源与技能存储目录重叠,请从独立文件夹导入')
108
200
  }
109
- return { name, file, kind, paths, previous, source }
201
+ return { name, file, kind, paths, previous, source, replace }
110
202
  }
111
203
 
112
204
  function installOne(entry, options) {
113
- const { name, file, kind, paths, previous, source } = preflight(entry, options)
205
+ const { name, file, kind, paths, previous, source, replace } = preflight(entry, options)
114
206
  // A bare SKILL.md file, or a flat `<name>.md` sitting beside other skills in
115
207
  // one folder, has no assets to carry: only the manifest is copied.
116
208
  const manifestOnly = options.singleFile || options.fileDir
@@ -131,6 +223,13 @@ function installOne(entry, options) {
131
223
  if (previous) {
132
224
  removeTarget(previous)
133
225
  safeRmDir(recordPaths(previous.name, previous.kind).sourceDir)
226
+ } else if (replace) {
227
+ // A copy the user placed in the DSH root themselves: they just agreed to
228
+ // replace it. Clear both exposed shapes: a leftover of the other one
229
+ // answers to the same name and splits one command across two cards.
230
+ removeTarget({ name, kind })
231
+ removeTarget({ name, kind: kind === 'file' ? 'directory' : 'file' })
232
+ if (pathExists(paths.sourceDir)) safeRmDir(paths.sourceDir)
134
233
  }
135
234
  renameSync(staging, paths.sourceDir)
136
235
  staged = false
@@ -142,7 +241,7 @@ function installOne(entry, options) {
142
241
  state.uploadedSkills = [...(state.uploadedSkills || []).filter(item => item.name !== name),
143
242
  { name, kind, ...paths, uploadedAt: previous?.uploadedAt || Date.now(), updatedAt: Date.now() }]
144
243
  writeState(state)
145
- return { name, kind }
244
+ return { name, kind, replace }
146
245
  } catch (error) {
147
246
  // Roll back only what this attempt created; never delete an old original
148
247
  // that was already removed before the failure (its target is gone too, so
@@ -155,20 +254,25 @@ function installOne(entry, options) {
155
254
  }
156
255
  }
157
256
 
158
- export function installUploadedSkills(entries, { overwrite = false, singleFile = false } = {}) {
257
+ export function installUploadedSkills(entries, { overwrite = false, overwriteNames = null, singleFile = false } = {}) {
159
258
  if (!Array.isArray(entries) || entries.length === 0) throw new Error('未检测到可上传的 Skill')
160
259
  // A batch must not half-install: every rejection this import can predict is
161
260
  // raised before the first file moves, so a duplicate name in the middle of
162
261
  // the package cannot leave the earlier skills live while the UI reports a
163
262
  // failure.
164
- for (const entry of entries) preflight(entry, { overwrite, singleFile, fileDir: entry.singleFile })
263
+ const taken = takenSkillNames()
264
+ const options = { overwrite, overwriteNames, singleFile, taken }
265
+ for (const entry of entries) preflight(entry, { ...options, fileDir: entry.singleFile })
165
266
  const installed = []
166
267
  try {
167
268
  for (const entry of entries) {
168
269
  const replaced = !!uploadedSkillRecord(String(entry?.row?.name || ''))
169
- installed.push({ ...installOne(entry, { overwrite, singleFile, fileDir: entry.singleFile }), replaced })
270
+ const installedOne = installOne(entry, { ...options, fileDir: entry.singleFile })
271
+ // An overwrite has already destroyed whatever it replaced, so undoing it
272
+ // would leave nothing behind, not even the copy this import just wrote.
273
+ installed.push({ ...installedOne, replaced: replaced || installedOne.replace })
170
274
  }
171
- return installed.map(({ replaced, ...skill }) => skill)
275
+ return installed.map(({ replaced, replace, ...skill }) => skill)
172
276
  } catch (error) {
173
277
  // Only a failure preflight cannot see (disk, permissions) gets here. Undo
174
278
  // the entries this batch created; an overwrite has already replaced its
package/src/skills.js CHANGED
@@ -431,7 +431,14 @@ export function createSkillsManager(root) {
431
431
  const after = await status(item)
432
432
  const desired = enabled ? item.invocation : { modelInvocable: false, userInvocable: false }
433
433
  if (!after.available || !after.invocations.every(policy => policy.modelInvocable === desired.modelInvocable && policy.userInvocable === desired.userInvocable)) {
434
- state.disabledLocalSkills = previous; writeState(state); invalidateAll()
434
+ const current = readState()
435
+ const restored = { ...(current.disabledLocalSkills || {}) }
436
+ for (const location of item.locations) {
437
+ if (Object.prototype.hasOwnProperty.call(previous, location.id)) restored[location.id] = previous[location.id]
438
+ else delete restored[location.id]
439
+ }
440
+ current.disabledLocalSkills = restored
441
+ writeState(current); invalidateAll()
435
442
  catalogChanged?.()
436
443
  throw new Error(after.message || 'DSH 未确认开关状态,已恢复原状态')
437
444
  }
package/src/store.js CHANGED
@@ -7,39 +7,140 @@
7
7
  * installed/<name>/ — installed plugin copies
8
8
  */
9
9
  import { homedir } from 'node:os'
10
- import { dirname, join } from 'node:path'
11
- import { existsSync, mkdirSync, readFileSync, writeFileSync, renameSync, statSync, rmSync } from 'node:fs'
10
+ import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path'
11
+ import { existsSync, mkdirSync, readFileSync, writeFileSync, renameSync, statSync, lstatSync, rmSync, rmdirSync, unlinkSync, readdirSync } from 'node:fs'
12
12
  import { execFileSync } from 'node:child_process'
13
13
 
14
+ let TRASH_SEQ = 0
15
+ let TRASH_SWEEP_TIMER = null
16
+ const PENDING_TRASH_PATHS = new Set()
17
+ let STATE_TMP_SEQ = 0
18
+
19
+ function canonicalComparePath(p) {
20
+ const resolved = resolve(p)
21
+ return process.platform === 'win32' ? resolved.toLowerCase() : resolved
22
+ }
23
+
24
+ export function isSameOrInsidePath(child, parent) {
25
+ if (!child || !parent) return false
26
+ const c = canonicalComparePath(child)
27
+ const p = canonicalComparePath(parent)
28
+ if (c === p) return true
29
+ const rel = relative(p, c)
30
+ return rel !== '' && !isAbsolute(rel) && rel !== '..' && !rel.startsWith(`..${sep}`)
31
+ }
32
+
33
+ function scheduleTrashSweep(trashed) {
34
+ if (trashed) PENDING_TRASH_PATHS.add(trashed)
35
+ if (TRASH_SWEEP_TIMER) return
36
+ TRASH_SWEEP_TIMER = setTimeout(() => {
37
+ TRASH_SWEEP_TIMER = null
38
+ try { sweepTrash() } catch {}
39
+ }, 5000)
40
+ TRASH_SWEEP_TIMER.unref?.()
41
+ }
42
+
43
+ function unlinkReparsePointsSync(dir) {
44
+ let entries
45
+ try {
46
+ entries = readdirSync(dir, { withFileTypes: true })
47
+ } catch {
48
+ return
49
+ }
50
+ for (const entry of entries) {
51
+ const child = join(dir, entry.name)
52
+ if (entry.isSymbolicLink()) {
53
+ try { unlinkSync(child) } catch { try { rmdirSync(child) } catch {} }
54
+ } else if (entry.isDirectory()) {
55
+ unlinkReparsePointsSync(child)
56
+ }
57
+ }
58
+ }
59
+
14
60
  /** Robust directory deletion handling Windows readonly/locked files. */
15
- export function safeRmDir(dir) {
16
- if (!dir || !existsSync(dir)) return
61
+ export function safeRmDir(dir, { allowTrash = true, quarantineRoot = trashRoot() } = {}) {
62
+ if (!dir) return
63
+ // A dangling junction is invisible to existsSync. Unlink junctions directly
64
+ // so the Windows directory fallbacks never operate on their targets.
65
+ let entry
66
+ let lstatErr = null
67
+ try { entry = lstatSync(dir, { throwIfNoEntry: false }) } catch (err) { lstatErr = err }
68
+ if (entry?.isSymbolicLink()) {
69
+ try {
70
+ unlinkSync(dir)
71
+ } catch {
72
+ try { rmdirSync(dir) } catch {
73
+ try { rmSync(dir, { recursive: true, force: true }) } catch {}
74
+ }
75
+ }
76
+ return
77
+ }
78
+ if (!entry && !lstatErr && !existsSync(dir)) return
79
+ if (entry && !entry.isDirectory()) {
80
+ try {
81
+ rmSync(dir, { force: true })
82
+ return
83
+ } catch {}
84
+ }
17
85
  try {
18
- rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 50 })
86
+ rmSync(dir, { recursive: true, force: true })
19
87
  return
20
88
  } catch (err) {
21
- if (process.platform === 'win32') {
89
+ if (allowTrash && quarantineRoot && !isSameOrInsidePath(dir, quarantineRoot) && !isSameOrInsidePath(quarantineRoot, dir)) {
22
90
  try {
23
- execFileSync('cmd.exe', ['/c', `attrib -r -s -h "${dir}\\*" /s /d`], { stdio: 'ignore', windowsHide: true })
24
- rmSync(dir, { recursive: true, force: true, maxRetries: 3, retryDelay: 50 })
91
+ mkdirSync(quarantineRoot, { recursive: true })
92
+ const seq = (TRASH_SEQ = (TRASH_SEQ + 1) & 0xffffff).toString(36)
93
+ const trashed = join(quarantineRoot, `${basename(dir) || 'dir'}-${process.pid}-${Date.now().toString(36)}-${seq}`)
94
+ renameSync(dir, trashed)
95
+ scheduleTrashSweep(trashed)
25
96
  return
26
97
  } catch {}
27
- try {
28
- execFileSync('cmd.exe', ['/c', `rd /s /q "${dir}"`], { stdio: 'ignore', windowsHide: true })
29
- if (!existsSync(dir)) return
30
- } catch {}
31
- try {
32
- const trash = `${dir}.trash-${Date.now()}`
33
- renameSync(dir, trash)
98
+ }
99
+ if (process.platform === 'win32') {
100
+ // Never let attrib.exe or rd traverse into a junction target outside `dir`.
101
+ unlinkReparsePointsSync(dir)
102
+ const isPermErr = err?.code === 'EPERM' || err?.code === 'EACCES'
103
+ if (isPermErr) {
34
104
  try {
35
- execFileSync('cmd.exe', ['/c', `rd /s /q "${trash}"`], { stdio: 'ignore', windowsHide: true })
105
+ execFileSync('attrib.exe', ['-r', '-s', '-h', dir], { stdio: 'ignore', windowsHide: true })
36
106
  } catch {}
37
- return
38
- } catch {}
107
+ try {
108
+ execFileSync('attrib.exe', ['-r', '-s', '-h', join(dir, '*'), '/s', '/d'], { stdio: 'ignore', windowsHide: true })
109
+ rmSync(dir, { recursive: true, force: true })
110
+ return
111
+ } catch {}
112
+ }
113
+ if (err?.code !== 'EBUSY') {
114
+ try {
115
+ execFileSync('cmd.exe', ['/d', '/s', '/c', `rd /s /q "${dir}"`], { stdio: 'ignore', windowsHide: true })
116
+ let remaining = null
117
+ try { remaining = lstatSync(dir, { throwIfNoEntry: false }) } catch { remaining = true }
118
+ if (!remaining) return
119
+ } catch {}
120
+ }
39
121
  }
40
122
  }
41
123
  }
42
124
 
125
+ /** Remove managed files before forgetting the record needed to retry cleanup. */
126
+ export function removeManagedDir(dir, { allowTrash = false } = {}) {
127
+ safeRmDir(dir, { allowTrash })
128
+ let remaining = null
129
+ let lstatErr = null
130
+ try {
131
+ remaining = lstatSync(dir, { throwIfNoEntry: false })
132
+ } catch (err) {
133
+ lstatErr = err
134
+ }
135
+ if (remaining || lstatErr) {
136
+ throw Object.assign(new Error(`无法清理目录:${dir}`), {
137
+ code: lstatErr?.code || 'EBUSY',
138
+ syscall: lstatErr?.syscall || 'rmdir',
139
+ path: dir,
140
+ })
141
+ }
142
+ }
143
+
43
144
  let STATE_CACHE = null
44
145
  let STATE_CACHE_MTIME = 0
45
146
 
@@ -69,11 +170,66 @@ export function installedDir(name) {
69
170
  return join(marketRoot(), 'installed', name)
70
171
  }
71
172
 
173
+ /** Persistent per-plugin data directory (${PLUGIN_DATA} / ${CLAUDE_PLUGIN_DATA}). */
174
+ export function pluginDataDir(name) {
175
+ return join(marketRoot(), 'plugin-data', name)
176
+ }
177
+
178
+ /** Compiled normalized JSON hook file used when hooks need compilation/expansion. */
179
+ export function compiledHooksPath(name) {
180
+ return join(marketRoot(), 'compiled-hooks', `${name}.json`)
181
+ }
182
+
72
183
  /** Original copies of skills imported directly into the Skills tab. */
73
184
  export function uploadedSkillsDir() {
74
185
  return join(marketRoot(), 'uploaded')
75
186
  }
76
187
 
188
+ export function trashRoot() {
189
+ return join(marketRoot(), '.trash')
190
+ }
191
+
192
+ export function sweepTrash() {
193
+ for (const trashed of Array.from(PENDING_TRASH_PATHS)) {
194
+ try { safeRmDir(trashed, { allowTrash: false }) } catch {}
195
+ try {
196
+ if (!lstatSync(trashed, { throwIfNoEntry: false })) {
197
+ PENDING_TRASH_PATHS.delete(trashed)
198
+ const parent = dirname(trashed)
199
+ try { if (readdirSync(parent).length === 0) rmdirSync(parent) } catch {}
200
+ }
201
+ } catch {}
202
+ }
203
+ const root = trashRoot()
204
+ if (existsSync(root)) {
205
+ try {
206
+ for (const entry of readdirSync(root, { withFileTypes: true })) {
207
+ try { safeRmDir(join(root, entry.name), { allowTrash: false }) } catch {}
208
+ }
209
+ if (readdirSync(root).length === 0) {
210
+ try { rmdirSync(root) } catch {}
211
+ }
212
+ } catch {}
213
+ }
214
+ const legacyParents = [
215
+ dshSkillsDir(),
216
+ join(marketRoot(), 'installed'),
217
+ join(marketRoot(), 'market'),
218
+ join(marketRoot(), 'plugin-data'),
219
+ uploadedSkillsDir(),
220
+ ]
221
+ for (const parent of legacyParents) {
222
+ if (!existsSync(parent)) continue
223
+ try {
224
+ for (const entry of readdirSync(parent, { withFileTypes: true })) {
225
+ if (/\.trash-\d+$/.test(entry.name)) {
226
+ try { safeRmDir(join(parent, entry.name), { allowTrash: false }) } catch {}
227
+ }
228
+ }
229
+ } catch {}
230
+ }
231
+ }
232
+
77
233
  /** Default state: the built-in Anthropic source. */
78
234
  export function defaultState() {
79
235
  return {
@@ -97,12 +253,12 @@ export function readState() {
97
253
  if (!existsSync(path)) {
98
254
  const fresh = defaultState()
99
255
  writeState(fresh)
100
- return fresh
256
+ return structuredClone(fresh)
101
257
  }
102
258
  try {
103
259
  const stat = statSync(path)
104
260
  if (STATE_CACHE && STATE_CACHE_MTIME === stat.mtimeMs) {
105
- return STATE_CACHE
261
+ return structuredClone(STATE_CACHE)
106
262
  }
107
263
  const parsed = JSON.parse(readFileSync(path, 'utf8'))
108
264
  const base = defaultState()
@@ -114,7 +270,7 @@ export function readState() {
114
270
  }
115
271
  STATE_CACHE = merged
116
272
  STATE_CACHE_MTIME = stat.mtimeMs
117
- return merged
273
+ return structuredClone(merged)
118
274
  } catch {
119
275
  return defaultState()
120
276
  }
@@ -123,10 +279,12 @@ export function readState() {
123
279
  export function writeState(state) {
124
280
  const file = statePath()
125
281
  mkdirSync(dirname(file), { recursive: true })
126
- const tmp = join(dirname(file), `.state.${process.pid}.${Date.now().toString(36)}.tmp`)
127
- writeFileSync(tmp, JSON.stringify(state, null, 2), 'utf8')
282
+ const seq = (STATE_TMP_SEQ = (STATE_TMP_SEQ + 1) & 0xffffff).toString(36)
283
+ const tmp = join(dirname(file), `.state.${process.pid}.${Date.now().toString(36)}.${seq}.tmp`)
284
+ const snapshot = structuredClone(state)
285
+ writeFileSync(tmp, JSON.stringify(snapshot, null, 2), 'utf8')
128
286
  renameSync(tmp, file)
129
- STATE_CACHE = state
287
+ STATE_CACHE = snapshot
130
288
  try {
131
289
  STATE_CACHE_MTIME = statSync(file).mtimeMs
132
290
  } catch {
@@ -206,7 +364,8 @@ export function suggestSourceName(url) {
206
364
  const ownerLower = (owner || '').toLowerCase()
207
365
  const repoLower = (repo || '').toLowerCase()
208
366
 
209
- if (repoLower === 'claude-plugins-official' || ownerLower === 'anthropics') return 'Anthropic'
367
+ if (ownerLower === 'anthropics' && repoLower === 'knowledge-work-plugins') return 'Knowledge Work'
368
+ if (repoLower === 'claude-plugins-official') return 'Anthropic'
210
369
  if (repoLower === 'claude-plugins-community') return 'Community'
211
370
 
212
371
  const genericRepoNames = new Set([