@fleettools/opencode-plugin 0.2.0 → 1.0.0

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 ADDED
@@ -0,0 +1,73 @@
1
+ # FleetTools OpenCode Plugin
2
+
3
+ Integrates FleetTools AI Agent Coordination System into OpenCode.
4
+
5
+ ## Installation
6
+
7
+ ### From npm (Recommended)
8
+ ```bash
9
+ npm install @fleettools/opencode-plugin
10
+ ```
11
+
12
+ ### From OpenCode CLI
13
+ ```bash
14
+ opencode plugin install @fleettools/opencode-plugin
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Once installed, the plugin provides three tools:
20
+
21
+ ### 🚀 `fleet-start`
22
+ Start FleetTools services (API, Squawk coordination)
23
+
24
+ ```bash
25
+ # Start all services
26
+ fleet-start
27
+
28
+ # Start specific services
29
+ fleet-start --services api,squawk
30
+
31
+ # Run in foreground
32
+ fleet-start --foreground
33
+ ```
34
+
35
+ ### 🛑 `fleet-stop`
36
+ Stop FleetTools services
37
+
38
+ ```bash
39
+ # Graceful stop
40
+ fleet-stop
41
+
42
+ # Force stop
43
+ fleet-stop --force
44
+ ```
45
+
46
+ ### 📊 `fleet-status`
47
+ Get FleetTools service status and configuration
48
+
49
+ ```bash
50
+ # Human-readable status
51
+ fleet-status
52
+
53
+ # JSON format
54
+ fleet-status --format json
55
+ ```
56
+
57
+ ## Features
58
+
59
+ - ✅ **Service Management**: Start, stop, and monitor FleetTools services
60
+ - ✅ **JSON & Text Output**: Flexible output formats for different use cases
61
+ - ✅ **Error Handling**: Graceful error reporting and process management
62
+ - ✅ **Background/Foreground**: Choose how services run
63
+ - ✅ **Service Selection**: Start specific services or all services
64
+
65
+ ## Requirements
66
+
67
+ - OpenCode >= 1.0.0
68
+ - FleetTools CLI >= 0.1.0
69
+ - Node.js >= 18.0.0
70
+
71
+ ## License
72
+
73
+ MIT License - see LICENSE file for details.
@@ -0,0 +1,6 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="32" height="32" rx="8" fill="#3B82F6"/>
3
+ <path d="M8 12h2M12 12h8M8 16h2M12 16h8M8 20h2M12 20h8" stroke="white" stroke-width="2" stroke-linecap="round"/>
4
+ <path d="M16 8l4 4M16 12l4 4M16 16l4 4" stroke="#60A5FA" stroke-width="2" stroke-linecap="round"/>
5
+ <circle cx="24" cy="8" r="2" fill="#60A5FA"/>
6
+ </svg>
package/dist/index.js CHANGED
@@ -1,7 +1,12 @@
1
- import { exec } from 'child_process';
2
- import { promisify } from 'util';
3
- const execAsync = promisify(exec);
4
- export class FleetToolsOpenCodePluginImpl {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fleetToolsPlugin = exports.FleetToolsOpenCodePluginImpl = void 0;
4
+ exports.createPlugin = createPlugin;
5
+ exports.fallbackRegister = fallbackRegister;
6
+ const child_process_1 = require("child_process");
7
+ const util_1 = require("util");
8
+ const execAsync = (0, util_1.promisify)(child_process_1.exec);
9
+ class FleetToolsOpenCodePluginImpl {
5
10
  /** Plugin name */
6
11
  name = 'FleetTools';
7
12
  /** Plugin version */
@@ -146,14 +151,15 @@ export class FleetToolsOpenCodePluginImpl {
146
151
  console.log(`\n--- ${title} ---\n${content}\n`);
147
152
  }
148
153
  }
154
+ exports.FleetToolsOpenCodePluginImpl = FleetToolsOpenCodePluginImpl;
149
155
  let plugin = null;
150
- export function createPlugin() {
156
+ function createPlugin() {
151
157
  if (!plugin) {
152
158
  plugin = new FleetToolsOpenCodePluginImpl();
153
159
  }
154
160
  return plugin;
155
161
  }
156
- export const fleetToolsPlugin = {
162
+ exports.fleetToolsPlugin = {
157
163
  name: 'FleetTools',
158
164
  version: '0.1.0',
159
165
  register: async (commands) => {
@@ -161,7 +167,7 @@ export const fleetToolsPlugin = {
161
167
  await fleetPlugin.registerCommands(commands);
162
168
  },
163
169
  };
164
- export async function fallbackRegister() {
170
+ async function fallbackRegister() {
165
171
  console.warn('[FleetTools] OpenCode SDK not available. Running in CLI fallback mode.');
166
172
  console.warn('[FleetTools] The following commands are available via fleet CLI:');
167
173
  console.warn(' - fleet status');
@@ -170,5 +176,5 @@ export async function fallbackRegister() {
170
176
  console.warn(' - fleet services');
171
177
  console.warn(' - fleet help');
172
178
  }
173
- export default fleetToolsPlugin;
179
+ exports.default = exports.fleetToolsPlugin;
174
180
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,69 @@
1
+ /**
2
+ * FleetTools OpenCode Plugin
3
+ *
4
+ * Integrates FleetTools CLI functionality into OpenCode
5
+ */
6
+ export default function FleetToolsPlugin(): Promise<{
7
+ tool: {
8
+ 'fleet-status': {
9
+ description: string;
10
+ parameters: {
11
+ type: string;
12
+ properties: {
13
+ format: {
14
+ type: string;
15
+ enum: string[];
16
+ description: string;
17
+ };
18
+ };
19
+ };
20
+ execute: ({ format }: {
21
+ format?: string;
22
+ }) => Promise<{
23
+ success: boolean;
24
+ data: string;
25
+ error?: undefined;
26
+ } | {
27
+ success: boolean;
28
+ error: string;
29
+ data?: undefined;
30
+ }>;
31
+ };
32
+ 'fleet-start': {
33
+ description: string;
34
+ parameters: {
35
+ type: string;
36
+ properties: {
37
+ services: {
38
+ type: string;
39
+ description: string;
40
+ };
41
+ foreground: {
42
+ type: string;
43
+ description: string;
44
+ };
45
+ };
46
+ };
47
+ execute: ({ services, foreground }: {
48
+ services?: string;
49
+ foreground?: boolean;
50
+ }) => Promise<unknown>;
51
+ };
52
+ 'fleet-stop': {
53
+ description: string;
54
+ parameters: {
55
+ type: string;
56
+ properties: {
57
+ force: {
58
+ type: string;
59
+ description: string;
60
+ };
61
+ };
62
+ };
63
+ execute: ({ force }: {
64
+ force?: boolean;
65
+ }) => Promise<unknown>;
66
+ };
67
+ };
68
+ }>;
69
+ //# sourceMappingURL=plugin.d.ts.map
package/dist/plugin.js ADDED
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ /**
3
+ * FleetTools OpenCode Plugin
4
+ *
5
+ * Integrates FleetTools CLI functionality into OpenCode
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.default = FleetToolsPlugin;
9
+ async function FleetToolsPlugin() {
10
+ console.log('FleetTools plugin initialized!');
11
+ // Return tool definitions for FleetTools
12
+ return {
13
+ tool: {
14
+ 'fleet-status': {
15
+ description: 'Get FleetTools service status and configuration',
16
+ parameters: {
17
+ type: 'object',
18
+ properties: {
19
+ format: {
20
+ type: 'string',
21
+ enum: ['json', 'text'],
22
+ description: 'Output format (default: text)'
23
+ }
24
+ }
25
+ },
26
+ execute: async ({ format = 'text' }) => {
27
+ const { execSync } = await import('node:child_process');
28
+ try {
29
+ const result = execSync(`fleet status${format === 'json' ? ' --json' : ''}`, {
30
+ encoding: 'utf-8'
31
+ });
32
+ return { success: true, data: result };
33
+ }
34
+ catch (error) {
35
+ return {
36
+ success: false,
37
+ error: error instanceof Error ? error.message : String(error)
38
+ };
39
+ }
40
+ }
41
+ },
42
+ 'fleet-start': {
43
+ description: 'Start FleetTools services',
44
+ parameters: {
45
+ type: 'object',
46
+ properties: {
47
+ services: {
48
+ type: 'string',
49
+ description: 'Comma-separated list of services to start (api,squawk)'
50
+ },
51
+ foreground: {
52
+ type: 'boolean',
53
+ description: 'Run in foreground instead of background'
54
+ }
55
+ }
56
+ },
57
+ execute: async ({ services, foreground }) => {
58
+ const { spawn } = await import('node:child_process');
59
+ return new Promise((resolve) => {
60
+ const args = ['start'];
61
+ if (services)
62
+ args.push('--services', services);
63
+ if (foreground)
64
+ args.push('--foreground');
65
+ const process = spawn('fleet', args, { stdio: 'pipe' });
66
+ let stdout = '';
67
+ let stderr = '';
68
+ process.stdout?.on('data', (data) => stdout += data);
69
+ process.stderr?.on('data', (data) => stderr += data);
70
+ process.on('close', (code) => {
71
+ if (code === 0) {
72
+ resolve({
73
+ success: true,
74
+ data: stdout || 'FleetTools services started successfully'
75
+ });
76
+ }
77
+ else {
78
+ resolve({
79
+ success: false,
80
+ error: stderr || `Process exited with code ${code}`
81
+ });
82
+ }
83
+ });
84
+ process.on('error', (error) => {
85
+ resolve({
86
+ success: false,
87
+ error: error.message
88
+ });
89
+ });
90
+ });
91
+ }
92
+ },
93
+ 'fleet-stop': {
94
+ description: 'Stop FleetTools services',
95
+ parameters: {
96
+ type: 'object',
97
+ properties: {
98
+ force: {
99
+ type: 'boolean',
100
+ description: 'Force stop services'
101
+ }
102
+ }
103
+ },
104
+ execute: async ({ force }) => {
105
+ const { spawn } = await import('node:child_process');
106
+ return new Promise((resolve) => {
107
+ const args = ['stop'];
108
+ if (force)
109
+ args.push('--force');
110
+ const process = spawn('fleet', args, { stdio: 'pipe' });
111
+ let stdout = '';
112
+ let stderr = '';
113
+ process.stdout?.on('data', (data) => stdout += data);
114
+ process.stderr?.on('data', (data) => stderr += data);
115
+ process.on('close', (code) => {
116
+ if (code === 0) {
117
+ resolve({
118
+ success: true,
119
+ data: stdout || 'FleetTools services stopped successfully'
120
+ });
121
+ }
122
+ else {
123
+ resolve({
124
+ success: false,
125
+ error: stderr || `Process exited with code ${code}`
126
+ });
127
+ }
128
+ });
129
+ process.on('error', (error) => {
130
+ resolve({
131
+ success: false,
132
+ error: error.message
133
+ });
134
+ });
135
+ });
136
+ }
137
+ }
138
+ }
139
+ };
140
+ }
141
+ //# sourceMappingURL=plugin.js.map
package/manifest.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "FleetTools",
3
+ "description": "AI Agent Coordination System",
4
+ "version": "1.0.0",
5
+ "author": "FleetTools",
6
+ "license": "MIT",
7
+ "entry": "dist/plugin.js",
8
+ "icon": "assets/icon.svg",
9
+ "permissions": [
10
+ "bash",
11
+ "read",
12
+ "write"
13
+ ],
14
+ "hooks": [
15
+ "tool.execute.before",
16
+ "chat.params"
17
+ ],
18
+ "tools": [
19
+ "fleet-status",
20
+ "fleet-start",
21
+ "fleet-stop"
22
+ ],
23
+ "categories": [
24
+ "development",
25
+ "automation",
26
+ "ai"
27
+ ]
28
+ }
package/package.json CHANGED
@@ -1,38 +1,40 @@
1
1
  {
2
2
  "name": "@fleettools/opencode-plugin",
3
- "version": "0.2.0",
4
- "description": "FleetTools plugin for OpenCode editor - /fleet commands",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "type": "module",
8
- "exports": {
9
- "import": "./dist/index.js",
10
- "types": "./dist/index.d.ts"
11
- },
12
- "bin": {
13
- "fleet-opencode": "./dist/index.js"
14
- },
3
+ "version": "1.0.0",
4
+ "description": "FleetTools OpenCode Plugin - AI Agent Coordination System",
5
+ "main": "dist/plugin.js",
6
+ "types": "dist/plugin.d.ts",
15
7
  "scripts": {
16
- "build": "tsc --project tsconfig.json",
17
- "test": "echo 'No tests configured'",
18
- "clean": "rm -rf dist"
8
+ "build": "tsc",
9
+ "dev": "tsc --watch",
10
+ "package": "npm run build && node scripts/package.js"
19
11
  },
20
12
  "keywords": [
21
13
  "fleettools",
22
14
  "opencode",
23
- "plugin",
15
+ "ai",
16
+ "agents",
17
+ "coordination",
24
18
  "cli"
25
19
  ],
26
- "author": "FleetTools Contributors",
20
+ "author": "FleetTools",
27
21
  "license": "MIT",
28
- "engines": {
29
- "bun": ">=1.0.0"
30
- },
22
+ "dependencies": {},
31
23
  "devDependencies": {
32
- "typescript": "^5.9.3",
33
- "@types/node": "^20.10.6"
24
+ "typescript": "^5.0.0",
25
+ "@types/node": "^20.0.0"
26
+ },
27
+ "peerDependencies": {
28
+ "opencode": "^1.0.0"
34
29
  },
35
- "publishConfig": {
36
- "access": "public"
30
+ "opencode": {
31
+ "displayName": "FleetTools",
32
+ "description": "AI Agent Coordination System for FleetTools",
33
+ "icon": "assets/icon.svg",
34
+ "permissions": [
35
+ "bash",
36
+ "read",
37
+ "write"
38
+ ]
37
39
  }
38
- }
40
+ }
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Plugin Packaging Script
5
+ *
6
+ * Creates a distributable plugin package
7
+ */
8
+
9
+ import { readFileSync, writeFileSync, createWriteStream } from 'node:fs';
10
+ import { join } from 'node:path';
11
+ import { execSync } from 'node:child_process';
12
+ import { fileURLToPath } from 'node:url';
13
+ import { dirname } from 'node:path';
14
+ import archiver from 'archiver';
15
+
16
+ const __filename = fileURLToPath(import.meta.url);
17
+ const __dirname = dirname(__filename);
18
+
19
+ async function createPluginPackage() {
20
+ console.log('📦 Creating FleetTools OpenCode plugin package...');
21
+
22
+ try {
23
+ // Ensure the build is up to date
24
+ execSync('npm run build', { stdio: 'inherit' });
25
+
26
+ // Create a zip file
27
+ const output = createWriteStream(join(__dirname, '../fleettools-opencode-plugin.zip'));
28
+ const archive = archiver('zip', { zlib: { level: 9 } });
29
+
30
+ output.on('close', () => {
31
+ console.log(`✅ Plugin package created: ${archive.pointer()} bytes`);
32
+ });
33
+
34
+ archive.on('error', (err) => {
35
+ throw err;
36
+ });
37
+
38
+ archive.pipe(output);
39
+
40
+ // Add essential files
41
+ archive.file(join(__dirname, '../dist/plugin.js'), { name: 'plugin.js' });
42
+ archive.file(join(__dirname, '../dist/plugin.d.ts'), { name: 'plugin.d.ts' });
43
+ archive.file(join(__dirname, '../package.json'), { name: 'package.json' });
44
+ archive.file(join(__dirname, '../manifest.json'), { name: 'manifest.json' });
45
+ archive.file(join(__dirname, '../README.md'), { name: 'README.md' });
46
+
47
+ await archive.finalize();
48
+
49
+ } catch (error) {
50
+ console.error('❌ Failed to create plugin package:', error);
51
+ process.exit(1);
52
+ }
53
+ }
54
+
55
+ createPluginPackage();