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

@ordis_co_th/execute-powershell

v1.0.5

Published

An OpenCode plugin that provides PowerShell script execution capabilities with built-in safety controls and permission management.

Readme

Execute PowerShell Plugin

An OpenCode plugin that provides PowerShell script execution capabilities with built-in safety controls and permission management.

Usage

Register in opencode.json

Add the plugin to your OpenCode configuration. OpenCode expects the plugin key (singular) with a string array:

{
  "plugin": [
    "@ordis_co_th/[email protected]"
  ]
}

Tool

Once registered, the plugin provides one tool: execute_powershell.

  • Required params: command, description
  • Optional params: timeout_ms, workdir
  • timeout_ms default: 120000 (2 minutes)
  • workdir default: current OpenCode directory (context.directory)

Example Tool Call

{
  "tool": "execute_powershell",
  "params": {
    "command": "Get-Process",
    "workdir": "/path/to/workdir",
    "timeout_ms": 30000
  }
}

Permission Integration (ask / allow / deny)

This plugin uses OpenCode's native permission engine and asks for permission key execute_powershell before spawning any command.

{
  "permission": {
    "execute_powershell": {
      "*": "ask",
      "Get-Process*": "allow",
      "Get-ChildItem*": "allow",
      "Invoke-Expression*": "deny",
      "Remove-Item*": "deny"
    }
  }
}

OpenCode evaluates rules with "last matching rule wins", so put broad defaults first and specific overrides later.

External Directory Permission

If workdir resolves outside the active project/worktree boundary, the tool asks for OpenCode permission key external_directory using a recursive glob pattern. The tool also performs a best-effort scan of path arguments in common filesystem PowerShell commands (for example Get-Content, Set-Content, Copy-Item, Move-Item, Remove-Item, Set-Location) and asks external_directory for out-of-bound path targets.

{
  "permission": {
    "execute_powershell": "ask",
    "external_directory": "ask"
  }
}

Output Metadata Footer

Tool output includes a metadata footer:

<powershell_metadata>{...}</powershell_metadata>

Long output is truncated using OpenCode-compatible defaults (2000 lines or 50 KiB), and the full output is written to OpenCode's tool-output directory. The returned content includes a preview and the full output path.

Metadata fields:

  • exitCode
  • endedBy (exit, timeout, or abort)
  • shell (pwsh, powershell, or unknown)
  • resolvedWorkdir
  • timeoutMs
  • durationMs
  • truncated (optional)
  • outputPath (optional)

Platform and Security Notes

  • Intended for Windows PowerShell command execution.
  • Permission checks run before execution.
  • For safer defaults, deny high-risk command patterns such as Invoke-Expression* and Remove-Item*.

Development

# Install dependencies
bun install

# Build the project
bun run build

# Run tests
bun test

# Check package contents
bun run package:check

Package Structure

  • Entry Point: ./dist/index.js
  • Type Definitions: ./dist/index.d.ts
  • Export: ExecutePowerShellPlugin - Main plugin function

License

MIT