MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / describeInstallAction

Function describeInstallAction

apps/kimi-code/src/tui/commands/plugins.ts:504–521  ·  view source on GitHub ↗
(
  previous: PluginSummary | undefined,
  next: PluginSummary,
)

Source from the content-addressed store, hash-verified

502}
503
504function describeInstallAction(
505 previous: PluginSummary | undefined,
506 next: PluginSummary,
507): string {
508 const sourceLabel = formatPluginSourceLabel(next);
509 const versionFromTo = (prev?: string, cur?: string): string => {
510 if (prev === undefined || prev === cur) return cur === undefined ? '' : ` ${cur}`;
511 return ` ${prev} → ${cur ?? '-'}`;
512 };
513 if (previous === undefined) {
514 return `Installed ${next.displayName}${versionFromTo(undefined, next.version)} ${sourcePhrase(sourceLabel)}`;
515 }
516 if (sourceIdentity(previous) !== sourceIdentity(next)) {
517 const prevSourceLabel = formatPluginSourceLabel(previous);
518 return `Migrated ${next.displayName}: ${prevSourceLabel} → ${sourceLabel}${versionFromTo(previous.version, next.version)}`;
519 }
520 return `Updated ${next.displayName}${versionFromTo(previous.version, next.version)} ${sourcePhrase(sourceLabel)}`;
521}
522
523// formatPluginSourceLabel already prefixes zip-url hosts with "via", so adding
524// "from" would read as "from via <host>". Only prepend "from" otherwise.

Callers 1

showPluginInstallResultFunction · 0.85

Calls 4

formatPluginSourceLabelFunction · 0.90
versionFromToFunction · 0.85
sourcePhraseFunction · 0.85
sourceIdentityFunction · 0.85

Tested by

no test coverage detected