MCPcopy Index your code
hub / github.com/anomalyco/opencode / packageTargets

Function packageTargets

packages/opencode/src/plugin/install.ts:145–166  ·  view source on GitHub ↗
(pkg: { json: Record<string, unknown>; dir: string; pkg: string })

Source from the content-addressed store, hash-verified

143}
144
145function packageTargets(pkg: { json: Record<string, unknown>; dir: string; pkg: string }) {
146 const spec =
147 typeof pkg.json.name === "string" && pkg.json.name.trim().length > 0 ? pkg.json.name.trim() : path.basename(pkg.dir)
148 const targets: Target[] = []
149 const server = exportTarget(pkg.json, "server")
150 if (server) {
151 targets.push({ kind: "server", opts: server.opts })
152 } else if (hasMainTarget(pkg.json)) {
153 targets.push({ kind: "server" })
154 }
155
156 const tui = exportTarget(pkg.json, "tui")
157 if (tui) {
158 targets.push({ kind: "tui", opts: tui.opts })
159 }
160
161 if (!targets.some((item) => item.kind === "tui") && readPackageThemes(spec, pkg).length) {
162 targets.push({ kind: "tui" })
163 }
164
165 return targets
166}
167
168function patch(text: string, path: Array<string | number>, value: unknown, insert = false) {
169 return applyEdits(

Callers 1

readPluginManifestFunction · 0.85

Calls 4

readPackageThemesFunction · 0.90
exportTargetFunction · 0.85
hasMainTargetFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected