create-codemodekit 0.1.0 → 0.2.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 +21 -0
- package/dist/agent-plugin.d.ts +70 -0
- package/dist/agent-plugin.d.ts.map +1 -0
- package/dist/agent-plugin.js +286 -0
- package/dist/agent-plugin.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +46 -0
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/scaffold.d.ts +23 -0
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/scaffold.js +162 -6
- package/dist/scaffold.js.map +1 -1
- package/package.json +5 -14
package/README.md
CHANGED
|
@@ -14,3 +14,24 @@ npm start
|
|
|
14
14
|
The command is parsed directly into an executable and argument array. Shell operators, shell expansion, and leading environment assignments are rejected; no shell is invoked. Dependency installation is automatic unless `--no-install` is supplied.
|
|
15
15
|
|
|
16
16
|
Generated servers use `--policy allow-all` by default so the project runs immediately. Use `--policy deny-all` when you want the generated server to start closed while you define a narrower tool policy.
|
|
17
|
+
|
|
18
|
+
## Generate an Agent Plugin
|
|
19
|
+
|
|
20
|
+
Add `--agent-plugin` to create a portable Agent Plugins 1.0 package around the Code Mode server:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm create codemodekit@latest my-code-mode -- \
|
|
24
|
+
--mcp-name upstream \
|
|
25
|
+
--mcp-command 'uvx my-mcp-server' \
|
|
26
|
+
--agent-plugin
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
This adds root `plugin.json` and `mcp.json` files plus `skills/use-upstream-codemode/`. The companion skill teaches an agent to compose calls through `run_typescript`; its `references/tools.d.ts` is generated from CodeModeKit's live normalized catalog.
|
|
30
|
+
|
|
31
|
+
The generator attempts catalog sync after dependency installation. If the upstream MCP still needs credentials or connectivity, the project remains valid with pending references. Configure the source and run:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npm run plugin:sync
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Use `--no-sync` to skip the initial attempt intentionally. Programmatic consumers can call `scaffoldAgentPlugin` and `syncAgentPluginSkill` directly.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface AgentPluginCatalogSource {
|
|
2
|
+
start(signal?: AbortSignal): Promise<AgentPluginStartupReport>;
|
|
3
|
+
getTypeScriptCatalog(signal?: AbortSignal): Promise<AgentPluginTypeScriptCatalog>;
|
|
4
|
+
}
|
|
5
|
+
export interface AgentPluginStartupReport {
|
|
6
|
+
readonly status: "ready" | "degraded";
|
|
7
|
+
readonly catalogRevision: string;
|
|
8
|
+
readonly sources: readonly AgentPluginSourceReport[];
|
|
9
|
+
}
|
|
10
|
+
export interface AgentPluginSourceReport {
|
|
11
|
+
readonly source: string;
|
|
12
|
+
readonly status: "healthy" | "unavailable";
|
|
13
|
+
readonly toolCount: number;
|
|
14
|
+
readonly message?: string;
|
|
15
|
+
readonly rejectedToolCount?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface AgentPluginTypeScriptCatalog {
|
|
18
|
+
readonly catalogRevision: string;
|
|
19
|
+
readonly declarations: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ScaffoldAgentPluginOptions {
|
|
22
|
+
readonly root: string;
|
|
23
|
+
readonly pluginName: string;
|
|
24
|
+
readonly serverName: string;
|
|
25
|
+
readonly skillName: string;
|
|
26
|
+
readonly description?: string;
|
|
27
|
+
readonly version?: string;
|
|
28
|
+
readonly license?: string;
|
|
29
|
+
readonly entrypoint?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ScaffoldAgentPluginResult {
|
|
32
|
+
readonly root: string;
|
|
33
|
+
readonly manifest: string;
|
|
34
|
+
readonly mcpConfig: string;
|
|
35
|
+
readonly skillDirectory: string;
|
|
36
|
+
readonly skillName: string;
|
|
37
|
+
}
|
|
38
|
+
export interface SyncAgentPluginSkillOptions {
|
|
39
|
+
readonly root: string;
|
|
40
|
+
readonly skillName: string;
|
|
41
|
+
readonly serverName: string;
|
|
42
|
+
readonly codeMode: AgentPluginCatalogSource;
|
|
43
|
+
readonly signal?: AbortSignal;
|
|
44
|
+
}
|
|
45
|
+
export interface SyncAgentPluginSkillResult {
|
|
46
|
+
readonly skillDirectory: string;
|
|
47
|
+
readonly catalogRevision: string;
|
|
48
|
+
readonly declarations: string;
|
|
49
|
+
readonly metadata: string;
|
|
50
|
+
readonly sources: readonly AgentPluginSourceReport[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Writes the portable Agent Plugins 1.0 wrapper and a compact companion skill.
|
|
54
|
+
* Tool-specific declarations are populated later by syncAgentPluginSkill.
|
|
55
|
+
*/
|
|
56
|
+
export declare function scaffoldAgentPlugin(options: ScaffoldAgentPluginOptions): Promise<ScaffoldAgentPluginResult>;
|
|
57
|
+
/**
|
|
58
|
+
* Snapshots CodeModeKit's active catalog into an already-scaffolded companion
|
|
59
|
+
* skill. A degraded catalog is rejected so a partial tool surface is never
|
|
60
|
+
* presented as complete documentation.
|
|
61
|
+
*/
|
|
62
|
+
export declare function syncAgentPluginSkill(options: SyncAgentPluginSkillOptions): Promise<SyncAgentPluginSkillResult>;
|
|
63
|
+
export declare function normalizePortableName(value: string, label?: string): string;
|
|
64
|
+
interface RenderCompanionSkillOptions {
|
|
65
|
+
readonly skillName: string;
|
|
66
|
+
readonly serverName: string;
|
|
67
|
+
}
|
|
68
|
+
export declare function renderCompanionSkill(options: RenderCompanionSkillOptions): string;
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=agent-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-plugin.d.ts","sourceRoot":"","sources":["../src/agent-plugin.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,O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
|
|
3
|
+
const PLUGIN_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json";
|
|
4
|
+
const MCP_SCHEMA = "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json";
|
|
5
|
+
const PORTABLE_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;
|
|
6
|
+
/**
|
|
7
|
+
* Writes the portable Agent Plugins 1.0 wrapper and a compact companion skill.
|
|
8
|
+
* Tool-specific declarations are populated later by syncAgentPluginSkill.
|
|
9
|
+
*/
|
|
10
|
+
export async function scaffoldAgentPlugin(options) {
|
|
11
|
+
const root = path.resolve(options.root);
|
|
12
|
+
const pluginName = validatePortableName(options.pluginName, "Plugin name");
|
|
13
|
+
const skillName = validatePortableName(options.skillName, "Skill name");
|
|
14
|
+
const serverName = required(options.serverName, "Server name");
|
|
15
|
+
const version = required(options.version ?? "0.1.0", "Plugin version");
|
|
16
|
+
const entrypoint = options.entrypoint ?? "src/server.mjs";
|
|
17
|
+
validatePluginRelativePath(entrypoint, "Plugin entrypoint");
|
|
18
|
+
const manifestPath = path.join(root, "plugin.json");
|
|
19
|
+
const mcpConfigPath = path.join(root, "mcp.json");
|
|
20
|
+
const skillDirectory = path.join(root, "skills", skillName);
|
|
21
|
+
const referencesDirectory = path.join(skillDirectory, "references");
|
|
22
|
+
await mkdir(referencesDirectory, { recursive: true });
|
|
23
|
+
const description = options.description ??
|
|
24
|
+
`Use ${serverName} through a sandboxed TypeScript Code Mode interface.`;
|
|
25
|
+
const manifest = {
|
|
26
|
+
$schema: PLUGIN_SCHEMA,
|
|
27
|
+
name: pluginName,
|
|
28
|
+
version,
|
|
29
|
+
description,
|
|
30
|
+
...(options.license === undefined
|
|
31
|
+
? {}
|
|
32
|
+
: { license: required(options.license, "Plugin license") }),
|
|
33
|
+
keywords: ["code-mode", "mcp", "agent-skill"],
|
|
34
|
+
};
|
|
35
|
+
const mcpConfig = {
|
|
36
|
+
$schema: MCP_SCHEMA,
|
|
37
|
+
mcpServers: {
|
|
38
|
+
[serverName]: {
|
|
39
|
+
type: "stdio",
|
|
40
|
+
command: "node",
|
|
41
|
+
args: [`\${PLUGIN_ROOT}/${entrypoint}`],
|
|
42
|
+
cwd: "${PLUGIN_ROOT}",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
await Promise.all([
|
|
47
|
+
writeJson(manifestPath, manifest),
|
|
48
|
+
writeJson(mcpConfigPath, mcpConfig),
|
|
49
|
+
writeFile(path.join(skillDirectory, "SKILL.md"), renderCompanionSkill({ skillName, serverName }), "utf8"),
|
|
50
|
+
writeFile(path.join(referencesDirectory, "runtime.md"), renderRuntimeReference(serverName), "utf8"),
|
|
51
|
+
writeFile(path.join(referencesDirectory, "result-contract.md"), renderResultContractReference(), "utf8"),
|
|
52
|
+
writeFile(path.join(referencesDirectory, "examples.md"), renderExamplesReference(), "utf8"),
|
|
53
|
+
writeFile(path.join(referencesDirectory, "tools.d.ts"), renderPendingDeclarations(), "utf8"),
|
|
54
|
+
writeJson(path.join(referencesDirectory, "catalog-metadata.json"), {
|
|
55
|
+
schemaVersion: 1,
|
|
56
|
+
status: "pending",
|
|
57
|
+
serverName,
|
|
58
|
+
message: "Run npm run plugin:sync after the upstream tool source is available.",
|
|
59
|
+
}),
|
|
60
|
+
]);
|
|
61
|
+
return {
|
|
62
|
+
root,
|
|
63
|
+
manifest: manifestPath,
|
|
64
|
+
mcpConfig: mcpConfigPath,
|
|
65
|
+
skillDirectory,
|
|
66
|
+
skillName,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Snapshots CodeModeKit's active catalog into an already-scaffolded companion
|
|
71
|
+
* skill. A degraded catalog is rejected so a partial tool surface is never
|
|
72
|
+
* presented as complete documentation.
|
|
73
|
+
*/
|
|
74
|
+
export async function syncAgentPluginSkill(options) {
|
|
75
|
+
const root = path.resolve(options.root);
|
|
76
|
+
const skillName = validatePortableName(options.skillName, "Skill name");
|
|
77
|
+
const serverName = required(options.serverName, "Server name");
|
|
78
|
+
const snapshot = await stableCatalogSnapshot(options.codeMode, options.signal);
|
|
79
|
+
if (snapshot.startup.status !== "ready") {
|
|
80
|
+
const unavailable = snapshot.startup.sources
|
|
81
|
+
.filter((source) => source.status === "unavailable")
|
|
82
|
+
.map((source) => source.source)
|
|
83
|
+
.join(", ");
|
|
84
|
+
throw new Error(unavailable === ""
|
|
85
|
+
? "Cannot sync an Agent Plugin skill from a degraded catalog"
|
|
86
|
+
: `Cannot sync an Agent Plugin skill while sources are unavailable: ${unavailable}`);
|
|
87
|
+
}
|
|
88
|
+
const skillDirectory = path.join(root, "skills", skillName);
|
|
89
|
+
const referencesDirectory = path.join(skillDirectory, "references");
|
|
90
|
+
await mkdir(referencesDirectory, { recursive: true });
|
|
91
|
+
const declarationsPath = path.join(referencesDirectory, "tools.d.ts");
|
|
92
|
+
const metadataPath = path.join(referencesDirectory, "catalog-metadata.json");
|
|
93
|
+
const declarations = renderCatalogDeclarations(snapshot.catalog.catalogRevision, snapshot.catalog.declarations);
|
|
94
|
+
const metadata = {
|
|
95
|
+
schemaVersion: 1,
|
|
96
|
+
status: "ready",
|
|
97
|
+
serverName,
|
|
98
|
+
catalogRevision: snapshot.catalog.catalogRevision,
|
|
99
|
+
sources: snapshot.startup.sources.map((source) => ({
|
|
100
|
+
source: source.source,
|
|
101
|
+
status: source.status,
|
|
102
|
+
toolCount: source.toolCount,
|
|
103
|
+
...(source.rejectedToolCount === undefined
|
|
104
|
+
? {}
|
|
105
|
+
: { rejectedToolCount: source.rejectedToolCount }),
|
|
106
|
+
})),
|
|
107
|
+
};
|
|
108
|
+
await Promise.all([
|
|
109
|
+
atomicWrite(declarationsPath, declarations),
|
|
110
|
+
atomicWrite(metadataPath, `${JSON.stringify(metadata, null, 2)}\n`),
|
|
111
|
+
]);
|
|
112
|
+
return {
|
|
113
|
+
skillDirectory,
|
|
114
|
+
catalogRevision: snapshot.catalog.catalogRevision,
|
|
115
|
+
declarations: declarationsPath,
|
|
116
|
+
metadata: metadataPath,
|
|
117
|
+
sources: snapshot.startup.sources,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export function normalizePortableName(value, label = "Name") {
|
|
121
|
+
const normalized = value
|
|
122
|
+
.trim()
|
|
123
|
+
.toLowerCase()
|
|
124
|
+
.replace(/[^a-z0-9]+/gu, "-")
|
|
125
|
+
.replace(/-+/gu, "-")
|
|
126
|
+
.replace(/^-|-$/gu, "")
|
|
127
|
+
.slice(0, 64)
|
|
128
|
+
.replace(/-$/u, "");
|
|
129
|
+
return validatePortableName(normalized, label);
|
|
130
|
+
}
|
|
131
|
+
export function renderCompanionSkill(options) {
|
|
132
|
+
const skillName = validatePortableName(options.skillName, "Skill name");
|
|
133
|
+
const serverName = required(options.serverName, "Server name");
|
|
134
|
+
const description = `Use the ${serverName} Code Mode MCP server for requests that require its upstream tools. ` +
|
|
135
|
+
"Apply the generated TypeScript catalog, compose calls in run_typescript, and return only the requested result.";
|
|
136
|
+
return `---
|
|
137
|
+
name: ${skillName}
|
|
138
|
+
description: ${JSON.stringify(description)}
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
# Use ${serverName} Code Mode
|
|
142
|
+
|
|
143
|
+
Use \`run_typescript\` as the primary interface to the tools wrapped by this server.
|
|
144
|
+
|
|
145
|
+
1. Locate the relevant declarations in [references/tools.d.ts](references/tools.d.ts) before authoring calls. Search large files by capability, source, or tool name and read only focused matches.
|
|
146
|
+
2. Put related calls, result extraction, filtering, and reshaping into one \`run_typescript\` execution.
|
|
147
|
+
3. Return only the bounded value needed to answer the user.
|
|
148
|
+
4. Use \`search_tools\` when the generated catalog is pending or stale, does not contain the needed capability, or the client cannot search a large declaration reference efficiently.
|
|
149
|
+
5. Treat tool errors as data you can catch and handle; do not bypass tool policy or sandbox limits.
|
|
150
|
+
|
|
151
|
+
Read [references/runtime.md](references/runtime.md) for execution rules, [references/result-contract.md](references/result-contract.md) for MCP result extraction, and [references/examples.md](references/examples.md) for composition patterns.
|
|
152
|
+
`;
|
|
153
|
+
}
|
|
154
|
+
function renderRuntimeReference(serverName) {
|
|
155
|
+
return `# ${serverName} runtime
|
|
156
|
+
|
|
157
|
+
The server exposes a small Code Mode surface:
|
|
158
|
+
|
|
159
|
+
- \`run_typescript\` compiles and executes an async TypeScript function body in a sandbox. Top-level \`await\` and \`return\` are supported.
|
|
160
|
+
- \`search_tools\` searches the current runtime catalog and can return focused TypeScript declarations.
|
|
161
|
+
|
|
162
|
+
The sandbox exposes \`tools\` and a limited set of safe JavaScript globals. It does not expose Node.js modules, filesystem APIs, process APIs, network APIs, dynamic imports, or arbitrary package imports.
|
|
163
|
+
|
|
164
|
+
Prefer one execution that calls, combines, and reduces upstream results. Use \`Promise.all\` only for independent operations. Keep the final return value small; do not return raw payloads when a projection or summary is sufficient.
|
|
165
|
+
|
|
166
|
+
The generated declaration snapshot is authoritative for its recorded catalog revision. If a call is missing or fails with \`TOOL_NOT_FOUND\`, use \`search_tools\` to inspect the live catalog and then refresh the snapshot with \`npm run plugin:sync\` when maintaining the plugin.
|
|
167
|
+
`;
|
|
168
|
+
}
|
|
169
|
+
function renderResultContractReference() {
|
|
170
|
+
return `# Tool result contract
|
|
171
|
+
|
|
172
|
+
Every \`tools.*\` call resolves to an MCP result wrapper rather than directly to the upstream payload:
|
|
173
|
+
|
|
174
|
+
\`\`\`ts
|
|
175
|
+
interface ToolContentBlock {
|
|
176
|
+
readonly type: string;
|
|
177
|
+
readonly [key: string]: unknown;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
interface ToolResult<TStructured = unknown> {
|
|
181
|
+
readonly content: readonly ToolContentBlock[];
|
|
182
|
+
readonly structuredContent?: TStructured;
|
|
183
|
+
}
|
|
184
|
+
\`\`\`
|
|
185
|
+
|
|
186
|
+
Prefer \`structuredContent\` when present. Some servers nest the useful value under \`structuredContent.result\`. When structured content is absent, inspect text blocks in \`content\` and call \`JSON.parse\` only after confirming the selected block has a string \`text\` field.
|
|
187
|
+
|
|
188
|
+
Tool failures throw a catchable \`ToolCallError\` with \`code\`, \`phase\`, and optional \`source\` and \`tool\` fields. Catch an error only when the workflow can recover or return a more useful bounded result.
|
|
189
|
+
`;
|
|
190
|
+
}
|
|
191
|
+
function renderExamplesReference() {
|
|
192
|
+
return `# Composition examples
|
|
193
|
+
|
|
194
|
+
Replace the source, tool, and input names with declarations from \`tools.d.ts\`.
|
|
195
|
+
|
|
196
|
+
## Extract structured data
|
|
197
|
+
|
|
198
|
+
\`\`\`ts
|
|
199
|
+
const result = await tools["source-name"]["tool-name"]({});
|
|
200
|
+
const structured = result.structuredContent;
|
|
201
|
+
return structured !== null &&
|
|
202
|
+
typeof structured === "object" &&
|
|
203
|
+
!Array.isArray(structured) &&
|
|
204
|
+
"result" in structured
|
|
205
|
+
? structured.result
|
|
206
|
+
: structured;
|
|
207
|
+
\`\`\`
|
|
208
|
+
|
|
209
|
+
## Run independent calls concurrently
|
|
210
|
+
|
|
211
|
+
\`\`\`ts
|
|
212
|
+
const [first, second] = await Promise.all([
|
|
213
|
+
tools["source-name"]["first-tool"]({}),
|
|
214
|
+
tools["source-name"]["second-tool"]({}),
|
|
215
|
+
]);
|
|
216
|
+
return {
|
|
217
|
+
first: first.structuredContent,
|
|
218
|
+
second: second.structuredContent,
|
|
219
|
+
};
|
|
220
|
+
\`\`\`
|
|
221
|
+
|
|
222
|
+
## Recover from an optional call
|
|
223
|
+
|
|
224
|
+
\`\`\`ts
|
|
225
|
+
try {
|
|
226
|
+
const result = await tools["source-name"]["optional-tool"]({});
|
|
227
|
+
return { available: true, value: result.structuredContent };
|
|
228
|
+
} catch (error) {
|
|
229
|
+
return {
|
|
230
|
+
available: false,
|
|
231
|
+
code: error instanceof ToolCallError ? error.code : "UNKNOWN",
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
\`\`\`
|
|
235
|
+
`;
|
|
236
|
+
}
|
|
237
|
+
function renderPendingDeclarations() {
|
|
238
|
+
return `// CodeModeKit catalog snapshot pending.
|
|
239
|
+
// Run: npm run plugin:sync
|
|
240
|
+
`;
|
|
241
|
+
}
|
|
242
|
+
function renderCatalogDeclarations(revision, declarations) {
|
|
243
|
+
return `// Generated by CodeModeKit from catalog revision ${revision}.
|
|
244
|
+
// Refresh with: npm run plugin:sync
|
|
245
|
+
|
|
246
|
+
${declarations.trim()}\n`;
|
|
247
|
+
}
|
|
248
|
+
async function stableCatalogSnapshot(codeMode, signal) {
|
|
249
|
+
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
250
|
+
const startup = await codeMode.start(signal);
|
|
251
|
+
const catalog = await codeMode.getTypeScriptCatalog(signal);
|
|
252
|
+
if (startup.catalogRevision === catalog.catalogRevision) {
|
|
253
|
+
return { startup, catalog };
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
throw new Error("The Code Mode catalog changed repeatedly while creating the snapshot");
|
|
257
|
+
}
|
|
258
|
+
async function writeJson(file, value) {
|
|
259
|
+
await writeFile(file, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
260
|
+
}
|
|
261
|
+
async function atomicWrite(file, contents) {
|
|
262
|
+
const temporary = `${file}.${String(process.pid)}.tmp`;
|
|
263
|
+
await writeFile(temporary, contents, "utf8");
|
|
264
|
+
await rename(temporary, file);
|
|
265
|
+
}
|
|
266
|
+
function validatePortableName(value, label) {
|
|
267
|
+
const name = required(value, label);
|
|
268
|
+
if (name.length > 64 || !PORTABLE_NAME.test(name)) {
|
|
269
|
+
throw new TypeError(`${label} must contain at most 64 lowercase letters, digits, and single hyphens`);
|
|
270
|
+
}
|
|
271
|
+
return name;
|
|
272
|
+
}
|
|
273
|
+
function validatePluginRelativePath(value, label) {
|
|
274
|
+
if (value === "" ||
|
|
275
|
+
path.isAbsolute(value) ||
|
|
276
|
+
value.split(/[\\/]/u).some((segment) => segment === "..")) {
|
|
277
|
+
throw new TypeError(`${label} must stay within the plugin root`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function required(value, label) {
|
|
281
|
+
if (value.trim() === "") {
|
|
282
|
+
throw new TypeError(`${label} must not be empty`);
|
|
283
|
+
}
|
|
284
|
+
return value;
|
|
285
|
+
}
|
|
286
|
+
//# sourceMappingURL=agent-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-plugin.js","sourceRoot":"","sources":["../src/agent-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,aAAa,GACjB,4DAA4D,CAAC;AAC/D,MAAM,UAAU,GACd,yDAAyD,CAAC;AAC5D,MAAM,aAAa,GAAG,6BAA6B,CAAC;AA6DpD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAAmC;IAEnC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,oBAAoB,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAC3E,MAAM,SAAS,GAAG,oBAAoB,CAAC,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACxE,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,EAAE,gBAAgB,CAAC,CAAC;IACvE,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,gBAAgB,CAAC;IAC1D,0BAA0B,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;IAE5D,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACpD,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAA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
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAiBA,wBAAsB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAyCnE"}
|
package/dist/cli.js
CHANGED
|
@@ -16,9 +16,26 @@ export async function runCli(args) {
|
|
|
16
16
|
: { serverName: options.serverName }),
|
|
17
17
|
policy: options.policy,
|
|
18
18
|
install: options.install,
|
|
19
|
+
...(options.codemodekitVersion === undefined
|
|
20
|
+
? {}
|
|
21
|
+
: { codemodekitVersion: options.codemodekitVersion }),
|
|
22
|
+
...(options.createCodemodekitVersion === undefined
|
|
23
|
+
? {}
|
|
24
|
+
: { createCodemodekitVersion: options.createCodemodekitVersion }),
|
|
25
|
+
...(options.agentPlugin
|
|
26
|
+
? { agentPlugin: { sync: options.sync && options.install } }
|
|
27
|
+
: {}),
|
|
19
28
|
});
|
|
29
|
+
const pluginSummary = result.agentPlugin === undefined
|
|
30
|
+
? ""
|
|
31
|
+
: result.agentPlugin.synced
|
|
32
|
+
? `Agent Plugin: ready (${result.agentPlugin.skillName})\n`
|
|
33
|
+
: `Agent Plugin: scaffolded (${result.agentPlugin.skillName})\n` +
|
|
34
|
+
`${result.agentPlugin.syncError === undefined ? "" : `Catalog sync pending: ${result.agentPlugin.syncError}\n`}` +
|
|
35
|
+
" npm run plugin:sync\n";
|
|
20
36
|
process.stdout.write(`\nCreated ${options.serverName ?? `${options.mcpName}-code-mode`} in ${result.directory}\n\n` +
|
|
21
37
|
`${result.installed ? "" : " npm install\n"} npm start\n\n` +
|
|
38
|
+
pluginSummary +
|
|
22
39
|
`Tool policy: ${options.policy}\n`);
|
|
23
40
|
}
|
|
24
41
|
function parseOptions(args) {
|
|
@@ -27,7 +44,11 @@ function parseOptions(args) {
|
|
|
27
44
|
let mcpCommand;
|
|
28
45
|
let serverName;
|
|
29
46
|
let policy = "allow-all";
|
|
47
|
+
let agentPlugin = false;
|
|
48
|
+
let sync = true;
|
|
30
49
|
let install = true;
|
|
50
|
+
let codemodekitVersion;
|
|
51
|
+
let createCodemodekitVersion;
|
|
31
52
|
for (let index = 0; index < args.length; index += 1) {
|
|
32
53
|
const argument = args[index];
|
|
33
54
|
if (argument === undefined)
|
|
@@ -43,6 +64,14 @@ function parseOptions(args) {
|
|
|
43
64
|
install = false;
|
|
44
65
|
continue;
|
|
45
66
|
}
|
|
67
|
+
if (argument === "--agent-plugin") {
|
|
68
|
+
agentPlugin = true;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (argument === "--no-sync") {
|
|
72
|
+
sync = false;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
46
75
|
const value = args[index + 1];
|
|
47
76
|
if (value === undefined || value.startsWith("--")) {
|
|
48
77
|
throw new TypeError(`Missing value for ${argument}`);
|
|
@@ -64,6 +93,12 @@ function parseOptions(args) {
|
|
|
64
93
|
}
|
|
65
94
|
policy = value;
|
|
66
95
|
break;
|
|
96
|
+
case "--codemodekit-version":
|
|
97
|
+
codemodekitVersion = value;
|
|
98
|
+
break;
|
|
99
|
+
case "--create-codemodekit-version":
|
|
100
|
+
createCodemodekitVersion = value;
|
|
101
|
+
break;
|
|
67
102
|
default:
|
|
68
103
|
throw new TypeError(`Unknown option: ${argument}`);
|
|
69
104
|
}
|
|
@@ -83,7 +118,13 @@ function parseOptions(args) {
|
|
|
83
118
|
mcpCommand,
|
|
84
119
|
...(serverName === undefined ? {} : { serverName }),
|
|
85
120
|
policy,
|
|
121
|
+
agentPlugin,
|
|
122
|
+
sync,
|
|
86
123
|
install,
|
|
124
|
+
...(codemodekitVersion === undefined ? {} : { codemodekitVersion }),
|
|
125
|
+
...(createCodemodekitVersion === undefined
|
|
126
|
+
? {}
|
|
127
|
+
: { createCodemodekitVersion }),
|
|
87
128
|
};
|
|
88
129
|
}
|
|
89
130
|
function usage() {
|
|
@@ -98,7 +139,12 @@ Options:
|
|
|
98
139
|
--server-name <name> Downstream MCP server name
|
|
99
140
|
--policy allow-all Allow every discovered upstream tool (default)
|
|
100
141
|
--policy deny-all Deny every upstream tool until policy is edited
|
|
142
|
+
--agent-plugin Add plugin.json, mcp.json, and a companion Agent Skill
|
|
143
|
+
--no-sync Do not snapshot tool types during Agent Plugin creation
|
|
101
144
|
--no-install Generate files without running npm install
|
|
145
|
+
--codemodekit-version <v> Override the generated runtime dependency
|
|
146
|
+
--create-codemodekit-version <v>
|
|
147
|
+
Override the generated sync dependency
|
|
102
148
|
-h, --help Show this help
|
|
103
149
|
`;
|
|
104
150
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAepD,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAuB;IAClD,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;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC;QACvC,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,OAAO,EAAE,OAAO,CAAC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MAAM,IAAI,SAAS,CAAC,2BAA2B,CAAC,CAAC;IACnD,CAAC;IAED,OAAO;QACL,eAAe;QACf,OAAO;QACP,UAAU;QACV,GAAG,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC;QACnD,MAAM;QACN,WAAW;QACX,IAAI;QACJ,OAAO;QACP,GAAG,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC;QACnE,GAAG,CAAC,wBAAwB,KAAK,SAAS;YACxC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,wBAAwB,EAAE,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,SAAS,KAAK;IACZ,OAAO;;;;;;;;;;;;;;;;;;CAkBR,CAAC;AACF,CAAC;AAED,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACrD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,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/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { parseMcpCommand, type ParsedCommand } from "./command.js";
|
|
2
|
-
export {
|
|
2
|
+
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";
|
|
3
4
|
//# 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,YAAY,EACZ,mBAAmB,EACnB,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,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"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { parseMcpCommand } from "./command.js";
|
|
2
|
+
export { normalizePortableName, renderCompanionSkill, scaffoldAgentPlugin, syncAgentPluginSkill, } from "./agent-plugin.js";
|
|
2
3
|
export { renderServer, scaffoldCodeModeMcp, } from "./scaffold.js";
|
|
3
4
|
//# 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,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,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,GASrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,mBAAmB,GAKpB,MAAM,eAAe,CAAC"}
|
package/dist/scaffold.d.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import { type ScaffoldAgentPluginResult } from "./agent-plugin.js";
|
|
1
2
|
import type { ParsedCommand } from "./command.js";
|
|
3
|
+
export interface AgentPluginScaffoldOptions {
|
|
4
|
+
readonly pluginName?: string;
|
|
5
|
+
readonly skillName?: string;
|
|
6
|
+
readonly description?: string;
|
|
7
|
+
readonly license?: string;
|
|
8
|
+
/** Discover the live catalog and populate references after install. Defaults to true. */
|
|
9
|
+
readonly sync?: boolean;
|
|
10
|
+
}
|
|
2
11
|
export interface ScaffoldCodeModeMcpOptions {
|
|
3
12
|
readonly targetDirectory: string;
|
|
4
13
|
readonly mcpName: string;
|
|
@@ -6,13 +15,24 @@ export interface ScaffoldCodeModeMcpOptions {
|
|
|
6
15
|
readonly serverName?: string;
|
|
7
16
|
readonly packageName?: string;
|
|
8
17
|
readonly policy?: "allow-all" | "deny-all";
|
|
18
|
+
/** Generate a portable Agent Plugins 1.0 package and companion skill. */
|
|
19
|
+
readonly agentPlugin?: boolean | AgentPluginScaffoldOptions;
|
|
9
20
|
readonly install?: boolean;
|
|
21
|
+
/** Override the generated runtime dependency, including with a file: specifier. */
|
|
22
|
+
readonly codemodekitVersion?: string;
|
|
23
|
+
/** Override the generated sync-time dependency. */
|
|
24
|
+
readonly createCodemodekitVersion?: string;
|
|
10
25
|
readonly cwd?: string;
|
|
11
26
|
}
|
|
27
|
+
export interface GeneratedAgentPluginResult extends ScaffoldAgentPluginResult {
|
|
28
|
+
readonly synced: boolean;
|
|
29
|
+
readonly syncError?: string;
|
|
30
|
+
}
|
|
12
31
|
export interface ScaffoldResult {
|
|
13
32
|
readonly directory: string;
|
|
14
33
|
readonly entrypoint: string;
|
|
15
34
|
readonly installed: boolean;
|
|
35
|
+
readonly agentPlugin?: GeneratedAgentPluginResult;
|
|
16
36
|
}
|
|
17
37
|
export declare function scaffoldCodeModeMcp(options: ScaffoldCodeModeMcpOptions): Promise<ScaffoldResult>;
|
|
18
38
|
interface RenderServerOptions {
|
|
@@ -20,6 +40,9 @@ interface RenderServerOptions {
|
|
|
20
40
|
readonly mcpName: string;
|
|
21
41
|
readonly mcpCommand: ParsedCommand;
|
|
22
42
|
readonly policy: "allow-all" | "deny-all";
|
|
43
|
+
readonly agentPlugin?: {
|
|
44
|
+
readonly skillName: string;
|
|
45
|
+
};
|
|
23
46
|
}
|
|
24
47
|
export declare function renderServer(options: RenderServerOptions): string;
|
|
25
48
|
export {};
|
package/dist/scaffold.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAOlD,MAAM,WAAW,0BAA0B;IACzC,QAAQ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E,0BAA0B,CAAC;CACnD;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,cAAc,CAAC,CA6IzB;AAED,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE;QACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAyBjE"}
|
package/dist/scaffold.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
2
3
|
import { mkdir, readdir, writeFile } from "node:fs/promises";
|
|
3
4
|
import path from "node:path";
|
|
5
|
+
import { normalizePortableName, scaffoldAgentPlugin, } from "./agent-plugin.js";
|
|
6
|
+
const PACKAGE_VERSION = readPackageVersion();
|
|
7
|
+
// The generator and batteries-included runtime release independently.
|
|
8
|
+
const DEFAULT_CODEMODEKIT_VERSION = "^0.1.0";
|
|
9
|
+
const DEFAULT_CREATE_CODEMODEKIT_VERSION = `^${PACKAGE_VERSION}`;
|
|
4
10
|
export async function scaffoldCodeModeMcp(options) {
|
|
5
11
|
const cwd = options.cwd ?? process.cwd();
|
|
6
12
|
const directory = path.resolve(cwd, options.targetDirectory);
|
|
@@ -8,6 +14,16 @@ export async function scaffoldCodeModeMcp(options) {
|
|
|
8
14
|
const serverName = required(options.serverName ?? `${mcpName}-code-mode`, "Server name");
|
|
9
15
|
const packageName = validPackageName(options.packageName ?? packageNameFromDirectory(directory));
|
|
10
16
|
const policy = options.policy ?? "allow-all";
|
|
17
|
+
const install = options.install ?? true;
|
|
18
|
+
const agentPluginOptions = resolveAgentPluginOptions(options.agentPlugin);
|
|
19
|
+
const pluginName = agentPluginOptions === undefined
|
|
20
|
+
? undefined
|
|
21
|
+
: normalizePortableName(agentPluginOptions.pluginName ?? path.basename(directory), "Plugin name");
|
|
22
|
+
const skillName = agentPluginOptions === undefined
|
|
23
|
+
? undefined
|
|
24
|
+
: normalizePortableName(agentPluginOptions.skillName ?? `use-${mcpName}-codemode`, "Skill name");
|
|
25
|
+
const codemodekitVersion = required(options.codemodekitVersion ?? DEFAULT_CODEMODEKIT_VERSION, "CodeModeKit dependency version");
|
|
26
|
+
const createCodemodekitVersion = required(options.createCodemodekitVersion ?? DEFAULT_CREATE_CODEMODEKIT_VERSION, "create-codemodekit dependency version");
|
|
11
27
|
await ensureEmptyDirectory(directory);
|
|
12
28
|
await mkdir(path.join(directory, "src"), { recursive: true });
|
|
13
29
|
const packageJson = {
|
|
@@ -16,8 +32,20 @@ export async function scaffoldCodeModeMcp(options) {
|
|
|
16
32
|
private: true,
|
|
17
33
|
type: "module",
|
|
18
34
|
engines: { node: ">=20" },
|
|
19
|
-
scripts: {
|
|
20
|
-
|
|
35
|
+
scripts: {
|
|
36
|
+
start: "node src/server.mjs",
|
|
37
|
+
...(agentPluginOptions === undefined
|
|
38
|
+
? {}
|
|
39
|
+
: { "plugin:sync": "node src/server.mjs --sync-plugin" }),
|
|
40
|
+
},
|
|
41
|
+
dependencies: { "codemodekit": codemodekitVersion },
|
|
42
|
+
...(agentPluginOptions === undefined
|
|
43
|
+
? {}
|
|
44
|
+
: {
|
|
45
|
+
devDependencies: {
|
|
46
|
+
"create-codemodekit": createCodemodekitVersion,
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
21
49
|
};
|
|
22
50
|
const entrypoint = path.join(directory, "src", "server.mjs");
|
|
23
51
|
await Promise.all([
|
|
@@ -28,15 +56,63 @@ export async function scaffoldCodeModeMcp(options) {
|
|
|
28
56
|
mcpName,
|
|
29
57
|
mcpCommand: options.mcpCommand,
|
|
30
58
|
policy,
|
|
59
|
+
...(skillName === undefined
|
|
60
|
+
? {}
|
|
61
|
+
: { agentPlugin: { skillName } }),
|
|
31
62
|
}), "utf8"),
|
|
32
63
|
]);
|
|
33
|
-
|
|
64
|
+
let generatedPlugin;
|
|
65
|
+
if (agentPluginOptions !== undefined &&
|
|
66
|
+
pluginName !== undefined &&
|
|
67
|
+
skillName !== undefined) {
|
|
68
|
+
generatedPlugin = await scaffoldAgentPlugin({
|
|
69
|
+
root: directory,
|
|
70
|
+
pluginName,
|
|
71
|
+
serverName,
|
|
72
|
+
skillName,
|
|
73
|
+
...(agentPluginOptions.description === undefined
|
|
74
|
+
? {}
|
|
75
|
+
: { description: agentPluginOptions.description }),
|
|
76
|
+
...(agentPluginOptions.license === undefined
|
|
77
|
+
? {}
|
|
78
|
+
: { license: agentPluginOptions.license }),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (install) {
|
|
34
82
|
await runNpmInstall(directory);
|
|
35
83
|
}
|
|
36
|
-
|
|
84
|
+
let syncError;
|
|
85
|
+
let synced = false;
|
|
86
|
+
if (generatedPlugin !== undefined &&
|
|
87
|
+
(agentPluginOptions?.sync ?? install)) {
|
|
88
|
+
try {
|
|
89
|
+
await runPluginSync(directory);
|
|
90
|
+
synced = true;
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
syncError = error instanceof Error ? error.message : String(error);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
directory,
|
|
98
|
+
entrypoint,
|
|
99
|
+
installed: install,
|
|
100
|
+
...(generatedPlugin === undefined
|
|
101
|
+
? {}
|
|
102
|
+
: {
|
|
103
|
+
agentPlugin: {
|
|
104
|
+
...generatedPlugin,
|
|
105
|
+
synced,
|
|
106
|
+
...(syncError === undefined ? {} : { syncError }),
|
|
107
|
+
},
|
|
108
|
+
}),
|
|
109
|
+
};
|
|
37
110
|
}
|
|
38
111
|
export function renderServer(options) {
|
|
39
112
|
const policyFactory = options.policy === "allow-all" ? "allowAllToolCalls" : "denyAllToolCalls";
|
|
113
|
+
if (options.agentPlugin !== undefined) {
|
|
114
|
+
return renderAgentPluginServer(options, policyFactory);
|
|
115
|
+
}
|
|
40
116
|
return `import {
|
|
41
117
|
${policyFactory},
|
|
42
118
|
mcp,
|
|
@@ -57,6 +133,54 @@ await serveCodeModeStdio({
|
|
|
57
133
|
});
|
|
58
134
|
`;
|
|
59
135
|
}
|
|
136
|
+
function renderAgentPluginServer(options, policyFactory) {
|
|
137
|
+
const skillName = options.agentPlugin?.skillName;
|
|
138
|
+
if (skillName === undefined) {
|
|
139
|
+
throw new TypeError("Agent Plugin skill name is required");
|
|
140
|
+
}
|
|
141
|
+
return `import { fileURLToPath } from "node:url";
|
|
142
|
+
|
|
143
|
+
import {
|
|
144
|
+
${policyFactory},
|
|
145
|
+
createCodeModeMcp,
|
|
146
|
+
mcp,
|
|
147
|
+
serveCodeModeStdio,
|
|
148
|
+
} from "codemodekit";
|
|
149
|
+
|
|
150
|
+
const options = {
|
|
151
|
+
name: ${JSON.stringify(options.serverName)},
|
|
152
|
+
version: "0.1.0",
|
|
153
|
+
toolPolicy: ${policyFactory}(),
|
|
154
|
+
sources: [
|
|
155
|
+
mcp.stdio({
|
|
156
|
+
name: ${JSON.stringify(options.mcpName)},
|
|
157
|
+
command: ${JSON.stringify(options.mcpCommand.command)},
|
|
158
|
+
args: ${JSON.stringify(options.mcpCommand.args)},
|
|
159
|
+
}),
|
|
160
|
+
],
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
if (process.argv.includes("--sync-plugin")) {
|
|
164
|
+
const { syncAgentPluginSkill } = await import("create-codemodekit");
|
|
165
|
+
const application = createCodeModeMcp(options);
|
|
166
|
+
try {
|
|
167
|
+
const result = await syncAgentPluginSkill({
|
|
168
|
+
root: fileURLToPath(new URL("../", import.meta.url)),
|
|
169
|
+
skillName: ${JSON.stringify(skillName)},
|
|
170
|
+
serverName: ${JSON.stringify(options.serverName)},
|
|
171
|
+
codeMode: application.codeMode,
|
|
172
|
+
});
|
|
173
|
+
process.stdout.write(
|
|
174
|
+
\`Synced Agent Plugin catalog \${result.catalogRevision} to \${result.skillDirectory}\\n\`,
|
|
175
|
+
);
|
|
176
|
+
} finally {
|
|
177
|
+
await application.close();
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
await serveCodeModeStdio(options);
|
|
181
|
+
}
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
60
184
|
async function ensureEmptyDirectory(directory) {
|
|
61
185
|
try {
|
|
62
186
|
const entries = await readdir(directory);
|
|
@@ -73,11 +197,18 @@ async function ensureEmptyDirectory(directory) {
|
|
|
73
197
|
}
|
|
74
198
|
}
|
|
75
199
|
function runNpmInstall(directory) {
|
|
200
|
+
return runCommand("npm", ["install"], directory, "npm install");
|
|
201
|
+
}
|
|
202
|
+
function runPluginSync(directory) {
|
|
203
|
+
return runCommand("npm", ["run", "plugin:sync"], directory, "Agent Plugin catalog sync");
|
|
204
|
+
}
|
|
205
|
+
function runCommand(command, args, directory, label) {
|
|
76
206
|
return new Promise((resolve, reject) => {
|
|
77
|
-
const child = spawn(
|
|
207
|
+
const child = spawn(command, [...args], {
|
|
78
208
|
cwd: directory,
|
|
79
209
|
stdio: "inherit",
|
|
80
210
|
shell: false,
|
|
211
|
+
env: projectCommandEnvironment(),
|
|
81
212
|
});
|
|
82
213
|
child.once("error", reject);
|
|
83
214
|
child.once("exit", (code, signal) => {
|
|
@@ -85,10 +216,35 @@ function runNpmInstall(directory) {
|
|
|
85
216
|
resolve();
|
|
86
217
|
return;
|
|
87
218
|
}
|
|
88
|
-
reject(new Error(
|
|
219
|
+
reject(new Error(`${label} failed${signal === null ? ` with exit code ${String(code)}` : ` from signal ${signal}`}`));
|
|
89
220
|
});
|
|
90
221
|
});
|
|
91
222
|
}
|
|
223
|
+
function projectCommandEnvironment() {
|
|
224
|
+
const environment = { ...process.env };
|
|
225
|
+
for (const key of Object.keys(environment)) {
|
|
226
|
+
if (key.toLowerCase() === "npm_config_allow_scripts") {
|
|
227
|
+
delete environment[key];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return environment;
|
|
231
|
+
}
|
|
232
|
+
function resolveAgentPluginOptions(value) {
|
|
233
|
+
if (value === undefined || value === false)
|
|
234
|
+
return undefined;
|
|
235
|
+
return value === true ? {} : value;
|
|
236
|
+
}
|
|
237
|
+
function readPackageVersion() {
|
|
238
|
+
const document = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
239
|
+
if (typeof document !== "object" ||
|
|
240
|
+
document === null ||
|
|
241
|
+
!("version" in document) ||
|
|
242
|
+
typeof document.version !== "string" ||
|
|
243
|
+
document.version.trim() === "") {
|
|
244
|
+
throw new Error("create-codemodekit package version is unavailable");
|
|
245
|
+
}
|
|
246
|
+
return document.version;
|
|
247
|
+
}
|
|
92
248
|
function packageNameFromDirectory(directory) {
|
|
93
249
|
return path.basename(directory).toLowerCase().replace(/[^a-z0-9._-]+/gu, "-");
|
|
94
250
|
}
|
package/dist/scaffold.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"scaffold.js","sourceRoot":"","sources":["../src/scaffold.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,IAAI,MA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K,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,GAAG,KAAK,oBAAoB,CAAC,CAAC;IAC3E,OAAO,KAAK,CAAC;AACf,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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-codemodekit",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Scaffold
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Scaffold runnable CodeModeKit servers and portable Agent Plugins from MCP commands.",
|
|
5
5
|
"author": "Stephen Brown",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -29,19 +29,10 @@
|
|
|
29
29
|
"default": "./dist/index.js"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
"files": [
|
|
33
|
-
|
|
34
|
-
"dist/*.d.ts",
|
|
35
|
-
"dist/*.map"
|
|
36
|
-
],
|
|
37
|
-
"keywords": [
|
|
38
|
-
"code-mode",
|
|
39
|
-
"mcp",
|
|
40
|
-
"model-context-protocol",
|
|
41
|
-
"scaffold"
|
|
42
|
-
],
|
|
32
|
+
"files": ["dist/*.js", "dist/*.d.ts", "dist/*.map"],
|
|
33
|
+
"keywords": ["code-mode", "mcp", "model-context-protocol", "agent-plugin", "agent-skill", "scaffold"],
|
|
43
34
|
"publishConfig": {
|
|
44
35
|
"access": "public"
|
|
45
36
|
},
|
|
46
37
|
"dependencies": {}
|
|
47
|
-
}
|
|
38
|
+
}
|