create-glosc 0.2.0 → 0.2.1

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 CHANGED
@@ -31,8 +31,7 @@ License: MIT
31
31
  ```sh
32
32
 
33
33
  <your-project-name>/
34
- ├── src/ # 源代码目录
35
- │ ├── main.py # MCP Server 入口 (Python, stdio)
34
+ ├── main.py # MCP Server 入口 (Python, stdio)
36
35
  ├── pyproject.toml # 项目配置
37
36
  ├── requirements.txt # 依赖文件
38
37
  ├── config.yml # 配置文件
@@ -59,7 +58,7 @@ Python:
59
58
 
60
59
  ```sh
61
60
  python -m pip install -r requirements.txt
62
- python src/main.py
61
+ python main.py
63
62
  ```
64
63
 
65
64
  TypeScript:
package/dist/templates.js CHANGED
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getProjectFiles = getProjectFiles;
4
+ function entryPath(options) {
5
+ return options.language === "python"
6
+ ? options.mainFileName
7
+ : `src/${options.mainFileName}`;
8
+ }
4
9
  function escapeYamlString(value) {
5
10
  const s = String(value ?? "");
6
11
  const escaped = s.replace(/"/g, '\\"');
@@ -14,7 +19,7 @@ function mitLicenseText({ author }) {
14
19
  function projectReadme(options) {
15
20
  const { projectName, description, author, language, mainFileName } = options;
16
21
  const langLabel = language === "python" ? "Python" : "TypeScript";
17
- const entry = `src/${mainFileName}`;
22
+ const entry = entryPath(options);
18
23
  const runSection = language === "python"
19
24
  ? `## 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`
20
25
  : `## 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`;
@@ -27,7 +32,7 @@ function configYml(options) {
27
32
  `description: ${escapeYamlString(description)}`,
28
33
  `author: ${escapeYamlString(author)}`,
29
34
  `language: ${escapeYamlString(language)}`,
30
- `entry: ${escapeYamlString(`src/${mainFileName}`)}`,
35
+ `entry: ${escapeYamlString(entryPath(options))}`,
31
36
  "",
32
37
  ].join("\n");
33
38
  }
@@ -110,7 +115,7 @@ function getProjectFiles(options) {
110
115
  }
111
116
  if (options.language === "python") {
112
117
  files.push({
113
- relativePath: `src/${options.mainFileName}`,
118
+ relativePath: options.mainFileName,
114
119
  content: pythonMain(options),
115
120
  });
116
121
  files.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-glosc",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Scaffold Glosc projects (Python/TypeScript) via npm create",
5
5
  "author": "glosc-ai",
6
6
  "license": "MIT",
package/src/templates.ts CHANGED
@@ -15,6 +15,12 @@ export type ProjectFile = {
15
15
  content: string;
16
16
  };
17
17
 
18
+ function entryPath(options: ProjectOptions): string {
19
+ return options.language === "python"
20
+ ? options.mainFileName
21
+ : `src/${options.mainFileName}`;
22
+ }
23
+
18
24
  function escapeYamlString(value: unknown): string {
19
25
  const s = String(value ?? "");
20
26
  const escaped = s.replace(/"/g, '\\"');
@@ -32,7 +38,7 @@ function projectReadme(options: ProjectOptions): string {
32
38
  options;
33
39
  const langLabel = language === "python" ? "Python" : "TypeScript";
34
40
 
35
- const entry = `src/${mainFileName}`;
41
+ const entry = entryPath(options);
36
42
  const runSection =
37
43
  language === "python"
38
44
  ? `## 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`
@@ -51,7 +57,7 @@ function configYml(options: ProjectOptions): string {
51
57
  `description: ${escapeYamlString(description)}`,
52
58
  `author: ${escapeYamlString(author)}`,
53
59
  `language: ${escapeYamlString(language)}`,
54
- `entry: ${escapeYamlString(`src/${mainFileName}`)}`,
60
+ `entry: ${escapeYamlString(entryPath(options))}`,
55
61
  "",
56
62
  ].join("\n");
57
63
  }
@@ -163,7 +169,7 @@ export function getProjectFiles(options: ProjectOptions): ProjectFile[] {
163
169
 
164
170
  if (options.language === "python") {
165
171
  files.push({
166
- relativePath: `src/${options.mainFileName}`,
172
+ relativePath: options.mainFileName,
167
173
  content: pythonMain(options),
168
174
  });
169
175
  files.push({