@opentabs-dev/plugin-tools 0.0.10
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.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +16 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/build.d.ts +26 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +341 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +2 -0
- package/dist/commands/index.js.map +1 -0
- package/package.json +27 -0
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { registerBuildCommand } from './commands/index.js';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
const cliDir = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const pkgJson = JSON.parse(await Bun.file(join(cliDir, '..', 'package.json')).text());
|
|
8
|
+
const program = new Command('opentabs-plugin')
|
|
9
|
+
.version(pkgJson.version, '-V, --version')
|
|
10
|
+
.description('OpenTabs plugin tools — build and validate plugins')
|
|
11
|
+
.action(() => {
|
|
12
|
+
program.help();
|
|
13
|
+
});
|
|
14
|
+
registerBuildCommand(program);
|
|
15
|
+
await program.parseAsync();
|
|
16
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACvD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,IAAI,EAAE,CAAwB,CAAC;AAE7G,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;KAC3C,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC;KACzC,WAAW,CAAC,oDAAoD,CAAC;KACjE,MAAM,CAAC,GAAG,EAAE;IACX,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC,CAAC,CAAC;AAEL,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAE9B,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `opentabs-plugin build` command — generates dist/tools.json and bundles the adapter IIFE.
|
|
3
|
+
* Plugin metadata (name, version, displayName, description, urlPatterns) is read from
|
|
4
|
+
* package.json's `opentabs` field; tool schemas are serialized from the plugin module.
|
|
5
|
+
* With `--watch`, rebuilds automatically when tsc output in `dist/` changes.
|
|
6
|
+
*/
|
|
7
|
+
import type { ManifestTool, OpenTabsPlugin, ToolDefinition } from '@opentabs-dev/plugin-sdk';
|
|
8
|
+
import type { PluginPackageJson } from '@opentabs-dev/shared';
|
|
9
|
+
import type { Command } from 'commander';
|
|
10
|
+
/**
|
|
11
|
+
* Validate the plugin's package.json has the required `opentabs` field.
|
|
12
|
+
* Returns the parsed PluginPackageJson or throws with a descriptive error.
|
|
13
|
+
*/
|
|
14
|
+
declare const validatePackageJson: (pkgJson: unknown, projectDir: string) => PluginPackageJson;
|
|
15
|
+
declare const validatePlugin: (plugin: OpenTabsPlugin) => string[];
|
|
16
|
+
declare const convertToolSchemas: (tool: ToolDefinition) => {
|
|
17
|
+
inputSchema: Record<string, unknown>;
|
|
18
|
+
outputSchema: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
/** Serialize plugin tools to ManifestTool[] for dist/tools.json */
|
|
21
|
+
declare const generateToolsJson: (plugin: OpenTabsPlugin) => ManifestTool[];
|
|
22
|
+
declare const formatBytes: (bytes: number) => string;
|
|
23
|
+
declare const formatTimestamp: () => string;
|
|
24
|
+
declare const registerBuildCommand: (program: Command) => void;
|
|
25
|
+
export { convertToolSchemas, formatBytes, formatTimestamp, generateToolsJson, registerBuildCommand, validatePackageJson, validatePlugin, };
|
|
26
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC7F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC;;;GAGG;AACH,QAAA,MAAM,mBAAmB,GAAI,SAAS,OAAO,EAAE,YAAY,MAAM,KAAG,iBAanE,CAAC;AAEF,QAAA,MAAM,cAAc,GAAI,QAAQ,cAAc,KAAG,MAAM,EA8DtD,CAAC;AAEF,QAAA,MAAM,kBAAkB,GAAI,MAAM,cAAc;;;CA2B/C,CAAC;AAEF,mEAAmE;AACnE,QAAA,MAAM,iBAAiB,GAAI,QAAQ,cAAc,KAAG,YAAY,EAW5D,CAAC;AA8CL,QAAA,MAAM,WAAW,GAAI,OAAO,MAAM,KAAG,MAIpC,CAAC;AAEF,QAAA,MAAM,eAAe,QAAO,MAM3B,CAAC;AAyKF,QAAA,MAAM,oBAAoB,GAAI,SAAS,OAAO,KAAG,IAahD,CAAC;AAEF,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,GACf,CAAC"}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `opentabs-plugin build` command — generates dist/tools.json and bundles the adapter IIFE.
|
|
3
|
+
* Plugin metadata (name, version, displayName, description, urlPatterns) is read from
|
|
4
|
+
* package.json's `opentabs` field; tool schemas are serialized from the plugin module.
|
|
5
|
+
* With `--watch`, rebuilds automatically when tsc output in `dist/` changes.
|
|
6
|
+
*/
|
|
7
|
+
import { validatePluginName, validateUrlPattern, LUCIDE_ICON_NAMES } from '@opentabs-dev/plugin-sdk';
|
|
8
|
+
import { parsePluginPackageJson } from '@opentabs-dev/shared';
|
|
9
|
+
import pc from 'picocolors';
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { mkdirSync, watch } from 'node:fs';
|
|
12
|
+
import { resolve, join, relative } from 'node:path';
|
|
13
|
+
const DEBOUNCE_MS = 100;
|
|
14
|
+
/**
|
|
15
|
+
* Validate the plugin's package.json has the required `opentabs` field.
|
|
16
|
+
* Returns the parsed PluginPackageJson or throws with a descriptive error.
|
|
17
|
+
*/
|
|
18
|
+
const validatePackageJson = (pkgJson, projectDir) => {
|
|
19
|
+
const result = parsePluginPackageJson(pkgJson, projectDir);
|
|
20
|
+
if (!result.ok) {
|
|
21
|
+
throw new Error(result.error);
|
|
22
|
+
}
|
|
23
|
+
// Additional validation: URL patterns
|
|
24
|
+
for (const pattern of result.value.opentabs.urlPatterns) {
|
|
25
|
+
const patternError = validateUrlPattern(pattern);
|
|
26
|
+
if (patternError)
|
|
27
|
+
throw new Error(patternError);
|
|
28
|
+
}
|
|
29
|
+
return result.value;
|
|
30
|
+
};
|
|
31
|
+
const validatePlugin = (plugin) => {
|
|
32
|
+
const errors = [];
|
|
33
|
+
// Name
|
|
34
|
+
const nameError = validatePluginName(plugin.name);
|
|
35
|
+
if (nameError)
|
|
36
|
+
errors.push(nameError);
|
|
37
|
+
// Version — must be valid semver (e.g., "1.0.0", "0.1.0-beta.1")
|
|
38
|
+
if (plugin.version.length === 0) {
|
|
39
|
+
errors.push('Plugin version is required');
|
|
40
|
+
}
|
|
41
|
+
else if (!/^\d+\.\d+\.\d+(-[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)?(\+[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)?$/.test(plugin.version)) {
|
|
42
|
+
errors.push(`Plugin version "${plugin.version}" is not valid semver (expected: MAJOR.MINOR.PATCH)`);
|
|
43
|
+
}
|
|
44
|
+
// Display name
|
|
45
|
+
if (plugin.displayName.length === 0)
|
|
46
|
+
errors.push('Plugin displayName is required');
|
|
47
|
+
// Description
|
|
48
|
+
if (plugin.description.length === 0)
|
|
49
|
+
errors.push('Plugin description is required');
|
|
50
|
+
// URL patterns
|
|
51
|
+
if (plugin.urlPatterns.length === 0) {
|
|
52
|
+
errors.push('At least one URL pattern is required');
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
for (const pattern of plugin.urlPatterns) {
|
|
56
|
+
const patternError = validateUrlPattern(pattern);
|
|
57
|
+
if (patternError)
|
|
58
|
+
errors.push(patternError);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Tools
|
|
62
|
+
if (plugin.tools.length === 0) {
|
|
63
|
+
errors.push('At least one tool is required');
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const TOOL_NAME_REGEX = /^[a-z][a-z0-9]*(_[a-z0-9]+)*$/;
|
|
67
|
+
const toolNames = new Set();
|
|
68
|
+
for (const tool of plugin.tools) {
|
|
69
|
+
if (tool.name.length === 0) {
|
|
70
|
+
errors.push('Tool name is required');
|
|
71
|
+
}
|
|
72
|
+
else if (!TOOL_NAME_REGEX.test(tool.name)) {
|
|
73
|
+
errors.push(`Tool name "${tool.name}" must be snake_case (lowercase alphanumeric with underscores, e.g., "send_message")`);
|
|
74
|
+
}
|
|
75
|
+
if (!tool.displayName || tool.displayName.length === 0)
|
|
76
|
+
errors.push(`Tool "${tool.name || '(unnamed)'}" is missing a displayName`);
|
|
77
|
+
if (tool.description.length === 0)
|
|
78
|
+
errors.push(`Tool "${tool.name || '(unnamed)'}" is missing a description`);
|
|
79
|
+
if (!LUCIDE_ICON_NAMES.has(tool.icon)) {
|
|
80
|
+
errors.push(`Tool "${tool.name || '(unnamed)'}" has invalid icon "${tool.icon}" — must be a valid Lucide icon name (kebab-case). See https://lucide.dev/icons`);
|
|
81
|
+
}
|
|
82
|
+
if (tool.name.length > 0 && toolNames.has(tool.name)) {
|
|
83
|
+
errors.push(`Duplicate tool name "${tool.name}"`);
|
|
84
|
+
}
|
|
85
|
+
if (tool.name.length > 0)
|
|
86
|
+
toolNames.add(tool.name);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return errors;
|
|
90
|
+
};
|
|
91
|
+
const convertToolSchemas = (tool) => {
|
|
92
|
+
let inputSchema;
|
|
93
|
+
try {
|
|
94
|
+
inputSchema = z.toJSONSchema(tool.input);
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
throw new Error(`Tool "${tool.name}" input schema failed to serialize to JSON Schema. ` +
|
|
98
|
+
`Schemas cannot use .transform(), .pipe(), or .preprocess() — these produce runtime-only behavior ` +
|
|
99
|
+
`that cannot be represented in JSON Schema. ${err instanceof Error ? err.message : String(err)}`);
|
|
100
|
+
}
|
|
101
|
+
let outputSchema;
|
|
102
|
+
try {
|
|
103
|
+
outputSchema = z.toJSONSchema(tool.output);
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
throw new Error(`Tool "${tool.name}" output schema failed to serialize to JSON Schema. ` +
|
|
107
|
+
`Schemas cannot use .transform(), .pipe(), or .preprocess() — these produce runtime-only behavior ` +
|
|
108
|
+
`that cannot be represented in JSON Schema. ${err instanceof Error ? err.message : String(err)}`);
|
|
109
|
+
}
|
|
110
|
+
delete inputSchema['$schema'];
|
|
111
|
+
delete outputSchema['$schema'];
|
|
112
|
+
return { inputSchema, outputSchema };
|
|
113
|
+
};
|
|
114
|
+
/** Serialize plugin tools to ManifestTool[] for dist/tools.json */
|
|
115
|
+
const generateToolsJson = (plugin) => plugin.tools.map(tool => {
|
|
116
|
+
const { inputSchema, outputSchema } = convertToolSchemas(tool);
|
|
117
|
+
return {
|
|
118
|
+
name: tool.name,
|
|
119
|
+
displayName: tool.displayName,
|
|
120
|
+
description: tool.description,
|
|
121
|
+
icon: tool.icon,
|
|
122
|
+
input_schema: inputSchema,
|
|
123
|
+
output_schema: outputSchema,
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
const bundleIIFE = async (sourceEntry, outDir, pluginName) => {
|
|
127
|
+
// Create a temporary wrapper entry that imports the plugin and registers it
|
|
128
|
+
// on window.__openTabs.adapters. This is bundled as an IIFE so the adapter
|
|
129
|
+
// is available when executed in MAIN world.
|
|
130
|
+
const wrapperPath = join(outDir, `_adapter_entry_${crypto.randomUUID()}.ts`);
|
|
131
|
+
const relativeImport = './' + relative(outDir, sourceEntry).replace(/\.ts$/, '.js');
|
|
132
|
+
const wrapperCode = `import plugin from ${JSON.stringify(relativeImport)};
|
|
133
|
+
(globalThis as any).__openTabs = (globalThis as any).__openTabs || {};
|
|
134
|
+
(globalThis as any).__openTabs.adapters = (globalThis as any).__openTabs.adapters || {};
|
|
135
|
+
const adapters = (globalThis as any).__openTabs.adapters;
|
|
136
|
+
const existing = adapters[${JSON.stringify(pluginName)}];
|
|
137
|
+
if (existing && typeof existing.teardown === 'function') {
|
|
138
|
+
try { existing.teardown(); } catch (e) { console.warn('[OpenTabs] teardown failed for ' + ${JSON.stringify(pluginName)} + ':', e); }
|
|
139
|
+
}
|
|
140
|
+
Reflect.deleteProperty(adapters, ${JSON.stringify(pluginName)});
|
|
141
|
+
adapters[${JSON.stringify(pluginName)}] = plugin;
|
|
142
|
+
`;
|
|
143
|
+
await Bun.write(wrapperPath, wrapperCode);
|
|
144
|
+
try {
|
|
145
|
+
const result = await Bun.build({
|
|
146
|
+
entrypoints: [wrapperPath],
|
|
147
|
+
outdir: outDir,
|
|
148
|
+
format: 'iife',
|
|
149
|
+
target: 'browser',
|
|
150
|
+
minify: false,
|
|
151
|
+
naming: 'adapter.iife.js',
|
|
152
|
+
external: [],
|
|
153
|
+
});
|
|
154
|
+
if (!result.success) {
|
|
155
|
+
const messages = result.logs.map(log => (log.message ? log.message : JSON.stringify(log))).join('\n');
|
|
156
|
+
throw new Error(`IIFE bundling failed:\n${messages}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
finally {
|
|
160
|
+
try {
|
|
161
|
+
await Bun.file(wrapperPath).delete();
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
// best-effort cleanup
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const formatBytes = (bytes) => {
|
|
169
|
+
if (bytes < 1024)
|
|
170
|
+
return `${bytes} B`;
|
|
171
|
+
if (bytes < 1024 * 1024)
|
|
172
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
173
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
174
|
+
};
|
|
175
|
+
const formatTimestamp = () => {
|
|
176
|
+
const now = new Date();
|
|
177
|
+
const h = String(now.getHours()).padStart(2, '0');
|
|
178
|
+
const m = String(now.getMinutes()).padStart(2, '0');
|
|
179
|
+
const s = String(now.getSeconds()).padStart(2, '0');
|
|
180
|
+
return `${h}:${m}:${s}`;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Core build pipeline. Throws on errors instead of calling process.exit,
|
|
184
|
+
* so callers can decide how to handle failures (exit in one-shot mode,
|
|
185
|
+
* continue watching in watch mode).
|
|
186
|
+
*/
|
|
187
|
+
const runBuild = async (projectDir) => {
|
|
188
|
+
const startTime = performance.now();
|
|
189
|
+
// Step 1: Read and validate package.json (must have opentabs field)
|
|
190
|
+
const pkgJsonFile = Bun.file(join(projectDir, 'package.json'));
|
|
191
|
+
if (!(await pkgJsonFile.exists())) {
|
|
192
|
+
throw new Error('No valid package.json found in current directory. Run this command from a plugin directory.');
|
|
193
|
+
}
|
|
194
|
+
let pkgJsonRaw;
|
|
195
|
+
try {
|
|
196
|
+
pkgJsonRaw = JSON.parse(await pkgJsonFile.text());
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
throw new Error('No valid package.json found in current directory. Run this command from a plugin directory.');
|
|
200
|
+
}
|
|
201
|
+
console.log(pc.dim('Validating package.json opentabs field...'));
|
|
202
|
+
const pkgJson = validatePackageJson(pkgJsonRaw, projectDir);
|
|
203
|
+
// Determine entry point — look for compiled output in dist/
|
|
204
|
+
const entryPoint = resolve(projectDir, 'dist', 'index.js');
|
|
205
|
+
const sourceEntry = resolve(projectDir, 'src', 'index.ts');
|
|
206
|
+
if (!(await Bun.file(entryPoint).exists())) {
|
|
207
|
+
throw new Error(`Compiled entry point not found at ${entryPoint}. Run tsc first, then retry opentabs-plugin build.`);
|
|
208
|
+
}
|
|
209
|
+
// Step 2: Dynamically import the plugin module (cache-bust for watch mode rebuilds)
|
|
210
|
+
console.log(pc.dim('Loading plugin module...'));
|
|
211
|
+
const mod = (await import(`${entryPoint}?t=${String(Date.now())}`));
|
|
212
|
+
const defaultExport = mod.default;
|
|
213
|
+
if (!defaultExport) {
|
|
214
|
+
throw new Error('Plugin module must export a default instance of OpenTabsPlugin.');
|
|
215
|
+
}
|
|
216
|
+
const plugin = defaultExport;
|
|
217
|
+
// Step 3: Validate
|
|
218
|
+
console.log(pc.dim('Validating plugin...'));
|
|
219
|
+
const errors = validatePlugin(plugin);
|
|
220
|
+
if (errors.length > 0) {
|
|
221
|
+
throw new Error(`Validation failed:\n${errors.map(e => ` - ${e}`).join('\n')}`);
|
|
222
|
+
}
|
|
223
|
+
// Step 4: Bundle IIFE (before manifest, so adapterHash can be included)
|
|
224
|
+
console.log(pc.dim('Bundling adapter IIFE...'));
|
|
225
|
+
const distDir = join(projectDir, 'dist');
|
|
226
|
+
mkdirSync(distDir, { recursive: true });
|
|
227
|
+
await bundleIIFE(sourceEntry, distDir, plugin.name);
|
|
228
|
+
// Read the bundled IIFE and compute its SHA-256 hash. The hash is computed
|
|
229
|
+
// from the core IIFE content (before the __adapterHash setter is appended).
|
|
230
|
+
const iifePath = join(distDir, 'adapter.iife.js');
|
|
231
|
+
const iifeContent = await Bun.file(iifePath).text();
|
|
232
|
+
const adapterHash = new Bun.CryptoHasher('sha256').update(iifeContent).digest('hex');
|
|
233
|
+
// Append a self-contained snippet that sets the adapter hash and then freezes
|
|
234
|
+
// the adapter entry to prevent cross-adapter tampering. The freeze must happen
|
|
235
|
+
// AFTER the hash is set (since frozen objects reject new properties). The
|
|
236
|
+
// property descriptor uses writable:false + configurable:true so that:
|
|
237
|
+
// - Simple assignment by page scripts fails (non-writable)
|
|
238
|
+
// - Re-injection via Object.defineProperty succeeds (configurable)
|
|
239
|
+
// - Extension cleanup via Reflect.deleteProperty succeeds (configurable)
|
|
240
|
+
const hashAndFreeze = `
|
|
241
|
+
(function(){var o=(globalThis).__openTabs;if(o&&o.adapters&&o.adapters[${JSON.stringify(plugin.name)}]){var a=o.adapters[${JSON.stringify(plugin.name)}];a.__adapterHash=${JSON.stringify(adapterHash)};if(a.tools&&Array.isArray(a.tools)){for(var i=0;i<a.tools.length;i++){Object.freeze(a.tools[i]);}Object.freeze(a.tools);}Object.freeze(a);Object.defineProperty(o.adapters,${JSON.stringify(plugin.name)},{value:a,writable:false,configurable:true,enumerable:true});}})();
|
|
242
|
+
`;
|
|
243
|
+
await Bun.write(iifePath, iifeContent + hashAndFreeze);
|
|
244
|
+
const iifeSize = (await Bun.file(iifePath).stat()).size;
|
|
245
|
+
console.log(` Written: ${pc.bold('dist/adapter.iife.js')} (${formatBytes(iifeSize)})`);
|
|
246
|
+
// Step 5: Generate dist/tools.json (tool schemas serialized from the plugin module)
|
|
247
|
+
console.log(pc.dim('Generating tools.json...'));
|
|
248
|
+
const tools = generateToolsJson(plugin);
|
|
249
|
+
const toolsJsonPath = join(distDir, 'tools.json');
|
|
250
|
+
await Bun.write(toolsJsonPath, JSON.stringify(tools, null, 2) + '\n');
|
|
251
|
+
console.log(` Written: ${pc.bold('dist/tools.json')} (${tools.length} tool${tools.length === 1 ? '' : 's'})`);
|
|
252
|
+
const elapsed = ((performance.now() - startTime) / 1000).toFixed(1);
|
|
253
|
+
console.log('');
|
|
254
|
+
console.log(pc.green(`Build complete for plugin "${pkgJson.name}" v${pkgJson.version} in ${elapsed}s`));
|
|
255
|
+
};
|
|
256
|
+
const handleBuild = async (options) => {
|
|
257
|
+
const projectDir = process.cwd();
|
|
258
|
+
// Initial build — always runs
|
|
259
|
+
try {
|
|
260
|
+
await runBuild(projectDir);
|
|
261
|
+
}
|
|
262
|
+
catch (err) {
|
|
263
|
+
console.error(pc.red(`Error: ${err instanceof Error ? err.message : String(err)}`));
|
|
264
|
+
process.exit(1);
|
|
265
|
+
}
|
|
266
|
+
if (!options.watch)
|
|
267
|
+
return;
|
|
268
|
+
// Watch mode: watch dist/ for changes to .js files and rebuild
|
|
269
|
+
const distDir = join(projectDir, 'dist');
|
|
270
|
+
let debounceTimer = null;
|
|
271
|
+
let building = false;
|
|
272
|
+
let pendingRebuild = false;
|
|
273
|
+
const rebuild = async () => {
|
|
274
|
+
if (building) {
|
|
275
|
+
pendingRebuild = true;
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
building = true;
|
|
279
|
+
console.log('');
|
|
280
|
+
console.log(pc.dim(`[${formatTimestamp()}] Change detected, rebuilding...`));
|
|
281
|
+
try {
|
|
282
|
+
await runBuild(projectDir);
|
|
283
|
+
}
|
|
284
|
+
catch (err) {
|
|
285
|
+
console.error(pc.red(`[${formatTimestamp()}] Rebuild failed: ${err instanceof Error ? err.message : String(err)}`));
|
|
286
|
+
}
|
|
287
|
+
finally {
|
|
288
|
+
building = false;
|
|
289
|
+
if (pendingRebuild) {
|
|
290
|
+
pendingRebuild = false;
|
|
291
|
+
void rebuild();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
let watcher;
|
|
296
|
+
try {
|
|
297
|
+
watcher = watch(distDir, { recursive: true }, (_event, filename) => {
|
|
298
|
+
// Only react to .js file changes (tsc output), skip adapter.iife.js
|
|
299
|
+
// and temporary wrapper files to avoid rebuild loops
|
|
300
|
+
if (!filename ||
|
|
301
|
+
!filename.endsWith('.js') ||
|
|
302
|
+
filename === 'adapter.iife.js' ||
|
|
303
|
+
filename.startsWith('_adapter_entry_'))
|
|
304
|
+
return;
|
|
305
|
+
if (debounceTimer)
|
|
306
|
+
clearTimeout(debounceTimer);
|
|
307
|
+
debounceTimer = setTimeout(() => void rebuild(), DEBOUNCE_MS);
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
console.error(pc.red(`Error: Could not watch ${distDir}. Ensure the dist/ directory exists.`));
|
|
312
|
+
process.exit(1);
|
|
313
|
+
}
|
|
314
|
+
console.log('');
|
|
315
|
+
console.log(pc.cyan(`Watching ${pc.bold('dist/')} for changes... (Ctrl+C to stop)`));
|
|
316
|
+
const cleanup = () => {
|
|
317
|
+
if (debounceTimer)
|
|
318
|
+
clearTimeout(debounceTimer);
|
|
319
|
+
watcher.close();
|
|
320
|
+
console.log('');
|
|
321
|
+
console.log(pc.dim('Watcher stopped.'));
|
|
322
|
+
process.exit(0);
|
|
323
|
+
};
|
|
324
|
+
process.on('SIGINT', cleanup);
|
|
325
|
+
process.on('SIGTERM', cleanup);
|
|
326
|
+
// Keep the process alive
|
|
327
|
+
await new Promise(() => { });
|
|
328
|
+
};
|
|
329
|
+
const registerBuildCommand = (program) => {
|
|
330
|
+
program
|
|
331
|
+
.command('build')
|
|
332
|
+
.description('Build the current plugin directory (dist/tools.json + adapter IIFE)')
|
|
333
|
+
.option('-w, --watch', 'Watch dist/ for changes and rebuild automatically')
|
|
334
|
+
.addHelpText('after', `
|
|
335
|
+
Examples:
|
|
336
|
+
$ opentabs-plugin build
|
|
337
|
+
$ opentabs-plugin build --watch`)
|
|
338
|
+
.action((options) => handleBuild(options));
|
|
339
|
+
};
|
|
340
|
+
export { convertToolSchemas, formatBytes, formatTimestamp, generateToolsJson, registerBuildCommand, validatePackageJson, validatePlugin, };
|
|
341
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAMpD,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB;;;GAGG;AACH,MAAM,mBAAmB,GAAG,CAAC,OAAgB,EAAE,UAAkB,EAAqB,EAAE;IACtF,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED,sCAAsC;IACtC,KAAK,MAAM,OA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,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAE/B,yBAAyB;IACzB,MAAM,IAAI,OAAO,CAAQ,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,OAAgB,EAAQ,EAAE;IACtD,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,qEAAqE,CAAC;SAClF,MAAM,CAAC,aAAa,EAAE,mDAAmD,CAAC;SAC1E,WAAW,CACV,OAAO,EACP;;;kCAG4B,CAC7B;SACA,MAAM,CAAC,CAAC,OAA4B,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,GACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@opentabs-dev/plugin-tools",
|
|
3
|
+
"version": "0.0.10",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"opentabs-plugin": "./dist/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "restricted"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc --build"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@opentabs-dev/plugin-sdk": "^0.0.10",
|
|
19
|
+
"@opentabs-dev/shared": "^0.0.10",
|
|
20
|
+
"commander": "^14.0.3",
|
|
21
|
+
"picocolors": "^1.1.1",
|
|
22
|
+
"zod": "^4.3.6"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"bun-types": "^1.3.9"
|
|
26
|
+
}
|
|
27
|
+
}
|