@melihmucuk/leash 1.0.0 → 1.0.2
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/README.md +2 -2
- package/bin/leash.js +12 -1
- package/bin/lib.js +11 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,11 +57,11 @@ Add to `~/.pi/agent/settings.json`:
|
|
|
57
57
|
|
|
58
58
|
**OpenCode** - [docs](https://opencode.ai/docs/plugins/)
|
|
59
59
|
|
|
60
|
-
Add to `~/.config/opencode/
|
|
60
|
+
Add to `~/.config/opencode/opencode.json` (or `opencode.jsonc` if you use that):
|
|
61
61
|
|
|
62
62
|
```json
|
|
63
63
|
{
|
|
64
|
-
"
|
|
64
|
+
"plugin": ["<path from leash --path opencode>"]
|
|
65
65
|
}
|
|
66
66
|
```
|
|
67
67
|
|
package/bin/leash.js
CHANGED
|
@@ -14,7 +14,18 @@ function getDistPath() {
|
|
|
14
14
|
|
|
15
15
|
function getConfigPath(platformKey) {
|
|
16
16
|
const platform = PLATFORMS[platformKey];
|
|
17
|
-
|
|
17
|
+
if (!platform) return null;
|
|
18
|
+
|
|
19
|
+
// Support multiple config paths (first existing wins, fallback to last)
|
|
20
|
+
if (platform.configPaths) {
|
|
21
|
+
for (const p of platform.configPaths) {
|
|
22
|
+
const full = join(homedir(), p);
|
|
23
|
+
if (existsSync(full)) return full;
|
|
24
|
+
}
|
|
25
|
+
return join(homedir(), platform.configPaths.at(-1));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return join(homedir(), platform.configPath);
|
|
18
29
|
}
|
|
19
30
|
|
|
20
31
|
function getLeashPath(platformKey) {
|
package/bin/lib.js
CHANGED
|
@@ -4,21 +4,24 @@ import { dirname } from "path";
|
|
|
4
4
|
export const PLATFORMS = {
|
|
5
5
|
opencode: {
|
|
6
6
|
name: "OpenCode",
|
|
7
|
-
|
|
7
|
+
configPaths: [
|
|
8
|
+
".config/opencode/opencode.jsonc",
|
|
9
|
+
".config/opencode/opencode.json",
|
|
10
|
+
],
|
|
8
11
|
distPath: "opencode/leash.js",
|
|
9
12
|
setup: (config, leashPath) => {
|
|
10
|
-
config.
|
|
11
|
-
if (config.
|
|
13
|
+
config.plugin = config.plugin || [];
|
|
14
|
+
if (config.plugin.some((p) => p.includes("leash"))) {
|
|
12
15
|
return { skipped: true };
|
|
13
16
|
}
|
|
14
|
-
config.
|
|
17
|
+
config.plugin.push(leashPath);
|
|
15
18
|
return { skipped: false };
|
|
16
19
|
},
|
|
17
20
|
remove: (config) => {
|
|
18
|
-
if (!config.
|
|
19
|
-
const before = config.
|
|
20
|
-
config.
|
|
21
|
-
return config.
|
|
21
|
+
if (!config.plugin) return false;
|
|
22
|
+
const before = config.plugin.length;
|
|
23
|
+
config.plugin = config.plugin.filter((p) => !p.includes("leash"));
|
|
24
|
+
return config.plugin.length < before;
|
|
22
25
|
},
|
|
23
26
|
},
|
|
24
27
|
pi: {
|