feat: scaffold yonexus client plugin
This commit is contained in:
27
package.json
Normal file
27
package.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "yonexus-client",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"description": "Yonexus.Client OpenClaw plugin scaffold",
|
||||||
|
"type": "module",
|
||||||
|
"main": "dist/plugin/index.js",
|
||||||
|
"files": [
|
||||||
|
"dist",
|
||||||
|
"plugin",
|
||||||
|
"scripts",
|
||||||
|
"protocol",
|
||||||
|
"README.md",
|
||||||
|
"PLAN.md",
|
||||||
|
"SCAFFOLD.md",
|
||||||
|
"STRUCTURE.md",
|
||||||
|
"TASKS.md"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc -p tsconfig.json",
|
||||||
|
"clean": "rm -rf dist",
|
||||||
|
"check": "tsc -p tsconfig.json --noEmit"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.6.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
0
plugin/commands/.gitkeep
Normal file
0
plugin/commands/.gitkeep
Normal file
0
plugin/core/.gitkeep
Normal file
0
plugin/core/.gitkeep
Normal file
0
plugin/hooks/.gitkeep
Normal file
0
plugin/hooks/.gitkeep
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
export interface YonexusClientPluginManifest {
|
||||||
|
readonly name: "Yonexus.Client";
|
||||||
|
readonly version: string;
|
||||||
|
readonly description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface YonexusClientPluginRuntime {
|
||||||
|
readonly hooks: readonly [];
|
||||||
|
readonly commands: readonly [];
|
||||||
|
readonly tools: readonly [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const manifest: YonexusClientPluginManifest = {
|
||||||
|
name: "Yonexus.Client",
|
||||||
|
version: "0.1.0",
|
||||||
|
description: "Yonexus client plugin for cross-instance OpenClaw communication"
|
||||||
|
};
|
||||||
|
|
||||||
|
export function createYonexusClientPlugin(): YonexusClientPluginRuntime {
|
||||||
|
return {
|
||||||
|
hooks: [],
|
||||||
|
commands: [],
|
||||||
|
tools: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default createYonexusClientPlugin;
|
||||||
|
export { manifest };
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "Yonexus.Client",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"description": "Yonexus client plugin for cross-instance OpenClaw communication",
|
||||||
|
"entry": "dist/plugin/index.js",
|
||||||
|
"permissions": [],
|
||||||
|
"config": {
|
||||||
|
"mainHost": "",
|
||||||
|
"identifier": "",
|
||||||
|
"notifyBotToken": "",
|
||||||
|
"adminUserId": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
0
plugin/tools/.gitkeep
Normal file
0
plugin/tools/.gitkeep
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
import fs from "node:fs";
|
||||||
|
import path from "node:path";
|
||||||
|
import os from "node:os";
|
||||||
|
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
const mode = args.includes("--install") ? "install" : args.includes("--uninstall") ? "uninstall" : null;
|
||||||
|
const profileIndex = args.indexOf("--openclaw-profile-path");
|
||||||
|
const profilePath = profileIndex >= 0 ? args[profileIndex + 1] : path.join(os.homedir(), ".openclaw");
|
||||||
|
|
||||||
|
if (!mode) {
|
||||||
|
console.error("Usage: node scripts/install.mjs --install|--uninstall [--openclaw-profile-path <path>]");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const repoRoot = path.resolve(import.meta.dirname, "..");
|
||||||
|
const pluginName = "Yonexus.Client";
|
||||||
|
const sourceDist = path.join(repoRoot, "dist");
|
||||||
|
const targetDir = path.join(profilePath, "plugins", pluginName);
|
||||||
|
|
||||||
|
if (mode === "install") {
|
||||||
|
if (!fs.existsSync(sourceDist)) {
|
||||||
|
console.error(`Build output not found: ${sourceDist}`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.mkdirSync(path.dirname(targetDir), { recursive: true });
|
||||||
|
fs.rmSync(targetDir, { recursive: true, force: true });
|
||||||
|
fs.cpSync(sourceDist, path.join(targetDir, "dist"), { recursive: true });
|
||||||
|
fs.copyFileSync(path.join(repoRoot, "plugin", "openclaw.plugin.json"), path.join(targetDir, "openclaw.plugin.json"));
|
||||||
|
console.log(`Installed ${pluginName} to ${targetDir}`);
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.rmSync(targetDir, { recursive: true, force: true });
|
||||||
|
console.log(`Removed ${pluginName} from ${targetDir}`);
|
||||||
|
|||||||
0
servers/.gitkeep
Normal file
0
servers/.gitkeep
Normal file
0
skills/.gitkeep
Normal file
0
skills/.gitkeep
Normal file
24
tsconfig.json
Normal file
24
tsconfig.json
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"outDir": "dist",
|
||||||
|
"rootDir": ".",
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"declaration": true,
|
||||||
|
"sourceMap": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"plugin/**/*.ts",
|
||||||
|
"servers/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"dist",
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user