create-codemodekit 0.2.0 → 0.4.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 +51 -4
- package/dist/agent-plugin.d.ts +3 -2
- package/dist/agent-plugin.d.ts.map +1 -1
- package/dist/agent-plugin.js +6 -4
- package/dist/agent-plugin.js.map +1 -1
- package/dist/authoring-skill.d.ts +14 -0
- package/dist/authoring-skill.d.ts.map +1 -0
- package/dist/authoring-skill.js +21 -0
- package/dist/authoring-skill.js.map +1 -0
- package/dist/cli.d.ts +14 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +306 -36
- package/dist/cli.js.map +1 -1
- package/dist/cursor-plugin.d.ts +25 -0
- package/dist/cursor-plugin.d.ts.map +1 -0
- package/dist/cursor-plugin.js +177 -0
- package/dist/cursor-plugin.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin-build.d.ts +19 -0
- package/dist/plugin-build.d.ts.map +1 -0
- package/dist/plugin-build.js +177 -0
- package/dist/plugin-build.js.map +1 -0
- package/dist/plugin-cli.d.ts +3 -0
- package/dist/plugin-cli.d.ts.map +1 -0
- package/dist/plugin-cli.js +102 -0
- package/dist/plugin-cli.js.map +1 -0
- package/dist/scaffold.d.ts +16 -5
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +176 -53
- package/dist/scaffold.js.map +1 -1
- package/dist/source-template.d.ts +21 -0
- package/dist/source-template.d.ts.map +1 -0
- package/dist/source-template.js +289 -0
- package/dist/source-template.js.map +1 -0
- package/package.json +22 -7
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { cp, lstat, mkdir, readFile, rename, rm, writeFile, } from "node:fs/promises";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { buildAgentPlugin } from "./plugin-build.js";
|
|
5
|
+
const INSTALL_MARKER = ".codemodekit-install.json";
|
|
6
|
+
/** Builds and installs a concrete copy under Cursor's local plugin directory. */
|
|
7
|
+
export async function installCursorPlugin(options) {
|
|
8
|
+
const root = path.resolve(options.root);
|
|
9
|
+
const build = await buildAgentPlugin({ root });
|
|
10
|
+
const pluginName = await readPluginName(build.artifactDirectory);
|
|
11
|
+
const nodePath = path.resolve(options.nodePath ?? process.execPath);
|
|
12
|
+
await assertRegularFile(nodePath, "Node executable");
|
|
13
|
+
const localRoot = cursorLocalPluginRoot(options.cursorHome);
|
|
14
|
+
const destination = path.join(localRoot, pluginName);
|
|
15
|
+
const staging = path.join(localRoot, `.${pluginName}.${String(process.pid)}.${String(Date.now())}.tmp`);
|
|
16
|
+
const backup = `${destination}.${String(process.pid)}.backup`;
|
|
17
|
+
await mkdir(localRoot, { recursive: true });
|
|
18
|
+
await rm(staging, { recursive: true, force: true });
|
|
19
|
+
await cp(build.artifactDirectory, staging, { recursive: true });
|
|
20
|
+
try {
|
|
21
|
+
await adaptCursorMcpConfig(staging, destination, nodePath);
|
|
22
|
+
await writeJson(path.join(staging, INSTALL_MARKER), {
|
|
23
|
+
schemaVersion: 1,
|
|
24
|
+
pluginName,
|
|
25
|
+
sourceRoot: root,
|
|
26
|
+
artifactDirectory: build.artifactDirectory,
|
|
27
|
+
nodePath,
|
|
28
|
+
});
|
|
29
|
+
await replaceInstallation({ destination, staging, backup, pluginName });
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
await rm(staging, { recursive: true, force: true });
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
pluginName,
|
|
37
|
+
destination,
|
|
38
|
+
artifactDirectory: build.artifactDirectory,
|
|
39
|
+
nodePath,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export async function getCursorPluginStatus(options) {
|
|
43
|
+
const root = path.resolve(options.root);
|
|
44
|
+
const pluginName = await readPluginName(root);
|
|
45
|
+
const destination = path.join(cursorLocalPluginRoot(options.cursorHome), pluginName);
|
|
46
|
+
return {
|
|
47
|
+
pluginName,
|
|
48
|
+
destination,
|
|
49
|
+
installed: await pathExists(destination),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export async function uninstallCursorPlugin(options) {
|
|
53
|
+
const status = await getCursorPluginStatus(options);
|
|
54
|
+
if (!status.installed)
|
|
55
|
+
return status;
|
|
56
|
+
await assertMatchingInstalledPlugin(status.destination, status.pluginName);
|
|
57
|
+
await rm(status.destination, { recursive: true, force: true });
|
|
58
|
+
return { ...status, installed: false };
|
|
59
|
+
}
|
|
60
|
+
async function adaptCursorMcpConfig(staging, destination, nodePath) {
|
|
61
|
+
const file = path.join(staging, "mcp.json");
|
|
62
|
+
const config = await readJsonObject(file, "mcp.json");
|
|
63
|
+
const rawServers = config.mcpServers;
|
|
64
|
+
if (!isRecord(rawServers)) {
|
|
65
|
+
throw new TypeError("mcp.json must contain an mcpServers object");
|
|
66
|
+
}
|
|
67
|
+
const stdioEntries = Object.entries(rawServers).filter(([, value]) => isRecord(value) && value.type === "stdio");
|
|
68
|
+
if (stdioEntries.length !== 1) {
|
|
69
|
+
throw new TypeError("Cursor installation currently requires one stdio server");
|
|
70
|
+
}
|
|
71
|
+
const entry = stdioEntries[0];
|
|
72
|
+
if (entry === undefined || !isRecord(entry[1])) {
|
|
73
|
+
throw new TypeError("Cursor installation could not resolve the stdio server");
|
|
74
|
+
}
|
|
75
|
+
const [serverName, server] = entry;
|
|
76
|
+
const { cwd: _cwd, ...serverWithoutCwd } = server;
|
|
77
|
+
await writeJson(file, {
|
|
78
|
+
...config,
|
|
79
|
+
mcpServers: {
|
|
80
|
+
...rawServers,
|
|
81
|
+
[serverName]: {
|
|
82
|
+
...serverWithoutCwd,
|
|
83
|
+
type: "stdio",
|
|
84
|
+
command: nodePath,
|
|
85
|
+
args: [path.join(destination, "server.mjs")],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async function replaceInstallation(options) {
|
|
91
|
+
const existing = await pathExists(options.destination);
|
|
92
|
+
if (!existing) {
|
|
93
|
+
await rename(options.staging, options.destination);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
await assertMatchingInstalledPlugin(options.destination, options.pluginName);
|
|
97
|
+
await rm(options.backup, { recursive: true, force: true });
|
|
98
|
+
await rename(options.destination, options.backup);
|
|
99
|
+
try {
|
|
100
|
+
await rename(options.staging, options.destination);
|
|
101
|
+
await rm(options.backup, { recursive: true, force: true });
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
if (!(await pathExists(options.destination))) {
|
|
105
|
+
await rename(options.backup, options.destination);
|
|
106
|
+
}
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async function assertMatchingInstalledPlugin(destination, expectedName) {
|
|
111
|
+
const actualName = await readPluginName(destination);
|
|
112
|
+
if (actualName !== expectedName) {
|
|
113
|
+
throw new Error(`Refusing to replace Cursor plugin ${destination}; expected ${expectedName}, found ${actualName}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async function readPluginName(root) {
|
|
117
|
+
const manifest = await readJsonObject(path.join(root, "plugin.json"), "plugin.json");
|
|
118
|
+
const name = manifest.name;
|
|
119
|
+
if (typeof name !== "string" ||
|
|
120
|
+
!/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(name) ||
|
|
121
|
+
path.basename(name) !== name) {
|
|
122
|
+
throw new TypeError("plugin.json contains an invalid portable plugin name");
|
|
123
|
+
}
|
|
124
|
+
return name;
|
|
125
|
+
}
|
|
126
|
+
function cursorLocalPluginRoot(cursorHome) {
|
|
127
|
+
const home = path.resolve(cursorHome ?? path.join(homedir(), ".cursor"));
|
|
128
|
+
return path.join(home, "plugins", "local");
|
|
129
|
+
}
|
|
130
|
+
async function pathExists(file) {
|
|
131
|
+
try {
|
|
132
|
+
await lstat(file);
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
if (isMissing(error))
|
|
137
|
+
return false;
|
|
138
|
+
throw error;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function assertRegularFile(file, label) {
|
|
142
|
+
let details;
|
|
143
|
+
try {
|
|
144
|
+
details = await lstat(file);
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
throw new TypeError(`${label} does not exist: ${file}`, { cause: error });
|
|
148
|
+
}
|
|
149
|
+
if (!details.isFile() && !details.isSymbolicLink()) {
|
|
150
|
+
throw new TypeError(`${label} must be a file: ${file}`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async function readJsonObject(file, label) {
|
|
154
|
+
let value;
|
|
155
|
+
try {
|
|
156
|
+
value = JSON.parse(await readFile(file, "utf8"));
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
throw new TypeError(`Could not read ${label}`, { cause: error });
|
|
160
|
+
}
|
|
161
|
+
if (!isRecord(value)) {
|
|
162
|
+
throw new TypeError(`${label} must contain a JSON object`);
|
|
163
|
+
}
|
|
164
|
+
return value;
|
|
165
|
+
}
|
|
166
|
+
async function writeJson(file, value) {
|
|
167
|
+
await writeFile(file, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
168
|
+
}
|
|
169
|
+
function isRecord(value) {
|
|
170
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
171
|
+
}
|
|
172
|
+
function isMissing(error) {
|
|
173
|
+
return (error instanceof Error &&
|
|
174
|
+
"code" in error &&
|
|
175
|
+
error.code === "ENOENT");
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=cursor-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-plugin.js","sourceRoot":"","sources":["../src/cursor-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EACF,KAAK,EACL,KAAK,EACL,QAAQ,EACR,MAAM,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EAAE,CAAC;QACrB,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,6BAA6B,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,IAAY,EAAE,KAAc;IACnD,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,CACL,KAAK,YAAY,KAAK;QACtB,MAAM,IAAI,KAAK;QACd,KAA+B,CAAC,IAAI,KAAK,QAAQ,CACnD,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export { parseMcpCommand, type ParsedCommand } from "./command.js";
|
|
2
|
+
export { runCli, type CliPrompter, type RunCliOptions, } from "./cli.js";
|
|
3
|
+
export { installProjectAuthoringSkill, installProjectAuthoringSkills, type InstallCodeModeKitSkillsResult, type InstallProjectAuthoringSkillOptions, } from "./authoring-skill.js";
|
|
2
4
|
export { normalizePortableName, renderCompanionSkill, scaffoldAgentPlugin, syncAgentPluginSkill, type AgentPluginCatalogSource, type AgentPluginSourceReport, type AgentPluginStartupReport, type AgentPluginTypeScriptCatalog, type ScaffoldAgentPluginOptions, type ScaffoldAgentPluginResult, type SyncAgentPluginSkillOptions, type SyncAgentPluginSkillResult, } from "./agent-plugin.js";
|
|
3
|
-
export { renderServer, scaffoldCodeModeMcp, type AgentPluginScaffoldOptions, type GeneratedAgentPluginResult, type ScaffoldCodeModeMcpOptions, type ScaffoldResult, } from "./scaffold.js";
|
|
5
|
+
export { renderServer, scaffoldCodeModeMcp, type AgentPluginScaffoldOptions, type GeneratedAgentPluginResult, type ScaffoldCodeModeMcpOptions, type ScaffoldResult, type ScaffoldSource, } from "./scaffold.js";
|
|
6
|
+
export { buildAgentPlugin, type BuildAgentPluginOptions, type BuildAgentPluginResult, } from "./plugin-build.js";
|
|
7
|
+
export { getCursorPluginStatus, installCursorPlugin, uninstallCursorPlugin, type CursorPluginInstallation, type CursorPluginStatus, type CursorPluginStatusOptions, type InstallCursorPluginOptions, } from "./cursor-plugin.js";
|
|
4
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,GAChC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EACL,MAAM,EACN,KAAK,WAAW,EAChB,KAAK,aAAa,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,EAC7B,KAAK,8BAA8B,EACnC,KAAK,mCAAmC,GACzC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,GAChC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,cAAc,EACnB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,GAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,GAChC,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export { parseMcpCommand } from "./command.js";
|
|
2
|
+
export { runCli, } from "./cli.js";
|
|
3
|
+
export { installProjectAuthoringSkill, installProjectAuthoringSkills, } from "./authoring-skill.js";
|
|
2
4
|
export { normalizePortableName, renderCompanionSkill, scaffoldAgentPlugin, syncAgentPluginSkill, } from "./agent-plugin.js";
|
|
3
5
|
export { renderServer, scaffoldCodeModeMcp, } from "./scaffold.js";
|
|
6
|
+
export { buildAgentPlugin, } from "./plugin-build.js";
|
|
7
|
+
export { getCursorPluginStatus, installCursorPlugin, uninstallCursorPlugin, } from "./cursor-plugin.js";
|
|
4
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAsB,MAAM,cAAc,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GASrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAsB,MAAM,cAAc,CAAC;AACnE,OAAO,EACL,MAAM,GAGP,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,GAG9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GASrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,mBAAmB,GAMpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,GAGjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,GAKtB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface BuildAgentPluginOptions {
|
|
2
|
+
readonly root: string;
|
|
3
|
+
readonly entrypoint?: string;
|
|
4
|
+
readonly artifactDirectory?: string;
|
|
5
|
+
readonly serverName?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface BuildAgentPluginResult {
|
|
8
|
+
readonly root: string;
|
|
9
|
+
readonly artifactDirectory: string;
|
|
10
|
+
readonly entrypoint: string;
|
|
11
|
+
readonly server: string;
|
|
12
|
+
readonly bytes: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Bundles a generated CodeModeKit server and copies its portable Agent Plugin
|
|
16
|
+
* components into a dependency-free distribution directory.
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildAgentPlugin(options: BuildAgentPluginOptions): Promise<BuildAgentPluginResult>;
|
|
19
|
+
//# sourceMappingURL=plugin-build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-build.d.ts","sourceRoot":"","sources":["../src/plugin-build.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,sBAAsB,CAAC,CA6FjC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { cp, mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { build } from "esbuild";
|
|
4
|
+
const DEFAULT_ENTRYPOINT = "src/server.mjs";
|
|
5
|
+
const DEFAULT_ARTIFACT_DIRECTORY = "dist/plugin";
|
|
6
|
+
const ARTIFACT_ENTRYPOINT = "server.mjs";
|
|
7
|
+
/**
|
|
8
|
+
* Bundles a generated CodeModeKit server and copies its portable Agent Plugin
|
|
9
|
+
* components into a dependency-free distribution directory.
|
|
10
|
+
*/
|
|
11
|
+
export async function buildAgentPlugin(options) {
|
|
12
|
+
const root = path.resolve(options.root);
|
|
13
|
+
const entrypoint = resolveContainedPath(root, options.entrypoint ?? DEFAULT_ENTRYPOINT, "Plugin entrypoint");
|
|
14
|
+
const artifactDirectory = resolveContainedPath(root, options.artifactDirectory ?? DEFAULT_ARTIFACT_DIRECTORY, "Plugin artifact directory");
|
|
15
|
+
const artifactParent = path.dirname(artifactDirectory);
|
|
16
|
+
const stagingDirectory = path.join(artifactParent, `.${path.basename(artifactDirectory)}.${String(process.pid)}.${String(Date.now())}.tmp`);
|
|
17
|
+
const server = path.join(stagingDirectory, ARTIFACT_ENTRYPOINT);
|
|
18
|
+
await assertRegularFile(entrypoint, "Plugin entrypoint");
|
|
19
|
+
await mkdir(artifactParent, { recursive: true });
|
|
20
|
+
await rm(stagingDirectory, { recursive: true, force: true });
|
|
21
|
+
await mkdir(stagingDirectory, { recursive: true });
|
|
22
|
+
try {
|
|
23
|
+
const buildResult = await build({
|
|
24
|
+
entryPoints: [entrypoint],
|
|
25
|
+
outfile: server,
|
|
26
|
+
absWorkingDir: root,
|
|
27
|
+
bundle: true,
|
|
28
|
+
platform: "node",
|
|
29
|
+
format: "esm",
|
|
30
|
+
target: "node20",
|
|
31
|
+
external: ["create-codemodekit"],
|
|
32
|
+
banner: {
|
|
33
|
+
js: [
|
|
34
|
+
'import { createRequire as __createRequire } from "node:module";',
|
|
35
|
+
'import { fileURLToPath as __fileURLToPath } from "node:url";',
|
|
36
|
+
'import { dirname as __pathDirname } from "node:path";',
|
|
37
|
+
"const require = __createRequire(import.meta.url);",
|
|
38
|
+
"const __filename = __fileURLToPath(import.meta.url);",
|
|
39
|
+
"const __dirname = __pathDirname(__filename);",
|
|
40
|
+
].join("\n"),
|
|
41
|
+
},
|
|
42
|
+
legalComments: "none",
|
|
43
|
+
logLevel: "silent",
|
|
44
|
+
metafile: true,
|
|
45
|
+
});
|
|
46
|
+
const [manifest, mcpConfig] = await Promise.all([
|
|
47
|
+
readJsonObject(path.join(root, "plugin.json"), "plugin.json"),
|
|
48
|
+
readJsonObject(path.join(root, "mcp.json"), "mcp.json"),
|
|
49
|
+
]);
|
|
50
|
+
const portableMcpConfig = projectArtifactMcpConfig(mcpConfig, options.serverName);
|
|
51
|
+
const quickJsWasm = resolveQuickJsReleaseWasm(root, Object.keys(buildResult.metafile.inputs));
|
|
52
|
+
await Promise.all([
|
|
53
|
+
writeJson(path.join(stagingDirectory, "plugin.json"), manifest),
|
|
54
|
+
writeJson(path.join(stagingDirectory, "mcp.json"), portableMcpConfig),
|
|
55
|
+
cp(quickJsWasm, path.join(stagingDirectory, "emscripten-module.wasm")),
|
|
56
|
+
copyIfPresent(root, stagingDirectory, "skills"),
|
|
57
|
+
copyIfPresent(root, stagingDirectory, "assets"),
|
|
58
|
+
copyIfPresent(root, stagingDirectory, "README.md"),
|
|
59
|
+
copyIfPresent(root, stagingDirectory, "LICENSE"),
|
|
60
|
+
]);
|
|
61
|
+
await rm(artifactDirectory, { recursive: true, force: true });
|
|
62
|
+
await rename(stagingDirectory, artifactDirectory);
|
|
63
|
+
const output = buildResult.metafile.outputs[path.resolve(server)];
|
|
64
|
+
const serverBytes = output?.bytes ??
|
|
65
|
+
(await stat(path.join(artifactDirectory, ARTIFACT_ENTRYPOINT))).size;
|
|
66
|
+
const wasmBytes = (await stat(path.join(artifactDirectory, "emscripten-module.wasm"))).size;
|
|
67
|
+
return {
|
|
68
|
+
root,
|
|
69
|
+
artifactDirectory,
|
|
70
|
+
entrypoint,
|
|
71
|
+
server: path.join(artifactDirectory, ARTIFACT_ENTRYPOINT),
|
|
72
|
+
bytes: serverBytes + wasmBytes,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
await rm(stagingDirectory, { recursive: true, force: true });
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function resolveQuickJsReleaseWasm(root, buildInputs) {
|
|
81
|
+
const moduleInput = buildInputs.find((input) => {
|
|
82
|
+
const normalized = input.replaceAll("\\", "/");
|
|
83
|
+
return (normalized.includes("quickjs-wasmfile-release-sync") &&
|
|
84
|
+
normalized.endsWith("/emscripten-module.mjs"));
|
|
85
|
+
});
|
|
86
|
+
if (moduleInput === undefined) {
|
|
87
|
+
throw new Error("Could not locate the bundled QuickJS release WASM module");
|
|
88
|
+
}
|
|
89
|
+
return path.join(path.dirname(path.resolve(root, moduleInput)), "emscripten-module.wasm");
|
|
90
|
+
}
|
|
91
|
+
function projectArtifactMcpConfig(config, requestedServerName) {
|
|
92
|
+
const rawServers = config.mcpServers;
|
|
93
|
+
if (!isRecord(rawServers)) {
|
|
94
|
+
throw new TypeError("mcp.json must contain an mcpServers object");
|
|
95
|
+
}
|
|
96
|
+
const stdioNames = Object.entries(rawServers)
|
|
97
|
+
.filter(([, value]) => isRecord(value) && value.type === "stdio")
|
|
98
|
+
.map(([name]) => name);
|
|
99
|
+
const serverName = requestedServerName ??
|
|
100
|
+
(stdioNames.length === 1 ? stdioNames[0] : undefined);
|
|
101
|
+
if (serverName === undefined || !stdioNames.includes(serverName)) {
|
|
102
|
+
throw new TypeError("Agent Plugin build requires exactly one stdio server or an explicit serverName");
|
|
103
|
+
}
|
|
104
|
+
const sourceServer = rawServers[serverName];
|
|
105
|
+
if (!isRecord(sourceServer)) {
|
|
106
|
+
throw new TypeError(`Invalid MCP server entry: ${serverName}`);
|
|
107
|
+
}
|
|
108
|
+
const { cwd: _cwd, ...serverWithoutCwd } = sourceServer;
|
|
109
|
+
return {
|
|
110
|
+
...config,
|
|
111
|
+
mcpServers: {
|
|
112
|
+
...rawServers,
|
|
113
|
+
[serverName]: {
|
|
114
|
+
...serverWithoutCwd,
|
|
115
|
+
type: "stdio",
|
|
116
|
+
command: "node",
|
|
117
|
+
args: [`\${PLUGIN_ROOT}/${ARTIFACT_ENTRYPOINT}`],
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async function copyIfPresent(root, destinationRoot, name) {
|
|
123
|
+
const source = path.join(root, name);
|
|
124
|
+
try {
|
|
125
|
+
await stat(source);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
if (isMissing(error))
|
|
129
|
+
return;
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
await cp(source, path.join(destinationRoot, name), { recursive: true });
|
|
133
|
+
}
|
|
134
|
+
async function readJsonObject(file, label) {
|
|
135
|
+
let value;
|
|
136
|
+
try {
|
|
137
|
+
value = JSON.parse(await readFile(file, "utf8"));
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
throw new TypeError(`Could not read ${label}`, { cause: error });
|
|
141
|
+
}
|
|
142
|
+
if (!isRecord(value)) {
|
|
143
|
+
throw new TypeError(`${label} must contain a JSON object`);
|
|
144
|
+
}
|
|
145
|
+
return value;
|
|
146
|
+
}
|
|
147
|
+
async function writeJson(file, value) {
|
|
148
|
+
await writeFile(file, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
149
|
+
}
|
|
150
|
+
async function assertRegularFile(file, label) {
|
|
151
|
+
let details;
|
|
152
|
+
try {
|
|
153
|
+
details = await stat(file);
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
throw new TypeError(`${label} does not exist: ${file}`, { cause: error });
|
|
157
|
+
}
|
|
158
|
+
if (!details.isFile()) {
|
|
159
|
+
throw new TypeError(`${label} must be a file: ${file}`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function resolveContainedPath(root, value, label) {
|
|
163
|
+
const resolved = path.resolve(root, value);
|
|
164
|
+
if (resolved === root || !resolved.startsWith(`${root}${path.sep}`)) {
|
|
165
|
+
throw new TypeError(`${label} must stay within the project root`);
|
|
166
|
+
}
|
|
167
|
+
return resolved;
|
|
168
|
+
}
|
|
169
|
+
function isRecord(value) {
|
|
170
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
171
|
+
}
|
|
172
|
+
function isMissing(error) {
|
|
173
|
+
return (error instanceof Error &&
|
|
174
|
+
"code" in error &&
|
|
175
|
+
error.code === "ENOENT");
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=plugin-build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-build.js","sourceRoot":"","sources":["../src/plugin-build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAC5C,MAAM,0BAA0B,GAAG,aAAa,CAAC;AACjD,MAAM,mBAAmB,GAAG,YAAY,CAAC;AAiBzC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAgC;IAEhC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,oBAAoB,CACrC,IAAI,EACJ,OAAO,CAAC,UAAU,IAAI,kBAAkB,EACxC,mBAAmB,CACpB,CAAC;IACF,MAAM,iBAAiB,GAAG,oBAAoB,CAC5C,IAAI,EACJ,OAAO,CAAC,iBAAiB,IAAI,0BAA0B,EACvD,2BAA2B,CAC5B,CAAC;IACF,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAChC,cAAc,EACd,IAAI,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CACxF,CAA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"node:path";
|
|
3
|
+
import { getCursorPluginStatus, installCursorPlugin, uninstallCursorPlugin, } from "./cursor-plugin.js";
|
|
4
|
+
import { buildAgentPlugin } from "./plugin-build.js";
|
|
5
|
+
export async function runPluginCli(args) {
|
|
6
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
7
|
+
process.stdout.write(usage());
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const options = parseOptions(args);
|
|
11
|
+
if (options.command === "build") {
|
|
12
|
+
const result = await buildAgentPlugin({ root: options.root });
|
|
13
|
+
process.stdout.write(`Built portable Agent Plugin at ${result.artifactDirectory} (${String(result.bytes)} bytes)\n`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (options.target !== "cursor") {
|
|
17
|
+
throw new TypeError(`${options.command} requires the cursor target`);
|
|
18
|
+
}
|
|
19
|
+
if (options.command === "install") {
|
|
20
|
+
const result = await installCursorPlugin({
|
|
21
|
+
root: options.root,
|
|
22
|
+
...(options.cursorHome === undefined ? {} : { cursorHome: options.cursorHome }),
|
|
23
|
+
});
|
|
24
|
+
process.stdout.write(`Installed ${result.pluginName} for Cursor at ${result.destination}\n` +
|
|
25
|
+
"Reload Cursor with Developer: Reload Window.\n");
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (options.command === "status") {
|
|
29
|
+
const result = await getCursorPluginStatus({
|
|
30
|
+
root: options.root,
|
|
31
|
+
...(options.cursorHome === undefined ? {} : { cursorHome: options.cursorHome }),
|
|
32
|
+
});
|
|
33
|
+
process.stdout.write(`${result.pluginName}: ${result.installed ? "installed" : "not installed"} (${result.destination})\n`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const result = await uninstallCursorPlugin({
|
|
37
|
+
root: options.root,
|
|
38
|
+
...(options.cursorHome === undefined ? {} : { cursorHome: options.cursorHome }),
|
|
39
|
+
});
|
|
40
|
+
process.stdout.write(`${result.pluginName}: ${result.installed ? "installed" : "uninstalled"} (${result.destination})\n`);
|
|
41
|
+
}
|
|
42
|
+
function parseOptions(args) {
|
|
43
|
+
const positional = [];
|
|
44
|
+
let root = process.cwd();
|
|
45
|
+
let cursorHome;
|
|
46
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
47
|
+
const argument = args[index];
|
|
48
|
+
if (argument === undefined)
|
|
49
|
+
continue;
|
|
50
|
+
if (!argument.startsWith("-")) {
|
|
51
|
+
positional.push(argument);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const value = args[index + 1];
|
|
55
|
+
if (value === undefined || value.startsWith("-")) {
|
|
56
|
+
throw new TypeError(`Missing value for ${argument}`);
|
|
57
|
+
}
|
|
58
|
+
index += 1;
|
|
59
|
+
if (argument === "--root") {
|
|
60
|
+
root = path.resolve(value);
|
|
61
|
+
}
|
|
62
|
+
else if (argument === "--cursor-home") {
|
|
63
|
+
cursorHome = path.resolve(value);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
throw new TypeError(`Unknown option: ${argument}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const command = positional[0];
|
|
70
|
+
if (command !== "build" &&
|
|
71
|
+
command !== "install" &&
|
|
72
|
+
command !== "status" &&
|
|
73
|
+
command !== "uninstall") {
|
|
74
|
+
throw new TypeError("Expected build, install cursor, status cursor, or uninstall cursor");
|
|
75
|
+
}
|
|
76
|
+
const target = positional[1];
|
|
77
|
+
if (positional.length > 2 || (target !== undefined && target !== "cursor")) {
|
|
78
|
+
throw new TypeError(`Unexpected plugin command: ${positional.join(" ")}`);
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
command,
|
|
82
|
+
...(target === undefined ? {} : { target }),
|
|
83
|
+
root,
|
|
84
|
+
...(cursorHome === undefined ? {} : { cursorHome }),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function usage() {
|
|
88
|
+
return `Build and install a generated CodeModeKit Agent Plugin.
|
|
89
|
+
|
|
90
|
+
Usage:
|
|
91
|
+
codemodekit-plugin build [--root <directory>]
|
|
92
|
+
codemodekit-plugin install cursor [--root <directory>] [--cursor-home <directory>]
|
|
93
|
+
codemodekit-plugin status cursor [--root <directory>] [--cursor-home <directory>]
|
|
94
|
+
codemodekit-plugin uninstall cursor [--root <directory>] [--cursor-home <directory>]
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
runPluginCli(process.argv.slice(2)).catch((error) => {
|
|
98
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
99
|
+
process.stderr.write(`codemodekit-plugin: ${message}\n\n${usage()}`);
|
|
100
|
+
process.exitCode = 1;
|
|
101
|
+
});
|
|
102
|
+
//# sourceMappingURL=plugin-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-cli.js","sourceRoot":"","sources":["../src/plugin-cli.ts"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AASrD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAuB;IACxD,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACnD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QAC9B,OAAO;IACT,CAAC;IACD,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9D,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,kCAAkC,MAAM,CAAC,iBAAiB,KAAK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MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,OAAO,OAAO,KAAK,EAAE,EAAE,CAAC,CAAC;IACrE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
package/dist/scaffold.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ScaffoldAgentPluginResult } from "./agent-plugin.js";
|
|
2
2
|
import type { ParsedCommand } from "./command.js";
|
|
3
|
+
import { type ScaffoldSource } from "./source-template.js";
|
|
4
|
+
export type { ScaffoldSource } from "./source-template.js";
|
|
3
5
|
export interface AgentPluginScaffoldOptions {
|
|
4
6
|
readonly pluginName?: string;
|
|
5
7
|
readonly skillName?: string;
|
|
@@ -10,13 +12,19 @@ export interface AgentPluginScaffoldOptions {
|
|
|
10
12
|
}
|
|
11
13
|
export interface ScaffoldCodeModeMcpOptions {
|
|
12
14
|
readonly targetDirectory: string;
|
|
13
|
-
|
|
14
|
-
readonly
|
|
15
|
+
/** Tool source to wrap. Prefer this over the legacy mcpName/mcpCommand pair. */
|
|
16
|
+
readonly source?: ScaffoldSource;
|
|
17
|
+
/** @deprecated Use source: { type: "mcp-stdio", ... }. */
|
|
18
|
+
readonly mcpName?: string;
|
|
19
|
+
/** @deprecated Use source: { type: "mcp-stdio", ... }. */
|
|
20
|
+
readonly mcpCommand?: ParsedCommand;
|
|
15
21
|
readonly serverName?: string;
|
|
16
22
|
readonly packageName?: string;
|
|
17
23
|
readonly policy?: "allow-all" | "deny-all";
|
|
18
24
|
/** Generate a portable Agent Plugins 1.0 package and companion skill. */
|
|
19
25
|
readonly agentPlugin?: boolean | AgentPluginScaffoldOptions;
|
|
26
|
+
/** Install both project-local authoring skills under .agents/skills. Defaults to true. */
|
|
27
|
+
readonly authoringSkill?: boolean;
|
|
20
28
|
readonly install?: boolean;
|
|
21
29
|
/** Override the generated runtime dependency, including with a file: specifier. */
|
|
22
30
|
readonly codemodekitVersion?: string;
|
|
@@ -27,23 +35,26 @@ export interface ScaffoldCodeModeMcpOptions {
|
|
|
27
35
|
export interface GeneratedAgentPluginResult extends ScaffoldAgentPluginResult {
|
|
28
36
|
readonly synced: boolean;
|
|
29
37
|
readonly syncError?: string;
|
|
38
|
+
readonly built: boolean;
|
|
39
|
+
readonly artifactDirectory?: string;
|
|
30
40
|
}
|
|
31
41
|
export interface ScaffoldResult {
|
|
32
42
|
readonly directory: string;
|
|
33
43
|
readonly entrypoint: string;
|
|
34
44
|
readonly installed: boolean;
|
|
45
|
+
/** First installed authoring skill retained for compatibility. */
|
|
46
|
+
readonly authoringSkillDirectory?: string;
|
|
47
|
+
readonly authoringSkillDirectories?: readonly string[];
|
|
35
48
|
readonly agentPlugin?: GeneratedAgentPluginResult;
|
|
36
49
|
}
|
|
37
50
|
export declare function scaffoldCodeModeMcp(options: ScaffoldCodeModeMcpOptions): Promise<ScaffoldResult>;
|
|
38
51
|
interface RenderServerOptions {
|
|
39
52
|
readonly serverName: string;
|
|
40
|
-
readonly
|
|
41
|
-
readonly mcpCommand: ParsedCommand;
|
|
53
|
+
readonly source: ScaffoldSource;
|
|
42
54
|
readonly policy: "allow-all" | "deny-all";
|
|
43
55
|
readonly agentPlugin?: {
|
|
44
56
|
readonly skillName: string;
|
|
45
57
|
};
|
|
46
58
|
}
|
|
47
59
|
export declare function renderServer(options: RenderServerOptions): string;
|
|
48
|
-
export {};
|
|
49
60
|
//# sourceMappingURL=scaffold.d.ts.map
|
package/dist/scaffold.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK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