@opencode-linear-agent/server 0.1.3-master.17 → 0.1.3-master.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jack Blanc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env sh
2
+ set -eu
3
+
4
+ PRG="$0"
5
+ while [ -h "$PRG" ]; do
6
+ LINK=$(readlink "$PRG")
7
+ case "$LINK" in
8
+ /*) PRG="$LINK" ;;
9
+ *) PRG="$(dirname "$PRG")/$LINK" ;;
10
+ esac
11
+ done
12
+
13
+ DIR=$(CDPATH= cd -- "$(dirname -- "$PRG")" && pwd)
14
+ ROOT=$(CDPATH= cd -- "$DIR/.." && pwd)
15
+
16
+ PLATFORM=$(uname -s)
17
+ ARCH=$(uname -m)
18
+
19
+ case "$PLATFORM" in
20
+ Darwin) PLATFORM="darwin" ;;
21
+ Linux) PLATFORM="linux" ;;
22
+ *) PLATFORM=$(printf '%s' "$PLATFORM" | tr '[:upper:]' '[:lower:]') ;;
23
+ esac
24
+
25
+ case "$ARCH" in
26
+ arm64|aarch64) ARCH="arm64" ;;
27
+ x86_64|amd64) ARCH="x64" ;;
28
+ esac
29
+
30
+ PACKAGE=""
31
+ case "$PLATFORM-$ARCH" in
32
+ darwin-arm64) PACKAGE="@opencode-linear-agent/server-darwin-arm64" ;;
33
+ darwin-x64) PACKAGE="@opencode-linear-agent/server-darwin-x64" ;;
34
+ linux-arm64) PACKAGE="@opencode-linear-agent/server-linux-arm64" ;;
35
+ linux-x64) PACKAGE="@opencode-linear-agent/server-linux-x64" ;;
36
+ esac
37
+
38
+ if [ -z "$PACKAGE" ]; then
39
+ printf 'Unsupported platform for opencode-linear-agent: %s-%s. Supported: darwin-arm64, darwin-x64, linux-arm64, linux-x64.\n' "$PLATFORM" "$ARCH" >&2
40
+ exit 1
41
+ fi
42
+
43
+ CACHE="$ROOT/bin/.opencode-linear-agent-$PLATFORM-$ARCH"
44
+ if [ -x "$CACHE" ]; then
45
+ exec "$CACHE" "$@"
46
+ fi
47
+
48
+ find_binary() {
49
+ search_root="$ROOT"
50
+ while :; do
51
+ nested="$search_root/node_modules/${PACKAGE%/*}/${PACKAGE#*/}/bin/opencode-linear-agent"
52
+ if [ -x "$nested" ]; then
53
+ printf '%s\n' "$nested"
54
+ return 0
55
+ fi
56
+
57
+ sibling="$(dirname "$search_root")/${PACKAGE#*/}/bin/opencode-linear-agent"
58
+ if [ -x "$sibling" ]; then
59
+ printf '%s\n' "$sibling"
60
+ return 0
61
+ fi
62
+
63
+ parent=$(dirname "$search_root")
64
+ if [ "$parent" = "$search_root" ]; then
65
+ return 1
66
+ fi
67
+ search_root="$parent"
68
+ done
69
+ }
70
+
71
+ BINARY=$(find_binary || true)
72
+ if [ -z "$BINARY" ]; then
73
+ printf 'Missing runtime package %s. Reinstall @opencode-linear-agent/server on a supported platform.\n' "$PACKAGE" >&2
74
+ exit 1
75
+ fi
76
+
77
+ exec "$BINARY" "$@"
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@opencode-linear-agent/server",
3
- "version": "0.1.3-master.17",
3
+ "version": "0.1.3-master.22",
4
4
  "type": "module",
5
- "main": "dist/index.js",
6
5
  "bin": {
7
- "opencode-linear-agent-server": "bin/opencode-linear-agent-server"
6
+ "opencode-linear-agent": "bin/opencode-linear-agent"
8
7
  },
9
8
  "files": [
10
9
  "bin",
11
- "dist/index.js"
10
+ "postinstall.mjs",
11
+ "LICENSE"
12
12
  ],
13
13
  "publishConfig": {
14
14
  "access": "public"
@@ -17,26 +17,22 @@
17
17
  "type": "git",
18
18
  "url": "git+https://github.com/jackblanc/opencode-linear-agent.git"
19
19
  },
20
- "engines": {
21
- "bun": ">=1.2.0"
22
- },
23
20
  "scripts": {
24
- "start": "bun run src/index.ts",
25
- "dev": "bun --watch run src/index.ts",
26
- "build": "rm -rf dist && bun build ./src/index.ts --outdir=dist --target=bun --packages=bundle",
27
- "build:bin": "mkdir -p dist && bun build ./src/index.ts --compile --outfile=dist/opencode-linear-agent-server",
28
- "prepublishOnly": "bun run build && test -f dist/index.js"
21
+ "postinstall": "node ./postinstall.mjs || true"
22
+ },
23
+ "optionalDependencies": {
24
+ "@opencode-linear-agent/server-darwin-arm64": "0.1.3-master.22",
25
+ "@opencode-linear-agent/server-darwin-x64": "0.1.3-master.22",
26
+ "@opencode-linear-agent/server-linux-arm64": "0.1.3-master.22",
27
+ "@opencode-linear-agent/server-linux-x64": "0.1.3-master.22"
29
28
  },
