npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

opencode-choose-directory

v0.1.5

Published

Windows directory picker for the OpenCode V2 home screen.

Readme

opencode-choose-directory

npm version license

Windows-only OpenCode V2 TUI plugin that adds a 选择目录 button to the home screen.

The button opens the native Windows Explorer-style folder picker. Selecting a directory keeps OpenCode on the home screen; OpenCode creates the session in that directory only after the first prompt is submitted.

Features

  • Visible only on the OpenCode home screen
  • Positioned at the far right of the home footer
  • Native Windows IFileDialog folder picker
  • Explorer-style address bar, search, navigation tree, and folder list
  • Preserves the selected directory until the first prompt is submitted
  • Does not create an empty session when a directory is selected
  • No keyboard shortcut, command-palette entry, or slash command
  • Handles spaces, Chinese characters, and other Unicode paths

Requirements

  • Windows 10 or Windows 11
  • OpenCode V2
  • Windows PowerShell 5.1 (included with Windows)

Install

npm (recommended)

Install the latest version from npm and add it to the global OpenCode configuration:

opencode2 plugin add opencode-choose-directory

Restart opencode2 after installation.

To install a specific version:

opencode2 plugin add [email protected]

The package is available at npmjs.com/package/opencode-choose-directory.

Manual configuration

You can also add the npm package directly to ~/.config/opencode/cli.json:

{
  "plugins": [
    "opencode-choose-directory@latest"
  ]
}

Preserve any existing entries in plugins, then restart opencode2.

GitHub source installation

To run the plugin directly from source, clone the repository into your OpenCode configuration directory:

git clone https://github.com/huahai0202/opencode-choose-directory.git `
  "$HOME\.config\opencode\plugins\opencode-choose-directory"
Set-Location "$HOME\.config\opencode\plugins\opencode-choose-directory"
npm install

Add the cloned TUI entrypoint to ~/.config/opencode/cli.json. Replace <USER> with your Windows user name:

{
  "plugins": [
    "file:///C:/Users/<USER>/.config/opencode/plugins/opencode-choose-directory/src/tui.tsx"
  ]
}

Update and uninstall

Install the newest npm release:

opencode2 plugin add opencode-choose-directory@latest

Remove the plugin from the global configuration:

opencode2 plugin remove opencode-choose-directory

How It Works

  1. The plugin appends a button to the outer prompt.footer TUI slot so it stays at the far right.
  2. The slot input supplies sessionID; the button renders only when it is absent.
  3. Clicking the button launches hidden Windows PowerShell in STA mode.
  4. PowerShell creates the native IFileDialog COM picker with FOS_PICKFOLDERS.
  5. The selected path is returned as UTF-8 Base64 between fixed markers.
  6. The plugin resolves the path through OpenCode and preloads the location-scoped agent/model catalogs.
  7. The plugin restores focus to the home prompt after the native dialog closes.
  8. OpenCode creates a session in that location when the first prompt is submitted.

Development

npm install
npm run typecheck

The main implementation is in src/tui.tsx. src/index.ts is the package entrypoint and declares that the package has a TUI plugin.

Limitations

  • Windows only. The plugin does not register a button on other platforms.
  • The native folder picker resembles File Explorer but does not include the full Explorer tab bar or file-operation toolbar.
  • The OpenCode V2 plugin API is beta and may require compatibility updates.

License

MIT