create-maa-project 1.2.0__tar.gz → 1.2.2__tar.gz

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.
Files changed (145) hide show
  1. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/.github/workflows/release.yml +2 -1
  2. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/.release/create-maa-project-manifest.json +23 -23
  3. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/PKG-INFO +1 -1
  4. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/package.json +1 -1
  5. create_maa_project-1.2.2/py-wrapper/create_maa_project/__init__.py +1 -0
  6. create_maa_project-1.2.2/py-wrapper/create_maa_project/release_manifest.py +2 -0
  7. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/pyproject.toml +1 -1
  8. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/doctor.ts +21 -296
  9. create_maa_project-1.2.2/templates/addons/dev-tools/tools/check-project.mjs +230 -0
  10. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/dev-tools/tools/validate-schema.mjs +3 -5
  11. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/github/.github/workflows/release.yml +10 -3
  12. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/github/tools/build-release.mjs +79 -23
  13. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/github/tools/sync-runtime.mjs +3 -0
  14. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/agent_runtime.py +3 -3
  15. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/bootstrap.py +85 -11
  16. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/custom/reco/general.py +2 -6
  17. create_maa_project-1.2.2/templates/agent/agent/utils/maa_types.py +224 -0
  18. create_maa_project-1.2.2/templates/agent/agent/utils/params.py +114 -0
  19. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/utils/pienv.py +4 -4
  20. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/tools/schema/interface.schema.json +20 -3
  21. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/tools/schema/schema-manifest.json +1 -1
  22. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/tests/scaffold.test.ts +63 -404
  23. create_maa_project-1.2.2/tests/test_agent_bootstrap.py +39 -0
  24. create_maa_project-1.2.0/py-wrapper/create_maa_project/__init__.py +0 -1
  25. create_maa_project-1.2.0/py-wrapper/create_maa_project/release_manifest.py +0 -2
  26. create_maa_project-1.2.0/templates/addons/dev-tools/tools/check-project.mjs +0 -551
  27. create_maa_project-1.2.0/templates/agent/agent/utils/maa_types.py +0 -21
  28. create_maa_project-1.2.0/templates/agent/agent/utils/params.py +0 -24
  29. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/.editorconfig +0 -0
  30. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/.gitattributes +0 -0
  31. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/.github/cliff.toml +0 -0
  32. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/.github/workflows/network-assets.yml +0 -0
  33. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/.github/workflows/schema-sync.yml +0 -0
  34. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/.gitignore +0 -0
  35. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/.prettierignore +0 -0
  36. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/.prettierrc.mjs +0 -0
  37. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/LICENSE +0 -0
  38. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/README.en.md +0 -0
  39. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/README.md +0 -0
  40. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/pnpm-lock.yaml +0 -0
  41. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/pnpm-workspace.yaml +0 -0
  42. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/py-wrapper/create_maa_project/__main__.py +0 -0
  43. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/scripts/build-sea.mjs +0 -0
  44. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/scripts/build.mjs +0 -0
  45. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/scripts/check-network-assets.ts +0 -0
  46. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/scripts/create-release-manifest.mjs +0 -0
  47. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/scripts/generate-template-assets.mjs +0 -0
  48. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/scripts/prepare-pypi-release.mjs +0 -0
  49. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/scripts/sync-release-version.mjs +0 -0
  50. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/scripts/sync-schema.mjs +0 -0
  51. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/scripts/test-python.mjs +0 -0
  52. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/addons.ts +0 -0
  53. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/args.ts +0 -0
  54. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/assets.ts +0 -0
  55. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/controllers.ts +0 -0
  56. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/features.ts +0 -0
  57. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/incremental-addons.ts +0 -0
  58. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/index.ts +0 -0
  59. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/lang.ts +0 -0
  60. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/log.ts +0 -0
  61. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/mcp.ts +0 -0
  62. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/project.ts +0 -0
  63. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/prompt.ts +0 -0
  64. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/report.ts +0 -0
  65. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/scaffold.ts +0 -0
  66. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/sync.ts +0 -0
  67. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/template-assets.generated.ts +0 -0
  68. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/templates.ts +0 -0
  69. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/types.ts +0 -0
  70. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/update.ts +0 -0
  71. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/src/utils.ts +0 -0
  72. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/auto-format/.github/workflows/format.yml +0 -0
  73. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/community/CONTRIBUTING.md +0 -0
  74. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/community/PULL_REQUEST_TEMPLATE.md +0 -0
  75. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/community/bug_report.yml +0 -0
  76. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/community/feature_request.yml +0 -0
  77. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/community/issue_config.yml +0 -0
  78. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/community/other_issue.yml +0 -0
  79. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/dependabot/.github/dependabot.yml +0 -0
  80. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/dev-tools/.vscode/extensions.agent.json +0 -0
  81. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/dev-tools/.vscode/extensions.json +0 -0
  82. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/dev-tools/.vscode/launch.agent.json +0 -0
  83. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/dev-tools/.vscode/settings.agent.json +0 -0
  84. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/dev-tools/.vscode/settings.json +0 -0
  85. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/dev-tools/.vscode/tasks.github.json +0 -0
  86. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/dev-tools/.vscode/tasks.json +0 -0
  87. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/dev-tools/package.json +0 -0
  88. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/dev-tools/pnpm-workspace.yaml +0 -0
  89. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/git-cliff/.github/cliff.toml +0 -0
  90. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/github/.github/workflows/check.yml +0 -0
  91. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/optimize-images/.github/workflows/optimize-images.yml +0 -0
  92. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/optimize-images/tools/optimize-images.mjs +0 -0
  93. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/schema-sync/.github/workflows/schema-sync.yml +0 -0
  94. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/addons/schema-sync/tools/sync-schema.mjs +0 -0
  95. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/README.en.md +0 -0
  96. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/README.md +0 -0
  97. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/__init__.py +0 -0
  98. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/custom/__init__.py +0 -0
  99. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/custom/action/__init__.py +0 -0
  100. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/custom/action/general.py +0 -0
  101. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/custom/reco/__init__.py +0 -0
  102. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/custom/sink/__init__.py +0 -0
  103. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/main.py +0 -0
  104. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/utils/__init__.py +0 -0
  105. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/utils/logger.py +0 -0
  106. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/agent/utils/runtime_paths.py +0 -0
  107. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/pyproject.toml +0 -0
  108. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/requirements.txt +0 -0
  109. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/tools/schema/custom.action.schema.json +0 -0
  110. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/tools/schema/custom.recognition.schema.json +0 -0
  111. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/agent/uv.lock +0 -0
  112. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/.editorconfig +0 -0
  113. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/.gitattributes +0 -0
  114. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/.gitignore +0 -0
  115. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/.prettierignore +0 -0
  116. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/.prettierrc.mjs +0 -0
  117. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/README.en.md +0 -0
  118. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/README.md +0 -0
  119. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/gitignore.tmpl +0 -0
  120. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/interface.json.tmpl +0 -0
  121. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/licenses/AGPL-3.0-or-later.txt +0 -0
  122. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/licenses/MIT.txt +0 -0
  123. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/maatools.config.mts +0 -0
  124. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/resource/base/default_pipeline.json +0 -0
  125. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/resource/base/image/empty.png +0 -0
  126. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/resource/base/model/ocr/manifest.json +0 -0
  127. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/resource/base/pipeline/tutorial.json +0 -0
  128. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/tasks/tutorial.json +0 -0
  129. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/tools/schema/custom.action.schema.json +0 -0
  130. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/tools/schema/custom.recognition.schema.json +0 -0
  131. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/tools/schema/interface_config.schema.json +0 -0
  132. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/tools/schema/interface_import.schema.json +0 -0
  133. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/templates/base/tools/schema/pipeline.schema.json +0 -0
  134. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/tests/addons.test.ts +0 -0
  135. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/tests/args.test.ts +0 -0
  136. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/tests/child-env.ts +0 -0
  137. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/tests/lang.test.ts +0 -0
  138. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/tests/mcp.test.ts +0 -0
  139. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/tests/project.test.ts +0 -0
  140. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/tests/prompt.test.ts +0 -0
  141. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/tests/report.test.ts +0 -0
  142. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/tests/templates.test.ts +0 -0
  143. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/tests/test_py_wrapper.py +0 -0
  144. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/tsconfig.json +0 -0
  145. {create_maa_project-1.2.0 → create_maa_project-1.2.2}/vitest.config.ts +0 -0
