MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / PublishConfirmation

Function PublishConfirmation

cli/src/components/publish-confirmation.tsx:237–417  ·  view source on GitHub ↗
({
  selectedAgents,
  allAgents,
  agentDefinitions,
  includeDependents,
  onToggleDependents,
})

Source from the content-addressed store, hash-verified

235)
236
237export const PublishConfirmation: React.FC<PublishConfirmationProps> = ({
238 selectedAgents,
239 allAgents,
240 agentDefinitions,
241 includeDependents,
242 onToggleDependents,
243}) => {
244 const theme = useTheme()
245 const [toggleHovered, setToggleHovered] = useState(false)
246
247 const selectedIds = useMemo(
248 () => new Set(selectedAgents.map((a) => a.id)),
249 [selectedAgents]
250 )
251
252 // Only include non-bundled agents in localAgentIds for dependency resolution
253 // (allAgents is already filtered to exclude bundled agents)
254 const localAgentIds = useMemo(
255 () => new Set(allAgents.map((a) => a.id)),
256 [allAgents]
257 )
258
259 // Compute dependencies (agents the selected agents spawn)
260 const dependencyIds = useMemo(
261 () => computeDependencies(selectedIds, agentDefinitions, localAgentIds),
262 [selectedIds, agentDefinitions, localAgentIds]
263 )
264
265 // Compute dependents (agents that spawn the selected agents)
266 const dependentIds = useMemo(
267 () => computeDependents(selectedIds, dependencyIds, agentDefinitions, localAgentIds),
268 [selectedIds, dependencyIds, agentDefinitions, localAgentIds]
269 )
270
271 // Build lists with display info
272 const selectedList = useMemo(
273 () =>
274 selectedAgents.map((a) => ({
275 id: a.id,
276 displayName: a.displayName,
277 })),
278 [selectedAgents]
279 )
280
281 const dependencyList = useMemo(
282 () =>
283 Array.from(dependencyIds).map((id) => {
284 const agent = allAgents.find((a) => a.id === id)
285 return {
286 id,
287 displayName: agent?.displayName ?? id,
288 }
289 }),
290 [dependencyIds, allAgents]
291 )
292
293 const dependentList = useMemo(
294 () =>

Callers

nothing calls this directly

Calls 4

useThemeFunction · 0.90
computeDependenciesFunction · 0.85
computeDependentsFunction · 0.85
fromMethod · 0.80

Tested by

no test coverage detected