opencode-pollinations-plugin 5.1.3 ā 5.1.4
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 +13 -14
- package/bin/setup.js +56 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -73,14 +73,22 @@ You spend it to verify API calls on premium models.
|
|
|
73
73
|
|
|
74
74
|
This plugin is part of the **OpenCode Ecosystem**.
|
|
75
75
|
|
|
76
|
-
### Option 1: NPM (
|
|
77
|
-
This
|
|
76
|
+
### Option 1: NPM (Instant Setup) (Recommended)
|
|
77
|
+
This method automatically configures OpenCode to load the plugin.
|
|
78
78
|
|
|
79
|
-
1. Install
|
|
79
|
+
1. Install global:
|
|
80
80
|
```bash
|
|
81
81
|
npm install -g opencode-pollinations-plugin
|
|
82
82
|
```
|
|
83
|
-
2.
|
|
83
|
+
2. Run the Auto-Setup (Magic):
|
|
84
|
+
```bash
|
|
85
|
+
npx opencode-pollinations-plugin
|
|
86
|
+
```
|
|
87
|
+
*This detects your OpenCode config and injects the plugin path automatically.*
|
|
88
|
+
|
|
89
|
+
### Option 2: Manual Configuration
|
|
90
|
+
1. Install globally as above.
|
|
91
|
+
2. Edit `~/.config/opencode/opencode.json`:
|
|
84
92
|
```json
|
|
85
93
|
{
|
|
86
94
|
"plugin": [
|
|
@@ -88,16 +96,7 @@ This is the native method for OpenCode CLI.
|
|
|
88
96
|
]
|
|
89
97
|
}
|
|
90
98
|
```
|
|
91
|
-
|
|
92
|
-
### Option 2: Local Development (Source)
|
|
93
|
-
If you are developing the plugin:
|
|
94
|
-
1. Clone the repo.
|
|
95
|
-
2. Link it globally:
|
|
96
|
-
```bash
|
|
97
|
-
cd opencode-pollinations-plugin
|
|
98
|
-
npm link
|
|
99
|
-
```
|
|
100
|
-
3. Use the provided script (`run_dev.sh`) which automatically injects the plugin for testing.
|
|
99
|
+
*Note: If OpenCode fails to find it, use the absolute path to the global install.*
|
|
101
100
|
|
|
102
101
|
## š Publication (The "Registry")
|
|
103
102
|
OpenCode uses NPM as its registry. To publish:
|
package/bin/setup.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
|
|
6
|
+
console.log('šø Pollinations Plugin Setup');
|
|
7
|
+
|
|
8
|
+
// 1. Locate Config
|
|
9
|
+
const configDir = path.join(os.homedir(), '.config', 'opencode');
|
|
10
|
+
const configFile = path.join(configDir, 'opencode.json');
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(configFile)) {
|
|
13
|
+
console.error(`ā OpenCode config not found at: ${configFile}`);
|
|
14
|
+
console.log(' Please run OpenCode once to generate it.');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 2. Read Config
|
|
19
|
+
let config;
|
|
20
|
+
try {
|
|
21
|
+
config = JSON.parse(fs.readFileSync(configFile, 'utf8'));
|
|
22
|
+
} catch (err) {
|
|
23
|
+
console.error('ā Failed to parse opencode.json');
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 3. Detect Plugin Path
|
|
28
|
+
// We use the absolute path of THIS package installation to be safe
|
|
29
|
+
const pluginPath = path.resolve(__dirname, '..');
|
|
30
|
+
console.log(`š Plugin Path: ${pluginPath}`);
|
|
31
|
+
|
|
32
|
+
// 4. Update Config
|
|
33
|
+
if (!config.plugin) {
|
|
34
|
+
config.plugin = [];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const pluginName = 'opencode-pollinations-plugin';
|
|
38
|
+
const alreadyExists = config.plugin.some(p => p === pluginName || p.includes('opencode-pollinations-plugin'));
|
|
39
|
+
|
|
40
|
+
if (!alreadyExists) {
|
|
41
|
+
// We strive to use the CLEAN name if possible, but fallback to absolute path if installed locally
|
|
42
|
+
// For global installs, absolute path is safest across envs
|
|
43
|
+
config.plugin.push(pluginPath);
|
|
44
|
+
console.log('ā
Added plugin to configuration.');
|
|
45
|
+
|
|
46
|
+
// Backup
|
|
47
|
+
fs.writeFileSync(configFile + '.bak', fs.readFileSync(configFile));
|
|
48
|
+
|
|
49
|
+
// Write
|
|
50
|
+
fs.writeFileSync(configFile, JSON.stringify(config, null, 2));
|
|
51
|
+
console.log(`⨠Configuration saved: ${configFile}`);
|
|
52
|
+
} else {
|
|
53
|
+
console.log('ā
Plugin already configured.');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
console.log('\nš Setup Complete! Restart OpenCode to see models.');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-pollinations-plugin",
|
|
3
3
|
"displayName": "Pollinations AI (V5.1)",
|
|
4
|
-
"version": "5.1.
|
|
4
|
+
"version": "5.1.4",
|
|
5
5
|
"description": "Native Pollinations.ai Provider Plugin for OpenCode",
|
|
6
6
|
"publisher": "pollinations",
|
|
7
7
|
"repository": {
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"default": "./dist/index.js"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
+
"bin": {
|
|
19
|
+
"opencode-pollinations-plugin": "./bin/setup.js"
|
|
20
|
+
},
|
|
18
21
|
"main": "./dist/index.js",
|
|
19
22
|
"types": "./dist/index.d.ts",
|
|
20
23
|
"engines": {
|
|
@@ -50,4 +53,4 @@
|
|
|
50
53
|
"@types/node": "^20.0.0",
|
|
51
54
|
"typescript": "^5.0.0"
|
|
52
55
|
}
|
|
53
|
-
}
|
|
56
|
+
}
|