MCPcopy Create free account
hub / github.com/ZToolsCenter/ZTools / updateProjectMeta

Function updateProjectMeta

src/main/api/renderer/pluginDevelopmentRegistry.ts:537–575  ·  view source on GitHub ↗
(options: UpdateProjectMetaParams)

Source from the content-addressed store, hash-verified

535 * 更新开发项目的元数据,直接写入 configSnapshot 对应字段。
536 */
537export function updateProjectMeta(options: UpdateProjectMetaParams): DevProjectMutationResult {
538 const clock = options.now ?? nowIso
539 const { projectName, meta } = options
540
541 const existing = options.registry.projects[projectName]
542 if (!existing) {
543 return {
544 success: false,
545 reason: `开发项目 "${projectName}" 不存在`,
546 registry: options.registry
547 }
548 }
549
550 const ts = clock()
551 const updatedEntry: DevProjectRecord = {
552 ...existing,
553 configSnapshot: {
554 ...existing.configSnapshot,
555 ...(meta.title ? { title: meta.title } : {}),
556 ...(meta.description !== undefined ? { description: meta.description } : {}),
557 ...(meta.author !== undefined ? { author: meta.author } : {}),
558 ...(Array.isArray(meta.platform) && meta.platform.length > 0
559 ? { platform: meta.platform }
560 : {})
561 },
562 updatedAt: ts
563 }
564
565 return {
566 success: true,
567 registry: {
568 version: options.registry.version,
569 projects: {
570 ...options.registry.projects,
571 [projectName]: updatedEntry
572 }
573 }
574 }
575}

Callers 1

updateDevProjectMetaMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected