Skip to content

Create the OpenCode config directory before writing install defaults - #94

Merged
Dhravya merged 2 commits into
supermemoryai:mainfrom
Chebaleomkar:fix/install-create-config-dir
Sep 27, 2026
Merged

Dhravya merged 2 commits into
supermemoryai:mainfrom
Chebaleomkar:fix/install-create-config-dir

Conversation

@Chebaleomkar

Copy link
Copy Markdown
Contributor

Fixes #93

Problem

On a machine without ~/.config/opencode (plugin installed before OpenCode was ever run, fresh CI/Docker/headless boxes), install crashed with ENOENT on its first write to supermemory.json, before any of the later steps that create the folder could run. The installer did nothing and exited with a stack trace.

Fix

One line in install(): create OPENCODE_CONFIG_DIR (recursive, so a no-op when it exists) before writeInstallDefaults(). This matches what the later install steps already do (src/cli.ts:309, :323, :347). It lives in install() rather than config.ts, so it doesn't conflict with #92, which moves writeInstallDefaults into the CLI.

No behaviour change for users whose folder already exists.

Before / after

Empty HOME, install --no-tui:

# main (and published 2.0.15)
🧠 opencode-supermemory installer
Error: ENOENT: no such file or directory, open '<HOME>/.config/opencode/supermemory.json'
exit 1, ~/.config/opencode not created

# this branch
✓ Created <HOME>/.config/opencode/opencode.jsonc
✓ Enabled the persistent Supermemory footer for OpenCode V1 in <HOME>/.config/opencode/tui.jsonc
✓ Created /supermemory-index command  (… and the other 4 commands)
✓ Setup complete! Restart OpenCode (V1 and/or OpenCode 2) to activate.
exit 0

Testing

  • New src/cli.test.ts runs the real install --no-tui against an empty temporary home. It fails on main with the exact ENOENT and passes with this change.
  • bun run typecheck is clean and bun test passes (34 tests).
  • End to end with the built CLI on an empty home, on Windows 11 and on Linux (WSL2 Ubuntu 24.04). The full install completes and creates opencode.jsonc, tui.jsonc, supermemory.json and the command files.

On a machine where ~/.config/opencode does not exist yet (plugin
installed before OpenCode was ever run, fresh CI/Docker/headless
boxes), install crashed with ENOENT writing supermemory.json, before
any later step that creates the directory could run.
ishaanxgupta added a commit that referenced this pull request Sep 27, 2026
Fixes #97.

- Describe what the plugin does today: profile-only first-message context,
  direct recall by default, the real `[SUPERMEMORY]` and
  `<supermemory-context>` blocks, `search` scope and `limit` semantics,
  container tag precedence, `filterPrompt`, capture defaults, and
  `SUPERMEMORY_DEBUG`.
- Document the installer steps once, including the config-directory and
  in-place config handling from #92 and #94.
- The generated /supermemory-login command no longer claims a fixed port, and
  the tool's help lists `limit` for search.
- Add a CI workflow running typecheck, tests, and build on pull requests and
  pushes to main.
- Bump to 2.0.16 so the CLI fixes in #92, #94, and #96 publish together.
@Dhravya
Dhravya merged commit 5ced88e into supermemoryai:main Sep 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

install crashes with ENOENT when ~/.config/opencode does not exist yet

3 participants