MCPcopy Create free account
hub / github.com/anomalyco/opencode / add

Function add

packages/app/src/context/server.tsx:255–269  ·  view source on GitHub ↗
(input: ServerConnection.Http)

Source from the content-addressed store, hash-verified

253 }
254
255 function add(input: ServerConnection.Http) {
256 const url_ = normalizeServerUrl(input.http.url)
257 if (!url_) return
258 const conn: ServerConnection.Http = { ...input, authToken: undefined, http: { ...input.http, url: url_ } }
259 return batch(() => {
260 const existing = store.list.findIndex((x) => url(x) === url_)
261 if (existing !== -1) {
262 setStore("list", existing, conn)
263 } else {
264 setStore("list", store.list.length, conn)
265 }
266 setState("active", ServerConnection.key(conn))
267 return conn
268 })
269 }
270
271 function remove(key: ServerConnection.Key) {
272 const next = nextServerAfterRemoval(allServers(), key, props.defaultServer)

Callers

nothing calls this directly

Calls 6

batchFunction · 0.85
setStoreFunction · 0.85
setStateFunction · 0.85
normalizeServerUrlFunction · 0.70
urlFunction · 0.70
keyMethod · 0.45

Tested by

no test coverage detected