create-glosc 0.3.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/dist/templates.js +17 -3
- package/package.json +1 -1
- package/src/templates.ts +18 -3
package/dist/templates.js
CHANGED
|
@@ -206,6 +206,14 @@ function entryPath(options) {
|
|
|
206
206
|
? options.mainFileName
|
|
207
207
|
: `src/${options.mainFileName}`;
|
|
208
208
|
}
|
|
209
|
+
function mcpRuntime(options) {
|
|
210
|
+
return options.language === "python" ? "python" : "node";
|
|
211
|
+
}
|
|
212
|
+
function mcpEntry(options) {
|
|
213
|
+
if (options.language === "python")
|
|
214
|
+
return options.mainFileName;
|
|
215
|
+
return `dist/${options.mainFileName.replace(/\.ts$/i, ".js")}`;
|
|
216
|
+
}
|
|
209
217
|
function escapeYamlString(value) {
|
|
210
218
|
const s = String(value ?? "");
|
|
211
219
|
const escaped = s.replace(/"/g, '\\"');
|
|
@@ -223,7 +231,7 @@ function projectReadme(options) {
|
|
|
223
231
|
const runSection = language === "python"
|
|
224
232
|
? `## Run (Python)\n\n\n\n1) Install deps\n\n\n\n\`\`\`sh\npython -m pip install -r requirements.txt\n\`\`\`\n\n\n\n2) Run the MCP server (stdio)\n\n\n\n\`\`\`sh\npython ${entry}\n\`\`\`\n\n\n\nThis server speaks MCP over stdio. Connect using an MCP client (e.g. an editor integration).\n`
|
|
225
233
|
: `## Run (TypeScript)\n\n\n\n1) Install deps\n\n\n\n\`\`\`sh\nnpm install\n\`\`\`\n\n\n\n2) Build\n\n\n\n\`\`\`sh\nnpm run build\n\`\`\`\n\n\n\n3) Run the MCP server (stdio)\n\n\n\n\`\`\`sh\nnpm start\n\`\`\`\n\n\n\nThis server speaks MCP over stdio. Connect using an MCP client (e.g. an editor integration).\n`;
|
|
226
|
-
return `# ${projectName}\n\n${description || ""}\n\n## Author\n\n${author || ""}\n\n## Language\n\n${langLabel}\n\n## Entry\n\n- ${entry}\n\n## MCP Tools\n\n- get_current_time: Returns the current time (UTC, ISO 8601)\n\n${runSection}\n\n## Config\n\n- config.yml\n`;
|
|
234
|
+
return `# ${projectName}\n\n${description || ""}\n\n## Author\n\n${author || ""}\n\n## Language\n\n${langLabel}\n\n## Entry\n\n- ${entry}\n\n## MCP Tools\n\n- get_current_time: Returns the current time (UTC, ISO 8601)\n\n${runSection}\n\n## Config\n\n- config.yml (see: mcp.runtime / mcp.entry)\n`;
|
|
227
235
|
}
|
|
228
236
|
function packagingPackageJson(options) {
|
|
229
237
|
const { projectName, description, author } = options;
|
|
@@ -244,9 +252,15 @@ function configYml(options) {
|
|
|
244
252
|
return [
|
|
245
253
|
`name: ${escapeYamlString(projectName)}`,
|
|
246
254
|
`description: ${escapeYamlString(description)}`,
|
|
247
|
-
`
|
|
255
|
+
`icon: ${escapeYamlString("")}`,
|
|
248
256
|
`language: ${escapeYamlString(language)}`,
|
|
249
|
-
`
|
|
257
|
+
`author: ${escapeYamlString(author)}`,
|
|
258
|
+
`mcp:`,
|
|
259
|
+
` runtime: ${escapeYamlString(mcpRuntime(options))}`,
|
|
260
|
+
` entry: ${escapeYamlString(mcpEntry(options))}`,
|
|
261
|
+
` cwd: ${escapeYamlString(".")}`,
|
|
262
|
+
` env: {}`,
|
|
263
|
+
` args: []`,
|
|
250
264
|
"",
|
|
251
265
|
].join("\n");
|
|
252
266
|
}
|
package/package.json
CHANGED
package/src/templates.ts
CHANGED
|
@@ -228,6 +228,15 @@ function entryPath(options: ProjectOptions): string {
|
|
|
228
228
|
: `src/${options.mainFileName}`;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
function mcpRuntime(options: ProjectOptions): "python" | "node" {
|
|
232
|
+
return options.language === "python" ? "python" : "node";
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function mcpEntry(options: ProjectOptions): string {
|
|
236
|
+
if (options.language === "python") return options.mainFileName;
|
|
237
|
+
return `dist/${options.mainFileName.replace(/\.ts$/i, ".js")}`;
|
|
238
|
+
}
|
|
239
|
+
|
|
231
240
|
function escapeYamlString(value: unknown): string {
|
|
232
241
|
const s = String(value ?? "");
|
|
233
242
|
const escaped = s.replace(/"/g, '\\"');
|
|
@@ -253,7 +262,7 @@ function projectReadme(options: ProjectOptions): string {
|
|
|
253
262
|
|
|
254
263
|
return `# ${projectName}\n\n${description || ""}\n\n## Author\n\n${
|
|
255
264
|
author || ""
|
|
256
|
-
}\n\n## Language\n\n${langLabel}\n\n## Entry\n\n- ${entry}\n\n## MCP Tools\n\n- get_current_time: Returns the current time (UTC, ISO 8601)\n\n${runSection}\n\n## Config\n\n- config.yml\n`;
|
|
265
|
+
}\n\n## Language\n\n${langLabel}\n\n## Entry\n\n- ${entry}\n\n## MCP Tools\n\n- get_current_time: Returns the current time (UTC, ISO 8601)\n\n${runSection}\n\n## Config\n\n- config.yml (see: mcp.runtime / mcp.entry)\n`;
|
|
257
266
|
}
|
|
258
267
|
|
|
259
268
|
function packagingPackageJson(options: ProjectOptions): string {
|
|
@@ -278,9 +287,15 @@ function configYml(options: ProjectOptions): string {
|
|
|
278
287
|
return [
|
|
279
288
|
`name: ${escapeYamlString(projectName)}`,
|
|
280
289
|
`description: ${escapeYamlString(description)}`,
|
|
281
|
-
`
|
|
290
|
+
`icon: ${escapeYamlString("")}`,
|
|
282
291
|
`language: ${escapeYamlString(language)}`,
|
|
283
|
-
`
|
|
292
|
+
`author: ${escapeYamlString(author)}`,
|
|
293
|
+
`mcp:`,
|
|
294
|
+
` runtime: ${escapeYamlString(mcpRuntime(options))}`,
|
|
295
|
+
` entry: ${escapeYamlString(mcpEntry(options))}`,
|
|
296
|
+
` cwd: ${escapeYamlString(".")}`,
|
|
297
|
+
` env: {}`,
|
|
298
|
+
` args: []`,
|
|
284
299
|
"",
|
|
285
300
|
].join("\n");
|
|
286
301
|
}
|