Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/app",
"version": "1.18.6",
"version": "1.18.7",
"description": "",
"type": "module",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/cli",
"version": "1.18.6",
"version": "1.18.7",
"type": "module",
"license": "MIT",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion packages/codemode/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/codemode",
"version": "1.18.6",
"version": "1.18.7",
"description": "Effect-native confined code execution over schema-described tools",
"private": true,
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/console/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-app",
"version": "1.18.6",
"version": "1.18.7",
"type": "module",
"license": "MIT",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/console/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/console-core",
"version": "1.18.6",
"version": "1.18.7",
"private": true,
"type": "module",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/console/function/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-function",
"version": "1.18.6",
"version": "1.18.7",
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/console/mail/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-mail",
"version": "1.18.6",
"version": "1.18.7",
"dependencies": {
"@jsx-email/all": "2.2.3",
"@jsx-email/cli": "1.4.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/console/support/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-support",
"version": "1.18.6",
"version": "1.18.7",
"type": "module",
"license": "MIT",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "1.18.6",
"version": "1.18.7",
"name": "@opencode-ai/core",
"type": "module",
"license": "MIT",
Expand Down
29 changes: 23 additions & 6 deletions packages/core/src/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,39 @@ const layer = Layer.effect(

const add = Effect.fn("Npm.add")(function* (pkg: string) {
const dir = directory(pkg)
const name = (() => {
const npaName = (() => {
try {
return npa(pkg).name ?? pkg
return npa(pkg).name ?? undefined
} catch {
return pkg
return undefined
}
})()

if (yield* afs.existsSafe(path.join(dir, "node_modules", name))) {
return resolveEntryPoint(name, path.join(dir, "node_modules", name))
if (yield* afs.existsSafe(dir)) {
// For non-registry specs (remote tarball URLs, git+https://, github:
// shorthand, file: paths), npa(pkg).name returns undefined — only
// registry packages have inferable names from the spec alone. Read
// the install-root package.json (written by Arborist on the initial
// install) to recover the actual installed package name from its
// first dependency entry, matching what the fresh-install path
// computes from the arborist tree below.
const cachedPkg = yield* afs.readJson(path.join(dir, "package.json")).pipe(Effect.option)
if (Option.isSome(cachedPkg)) {
const deps = (cachedPkg.value as { dependencies?: Record<string, unknown> })?.dependencies
const first = deps && Object.keys(deps)[0]
if (first) {
return resolveEntryPoint(first, path.join(dir, "node_modules", first))
}
}
// Cache directory exists but is empty / has no installable package.json —
// fall through to the Arborist install path below.
}

const tree = yield* reify({ dir, add: [pkg] })
const first = tree.edgesOut.values().next().value?.to
if (!first) {
const result = resolveEntryPoint(name, path.join(dir, "node_modules", name))
const fallbackName = npaName ?? pkg
const result = resolveEntryPoint(fallbackName, path.join(dir, "node_modules", fallbackName))
if (result.entrypoint) return result
return yield* new InstallFailedError({ add: [pkg], dir })
}
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@opencode-ai/desktop",
"private": true,
"version": "1.18.6",
"version": "1.18.7",
"type": "module",
"license": "MIT",
"homepage": "https://opencode.ai",
Expand Down
2 changes: 1 addition & 1 deletion packages/effect-drizzle-sqlite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "1.18.6",
"version": "1.18.7",
"name": "@opencode-ai/effect-drizzle-sqlite",
"type": "module",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/effect-sqlite-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "1.18.6",
"version": "1.18.7",
"name": "@opencode-ai/effect-sqlite-node",
"type": "module",
"license": "MIT",
Expand Down
Loading
Loading