MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / run

Function run

apps/web/src/scripts/managed-indexing/enable-orgs.ts:112–182  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110
111 console.log('📋 Fetching organizations to enable...');
112
113 const trialOrgs = await getTrialOrgs();
114 const seatsOrgs = await getOrgsWithSeats();
115
116 const allOrgs = [...trialOrgs, ...seatsOrgs];
117
118 // Remove duplicates (in case an org matches multiple categories)
119 const uniqueOrgs = Array.from(new Map(allOrgs.map(org => [org.id, org])).values());
120
121 console.log(
122 ` Found ${uniqueOrgs.length} eligible organizations (without code indexing enabled):`
123 );
124 console.log(` - ${trialOrgs.length} in free trial (< 40 days old)`);
125 console.log(` - ${seatsOrgs.length} with seats`);
126 console.log('');
127
128 if (uniqueOrgs.length === 0) {
129 console.log('✅ No eligible organizations found. Nothing to do.');
130 return;
131 }
132
133 await cliConfirm(`Do you want to enable code indexing for ${uniqueOrgs.length} organizations?`);
134 console.log('');
135
136 console.log('🔧 Enabling code indexing...');
137 const { successCount, errorCount } = await enableCodeIndexingForOrgs(
138 uniqueOrgs,
139 admin.id,
140 admin.google_user_email,
141 admin.google_user_name
142 );
143
144 console.log('');
145 console.log('📊 Summary:');
146 console.log(` ✅ Success: ${successCount} organizations`);
147 console.log(` ❌ Errors: ${errorCount} organizations`);
148 console.log(` 📦 Total: ${uniqueOrgs.length} organizations`);
149 console.log('');
150
151 if (errorCount > 0) {
152 console.log('⚠️ Some organizations failed to update. Check the error details above.');
153 process.exit(1);
154 }
155
156 console.log('✨ Code indexing enablement complete!');
157}

Callers

nothing calls this directly

Calls 7

cliConfirmFunction · 0.90
getTrialOrgsFunction · 0.85
getOrgsWithSeatsFunction · 0.85
logMethod · 0.65
limitMethod · 0.65
valuesMethod · 0.65

Tested by

no test coverage detected