From c3b35af9630b8fcf3883e87f68290da8c40597af Mon Sep 17 00:00:00 2001
From: Patrick
Date: Wed, 29 Apr 2026 14:32:15 +0200
Subject: [PATCH] COPSPA-489: Bugfixing
---
package-lock.json | 490 +++++++++++++++++++++++++++++++++++--------
package.json | 8 +-
plugin.json | 4 +-
plugins/shell-env.ts | 18 ++
src/shell-env.ts | 53 +++--
tsconfig.json | 2 +-
6 files changed, 465 insertions(+), 110 deletions(-)
create mode 100644 plugins/shell-env.ts
diff --git a/package-lock.json b/package-lock.json
index 37cd1d0..80af8d3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,18 +1,17 @@
{
"name": "@techdivision/opencode-plugin-shell-env",
- "version": "1.0.0",
+ "version": "1.3.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@techdivision/opencode-plugin-shell-env",
- "version": "1.0.0",
+ "version": "1.3.0",
"license": "MIT",
"dependencies": {
- "@opencode-ai/plugin": "1.2.5"
+ "@opencode-ai/plugin": "^1.14"
},
"devDependencies": {
- "@types/bun": "latest",
"@types/node": "^25.0.3",
"typescript": "^5.9.3"
},
@@ -20,26 +19,120 @@
"bun": ">=1.0.0"
}
},
+ "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.3.tgz",
+ "integrity": "sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@msgpackr-extract/msgpackr-extract-darwin-x64": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.3.tgz",
+ "integrity": "sha512-mdzd3AVzYKuUmiWOQ8GNhl64/IoFGol569zNRdkLReh6LRLHOXxU4U8eq0JwaD8iFHdVGqSy4IjFL4reoWCDFw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.3.tgz",
+ "integrity": "sha512-fg0uy/dG/nZEXfYilKoRe7yALaNmHoYeIoJuJ7KJ+YyU2bvY8vPv27f7UKhGRpY6euFYqEVhxCFZgAUNQBM3nw==",
+ "cpu": [
+ "arm"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm64": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.3.tgz",
+ "integrity": "sha512-YxQL+ax0XqBJDZiKimS2XQaf+2wDGVa1enVRGzEvLLVFeqa5kx2bWbtcSXgsxjQB7nRqqIGFIcLteF/sHeVtQg==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@msgpackr-extract/msgpackr-extract-linux-x64": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.3.tgz",
+ "integrity": "sha512-cvwNfbP07pKUfq1uH+S6KJ7dT9K8WOE4ZiAcsrSes+UY55E/0jLYc+vq+DO7jlmqRb5zAggExKm0H7O/CBaesg==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@msgpackr-extract/msgpackr-extract-win32-x64": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.3.tgz",
+ "integrity": "sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
"node_modules/@opencode-ai/plugin": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/@opencode-ai/plugin/-/plugin-1.2.5.tgz",
- "integrity": "sha512-mZACBKyMMhH87K6HtiigbauLKjK7ooZPVaZTnRs492ldAXhiSfqk28Z8hGYNzhpwpHjkU6Ws8LOJRwOemDVQYg==",
+ "version": "1.14.28",
+ "resolved": "https://registry.npmjs.org/@opencode-ai/plugin/-/plugin-1.14.28.tgz",
+ "integrity": "sha512-cHJo7t1jwrzbkIVmNgggdWh4cyOVGw5fnbSpuYeL6qwfmH3g/6YLWtw5ZYEP6detUkEebT08mHXDGmsMUpQa+A==",
"license": "MIT",
"dependencies": {
- "@opencode-ai/sdk": "1.2.5",
+ "@opencode-ai/sdk": "1.14.28",
+ "effect": "4.0.0-beta.48",
"zod": "4.1.8"
+ },
+ "peerDependencies": {
+ "@opentui/core": ">=0.1.105",
+ "@opentui/solid": ">=0.1.105"
+ },
+ "peerDependenciesMeta": {
+ "@opentui/core": {
+ "optional": true
+ },
+ "@opentui/solid": {
+ "optional": true
+ }
}
},
"node_modules/@opencode-ai/sdk": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/@opencode-ai/sdk/-/sdk-1.2.5.tgz",
- "integrity": "sha512-oFw08QNupBWuszpLa4HMRf/T+fDVqu8lbYSiqevdFTSH8Zih2cw/vPqLhjHgE6rPOSXyhvg46WivfSO7eNIpPw==",
- "license": "MIT"
+ "version": "1.14.28",
+ "resolved": "https://registry.npmjs.org/@opencode-ai/sdk/-/sdk-1.14.28.tgz",
+ "integrity": "sha512-qRFJfD+Zdz3jHHSupW4F6Io1ZFrQ6gCRFlG50O6kEU9xRxrBpK0wGvP+Y5VwwvD/gH9WKMHYinlQpDVI9/lgJQ==",
+ "license": "MIT",
+ "dependencies": {
+ "cross-spawn": "7.0.6"
+ }
},
"node_modules/@oven/bun-darwin-aarch64": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.3.10.tgz",
- "integrity": "sha512-PXgg5gqcS/rHwa1hF0JdM1y5TiyejVrMHoBmWY/DjtfYZoFTXie1RCFOkoG0b5diOOmUcuYarMpH7CSNTqwj+w==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/@oven/bun-darwin-aarch64/-/bun-darwin-aarch64-1.3.13.tgz",
+ "integrity": "sha512-qAS6Hg8Q14ckfBuqJ2Zh7gBQSVSUHeibSq4OFqBTv6DzyJuxYlr0sdYQzmYmnbPxbqobekqUDTa/4XEaqRi7vg==",
"cpu": [
"arm64"
],
@@ -51,9 +144,9 @@
"peer": true
},
"node_modules/@oven/bun-darwin-x64": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.3.10.tgz",
- "integrity": "sha512-Nhssuh7GBpP5PiDSOl3+qnoIG7PJo+ec2oomDevnl9pRY6x6aD2gRt0JE+uf+A8Om2D6gjeHCxjEdrw5ZHE8mA==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64/-/bun-darwin-x64-1.3.13.tgz",
+ "integrity": "sha512-kGePeDD4IN4imo+H4uLjQGZLmvyYQg+nKr2P0nt4ksXXrWA4HE+mb0/TUPHfRI127DocXQpew+fvrHuHR5mpJQ==",
"cpu": [
"x64"
],
@@ -65,9 +158,9 @@
"peer": true
},
"node_modules/@oven/bun-darwin-x64-baseline": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.3.10.tgz",
- "integrity": "sha512-w1gaTlqU0IJCmJ1X+PGHkdNU1n8Gemx5YKkjhkJIguvFINXEBB5U1KG82QsT65Tk4KyNMfbLTlmy4giAvUoKfA==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/@oven/bun-darwin-x64-baseline/-/bun-darwin-x64-baseline-1.3.13.tgz",
+ "integrity": "sha512-gMEQayUpmCPYaE9zkNBj9TiQqHupnhjOYcuSzxFjzIjHJBUO4VjNnrpbKVeXNs+rKHFothORDd2QKquu5paSPQ==",
"cpu": [
"x64"
],
@@ -79,9 +172,9 @@
"peer": true
},
"node_modules/@oven/bun-linux-aarch64": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.3.10.tgz",
- "integrity": "sha512-OUgPHfL6+PM2Q+tFZjcaycN3D7gdQdYlWnwMI31DXZKY1r4HINWk9aEz9t/rNaHg65edwNrt7dsv9TF7xK8xIA==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64/-/bun-linux-aarch64-1.3.13.tgz",
+ "integrity": "sha512-NbLOJdr+RBFO1vFZ2YUFg4oVJ+2ua6zrwo4ZWRs0jKKcGJWtbY2wY5uz+i0PkwH6b9HYaYDgVTzE4ev06ncYZw==",
"cpu": [
"arm64"
],
@@ -93,9 +186,9 @@
"peer": true
},
"node_modules/@oven/bun-linux-aarch64-musl": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64-musl/-/bun-linux-aarch64-musl-1.3.10.tgz",
- "integrity": "sha512-Ui5pAgM7JE9MzHokF0VglRMkbak3lTisY4Mf1AZutPACXWgKJC5aGrgnHBfkl7QS6fEeYb0juy1q4eRznRHOsw==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/@oven/bun-linux-aarch64-musl/-/bun-linux-aarch64-musl-1.3.13.tgz",
+ "integrity": "sha512-UV9EE18VE5aRhWtV2L6MTAGGn3slhJJ2OW/m+FJM15maHm0qf1V7TaZY0FovxhdQRvnklSiQ7Ntv0H5TUX4w0g==",
"cpu": [
"arm64"
],
@@ -107,9 +200,9 @@
"peer": true
},
"node_modules/@oven/bun-linux-x64": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.3.10.tgz",
- "integrity": "sha512-bzUgYj/PIZziB/ZesIP9HUyfvh6Vlf3od+TrbTTyVEuCSMKzDPQVW/yEbRp0tcHO3alwiEXwJDrWrHAguXlgiQ==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64/-/bun-linux-x64-1.3.13.tgz",
+ "integrity": "sha512-UwttIUXoe9fS+40OcjoaRHgZw+HCPFqBVWEXkXqAJ3W7wA0XPZrWsoMAD9sGh3TaLqrwdiMo5xPogwpXhOtVXA==",
"cpu": [
"x64"
],
@@ -121,9 +214,9 @@
"peer": true
},
"node_modules/@oven/bun-linux-x64-baseline": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.3.10.tgz",
- "integrity": "sha512-oqvMDYpX6dGJO03HgO5bXuccEsH3qbdO3MaAiAlO4CfkBPLUXz3N0DDElg5hz0L6ktdDVKbQVE5lfe+LAUISQg==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-baseline/-/bun-linux-x64-baseline-1.3.13.tgz",
+ "integrity": "sha512-fOi4ziKzgJG4UrrNd4AicBs6Fu9GY5xOqg+9tC76nuZNDAdSh6++kzab6TNi1Ck0Yzq6zIBIdGit6/0uSbBn8A==",
"cpu": [
"x64"
],
@@ -135,9 +228,9 @@
"peer": true
},
"node_modules/@oven/bun-linux-x64-musl": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-musl/-/bun-linux-x64-musl-1.3.10.tgz",
- "integrity": "sha512-poVXvOShekbexHq45b4MH/mRjQKwACAC8lHp3Tz/hEDuz0/20oncqScnmKwzhBPEpqJvydXficXfBYuSim8opw==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-musl/-/bun-linux-x64-musl-1.3.13.tgz",
+ "integrity": "sha512-+VHhE44kEjCXcTFHyc81zfTxL9+vzh9RqIh7gM1iWNhxpctD9kzntbUkP3UTFTwwNjoou1o8VRyxQafvc4OepA==",
"cpu": [
"x64"
],
@@ -149,9 +242,9 @@
"peer": true
},
"node_modules/@oven/bun-linux-x64-musl-baseline": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-musl-baseline/-/bun-linux-x64-musl-baseline-1.3.10.tgz",
- "integrity": "sha512-/hOZ6S1VsTX6vtbhWVL9aAnOrdpuO54mAGUWpTdMz7dFG5UBZ/VUEiK0pBkq9A1rlBk0GeD/6Y4NBFl8Ha7cRA==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/@oven/bun-linux-x64-musl-baseline/-/bun-linux-x64-musl-baseline-1.3.13.tgz",
+ "integrity": "sha512-fqBKuiiWLEu2dVkowZaXgKS98xfrvBqivdoxRtRP3eINcpI1dcelGbsOz+Xphn7tbGAuBiE1/0AelvvvdqS9rg==",
"cpu": [
"x64"
],
@@ -163,9 +256,9 @@
"peer": true
},
"node_modules/@oven/bun-windows-aarch64": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/@oven/bun-windows-aarch64/-/bun-windows-aarch64-1.3.10.tgz",
- "integrity": "sha512-GXbz2swvN2DLw2dXZFeedMxSJtI64xQ9xp9Eg7Hjejg6mS2E4dP1xoQ2yAo2aZPi/2OBPAVaGzppI2q20XumHA==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/@oven/bun-windows-aarch64/-/bun-windows-aarch64-1.3.13.tgz",
+ "integrity": "sha512-+EvdRWRCRg95Xea4M2lqSJFTjzQBTJDQTMlbG8bmwFkVTN16MdmSH7xhfxVQWUOyZBLEpIwuNFIlBBxVCwSUyQ==",
"cpu": [
"arm64"
],
@@ -177,9 +270,9 @@
"peer": true
},
"node_modules/@oven/bun-windows-x64": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64/-/bun-windows-x64-1.3.10.tgz",
- "integrity": "sha512-qaS1In3yfC/Z/IGQriVmF8GWwKuNqiw7feTSJWaQhH5IbL6ENR+4wGNPniZSJFaM/SKUO0e/YCRdoVBvgU4C1g==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64/-/bun-windows-x64-1.3.13.tgz",
+ "integrity": "sha512-vqDEFX63ZZQF3YstPSpPD+RxNm5AILPdUuuKpNwsj7ld4NjhdHUYkAmLXDtKNWt9JMRL10bop//W8faY/LV+RQ==",
"cpu": [
"x64"
],
@@ -191,9 +284,9 @@
"peer": true
},
"node_modules/@oven/bun-windows-x64-baseline": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64-baseline/-/bun-windows-x64-baseline-1.3.10.tgz",
- "integrity": "sha512-gh3UAHbUdDUG6fhLc1Csa4IGdtghue6U8oAIXWnUqawp6lwb3gOCRvp25IUnLF5vUHtgfMxuEUYV7YA2WxVutw==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/@oven/bun-windows-x64-baseline/-/bun-windows-x64-baseline-1.3.13.tgz",
+ "integrity": "sha512-6gy4hhQSjq/T/S9hC9m3NxY0RY+9Ww+XNlB+8koIMTsMSYEjk7Ho+hFHQz1Bn4W61Ub7Vykufg+jgDgPfa2GFA==",
"cpu": [
"x64"
],
@@ -204,30 +297,26 @@
],
"peer": true
},
- "node_modules/@types/bun": {
- "version": "1.3.9",
- "resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.3.9.tgz",
- "integrity": "sha512-KQ571yULOdWJiMH+RIWIOZ7B2RXQGpL1YQrBtLIV3FqDcCu6FsbFUBwhdKUlCKUpS3PJDsHlJ1QKlpxoVR+xtw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "bun-types": "1.3.9"
- }
+ "node_modules/@standard-schema/spec": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
+ "license": "MIT"
},
"node_modules/@types/node": {
- "version": "25.3.3",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-25.3.3.tgz",
- "integrity": "sha512-DpzbrH7wIcBaJibpKo9nnSQL0MTRdnWttGyE5haGwK86xgMOkFLp7vEyfQPGLOJh5wNYiJ3V9PmUMDhV9u8kkQ==",
+ "version": "25.6.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-25.6.0.tgz",
+ "integrity": "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==",
"dev": true,
"license": "MIT",
"dependencies": {
- "undici-types": "~7.18.0"
+ "undici-types": "~7.19.0"
}
},
"node_modules/bun": {
- "version": "1.3.10",
- "resolved": "https://registry.npmjs.org/bun/-/bun-1.3.10.tgz",
- "integrity": "sha512-S/CXaXXIyA4CMjdMkYQ4T2YMqnAn4s0ysD3mlsY4bUiOCqGlv28zck4Wd4H4kpvbekx15S9mUeLQ7Uxd0tYTLA==",
+ "version": "1.3.13",
+ "resolved": "https://registry.npmjs.org/bun/-/bun-1.3.13.tgz",
+ "integrity": "sha512-b9T4xZ8KqCHs4+TkHJv540LG1B8OD7noKu0Qaizusx3jFtMDHY6osNqgbaOlwW2B8RB2AKzz+sjzlGKIGxIjZw==",
"cpu": [
"arm64",
"x64"
@@ -245,28 +334,216 @@
"bunx": "bin/bunx.exe"
},
"optionalDependencies": {
- "@oven/bun-darwin-aarch64": "1.3.10",
- "@oven/bun-darwin-x64": "1.3.10",
- "@oven/bun-darwin-x64-baseline": "1.3.10",
- "@oven/bun-linux-aarch64": "1.3.10",
- "@oven/bun-linux-aarch64-musl": "1.3.10",
- "@oven/bun-linux-x64": "1.3.10",
- "@oven/bun-linux-x64-baseline": "1.3.10",
- "@oven/bun-linux-x64-musl": "1.3.10",
- "@oven/bun-linux-x64-musl-baseline": "1.3.10",
- "@oven/bun-windows-aarch64": "1.3.10",
- "@oven/bun-windows-x64": "1.3.10",
- "@oven/bun-windows-x64-baseline": "1.3.10"
+ "@oven/bun-darwin-aarch64": "1.3.13",
+ "@oven/bun-darwin-x64": "1.3.13",
+ "@oven/bun-darwin-x64-baseline": "1.3.13",
+ "@oven/bun-linux-aarch64": "1.3.13",
+ "@oven/bun-linux-aarch64-musl": "1.3.13",
+ "@oven/bun-linux-x64": "1.3.13",
+ "@oven/bun-linux-x64-baseline": "1.3.13",
+ "@oven/bun-linux-x64-musl": "1.3.13",
+ "@oven/bun-linux-x64-musl-baseline": "1.3.13",
+ "@oven/bun-windows-aarch64": "1.3.13",
+ "@oven/bun-windows-x64": "1.3.13",
+ "@oven/bun-windows-x64-baseline": "1.3.13"
}
},
- "node_modules/bun-types": {
- "version": "1.3.9",
- "resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.3.9.tgz",
- "integrity": "sha512-+UBWWOakIP4Tswh0Bt0QD0alpTY8cb5hvgiYeWCMet9YukHbzuruIEeXC2D7nMJPB12kbh8C7XJykSexEqGKJg==",
- "dev": true,
+ "node_modules/cross-spawn": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
+ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/detect-libc": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
+ "license": "Apache-2.0",
+ "optional": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/effect": {
+ "version": "4.0.0-beta.48",
+ "resolved": "https://registry.npmjs.org/effect/-/effect-4.0.0-beta.48.tgz",
+ "integrity": "sha512-MMAM/ZabuNdNmgXiin+BAanQXK7qM8mlt7nfXDoJ/Gn9V8i89JlCq+2N0AiWmqFLXjGLA0u3FjiOjSOYQk5uMw==",
+ "license": "MIT",
+ "dependencies": {
+ "@standard-schema/spec": "^1.1.0",
+ "fast-check": "^4.6.0",
+ "find-my-way-ts": "^0.1.6",
+ "ini": "^6.0.0",
+ "kubernetes-types": "^1.30.0",
+ "msgpackr": "^1.11.9",
+ "multipasta": "^0.2.7",
+ "toml": "^4.1.1",
+ "uuid": "^13.0.0",
+ "yaml": "^2.8.3"
+ }
+ },
+ "node_modules/fast-check": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-4.7.0.tgz",
+ "integrity": "sha512-NsZRtqvSSoCP0HbNjUD+r1JH8zqZalyp6gLY9e7OYs7NK9b6AHOs2baBFeBG7bVNsuoukh89x2Yg3rPsul8ziQ==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/dubzzz"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fast-check"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "pure-rand": "^8.0.0"
+ },
+ "engines": {
+ "node": ">=12.17.0"
+ }
+ },
+ "node_modules/find-my-way-ts": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/find-my-way-ts/-/find-my-way-ts-0.1.6.tgz",
+ "integrity": "sha512-a85L9ZoXtNAey3Y6Z+eBWW658kO/MwR7zIafkIUPUMf3isZG0NCs2pjW2wtjxAKuJPxMAsHUIP4ZPGv0o5gyTA==",
+ "license": "MIT"
+ },
+ "node_modules/ini": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-6.0.0.tgz",
+ "integrity": "sha512-IBTdIkzZNOpqm7q3dRqJvMaldXjDHWkEDfrwGEQTs5eaQMWV+djAhR+wahyNNMAa+qpbDUhBMVt4ZKNwpPm7xQ==",
+ "license": "ISC",
+ "engines": {
+ "node": "^20.17.0 || >=22.9.0"
+ }
+ },
+ "node_modules/isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
+ "license": "ISC"
+ },
+ "node_modules/kubernetes-types": {
+ "version": "1.30.0",
+ "resolved": "https://registry.npmjs.org/kubernetes-types/-/kubernetes-types-1.30.0.tgz",
+ "integrity": "sha512-Dew1okvhM/SQcIa2rcgujNndZwU8VnSapDgdxlYoB84ZlpAD43U6KLAFqYo17ykSFGHNPrg0qry0bP+GJd9v7Q==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/msgpackr": {
+ "version": "1.11.10",
+ "resolved": "https://registry.npmjs.org/msgpackr/-/msgpackr-1.11.10.tgz",
+ "integrity": "sha512-iCZNq+HszvF+fC3anCm4nBmWEnbeIAfpDs6IStAEKhQ2YSgkjzVG2FF9XJqwwQh5bH3N9OUTUt4QwVN6MLMLtA==",
+ "license": "MIT",
+ "optionalDependencies": {
+ "msgpackr-extract": "^3.0.2"
+ }
+ },
+ "node_modules/msgpackr-extract": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/msgpackr-extract/-/msgpackr-extract-3.0.3.tgz",
+ "integrity": "sha512-P0efT1C9jIdVRefqjzOQ9Xml57zpOXnIuS+csaB4MdZbTdmGDLo8XhzBG1N7aO11gKDDkJvBLULeFTo46wwreA==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "node-gyp-build-optional-packages": "5.2.2"
+ },
+ "bin": {
+ "download-msgpackr-prebuilds": "bin/download-prebuilds.js"
+ },
+ "optionalDependencies": {
+ "@msgpackr-extract/msgpackr-extract-darwin-arm64": "3.0.3",
+ "@msgpackr-extract/msgpackr-extract-darwin-x64": "3.0.3",
+ "@msgpackr-extract/msgpackr-extract-linux-arm": "3.0.3",
+ "@msgpackr-extract/msgpackr-extract-linux-arm64": "3.0.3",
+ "@msgpackr-extract/msgpackr-extract-linux-x64": "3.0.3",
+ "@msgpackr-extract/msgpackr-extract-win32-x64": "3.0.3"
+ }
+ },
+ "node_modules/multipasta": {
+ "version": "0.2.7",
+ "resolved": "https://registry.npmjs.org/multipasta/-/multipasta-0.2.7.tgz",
+ "integrity": "sha512-KPA58d68KgGil15oDqXjkUBEBYc00XvbPj5/X+dyzeo/lWm9Nc25pQRlf1D+gv4OpK7NM0J1odrbu9JNNGvynA==",
+ "license": "MIT"
+ },
+ "node_modules/node-gyp-build-optional-packages": {
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz",
+ "integrity": "sha512-s+w+rBWnpTMwSFbaE0UXsRlg7hU4FjekKU4eyAih5T8nJuNZT1nNsskXpxmeqSK9UzkBl6UgRlnKc8hz8IEqOw==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "detect-libc": "^2.0.1"
+ },
+ "bin": {
+ "node-gyp-build-optional-packages": "bin.js",
+ "node-gyp-build-optional-packages-optional": "optional.js",
+ "node-gyp-build-optional-packages-test": "build-test.js"
+ }
+ },
+ "node_modules/path-key": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/pure-rand": {
+ "version": "8.4.0",
+ "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-8.4.0.tgz",
+ "integrity": "sha512-IoM8YF/jY0hiugFo/wOWqfmarlE6J0wc6fDK1PhftMk7MGhVZl88sZimmqBBFomLOCSmcCCpsfj7wXASCpvK9A==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/dubzzz"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fast-check"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/shebang-command": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"license": "MIT",
"dependencies": {
- "@types/node": "*"
+ "shebang-regex": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/shebang-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/toml": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/toml/-/toml-4.1.1.tgz",
+ "integrity": "sha512-EBJnVBr3dTXdA89WVFoAIPUqkBjxPMwRqsfuo1r240tKFHXv3zgca4+NJib/h6TyvGF7vOawz0jGuryJCdNHrw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=20"
}
},
"node_modules/typescript": {
@@ -284,12 +561,55 @@
}
},
"node_modules/undici-types": {
- "version": "7.18.2",
- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
- "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
+ "version": "7.19.2",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.19.2.tgz",
+ "integrity": "sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==",
"dev": true,
"license": "MIT"
},
+ "node_modules/uuid": {
+ "version": "13.0.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-13.0.0.tgz",
+ "integrity": "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==",
+ "funding": [
+ "https://github.com/sponsors/broofa",
+ "https://github.com/sponsors/ctavan"
+ ],
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist-node/bin/uuid"
+ }
+ },
+ "node_modules/which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "license": "ISC",
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "node-which": "bin/node-which"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/yaml": {
+ "version": "2.8.3",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz",
+ "integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==",
+ "license": "ISC",
+ "bin": {
+ "yaml": "bin.mjs"
+ },
+ "engines": {
+ "node": ">= 14.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/eemeli"
+ }
+ },
"node_modules/zod": {
"version": "4.1.8",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.1.8.tgz",
diff --git a/package.json b/package.json
index e8bbc53..62482e0 100644
--- a/package.json
+++ b/package.json
@@ -1,21 +1,21 @@
{
"name": "@techdivision/opencode-plugin-shell-env",
- "version": "1.2.1",
+ "version": "1.3.0",
"description": "OpenCode Plugin - Shell environment loader for .env variables",
"type": "module",
"main": "src/shell-env.ts",
"types": "src/shell-env.ts",
"files": [
"src/",
+ "plugins/",
"skills/",
"plugin.json"
],
"keywords": ["opencode", "plugin", "shell", "env", "dotenv"],
"dependencies": {
- "@opencode-ai/plugin": "1.2.5"
+ "@opencode-ai/plugin": "^1.14"
},
"devDependencies": {
- "@types/bun": "latest",
"@types/node": "^25.0.3",
"typescript": "^5.9.3"
},
@@ -24,7 +24,7 @@
},
"opencode": {
"plugin": true,
- "category": "optional"
+ "category": "standard"
},
"repository": {
"type": "git",
diff --git a/plugin.json b/plugin.json
index 33a7c20..c8d4b9d 100644
--- a/plugin.json
+++ b/plugin.json
@@ -1,6 +1,6 @@
{
"name": "shell-env",
"description": "Shell environment loader - loads .env variables into OpenCode shell and MCP processes",
- "category": "optional",
- "version": "1.2.0"
+ "category": "standard",
+ "version": "1.3.0"
}
diff --git a/plugins/shell-env.ts b/plugins/shell-env.ts
new file mode 100644
index 0000000..fd5d3f0
--- /dev/null
+++ b/plugins/shell-env.ts
@@ -0,0 +1,18 @@
+/**
+ * OpenCode Shell Environment Plugin
+ *
+ * @package @techdivision/opencode-plugin-shell-env
+ * @author TechDivision GmbH
+ * @license MIT
+ * @version 1.3.0
+ *
+ * @description
+ * Loads .env variables from ~/.config/opencode/.env and /.opencode/.env
+ * into process.env (at plugin init) and shell.env hook (at every shell invocation).
+ *
+ * This ensures environment variables like OPENCODE_USER_EMAIL and API keys
+ * are available to all plugins and shell commands without hardcoding them.
+ */
+
+// Re-export the plugin from the main package
+export { plugin } from "../src/shell-env.ts"
diff --git a/src/shell-env.ts b/src/shell-env.ts
index 389b2c7..974bf15 100644
--- a/src/shell-env.ts
+++ b/src/shell-env.ts
@@ -1,4 +1,4 @@
-import type { Plugin } from "@opencode-ai/plugin"
+import type { Plugin, Hooks, PluginInput } from "@opencode-ai/plugin"
import fs from "fs"
import os from "os"
import path from "path"
@@ -22,13 +22,13 @@ import path from "path"
*
* ## .env Loading Order (Last Wins)
*
- * The plugin reads `.env` files from two locations and merges them with a
- * "last wins" strategy — more specific sources override less specific ones:
- *
- * | Priority | Source | Purpose |
- * |----------|---------------------------------|--------------------------------------|
- * | 1 (base) | `~/.config/opencode/.env` | Global defaults (user email, shared keys) |
- * | 2 (wins) | `/.opencode/.env` | Project-specific overrides |
+ * The plugin reads `.env` files from two locations and merges them with a
+ * "last wins" strategy — more specific sources override less specific ones:
+ *
+ * | Priority | Source | Purpose |
+ * |----------|---------------------------------|--------------------------------------|
+ * | 1 (base) | `~/.config/opencode/.env` | Global defaults (user email, shared keys) |
+ * | 2 (wins) | `/.env` | Project-specific overrides (.opencode/.env) |
*
* Both layers override existing OS environment variables. If a key appears in
* both files, the project-level value wins. This matches the "last wins"
@@ -150,15 +150,16 @@ function getGlobalConfigDir(): string {
* Merges .env variables from global and project locations using "last wins".
*
* Loading order (later entries override earlier ones):
- * 1. ~/.config/opencode/.env (global defaults)
- * 2. /.opencode/.env (project overrides)
+ * 1. ~/.config/opencode/.env (global defaults)
+ * 2. /.env (project overrides)
*
- * @param projectDir - The project working directory (input.directory)
+ * @param projectDir - The .opencode directory path (input.directory)
* @returns Merged key-value record with project values winning over global
*/
function loadMergedEnv(projectDir: string): Record {
const globalEnvPath = path.join(getGlobalConfigDir(), ".env")
- const projectEnvPath = path.join(projectDir, ".opencode", ".env")
+ // projectDir is already the .opencode directory, so .env is directly there
+ const projectEnvPath = path.join(projectDir, ".env")
const globalEnv = loadEnvFromPath(globalEnvPath)
const projectEnv = loadEnvFromPath(projectEnvPath)
@@ -167,8 +168,21 @@ function loadMergedEnv(projectDir: string): Record {
return { ...globalEnv, ...projectEnv }
}
-export const ShellEnvPlugin: Plugin = async (input) => {
- const projectDir = input.directory
+export const plugin: Plugin = async ({ client, directory }: PluginInput): Promise => {
+ // OpenCode passes the project root, but we need the .opencode directory
+ const projectDir = path.join(directory, ".opencode")
+
+ /**
+ * Helper function to inject merged .env variables into process.env.
+ * Called during plugin initialization to ensure downstream plugins
+ * can read environment variables via process.env.
+ */
+ const injectIntoProcessEnv = () => {
+ const merged = loadMergedEnv(projectDir)
+ for (const [key, value] of Object.entries(merged)) {
+ process.env[key] = value
+ }
+ }
// Phase 1: Inject merged .env variables into process.env at plugin init time.
// This makes them available to all plugins loaded AFTER this one via
@@ -177,10 +191,13 @@ export const ShellEnvPlugin: Plugin = async (input) => {
// Last Wins: .env values OVERRIDE existing OS environment variables.
// This is intentional — explicit .env configuration takes precedence
// over inherited shell environment, matching the opencode-cli convention.
- const merged = loadMergedEnv(projectDir)
- for (const [key, value] of Object.entries(merged)) {
- process.env[key] = value
- }
+ //
+ // NOTE: During local plugin development with symlinks in .opencode/plugins/,
+ // plugins are loaded sequentially in filesystem order. In production with
+ // npm package declarations in opencode.json, plugins may load in parallel.
+ // To ensure reliable environment variable propagation, downstream plugins
+ // should read process.env as a fallback (see time-tracking ConfigLoader).
+ injectIntoProcessEnv()
return {
// Phase 2: Inject merged .env variables into shell execution environment.
diff --git a/tsconfig.json b/tsconfig.json
index 2486a9f..d045cd0 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -7,7 +7,7 @@
"esModuleInterop": true,
"skipLibCheck": true,
"noEmit": true,
- "types": ["bun-types", "node"]
+ "types": ["node"]
},
"include": ["src/**/*"]
}