Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

fix: stabilize opencode declarations across package managers

Affaan Mustafa05acc275307a
diff --git a/.opencode/plugins/ecc-hooks.ts b/.opencode/plugins/ecc-hooks.ts
index 58a209283..9e4ab3fcd 100644
--- a/.opencode/plugins/ecc-hooks.ts
+++ b/.opencode/plugins/ecc-hooks.ts
@@ -23,7 +23,9 @@ import {
} from "./lib/changed-files-store.js"
import changedFilesTool from "../tools/changed-files.js"
-export const ECCHooksPlugin = async ({
+type ECCHooksPluginFn = (input: PluginInput) => Promise<Record<string, unknown>>
+
+export const ECCHooksPlugin: ECCHooksPluginFn = async ({
client,
$,
directory,
diff --git a/.opencode/tools/changed-files.ts b/.opencode/tools/changed-files.ts
index 09cdacd37..a6751bcc3 100644
--- a/.opencode/tools/changed-files.ts
+++ b/.opencode/tools/changed-files.ts
@@ -1,4 +1,4 @@
-import { tool } from "@opencode-ai/plugin/tool"
+import { tool, type ToolDefinition } from "@opencode-ai/plugin/tool"
import {
buildTree,
getChangedPaths,
@@ -26,7 +26,7 @@ function renderTree(nodes: TreeNode[], indent: string): string {
return lines.join("\n")
}
-export default tool({
+const changedFilesTool: ToolDefinition = tool({
description:
"List files changed by agents in this session as a navigable tree. Shows added (+), modified (~), and deleted (-) indicators. Use filter to show only specific change types. Returns paths for git diff.",
args: {
@@ -79,3 +79,5 @@ export default tool({
return output
},
})
+
+export default changedFilesTool
diff --git a/.opencode/tools/check-coverage.ts b/.opencode/tools/check-coverage.ts
index 6465cb6b5..46f11cd82 100644
--- a/.opencode/tools/check-coverage.ts
+++ b/.opencode/tools/check-coverage.ts
@@ -5,11 +5,11 @@
* Supports common coverage report formats.
*/
-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 checkCoverageTool: ToolDefinition = tool({
description:
"Check test coverage against a threshold and identify files with low coverage. Reads coverage reports from common locations.",
args: {
@@ -100,6 +100,8 @@ export default tool({
},
})
+export default checkCoverageTool
+
interface CoverageSummary {
total: {
lines: number
diff --git a/.opencode/tools/format-code.ts b/.opencode/tools/format-code.ts
index 6258c71ee..f1cb36604 100644
--- a/.opencode/tools/format-code.ts
+++ b/.opencode/tools/format-code.ts
@@ -5,13 +5,13 @@
* This avoids shell execution assumptions while still giving precise guidance.
*/
-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"
type Formatter = "biome" | "prettier" | "black" | "gofmt" | "rustfmt"
-export default tool({
+const formatCodeTool: ToolDefinition = tool({
description:
"Detect formatter for a file and return the exact command to run (Biome, Prettier, Black, gofmt, rustfmt).",
args: {
@@ -43,6 +43,8 @@ export default tool({
},
})
+export default formatCodeTool
+
function detectFormatter(cwd: string, ext: string): Formatter | null {
if (["ts", "tsx", "js", "jsx", "json", "css", "scss", "md", "yaml", "yml"].includes(ext)) {
if (fs.existsSync(path.join(cwd, "biome.json")) || fs.existsSync(path.join(cwd, "biome.jsonc"))) {
diff --git a/.opencode/tools/git-summary.ts b/.opencode/tools/git-summary.ts
index 488c515e0..dd11f657e 100644
--- a/.opencode/tools/git-summary.ts
+++ b/.opencode/tools/git-summary.ts
@@ -4,10 +4,10 @@
* Returns branch/status/log/diff details for the active repository.
*/
-import { tool } from "@opencode-ai/plugin/tool"
+import { tool, type ToolDefinition } from "@opencode-ai/plugin/tool"
import { execSync } from "child_process"
-export default tool({
+const gitSummaryTool: ToolDefinition = tool({
description:
"Generate git summary with branch, status, recent commits, and optional diff stats.",
args: {
@@ -45,6 +45,8 @@ export default tool({
},
})
+export default gitSummaryTool
+
function run(command: string, cwd: string): string {
try {
return execSync(command, { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim()
diff --git a/.opencode/tools/lint-check.ts b/.opencode/tools/lint-check.ts
index 1ebbfdf70..635399353 100644
--- a/.opencode/tools/lint-check.ts
+++ b/.opencode/tools/lint-check.ts
@@ -4,13 +4,13 @@
* Detects the appropriate linter and returns a runnable lint command.
*/
-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"
type Linter = "biome" | "eslint" | "ruff" | "pylint" | "golangci-lint"
-export default tool({
+const lintCheckTool: ToolDefinition = tool({
description:
"Detect linter for a target path and return command for check/fix runs.",
args: {
@@ -43,6 +43,8 @@ export default tool({
},
})
+export default lintCheckTool
+
function detectLinter(cwd: string): Linter {
if (fs.existsSync(path.join(cwd, "biome.json")) || fs.existsSync(path.join(cwd, "biome.jsonc"))) {
return "biome"
diff --git a/.opencode/tools/run-tests.ts b/.opencode/tools/run-tests.ts
index 3b17c9053..aa8ce520d 100644
--- a/.opencode/tools/run-tests.ts
+++ b/.opencode/tools/run-tests.ts
@@ -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",
diff --git a/.opencode/tools/security-audit.ts b/.opencode/tools/security-audit.ts
index 8f450f245..59b76d9ea 100644
--- a/.opencode/tools/security-audit.ts
+++ b/.opencode/tools/security-audit.ts
@@ -8,11 +8,11 @@
* The regex patterns below are used to DETECT potential issues in user code.
*/
-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 securityAuditTool: ToolDefinition = tool({
description:
"Run a comprehensive security audit including dependency vulnerabilities, secret scanning, and common security issues.",
args: {
@@ -106,6 +106,8 @@ export default tool({
},
})
+export default securityAuditTool
+
interface AuditCheck {
name: string
description: string