MCPcopy Create free account
hub / github.com/anus-dev/ANUS / getScopeMessageForSetting

Function getScopeMessageForSetting

packages/cli/src/utils/dialogScopeUtils.ts:37–65  ·  view source on GitHub ↗
(
  settingKey: string,
  selectedScope: SettingScope,
  settings: LoadedSettings,
)

Source from the content-addressed store, hash-verified

35 * Generate scope message for a specific setting
36 */
37export function getScopeMessageForSetting(
38 settingKey: string,
39 selectedScope: SettingScope,
40 settings: LoadedSettings,
41): string {
42 const otherScopes = Object.values(SettingScope).filter(
43 (scope) => scope !== selectedScope,
44 );
45
46 const modifiedInOtherScopes = otherScopes.filter((scope) => {
47 const scopeSettings = settings.forScope(scope).settings;
48 return settingExistsInScope(settingKey, scopeSettings);
49 });
50
51 if (modifiedInOtherScopes.length === 0) {
52 return '';
53 }
54
55 const modifiedScopesStr = modifiedInOtherScopes.join(', ');
56 const currentScopeSettings = settings.forScope(selectedScope).settings;
57 const existsInCurrentScope = settingExistsInScope(
58 settingKey,
59 currentScopeSettings,
60 );
61
62 return existsInCurrentScope
63 ? `(Also modified in ${modifiedScopesStr})`
64 : `(Modified in ${modifiedScopesStr})`;
65}

Callers 2

SettingsDialogFunction · 0.85
ThemeDialogFunction · 0.85

Calls 2

settingExistsInScopeFunction · 0.85
forScopeMethod · 0.80

Tested by

no test coverage detected