create-futurity-plugin 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/index.ts +48 -0
- package/package.json +22 -0
- package/template/package.json.tmpl +18 -0
- package/template/src/index.ts +16 -0
- package/template/tsconfig.json +15 -0
package/index.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { existsSync, mkdirSync, cpSync, readFileSync, writeFileSync, unlinkSync } from "node:fs";
|
|
3
|
+
import { resolve, basename } from "node:path";
|
|
4
|
+
import { execSync } from "node:child_process";
|
|
5
|
+
|
|
6
|
+
const arg = process.argv[2];
|
|
7
|
+
|
|
8
|
+
if (!arg) {
|
|
9
|
+
console.error("Usage: bun create futurity-plugin <project-name>");
|
|
10
|
+
console.error(" bun create futurity-plugin . (scaffold in current directory)");
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const isCwd = arg === ".";
|
|
15
|
+
const targetDir = isCwd ? process.cwd() : resolve(process.cwd(), arg);
|
|
16
|
+
const projectName = isCwd ? basename(process.cwd()) : arg;
|
|
17
|
+
|
|
18
|
+
if (!isCwd) {
|
|
19
|
+
if (existsSync(targetDir)) {
|
|
20
|
+
console.error(`Error: Directory "${arg}" already exists.`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
mkdirSync(targetDir, { recursive: true });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Copy template files
|
|
27
|
+
const templateDir = resolve(import.meta.dirname, "template");
|
|
28
|
+
cpSync(templateDir, targetDir, { recursive: true });
|
|
29
|
+
|
|
30
|
+
// Process package.json template
|
|
31
|
+
const pkgPath = resolve(targetDir, "package.json.tmpl");
|
|
32
|
+
const pkgContent = readFileSync(pkgPath, "utf-8");
|
|
33
|
+
writeFileSync(
|
|
34
|
+
resolve(targetDir, "package.json"),
|
|
35
|
+
pkgContent.replace(/\{\{name\}\}/g, projectName)
|
|
36
|
+
);
|
|
37
|
+
unlinkSync(pkgPath);
|
|
38
|
+
|
|
39
|
+
// Install dependencies
|
|
40
|
+
console.log(`\nScaffolding ${projectName}...\n`);
|
|
41
|
+
execSync("bun install", { cwd: targetDir, stdio: "inherit" });
|
|
42
|
+
|
|
43
|
+
console.log(`\n✅ Created ${projectName}\n`);
|
|
44
|
+
console.log("Next steps:\n");
|
|
45
|
+
if (!isCwd) {
|
|
46
|
+
console.log(` cd ${arg}`);
|
|
47
|
+
}
|
|
48
|
+
console.log(" bun run src/index.ts\n");
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-futurity-plugin",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Scaffold a new Futurity MCP plugin",
|
|
6
|
+
"author": "Futurity",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"bin": {
|
|
9
|
+
"create-futurity-plugin": "./index.ts"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "echo 'No tests'"
|
|
13
|
+
},
|
|
14
|
+
"files": ["index.ts", "template"],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"create",
|
|
17
|
+
"scaffold",
|
|
18
|
+
"mcp",
|
|
19
|
+
"futurity",
|
|
20
|
+
"plugin"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{name}}",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "bun run --watch src/index.ts",
|
|
7
|
+
"start": "bun run src/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@futurity/plugins": "^2.0.0"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
14
|
+
"@types/bun": "latest",
|
|
15
|
+
"typescript": "^5.9.3",
|
|
16
|
+
"zod": "^4.1.13"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { mcp, t } from "@futurity/plugins";
|
|
2
|
+
|
|
3
|
+
const app = mcp({
|
|
4
|
+
name: "my-plugin",
|
|
5
|
+
version: "0.1.0",
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
app.tool("hello", {
|
|
9
|
+
description: "Say hello",
|
|
10
|
+
input: t.obj({ name: t.str }),
|
|
11
|
+
handler: async ({ name }) => ({
|
|
12
|
+
greeting: `Hello, ${name}!`,
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
await app.listen(3000);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": ["ESNext"],
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "Preserve",
|
|
6
|
+
"moduleDetection": "force",
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"verbatimModuleSyntax": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"skipLibCheck": true
|
|
14
|
+
}
|
|
15
|
+
}
|