MCPcopy
hub / github.com/cursor/community-plugins / installRelevantChanged

Function installRelevantChanged

apps/cursor/src/actions/update-plugin.ts:58–95  ·  view source on GitHub ↗
(
  prevComponents: ExistingComponent[],
  prevRepository: string | null,
  nextComponents: ComponentInput[],
  nextRepository: string | null,
)

Source from the content-addressed store, hash-verified

56}
57
58function installRelevantChanged(
59 prevComponents: ExistingComponent[],
60 prevRepository: string | null,
61 nextComponents: ComponentInput[],
62 nextRepository: string | null,
63): boolean {
64 if ((prevRepository ?? null) !== (nextRepository ?? null)) {
65 return true;
66 }
67
68 if (prevComponents.length !== nextComponents.length) {
69 return true;
70 }
71
72 const prevSorted = [...prevComponents]
73 .sort((a, b) => a.sort_order - b.sort_order)
74 .map(fingerprintComponent)
75 .sort();
76 const prevByKey = new Map(
77 prevComponents.map((c) => [
78 componentKey(c.type, resolveComponentSlug(c)),
79 c,
80 ]),
81 );
82 const nextSorted = nextComponents
83 .map((component) =>
84 fingerprintComponent({
85 ...component,
86 metadata: resolveComponentMetadata(component, prevByKey),
87 }),
88 )
89 .sort();
90
91 for (let i = 0; i < prevSorted.length; i++) {
92 if (prevSorted[i] !== nextSorted[i]) return true;
93 }
94 return false;
95}
96
97export const updatePluginAction = authActionClient
98 .metadata({

Callers 1

update-plugin.tsFile · 0.85

Calls 4

resolveComponentSlugFunction · 0.90
componentKeyFunction · 0.85
fingerprintComponentFunction · 0.85
resolveComponentMetadataFunction · 0.85

Tested by

no test coverage detected