chutes-plugin 0.1.3 → 0.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/dist/cli/index.js CHANGED
@@ -1,20 +1,5 @@
1
1
  // @bun
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
2
  var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __toESM = (mod, isNodeMode, target) => {
8
- target = mod != null ? __create(__getProtoOf(mod)) : {};
9
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
- for (let key of __getOwnPropNames(mod))
11
- if (!__hasOwnProp.call(to, key))
12
- __defProp(to, key, {
13
- get: () => mod[key],
14
- enumerable: true
15
- });
16
- return to;
17
- };
18
3
  var __export = (target, all) => {
19
4
  for (var name in all)
20
5
  __defProp(target, name, {
@@ -25,7 +10,6 @@ var __export = (target, all) => {
25
10
  });
26
11
  };
27
12
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
28
- var __require = import.meta.require;
29
13
 
30
14
  // src/cli/install.ts
31
15
  var exports_install = {};
@@ -34,57 +18,16 @@ __export(exports_install, {
34
18
  });
35
19
  import * as fs from "fs";
36
20
  import * as path from "path";
37
- async function install(options) {
21
+ async function install() {
38
22
  console.log(`\uD83D\uDC0D chutes-plugin installer
39
23
  `);
40
24
  console.log(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
41
25
  `);
42
- let installType = options.type;
43
- if (!installType) {
44
- console.log("Choose installation type:");
45
- console.log("1. Project (copy plugin files to .opencode/plugin/)");
46
- console.log("2. Global (copy plugin files to ~/.config/opencode/plugin/)");
47
- console.log(`3. NPM (add "chutes-plugin" to opencode.json)
48
- `);
49
- const readline = await import("readline");
50
- const rl = readline.createInterface({
51
- input: process.stdin,
52
- output: process.stdout
53
- });
54
- installType = await new Promise((resolve) => {
55
- rl.question("> ", (answer) => {
56
- rl.close();
57
- resolve(answer.trim());
58
- });
59
- });
60
- }
61
- console.log(`Installing type: ${installType}
62
- `);
63
- switch (installType) {
64
- case "1":
65
- case "project":
66
- await installProject();
67
- break;
68
- case "2":
69
- case "global":
70
- await installGlobal();
71
- break;
72
- case "3":
73
- case "npm":
74
- await installNpm();
75
- break;
76
- default:
77
- console.log(`\u274C Invalid installation type: "${installType}"`);
78
- console.log("Please choose: 1 (project), 2 (global), or 3 (npm)");
79
- process.exit(1);
80
- }
81
- }
82
- async function installProject() {
83
26
  const projectDir = process.cwd();
84
27
  const pluginDir = path.join(projectDir, ".opencode", "plugin", "chutes-plugin");
85
- console.log(`Installing to project...
28
+ console.log(`Installing chutes-plugin to project...
86
29
  `);
87
- console.log(`Copying plugin files to .opencode/plugin/...
30
+ console.log(`Copying plugin files to .opencode/plugin/chutes-plugin/
88
31
  `);
89
32
  fs.mkdirSync(pluginDir, { recursive: true });
90
33
  const distDir = path.join(__dirname, "..", "..", "dist");
@@ -95,64 +38,21 @@ async function installProject() {
95
38
  if (fs.existsSync(srcCliDir)) {
96
39
  fs.cpSync(srcCliDir, path.join(pluginDir, "src"), { recursive: true });
97
40
  }
98
- console.log("\u2705 Plugin files installed to .opencode/plugin/chutes-plugin/");
41
+ console.log("\u2705 Successfully installed!");
99
42
  console.log(` Location: ${pluginDir}`);
100
43
  console.log(`
101
- Note: Plugins in .opencode/plugin/ are auto-loaded by OpenCode.
102
- `);
103
- }
104
- async function installGlobal() {
105
- const homeDir = process.env.HOME || process.env.USERPROFILE;
106
- if (!homeDir) {
107
- console.error("\u274C Error: Could not determine home directory");
108
- process.exit(1);
109
- }
110
- const configDir = path.join(homeDir, ".config", "opencode");
111
- const pluginDir = path.join(configDir, "plugin", "chutes-plugin");
112
- console.log(`Installing globally...
44
+ \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501
113
45
  `);
114
- fs.mkdirSync(pluginDir, { recursive: true });
115
- const distDir = path.join(__dirname, "..", "..", "dist");
116
- if (fs.existsSync(distDir)) {
117
- fs.cpSync(distDir, path.join(pluginDir, "dist"), { recursive: true });
118
- }
119
- const srcCliDir = path.join(__dirname, "..");
120
- if (fs.existsSync(srcCliDir)) {
121
- fs.cpSync(srcCliDir, path.join(pluginDir, "src"), { recursive: true });
122
- }
123
- console.log("\u2705 Plugin files installed globally!");
124
- console.log(` Location: ${pluginDir}`);
46
+ console.log("Next steps:");
47
+ console.log("1. Restart OpenCode if it's running");
48
+ console.log("2. Run: opencode");
49
+ console.log("3. Connect your token: /connect chutes");
50
+ console.log("4. Select a Chutes model from the dropdown");
125
51
  console.log(`
126
- Note: Plugins in ~/.config/opencode/plugin/ are auto-loaded by OpenCode.
127
- `);
128
- }
129
- async function installNpm() {
130
- const projectDir = process.cwd();
131
- const configPath = path.join(projectDir, "opencode.json");
132
- console.log(`Installing via npm...
133
- `);
134
- let config = {};
135
- if (fs.existsSync(configPath)) {
136
- const content = fs.readFileSync(configPath, "utf-8");
137
- try {
138
- config = JSON.parse(content);
139
- } catch (e) {
140
- console.error("\u274C Failed to parse opencode.json:", e);
141
- process.exit(1);
142
- }
143
- }
144
- config.plugins = config.plugins || [];
145
- if (!Array.isArray(config.plugins)) {
146
- config.plugins = [];
147
- }
148
- const plugins = config.plugins;
149
- if (!plugins.includes("chutes-plugin")) {
150
- plugins.push("chutes-plugin");
151
- }
152
- fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
153
- console.log('\u2705 Added "chutes-plugin" to opencode.json!');
154
- console.log(` OpenCode will auto-install the plugin on next startup.
155
- `);
52
+ Available tools:`);
53
+ console.log(" - chutes_list_models");
54
+ console.log(" - chutes_refresh_models");
55
+ console.log(" - chutes_status");
156
56
  }
157
57
  var __dirname = "/home/mark182/code/chutes-plugin/src/cli";
158
58
  var init_install = () => {};
@@ -433,13 +333,13 @@ cli.version("0.1.0");
433
333
  cli.usage(`
434
334
  \uD83D\uDC0D chutes-plugin
435
335
 
436
- A plugin for OpenCode that provides access to 48+ state-of-the-art AI models through the Chutes API.
336
+ A plugin for OpenCode that provides access to 58+ state-of-the-art AI models through the Chutes API.
437
337
 
438
338
  Usage:
439
339
  $ chutes-plugin <command>
440
340
 
441
341
  Commands:
442
- install Install the plugin (project, global, or npm)
342
+ install Install the plugin to the current project (.opencode/plugin/)
443
343
  status Check plugin status and configuration
444
344
  list List available models from the Chutes API
445
345
  refresh Force refresh the model cache
@@ -452,9 +352,9 @@ Examples:
452
352
  $ chutes-plugin refresh
453
353
  $ chutes-plugin doctor
454
354
  `);
455
- cli.command("install", "Install the plugin to OpenCode").option("--type <type>", "Installation type: project, global, or npm").action(async (options) => {
355
+ cli.command("install", "Install the plugin to the current project").action(async () => {
456
356
  const { install: install2 } = await Promise.resolve().then(() => (init_install(), exports_install));
457
- await install2(options);
357
+ await install2();
458
358
  });
459
359
  cli.command("status", "Check plugin status and configuration").action(async () => {
460
360
  const { status: status2 } = await Promise.resolve().then(() => (init_status(), exports_status));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chutes-plugin",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Chutes Models plugin for OpenCode - Access 48+ state-of-the-art AI models through the Chutes API",
5
5
  "author": {
6
6
  "name": "Gianmarco Martinelli",
package/src/cli/index.ts CHANGED
@@ -6,13 +6,13 @@ cli.version('0.1.0');
6
6
  cli.usage(`
7
7
  🐍 chutes-plugin
8
8
 
9
- A plugin for OpenCode that provides access to 48+ state-of-the-art AI models through the Chutes API.
9
+ A plugin for OpenCode that provides access to 58+ state-of-the-art AI models through the Chutes API.
10
10
 
11
11
  Usage:
12
12
  $ chutes-plugin <command>
13
13
 
14
14
  Commands:
15
- install Install the plugin (project, global, or npm)
15
+ install Install the plugin to the current project (.opencode/plugin/)
16
16
  status Check plugin status and configuration
17
17
  list List available models from the Chutes API
18
18
  refresh Force refresh the model cache
@@ -26,13 +26,10 @@ Examples:
26
26
  $ chutes-plugin doctor
27
27
  `);
28
28
 
29
- cli
30
- .command('install', 'Install the plugin to OpenCode')
31
- .option('--type <type>', 'Installation type: project, global, or npm')
32
- .action(async (options) => {
33
- const { install } = await import('./install.js');
34
- await install(options);
35
- });
29
+ cli.command('install', 'Install the plugin to the current project').action(async () => {
30
+ const { install } = await import('./install.js');
31
+ await install();
32
+ });
36
33
 
37
34
  cli.command('status', 'Check plugin status and configuration').action(async () => {
38
35
  const { status } = await import('./status.js');
@@ -1,93 +1,15 @@
1
1
  import * as fs from 'node:fs';
2
2
  import * as path from 'node:path';
3
3
 
4
- interface InstallOptions {
5
- type?: string;
6
- }
7
-
8
- export async function install(options: InstallOptions): Promise<void> {
4
+ export async function install(): Promise<void> {
9
5
  console.log('🐍 chutes-plugin installer\n');
10
6
  console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
11
7
 
12
- let installType = options.type;
13
-
14
- if (!installType) {
15
- console.log('Choose installation type:');
16
- console.log('1. Project (copy plugin files to .opencode/plugin/)');
17
- console.log('2. Global (copy plugin files to ~/.config/opencode/plugin/)');
18
- console.log('3. NPM (add "chutes-plugin" to opencode.json)\n');
19
-
20
- const readline = await import('node:readline');
21
- const rl = readline.createInterface({
22
- input: process.stdin,
23
- output: process.stdout,
24
- });
25
-
26
- installType = await new Promise<string>((resolve) => {
27
- rl.question('> ', (answer) => {
28
- rl.close();
29
- resolve(answer.trim());
30
- });
31
- });
32
- }
33
-
34
- console.log(`Installing type: ${installType}\n`);
35
-
36
- switch (installType) {
37
- case '1':
38
- case 'project':
39
- await installProject();
40
- break;
41
- case '2':
42
- case 'global':
43
- await installGlobal();
44
- break;
45
- case '3':
46
- case 'npm':
47
- await installNpm();
48
- break;
49
- default:
50
- console.log(`❌ Invalid installation type: "${installType}"`);
51
- console.log('Please choose: 1 (project), 2 (global), or 3 (npm)');
52
- process.exit(1);
53
- }
54
- }
55
-
56
- async function installProject(): Promise<void> {
57
8
  const projectDir = process.cwd();
58
9
  const pluginDir = path.join(projectDir, '.opencode', 'plugin', 'chutes-plugin');
59
10
 
60
- console.log('Installing to project...\n');
61
- console.log('Copying plugin files to .opencode/plugin/...\n');
62
-
63
- fs.mkdirSync(pluginDir, { recursive: true });
64
-
65
- const distDir = path.join(__dirname, '..', '..', 'dist');
66
- if (fs.existsSync(distDir)) {
67
- fs.cpSync(distDir, path.join(pluginDir, 'dist'), { recursive: true });
68
- }
69
-
70
- const srcCliDir = path.join(__dirname, '..');
71
- if (fs.existsSync(srcCliDir)) {
72
- fs.cpSync(srcCliDir, path.join(pluginDir, 'src'), { recursive: true });
73
- }
74
-
75
- console.log('✅ Plugin files installed to .opencode/plugin/chutes-plugin/');
76
- console.log(` Location: ${pluginDir}`);
77
- console.log('\nNote: Plugins in .opencode/plugin/ are auto-loaded by OpenCode.\n');
78
- }
79
-
80
- async function installGlobal(): Promise<void> {
81
- const homeDir = process.env.HOME || process.env.USERPROFILE;
82
- if (!homeDir) {
83
- console.error('❌ Error: Could not determine home directory');
84
- process.exit(1);
85
- }
86
-
87
- const configDir = path.join(homeDir, '.config', 'opencode');
88
- const pluginDir = path.join(configDir, 'plugin', 'chutes-plugin');
89
-
90
- console.log('Installing globally...\n');
11
+ console.log('Installing chutes-plugin to project...\n');
12
+ console.log('Copying plugin files to .opencode/plugin/chutes-plugin/\n');
91
13
 
92
14
  fs.mkdirSync(pluginDir, { recursive: true });
93
15
 
@@ -101,40 +23,16 @@ async function installGlobal(): Promise<void> {
101
23
  fs.cpSync(srcCliDir, path.join(pluginDir, 'src'), { recursive: true });
102
24
  }
103
25
 
104
- console.log('✅ Plugin files installed globally!');
26
+ console.log('✅ Successfully installed!');
105
27
  console.log(` Location: ${pluginDir}`);
106
- console.log('\nNote: Plugins in ~/.config/opencode/plugin/ are auto-loaded by OpenCode.\n');
107
- }
108
-
109
- async function installNpm(): Promise<void> {
110
- const projectDir = process.cwd();
111
- const configPath = path.join(projectDir, 'opencode.json');
112
-
113
- console.log('Installing via npm...\n');
114
-
115
- let config: Record<string, unknown> = {};
116
- if (fs.existsSync(configPath)) {
117
- const content = fs.readFileSync(configPath, 'utf-8');
118
- try {
119
- config = JSON.parse(content);
120
- } catch (e) {
121
- console.error('❌ Failed to parse opencode.json:', e);
122
- process.exit(1);
123
- }
124
- }
125
-
126
- config.plugins = config.plugins || [];
127
- if (!Array.isArray(config.plugins)) {
128
- config.plugins = [];
129
- }
130
-
131
- const plugins = config.plugins as string[];
132
- if (!plugins.includes('chutes-plugin')) {
133
- plugins.push('chutes-plugin');
134
- }
135
-
136
- fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
137
-
138
- console.log('✅ Added "chutes-plugin" to opencode.json!');
139
- console.log(' OpenCode will auto-install the plugin on next startup.\n');
28
+ console.log('\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n');
29
+ console.log('Next steps:');
30
+ console.log("1. Restart OpenCode if it's running");
31
+ console.log('2. Run: opencode');
32
+ console.log('3. Connect your token: /connect chutes');
33
+ console.log('4. Select a Chutes model from the dropdown');
34
+ console.log('\nAvailable tools:');
35
+ console.log(' - chutes_list_models');
36
+ console.log(' - chutes_refresh_models');
37
+ console.log(' - chutes_status');
140
38
  }