@@ -1,4 +1,4 @@
1
- name: Release
1
+ name: Release
2
2
 
3
3
  on:
4
4
  push:
@@ -153,6 +153,7 @@ jobs:
153
153
  - uses: softprops/action-gh-release@v3
154
154
  with:
155
155
  body_path: dist/release-notes/CHANGES.md
156
+ prerelease: ${{ contains(github.ref_name, '-') }}
156
157
  files: dist/release/*
157
158
 
158
159
  npm:
@@ -1,68 +1,68 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "create-maa-project",
4
- "version": "1.2.0",
5
- "tag": "v1.2.0",
4
+ "version": "1.2.2",
5
+ "tag": "v1.2.2",
6
6
  "assets": [
7
7
  {
8
8
  "kind": "sea",
9
9
  "os": "linux",
10
10
  "arch": "aarch64",
11
- "version": "1.2.0",
11
+ "version": "1.2.2",
12
12
  "name": "create-maa-project-linux-aarch64",
13
- "url": "https://github.com/Windsland52/create-maa-project/releases/download/v1.2.0/create-maa-project-linux-aarch64",
14
- "sha256": "8c23f9d9bc5f700b76b2460cf1957bda55ee54c216c0df082eede90a49dca659",
13
+ "url": "https://github.com/Windsland52/create-maa-project/releases/download/v1.2.2/create-maa-project-linux-aarch64",
14
+ "sha256": "302f1b94b68ead54ccfd7da68c5f0631fe2ea354469cc59da9238325cec6cc8f",
15
15
  "size": 123145344
16
16
  },
17
17
  {
18
18
  "kind": "sea",
19
19
  "os": "linux",
20
20
  "arch": "x86_64",
21
- "version": "1.2.0",
21
+ "version": "1.2.2",
22
22
  "name": "create-maa-project-linux-x86_64",
23
- "url": "https://github.com/Windsland52/create-maa-project/releases/download/v1.2.0/create-maa-project-linux-x86_64",
24
- "sha256": "bef4d442be2049f223eb46cdb0292e52c1e8962bdac0ab38a7c16e90f7b386b6",
23
+ "url": "https://github.com/Windsland52/create-maa-project/releases/download/v1.2.2/create-maa-project-linux-x86_64",
24
+ "sha256": "8ee14bcb3fafea060891cf98b2a131381065c7053019ac4eb1d6dffc4fa36ff6",
25
25
  "size": 125045952
26
26
  },
27
27
  {
28
28
  "kind": "sea",
29
29
  "os": "macos",
30
30
  "arch": "aarch64",
31
- "version": "1.2.0",
31
+ "version": "1.2.2",
32
32
  "name": "create-maa-project-macos-aarch64",
33
- "url": "https://github.com/Windsland52/create-maa-project/releases/download/v1.2.0/create-maa-project-macos-aarch64",
34
- "sha256": "0ac77bd2315d4ef794aa6fd608e9c39c0313571356e1a0cab6c50ad63b2e1d5a",
33
+ "url": "https://github.com/Windsland52/create-maa-project/releases/download/v1.2.2/create-maa-project-macos-aarch64",
34
+ "sha256": "b5cac2f528e7029224283dd7f623f85b6ab6199476ee6d29742d3323352119e4",
35
35
  "size": 121408240
36
36
  },
37
37
  {
38
38
  "kind": "sea",
39
39
  "os": "macos",
40
40
  "arch": "x86_64",
41
- "version": "1.2.0",
41
+ "version": "1.2.2",
42
42
  "name": "create-maa-project-macos-x86_64",
43
- "url": "https://github.com/Windsland52/create-maa-project/releases/download/v1.2.0/create-maa-project-macos-x86_64",
44
- "sha256": "fd9e41740a326f54a2990f61f741ac2c0745c51eb76e8c850f4839185bc0cb29",
45
- "size": 124476368
43
+ "url": "https://github.com/Windsland52/create-maa-project/releases/download/v1.2.2/create-maa-project-macos-x86_64",
44
+ "sha256": "05bb2f42843ce33bcb76e2dd701050ce224905bb08e5c620a4a6c62d7bb5da85",
45
+ "size": 124472240
46
46
  },
47
47
  {
48
48
  "kind": "sea",
49
49
  "os": "win",
50
50
  "arch": "aarch64",
51
- "version": "1.2.0",
51
+ "version": "1.2.2",
52
52
  "name": "create-maa-project-win-aarch64.exe",
53
- "url": "https://github.com/Windsland52/create-maa-project/releases/download/v1.2.0/create-maa-project-win-aarch64.exe",
54
- "sha256": "fbbd714298b4d864818ebd0cf302d7e385fe9db4543485ee6a4d9f973bac4178",
55
- "size": 82563584
53
+ "url": "https://github.com/Windsland52/create-maa-project/releases/download/v1.2.2/create-maa-project-win-aarch64.exe",
54
+ "sha256": "a554bdc37a181d7a407b1027effe5913a33833cea59c7707e1ec1fdd01df6342",
55
+ "size": 82560000
56
56
  },
57
57
  {
58
58
  "kind": "sea",
59
59
  "os": "win",
60
60
  "arch": "x86_64",
61
- "version": "1.2.0",
61
+ "version": "1.2.2",
62
62
  "name": "create-maa-project-win-x86_64.exe",
63
- "url": "https://github.com/Windsland52/create-maa-project/releases/download/v1.2.0/create-maa-project-win-x86_64.exe",
64
- "sha256": "4063de4f3f16f6bee4a0c03f2f8a542115583fc2349ca06fdd56d232d45caab8",
65
- "size": 94029824
63
+ "url": "https://github.com/Windsland52/create-maa-project/releases/download/v1.2.2/create-maa-project-win-x86_64.exe",
64
+ "sha256": "8a70811812de26fe0b9b51eb7908bd411351bfdbfe20da857bae82fb6d86db5c",
65
+ "size": 94026240
66
66
  }
67
67
  ]
68
68
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: create-maa-project
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: 用于创建和维护 MaaFW 应用项目的脚手架 CLI / Scaffold and maintenance CLI for MaaFW application projects
5
5
  Project-URL: Homepage, https://github.com/Windsland52/create-maa-project
6
6
  Project-URL: Source, https://github.com/Windsland52/create-maa-project
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-maa-project",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "用于创建和维护 MaaFW 应用项目的脚手架 CLI / Scaffold and maintenance CLI for MaaFW application projects",
5
5
  "keywords": [
6
6
  "maafw",
@@ -0,0 +1 @@
1
+ __version__ = "1.2.2"
@@ -0,0 +1,2 @@
1
+ # Filled by the release workflow when publishing the PyPI wrapper.
2
+ RELEASE_MANIFEST_SHA256 = "5c42a0a01b4e2c34e18d8e8adba50bb541ecff5529a84d298b869e29e4864b41"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "create-maa-project"
3
- version = "1.2.0"
3
+ version = "1.2.2"
4
4
  description = "用于创建和维护 MaaFW 应用项目的脚手架 CLI / Scaffold and maintenance CLI for MaaFW application projects"
5
5
  keywords = ["maafw", "scaffold", "mcp"]
6
6
  readme = "README.md"
@@ -1,11 +1,9 @@
1
1
  import { readFile } from 'node:fs/promises'
2
2
  import { join } from 'node:path'
3
3
  import { managedFileHash, readProjectConfig, readProjectLock } from './project.js'
4
- import { interfaceAgent, interfaceController, interfaceResourceItems } from './templates.js'
5
4
  import type { MaaProjectConfig, MaaProjectLock } from './types.js'
6
- import { projectControllerKinds } from './controllers.js'
7
5
  import { hasDevTools, hasGithubAutomation } from './features.js'
8
- import { addV, exists, readText } from './utils.js'
6
+ import { exists, readText } from './utils.js'
9
7
 
10
8
  export type DoctorReport = {
11
9
  ok: boolean
@@ -21,13 +19,11 @@ export async function runDoctor(root: string): Promise<DoctorReport> {
21
19
  lines.push(`[OK] Project: ${config.project.displayName} (${config.project.slug})`)
22
20
  ok = (await checkInterfaceMetadata(root, config, lines)) && ok
23
21
  if (hasDevTools(config)) {
24
- ok = (await checkPackageMetadata(root, config, lines)) && ok
25
22
  ok = (await checkNodeToolingFiles(root, config, lines)) && ok
26
23
  if (config.features.vscode.enabled) ok = (await checkVscodeSettings(root, lines)) && ok
27
24
  ok = (await checkNodeLockfile(root, lock, lines)) && ok
28
25
  }
29
- ok = (await checkPyprojectMetadata(root, config, lines)) && ok
30
- ok = (await checkResourceOrder(root, config, lines)) && ok
26
+ ok = (await checkResourcePaths(root, config, lines)) && ok
31
27
  ok = (await checkReferencedPaths(root, lines)) && ok
32
28
  ok = (await checkMaatoolsConfig(root, config, lines)) && ok
33
29
  ok = (await checkManagedFiles(root, lock, lines)) && ok
@@ -55,12 +51,7 @@ async function checkInterfaceMetadata(root: string, config: MaaProjectConfig, li
55
51
 
56
52
  const interfaceJson = JSON.parse(await readText(interfacePath)) as {
57
53
  name?: unknown
58
- label?: unknown
59
- version?: unknown
60
- icon?: unknown
61
54
  github?: unknown
62
- agent?: unknown
63
- controller?: unknown
64
55
  }
65
56
  let ok = true
66
57
  const unmanaged = config.project.interfaceUnmanaged === true
@@ -75,49 +66,6 @@ async function checkInterfaceMetadata(root: string, config: MaaProjectConfig, li
75
66
  ok = false
76
67
  }
77
68
  }
78
- if (interfaceJson.label !== config.project.displayName) {
79
- if (unmanaged) {
80
- lines.push(
81
- '[INFO] interface.json label differs from maa-project.json project.displayName; interface.json is unmanaged so this is allowed.',
82
- )
83
- } else {
84
- lines.push('[ERR] interface.json label differs from maa-project.json project.displayName.')
85
- lines.push(' To fix: create-maa-project --sync metadata')
86
- ok = false
87
- }
88
- }
89
- if (interfaceJson.version !== addV(config.project.version)) {
90
- if (unmanaged) {
91
- lines.push(
92
- '[INFO] interface.json version differs from maa-project.json project.version; interface.json is unmanaged so this is allowed.',
93
- )
94
- } else {
95
- lines.push('[ERR] interface.json version differs from maa-project.json project.version.')
96
- lines.push(' To fix: create-maa-project --sync metadata')
97
- ok = false
98
- }
99
- }
100
- if (interfaceJson.icon !== 'logo.ico') {
101
- lines.push('[ERR] interface.json icon must be logo.ico.')
102
- lines.push(' To fix: create-maa-project --sync metadata')
103
- ok = false
104
- }
105
- if (interfaceJson.agent !== undefined && !Array.isArray(interfaceJson.agent)) {
106
- lines.push('[ERR] interface.json agent must be an array.')
107
- lines.push(' To fix: create-maa-project --sync metadata')
108
- ok = false
109
- }
110
- if (JSON.stringify(interfaceJson.agent) !== JSON.stringify(expectedInterfaceAgent(config))) {
111
- if (unmanaged) {
112
- lines.push(
113
- '[INFO] interface.json agent differs from maa-project.json python config; interface.json is unmanaged so this is allowed.',
114
- )
115
- } else {
116
- lines.push('[ERR] interface.json agent differs from maa-project.json python config.')
117
- lines.push(' To fix: create-maa-project --sync metadata')
118
- ok = false
119
- }
120
- }
121
69
  if (interfaceJson.github !== config.project.github) {
122
70
  if (unmanaged) {
123
71
  lines.push(
@@ -129,113 +77,12 @@ async function checkInterfaceMetadata(root: string, config: MaaProjectConfig, li
129
77
  ok = false
130
78
  }
131
79
  }
132
- if (
133
- JSON.stringify(interfaceJson.controller ?? []) !==
134
- JSON.stringify(interfaceController(projectControllerKinds(config)))
135
- ) {
136
- if (unmanaged) {
137
- lines.push(
138
- '[INFO] interface.json controller differs from maa-project.json controller.kinds; interface.json is unmanaged so this is allowed.',
139
- )
140
- } else {
141
- lines.push('[ERR] interface.json controller differs from maa-project.json controller.kinds.')
142
- lines.push(' To fix: create-maa-project --sync metadata')
143
- ok = false
144
- }
145
- }
146
80
  if (ok) lines.push('[OK] Interface metadata matches project config.')
147
81
  return ok
148
82
  }
149
83
 
150
- function expectedInterfaceAgent(config: MaaProjectConfig): ReturnType<typeof interfaceAgent>[] | undefined {
151
- return config.python
152
- ? [
153
- interfaceAgent(config.python.devCommand),
154
- ]
155
- : undefined
156
- }
157
-
158
- async function checkPackageMetadata(root: string, config: MaaProjectConfig, lines: string[]): Promise<boolean> {
159
- const packagePath = join(root, 'package.json')
160
- if (!(await exists(packagePath))) {
161
- lines.push('[ERR] package.json is missing.')
162
- lines.push(' To fix: restore it from backup or run create-maa-project --update template')
163
- return false
164
- }
165
-
166
- const packageJson = JSON.parse(await readText(packagePath)) as {
167
- name?: unknown
168
- version?: unknown
169
- license?: unknown
170
- packageManager?: unknown
171
- engines?: { node?: unknown }
172
- devDependencies?: Record<string, unknown>
173
- scripts?: Record<string, unknown>
174
- }
175
- const expectedLicense = config.license.spdx === 'None' ? 'UNLICENSED' : config.license.spdx
176
- let ok = true
177
- if (packageJson.name !== config.project.slug) {
178
- lines.push('[ERR] package.json name differs from maa-project.json project.slug.')
179
- lines.push(' To fix: create-maa-project --sync metadata')
180
- ok = false
181
- }
182
- if (packageJson.version !== config.project.version) {
183
- lines.push('[ERR] package.json version differs from maa-project.json project.version.')
184
- lines.push(' To fix: create-maa-project --sync metadata')
185
- ok = false
186
- }
187
- if (packageJson.license !== expectedLicense) {
188
- lines.push('[ERR] package.json license differs from maa-project.json license.spdx.')
189
- lines.push(' To fix: create-maa-project --sync metadata')
190
- ok = false
191
- }
192
- if (packageJson.packageManager !== 'pnpm@11.5.1') {
193
- lines.push('[ERR] package.json packageManager must be pnpm@11.5.1.')
194
- lines.push(' To fix: create-maa-project --update template')
195
- ok = false
196
- }
197
- if (packageJson.engines?.node !== '>=24') {
198
- lines.push('[ERR] package.json engines.node must be >=24.')
199
- lines.push(' To fix: create-maa-project --update template')
200
- ok = false
201
- }
202
- for (const [
203
- name,
204
- version,
205
- ] of Object.entries(expectedDevDependencies())) {
206
- if (packageJson.devDependencies?.[name] !== version) {
207
- const label = name === '@nekosu/maa-tools' ? '@nekosu/maa-tools' : `devDependencies.${name}`
208
- lines.push(`[ERR] package.json ${label} must be pinned to ${version}.`)
209
- lines.push(' To fix: create-maa-project --update template')
210
- ok = false
211
- }
212
- }
213
- for (const [
214
- name,
215
- command,
216
- ] of Object.entries(expectedPackageScripts(config))) {
217
- if (packageJson.scripts?.[name] !== command) {
218
- const message =
219
- name === 'check:maa'
220
- ? 'package.json scripts.check:maa must use local pnpm exec maa-tools check.'
221
- : `package.json scripts.${name} must be ${command}.`
222
- lines.push(`[ERR] ${message}`)
223
- lines.push(' To fix: create-maa-project --update template')
224
- ok = false
225
- }
226
- }
227
- if (ok) lines.push('[OK] Package metadata matches project config.')
228
- return ok
229
- }
230
-
231
84
  async function checkNodeLockfile(root: string, lock: MaaProjectLock, lines: string[]): Promise<boolean> {
232
85
  if (lock.pending.some((item) => item.kind === 'node-deps')) return true
233
- const packagePath = join(root, 'package.json')
234
- if (!(await exists(packagePath))) return true
235
- const packageJson = JSON.parse(await readText(packagePath)) as { packageManager?: unknown }
236
- if (typeof packageJson.packageManager !== 'string' || !packageJson.packageManager.startsWith('pnpm@')) {
237
- return true
238
- }
239
86
  if (await exists(join(root, 'pnpm-lock.yaml'))) {
240
87
  lines.push('[OK] pnpm lockfile is present.')
241
88
  return true
@@ -331,41 +178,7 @@ async function checkVscodeSettings(root: string, lines: string[]): Promise<boole
331
178
  return ok
332
179
  }
333
180
 
334
- async function checkPyprojectMetadata(root: string, config: MaaProjectConfig, lines: string[]): Promise<boolean> {
335
- if (!config.python) return true
336
-
337
- const pyprojectPath = join(root, 'pyproject.toml')
338
- if (!(await exists(pyprojectPath))) return true
339
-
340
- const content = await readText(pyprojectPath)
341
- const metadata = parseTomlProjectMetadata(content)
342
- let ok = true
343
- if (metadata.name !== config.project.slug) {
344
- lines.push('[ERR] pyproject.toml project.name differs from maa-project.json project.slug.')
345
- lines.push(' To fix: create-maa-project --sync metadata')
346
- ok = false
347
- }
348
- if (metadata.version !== config.project.version) {
349
- lines.push('[ERR] pyproject.toml project.version differs from maa-project.json project.version.')
350
- lines.push(' To fix: create-maa-project --sync metadata')
351
- ok = false
352
- }
353
- if (!tomlHasAgentWheelPackage(content)) {
354
- lines.push('[ERR] pyproject.toml hatch wheel packages must include agent.')
355
- lines.push(' To fix: create-maa-project --update template')
356
- ok = false
357
- }
358
- if (ok) lines.push('[OK] Python project metadata matches project config.')
359
- return ok
360
- }
361
-
362
- async function checkResourceOrder(root: string, config: MaaProjectConfig, lines: string[]): Promise<boolean> {
363
- const first = config.resources[0]
364
- if (!first || first.path !== 'resource/base') {
365
- lines.push('[ERR] resource/base must be the first resource pack.')
366
- lines.push(' To fix: edit maa-project.json resources order, then run create-maa-project --sync metadata')
367
- return false
368
- }
181
+ async function checkResourcePaths(root: string, config: MaaProjectConfig, lines: string[]): Promise<boolean> {
369
182
  for (const pack of config.resources) {
370
183
  if (pack.path.includes('\\')) {
371
184
  lines.push(`[ERR] Resource pack path uses backslashes: ${pack.path}`)
@@ -378,18 +191,7 @@ async function checkResourceOrder(root: string, config: MaaProjectConfig, lines:
378
191
  return false
379
192
  }
380
193
  }
381
- const interfacePath = join(root, 'interface.json')
382
- if (await exists(interfacePath)) {
383
- const interfaceJson = JSON.parse(await readText(interfacePath)) as { resource?: unknown }
384
- const actual = Array.isArray(interfaceJson.resource) ? interfaceJson.resource : []
385
- const expected = interfaceResourceItems(config.resources)
386
- if (JSON.stringify(actual) !== JSON.stringify(expected)) {
387
- lines.push('[ERR] interface.json resource order differs from maa-project.json resources.')
388
- lines.push(' To fix: create-maa-project --sync metadata')
389
- return false
390
- }
391
- }
392
- lines.push('[OK] Resource packs are ordered and present.')
194
+ lines.push('[OK] Resource pack paths are present.')
393
195
  return true
394
196
  }
395
197
 
@@ -413,6 +215,12 @@ async function checkReferencedPaths(root: string, lines: string[]): Promise<bool
413
215
  ok = false
414
216
  continue
415
217
  }
218
+ if (!isProjectRelativePath(reference.path)) {
219
+ lines.push(`[ERR] interface.json ${reference.kind} path must stay within project root: ${reference.path}`)
220
+ lines.push(' To fix: use a project-relative path without .. segments')
221
+ ok = false
222
+ continue
223
+ }
416
224
  if (!(await exists(join(root, stripDotSlash(reference.path))))) {
417
225
  lines.push(`[ERR] interface.json ${reference.kind} path is missing: ${reference.path}`)
418
226
  lines.push(' To fix: restore the path or run create-maa-project --sync metadata')
@@ -502,6 +310,17 @@ function stripDotSlash(path: string): string {
502
310
  return path.startsWith('./') ? path.slice(2) : path
503
311
  }
504
312
 
313
+ function isProjectRelativePath(path: string): boolean {
314
+ const stripped = stripDotSlash(path)
315
+ return (
316
+ stripped !== '' &&
317
+ stripped !== '.' &&
318
+ !stripped.startsWith('/') &&
319
+ !/^[A-Za-z]:/.test(stripped) &&
320
+ !stripped.split('/').includes('..')
321
+ )
322
+ }
323
+
505
324
  function workflowPinsNode24(content: string): boolean {
506
325
  return /node-version:\s*['"]?24['"]?/.test(content)
507
326
  }
@@ -528,97 +347,3 @@ function hasJsoncFileAssociations(value: unknown): boolean {
528
347
  function isRecord(value: unknown): value is Record<string, unknown> {
529
348
  return typeof value === 'object' && value !== null && !Array.isArray(value)
530
349
  }
531
-
532
- function expectedDevDependencies(): Record<string, string> {
533
- return {
534
- '@nekosu/maa-tools': '1.0.24',
535
- '@nekosu/prettier-plugin-maafw-sort': '1.0.5',
536
- ajv: '8.20.0',
537
- 'ajv-formats': '3.0.1',
538
- 'jsonc-parser': '3.3.1',
539
- prettier: '3.8.4',
540
- 'prettier-plugin-multiline-arrays': '4.1.9',
541
- }
542
- }
543
-
544
- function expectedPackageScripts(config: MaaProjectConfig): Record<string, string> {
545
- const scripts: Record<string, string> = {
546
- format: 'prettier --write .',
547
- 'format:check': 'prettier --check .',
548
- lint: 'node tools/check-project.mjs',
549
- 'check:schema': 'node tools/validate-schema.mjs',
550
- 'check:maa': 'pnpm exec maa-tools check',
551
- check: 'pnpm format:check && pnpm check:schema && pnpm check:maa && pnpm lint',
552
- }
553
- if (hasGithubAutomation(config)) {
554
- scripts['release:dry-run'] = 'node tools/build-release.mjs --dry-run'
555
- scripts['sync:runtime'] = 'node tools/sync-runtime.mjs'
556
- }
557
- if (config.addons.schemaSync) {
558
- scripts['sync:schema'] = 'node tools/sync-schema.mjs'
559
- }
560
- if (config.addons.optimizeImages) {
561
- scripts['optimize:images'] = 'node tools/optimize-images.mjs'
562
- }
563
- if (config.python) {
564
- scripts['format:py'] = 'uv run --frozen ruff format .'
565
- scripts['lint:py'] = 'uv run --frozen ruff check .'
566
- scripts['typecheck:py'] = 'uv run --frozen pyright'
567
- scripts['check:py'] = 'pnpm lint:py && pnpm typecheck:py'
568
- }
569
- return scripts
570
- }
571
-
572
- function parseTomlProjectMetadata(content: string): {
573
- name: string | undefined
574
- version: string | undefined
575
- } {
576
- const section = tomlProjectSection(content)
577
- return {
578
- name: parseTomlStringField(section, 'name'),
579
- version: parseTomlStringField(section, 'version'),
580
- }
581
- }
582
-
583
- function tomlProjectSection(content: string): string {
584
- const section: string[] = []
585
- let inside = false
586
- for (const line of content.split(/\r?\n/)) {
587
- if (/^\s*\[project\]\s*$/.test(line)) {
588
- inside = true
589
- continue
590
- }
591
- if (inside && /^\s*\[[^\]]+\]\s*$/.test(line)) break
592
- if (inside) section.push(line)
593
- }
594
- return section.join('\n')
595
- }
596
-
597
- function tomlHasAgentWheelPackage(content: string): boolean {
598
- const section = tomlSection(content, 'tool.hatch.build.targets.wheel')
599
- return /^\s*packages\s*=\s*\[\s*"agent"\s*\]\s*$/m.test(section)
600
- }
601
-
602
- function tomlSection(content: string, name: string): string {
603
- const section: string[] = []
604
- let inside = false
605
- const pattern = new RegExp(`^\\s*\\[${escapeRegExp(name)}\\]\\s*$`)
606
- for (const line of content.split(/\r?\n/)) {
607
- if (pattern.test(line)) {
608
- inside = true
609
- continue
610
- }
611
- if (inside && /^\s*\[[^\]]+\]\s*$/.test(line)) break
612
- if (inside) section.push(line)
613
- }
614
- return section.join('\n')
615
- }
616
-
617
- function escapeRegExp(value: string): string {
618
- return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
619
- }
620
-
621
- function parseTomlStringField(section: string, key: 'name' | 'version'): string | undefined {
622
- const match = section.match(new RegExp(`^\\s*${key}\\s*=\\s*"([^"]*)"\\s*$`, 'm'))
623
- return match?.[1]
624
- }