30
- "dependencies": {},
31
- "devDependencies": {
32
- "@opencode-linear-agent/core": "workspace:*",
33
- "@linear/sdk": "catalog:",
34
- "@opencode-ai/sdk": "catalog:",
35
- "better-result": "catalog:",
36
- "xdg-basedir": "catalog:",
37
- "zod": "catalog:"
29
+ "opencodeLinearAgent": {
30
+ "cacheFiles": [
31
+ ".opencode-linear-agent-darwin-arm64",
32
+ ".opencode-linear-agent-darwin-x64",
33
+ ".opencode-linear-agent-linux-arm64",
34
+ ".opencode-linear-agent-linux-x64"
35
+ ]
38
36
  },
39
- "peerDependencies": {
40
- "typescript": "^5"
41
- }
37
+ "license": "MIT"
42
38
  }
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs";
4
+ import { createRequire } from "node:module";
5
+ import path from "node:path";
6
+ import os from "node:os";
7
+ import { fileURLToPath } from "node:url";
8
+
9
+ const require = createRequire(import.meta.url);
10
+ const root = path.dirname(fileURLToPath(import.meta.url));
11
+
12
+ function getRuntime() {
13
+ const platform = os.platform();
14
+ const arch = os.arch();
15
+
16
+ if (platform === "darwin" && arch === "arm64") {
17
+ return {
18
+ arch,
19
+ packageName: "@opencode-linear-agent/server-darwin-arm64",
20
+ platform,
21
+ };
22
+ }
23
+
24
+ if (platform === "darwin" && arch === "x64") {
25
+ return {
26
+ arch,
27
+ packageName: "@opencode-linear-agent/server-darwin-x64",
28
+ platform,
29
+ };
30
+ }
31
+
32
+ if (platform === "linux" && arch === "arm64") {
33
+ return {
34
+ arch,
35
+ packageName: "@opencode-linear-agent/server-linux-arm64",
36
+ platform,
37
+ };
38
+ }
39
+
40
+ if (platform === "linux" && arch === "x64") {
41
+ return {
42
+ arch,
43
+ packageName: "@opencode-linear-agent/server-linux-x64",
44
+ platform,
45
+ };
46
+ }
47
+
48
+ return null;
49
+ }
50
+
51
+ function getCache(runtime) {
52
+ return path.join(
53
+ root,
54
+ "bin",
55
+ `.opencode-linear-agent-${runtime.platform}-${runtime.arch}`,
56
+ );
57
+ }
58
+
59
+ function ensureParent(filepath) {
60
+ fs.mkdirSync(path.dirname(filepath), { recursive: true });
61
+ }
62
+
63
+ function installCache(source, cache) {
64
+ ensureParent(cache);
65
+ if (fs.existsSync(cache)) {
66
+ fs.unlinkSync(cache);
67
+ }
68
+
69
+ if (fs.existsSync(source)) {
70
+ fs.copyFileSync(source, cache);
71
+ }
72
+
73
+ if (fs.existsSync(cache)) {
74
+ fs.chmodSync(cache, 0o755);
75
+ }
76
+ }
77
+
78
+ function findBinary(packageName) {
79
+ const pkg = require.resolve(`${packageName}/package.json`);
80
+ return path.join(path.dirname(pkg), "bin", "opencode-linear-agent");
81
+ }
82
+
83
+ function main() {
84
+ const runtime = getRuntime();
85
+ if (!runtime) {
86
+ return;
87
+ }
88
+
89
+ const bin = findBinary(runtime.packageName);
90
+ if (!bin || !fs.existsSync(bin)) {
91
+ return;
92
+ }
93
+
94
+ installCache(bin, getCache(runtime));
95
+ }
96
+
97
+ main();
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env sh
2
- set -eu
3
-
4
- if ! command -v bun >/dev/null 2>&1; then
5
- echo "bun is required to run @opencode-linear-agent/server" >&2
6
- exit 1
7
- fi
8
-
9
- PRG="$0"
10
- while [ -h "$PRG" ]; do
11
- LINK=$(readlink "$PRG")
12
- case "$LINK" in
13
- /*) PRG="$LINK" ;;
14
- *) PRG="$(dirname "$PRG")/$LINK" ;;
15
- esac
16
- done
17
-
18
- DIR=$(CDPATH= cd -- "$(dirname -- "$PRG")" && pwd)
19
- exec bun run "$DIR/../dist/index.js" "$@"