MCPcopy
hub / github.com/anomalyco/opencode / sync

Function sync

packages/tui/src/context/project.tsx:38–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36 })
37
38 async function sync() {
39 const workspace = store.workspace.current
40 const [instancePath, project] = await Promise.all([
41 sdk.client.path.get({ workspace }),
42 sdk.client.project.current({ workspace }),
43 ])
44 const directories = project.data?.id
45 ? await sdk.client.project.directories({ projectID: project.data.id, workspace })
46 : undefined
47 batch(() => {
48 setStore("instance", "path", reconcile(instancePath.data || defaultPath))
49 setStore("project", "id", project.data?.id)
50 setStore("project", "worktree", project.data?.worktree)
51 setStore("project", "mainDir", directories?.data?.findLast((item) => item.strategy === undefined)?.directory)
52 })
53 }
54
55 async function syncWorkspace() {
56 const listed = await sdk.client.experimental.workspace.list().catch(() => undefined)

Callers

nothing calls this directly

Calls 7

batchFunction · 0.85
setStoreFunction · 0.85
directoriesMethod · 0.80
getMethod · 0.65
reconcileFunction · 0.50
allMethod · 0.45
currentMethod · 0.45

Tested by

no test coverage detected