forked from microsoft/GitHub-Copilot-for-Azure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.ts
More file actions
80 lines (68 loc) · 2.62 KB
/
Copy pathbootstrap.ts
File metadata and controls
80 lines (68 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import * as fs from "node:fs";
import * as path from "node:path";
import { fileURLToPath } from "node:url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
function main() {
const pluginName = "new-plugin";
const pluginManifestBase = {
name: pluginName,
description: "<Provide a description>",
version: "0.0.0-placeholder",
author: {
name: "Microsoft",
url: "https://www.microsoft.com"
},
homepage: "https://github.com/microsoft/github-copilot-for-azure",
repository: "https://github.com/microsoft/GitHub-Copilot-for-Azure",
license: "MIT",
keywords: [
"azure",
"cloud"
],
skills: "./skills/",
mcpServers: "./.mcp.json"
};
const copilotPluginManifest = {
...pluginManifestBase,
hooks: "./hooks/copilot-hooks.json"
};
const claudeCodePluginManifest = {
...pluginManifestBase,
hooks: "./hooks/claude-hooks.json"
};
const cursorPluginManifest = {
...pluginManifestBase,
hooks: "./hooks/cursor-hooks.json"
};
const repoRoot = path.resolve(__dirname, "../../..");
const azureSkillsPluginRoot = path.join(repoRoot, "plugins/azure-skills");
const pluginRoot = path.join(repoRoot, `plugins/${pluginName}`);
// Plugin root
fs.mkdirSync(pluginRoot);
// Plugin manifests
fs.mkdirSync(path.join(pluginRoot, ".plugin"));
fs.writeFileSync(path.join(pluginRoot, ".plugin/plugin.json"), JSON.stringify(copilotPluginManifest, null, 2));
fs.mkdirSync(path.join(pluginRoot, ".claude-plugin"));
fs.writeFileSync(path.join(pluginRoot, ".claude-plugin/plugin.json"), JSON.stringify(claudeCodePluginManifest, null, 2));
fs.mkdirSync(path.join(pluginRoot, ".cursor-plugin"));
fs.writeFileSync(path.join(pluginRoot, ".cursor-plugin/plugin.json"), JSON.stringify(cursorPluginManifest, null, 2));
// skills
fs.mkdirSync(path.join(pluginRoot, "skills"));
// MCP server declaration
fs.writeFileSync(path.join(pluginRoot, ".mcp.json"), JSON.stringify({ mcpServers: {} }, null, 2));
// License
fs.copyFileSync(path.join(azureSkillsPluginRoot, "LICENSE"), path.join(pluginRoot, "LICENSE"));
// Readme
fs.writeFileSync(path.join(pluginRoot, "README.md"), "");
// Version
const versionManifest = {
$schema: "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
version: "1.0",
pathFilters: ["."]
};
fs.writeFileSync(path.join(pluginRoot, "version.json"), JSON.stringify(versionManifest, null, 2));
// Hooks will be copied at build time
console.log(`Bootstrapped ${pluginName} at plugins/${pluginName}`);
}
main();