fix: stabilize opencode declarations across package managers

This commit is contained in:
Affaan Mustafa
2026-04-05 15:11:19 -07:00
parent 0f4f95b3de
commit 05acc27530
8 changed files with 31 additions and 15 deletions

View File

@@ -5,11 +5,11 @@
* Automatically detects the package manager and test framework.
*/
import { tool } from "@opencode-ai/plugin/tool"
import { tool, type ToolDefinition } from "@opencode-ai/plugin/tool"
import * as path from "path"
import * as fs from "fs"
export default tool({
const runTestsTool: ToolDefinition = tool({
description:
"Run the test suite with optional coverage, watch mode, or specific test patterns. Automatically detects package manager (npm, pnpm, yarn, bun) and test framework.",
args: {
@@ -97,6 +97,8 @@ export default tool({
},
})
export default runTestsTool
async function detectPackageManager(cwd: string): Promise<string> {
const lockFiles: Record<string, string> = {
"bun.lockb": "bun",