fcmd 0.3.7__tar.gz → 0.3.8__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 (256) hide show
  1. {fcmd-0.3.7 → fcmd-0.3.8}/.bumpversion.toml +1 -1
  2. {fcmd-0.3.7 → fcmd-0.3.8}/PKG-INFO +1 -1
  3. {fcmd-0.3.7 → fcmd-0.3.8}/pyproject.toml +1 -1
  4. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/__init__.py +1 -1
  5. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_discovery.py +61 -2
  6. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/dev/envdev.py +65 -20
  7. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/dev/envdev_go.py +5 -3
  8. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/dev/envdev_java.py +4 -3
  9. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/gittool.toml +3 -0
  10. fcmd-0.3.8/src/fcmd/commands/sshcopyid.toml +56 -0
  11. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/__init__.py +5 -3
  12. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/decl.py +51 -14
  13. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/synth.py +22 -2
  14. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/engine/task_runner.py +41 -31
  15. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/models/command.py +17 -6
  16. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli.py +109 -0
  17. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_envdev.py +129 -2
  18. fcmd-0.3.8/tests/test_cli_sshcopyid.py +299 -0
  19. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_dsl.py +1 -2
  20. {fcmd-0.3.7 → fcmd-0.3.8}/uv.lock +1 -1
  21. fcmd-0.3.7/src/fcmd/commands/sshcopyid.toml +0 -44
  22. fcmd-0.3.7/tests/test_cli_sshcopyid.py +0 -160
  23. {fcmd-0.3.7 → fcmd-0.3.8}/.claude/artifacts/fixes/dsl-entry-heavy-import-latency.md +0 -0
  24. {fcmd-0.3.7 → fcmd-0.3.8}/.claude/artifacts/plans/dsl-extension-cli-migration.md +0 -0
  25. {fcmd-0.3.7 → fcmd-0.3.8}/.copier-answers.yml +0 -0
  26. {fcmd-0.3.7 → fcmd-0.3.8}/.coveragerc +0 -0
  27. {fcmd-0.3.7 → fcmd-0.3.8}/.gitattributes +0 -0
  28. {fcmd-0.3.7 → fcmd-0.3.8}/.github/workflows/ci.yml +0 -0
  29. {fcmd-0.3.7 → fcmd-0.3.8}/.github/workflows/release.yml +0 -0
  30. {fcmd-0.3.7 → fcmd-0.3.8}/.gitignore +0 -0
  31. {fcmd-0.3.7 → fcmd-0.3.8}/.pre-commit-config.yaml +0 -0
  32. {fcmd-0.3.7 → fcmd-0.3.8}/.readthedocs.yaml +0 -0
  33. {fcmd-0.3.7 → fcmd-0.3.8}/.vscode/settings.json +0 -0
  34. {fcmd-0.3.7 → fcmd-0.3.8}/LICENSE +0 -0
  35. {fcmd-0.3.7 → fcmd-0.3.8}/Makefile +0 -0
  36. {fcmd-0.3.7 → fcmd-0.3.8}/README.md +0 -0
  37. {fcmd-0.3.7 → fcmd-0.3.8}/docs/_static/.gitkeep +0 -0
  38. {fcmd-0.3.7 → fcmd-0.3.8}/docs/api.rst +0 -0
  39. {fcmd-0.3.7 → fcmd-0.3.8}/docs/changelog.rst +0 -0
  40. {fcmd-0.3.7 → fcmd-0.3.8}/docs/conf.py +0 -0
  41. {fcmd-0.3.7 → fcmd-0.3.8}/docs/index.rst +0 -0
  42. {fcmd-0.3.7 → fcmd-0.3.8}/pyrefly.toml +0 -0
  43. {fcmd-0.3.7 → fcmd-0.3.8}/pytest.ini +0 -0
  44. {fcmd-0.3.7 → fcmd-0.3.8}/ruff.toml +0 -0
  45. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/__main__.py +0 -0
  46. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/_lazylog.py +0 -0
  47. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/apis/__init__.py +0 -0
  48. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/apis/_tool_args.py +0 -0
  49. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/apis/_tool_exec.py +0 -0
  50. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/apis/context.py +0 -0
  51. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/apis/dag.py +0 -0
  52. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/apis/errors.py +0 -0
  53. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/apis/profiling.py +0 -0
  54. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/apis/report.py +0 -0
  55. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/apis/task.py +0 -0
  56. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/apis/toolkit.py +0 -0
  57. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/__init__.py +0 -0
  58. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_builtins/__init__.py +0 -0
  59. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_builtins/completion_cmd.py +0 -0
  60. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_builtins/doctor_cmd.py +0 -0
  61. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_builtins/env_cmd.py +0 -0
  62. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_builtins/graph_cmd.py +0 -0
  63. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_builtins/info_cmd.py +0 -0
  64. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_builtins/profiler_cmd.py +0 -0
  65. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_builtins/yaml_cmd.py +0 -0
  66. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_common.py +0 -0
  67. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_completion_scripts.py +0 -0
  68. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_doctor_helpers.py +0 -0
  69. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_env_helpers.py +0 -0
  70. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_env_persist.py +0 -0
  71. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/_profiler_helpers.py +0 -0
  72. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/archive/__init__.py +0 -0
  73. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/archive/archivex.py +0 -0
  74. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/archive/zipencrypt.py +0 -0
  75. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/calc/__init__.py +0 -0
  76. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/calc/lscalc.py +0 -0
  77. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/dev/__init__.py +0 -0
  78. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/dev/bumpversion.py +0 -0
  79. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/dev/envdev_core.py +0 -0
  80. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/dev/envdev_node.py +0 -0
  81. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/dev/gittool.py +0 -0
  82. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/dev/packtool.py +0 -0
  83. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/dev/pymake.py +0 -0
  84. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/main.py +0 -0
  85. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/media/__init__.py +0 -0
  86. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/media/screenshot.py +0 -0
  87. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/net/__init__.py +0 -0
  88. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/cli/net/portcheck.py +0 -0
  89. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/asciitool.toml +0 -0
  90. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/autofmt.toml +0 -0
  91. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/calcdate.toml +0 -0
  92. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/casetool.toml +0 -0
  93. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/clr.toml +0 -0
  94. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/codetool.toml +0 -0
  95. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/colortool.toml +0 -0
  96. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/convtool.toml +0 -0
  97. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/cryptool.toml +0 -0
  98. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/csvtool.toml +0 -0
  99. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/dockercmd.toml +0 -0
  100. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/filedate.toml +0 -0
  101. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/filelevel.toml +0 -0
  102. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/filerename.toml +0 -0
  103. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/filesearch.toml +0 -0
  104. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/folderback.toml +0 -0
  105. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/folderzip.toml +0 -0
  106. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/hashfile.toml +0 -0
  107. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/hashtool.toml +0 -0
  108. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/idtool.toml +0 -0
  109. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/imagetool.toml +0 -0
  110. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/img2ico.toml +0 -0
  111. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/inifile.toml +0 -0
  112. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/iptool.toml +0 -0
  113. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/jsontool.toml +0 -0
  114. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/mathtool.toml +0 -0
  115. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/nettool.toml +0 -0
  116. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/packtool.toml +0 -0
  117. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/padtool.toml +0 -0
  118. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/pathtool.toml +0 -0
  119. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/pdftool.toml +0 -0
  120. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/piptool.toml +0 -0
  121. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/pymake.toml +0 -0
  122. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/randtool.toml +0 -0
  123. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/regextool.toml +0 -0
  124. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/reseticoncache.toml +0 -0
  125. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/setenv.toml +0 -0
  126. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/stattool.toml +0 -0
  127. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/sysinfo.toml +0 -0
  128. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/taskkill.toml +0 -0
  129. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/textdiff.toml +0 -0
  130. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/timetool.toml +0 -0
  131. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/tomltool.toml +0 -0
  132. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/txttool.toml +0 -0
  133. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/urlcheck.toml +0 -0
  134. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/urltool.toml +0 -0
  135. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/websave.toml +0 -0
  136. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/which.toml +0 -0
  137. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/writefile.toml +0 -0
  138. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/xmltool.toml +0 -0
  139. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/commands/yamtool.toml +0 -0
  140. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/console.py +0 -0
  141. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/__init__.py +0 -0
  142. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/archive.py +0 -0
  143. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/basic.py +0 -0
  144. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/calc.py +0 -0
  145. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/calcdate.py +0 -0
  146. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/compute.py +0 -0
  147. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/conv.py +0 -0
  148. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/conv2.py +0 -0
  149. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/crypto.py +0 -0
  150. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/data.py +0 -0
  151. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/filenames.py +0 -0
  152. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/fileops.py +0 -0
  153. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/genid.py +0 -0
  154. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/hashing.py +0 -0
  155. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/media.py +0 -0
  156. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/net.py +0 -0
  157. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/system.py +0 -0
  158. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/actions/text.py +0 -0
  159. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/entry.py +0 -0
  160. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/dsl/loader.py +0 -0
  161. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/engine/__init__.py +0 -0
  162. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/engine/dependency_runner.py +0 -0
  163. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/engine/executors.py +0 -0
  164. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/engine/layer_runner.py +0 -0
  165. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/engine/task_command.py +0 -0
  166. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/models/__init__.py +0 -0
  167. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/models/filefilter.py +0 -0
  168. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/models/pdf.py +0 -0
  169. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/models/version.py +0 -0
  170. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/orchestration/__init__.py +0 -0
  171. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/orchestration/conditions.py +0 -0
  172. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/orchestration/yaml_loader.py +0 -0
  173. {fcmd-0.3.7 → fcmd-0.3.8}/src/fcmd/py.typed +0 -0
  174. {fcmd-0.3.7 → fcmd-0.3.8}/tests/__init__.py +0 -0
  175. {fcmd-0.3.7 → fcmd-0.3.8}/tests/conftest.py +0 -0
  176. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_archivex.py +0 -0
  177. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_asciitool.py +0 -0
  178. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_autofmt.py +0 -0
  179. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_bumpversion.py +0 -0
  180. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_calcdate.py +0 -0
  181. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_casetool.py +0 -0
  182. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_codetool.py +0 -0
  183. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_colortool.py +0 -0
  184. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_convtool.py +0 -0
  185. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_cryptool.py +0 -0
  186. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_csvtool.py +0 -0
  187. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_dockercmd.py +0 -0
  188. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_filedate.py +0 -0
  189. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_filelevel.py +0 -0
  190. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_filerename.py +0 -0
  191. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_filesearch.py +0 -0
  192. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_folderback.py +0 -0
  193. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_folderzip.py +0 -0
  194. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_gittool.py +0 -0
  195. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_hashfile.py +0 -0
  196. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_hashtool.py +0 -0
  197. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_idtool.py +0 -0
  198. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_imagetool.py +0 -0
  199. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_img2ico.py +0 -0
  200. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_inifile.py +0 -0
  201. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_iptool.py +0 -0
  202. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_jsontool.py +0 -0
  203. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_lscalc.py +0 -0
  204. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_mathtool.py +0 -0
  205. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_nettool.py +0 -0
  206. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_packtool.py +0 -0
  207. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_padtool.py +0 -0
  208. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_pathtool.py +0 -0
  209. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_pdftool.py +0 -0
  210. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_piptool.py +0 -0
  211. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_portcheck.py +0 -0
  212. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_profiler.py +0 -0
  213. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_pymake.py +0 -0
  214. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_randtool.py +0 -0
  215. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_regextool.py +0 -0
  216. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_reseticoncache.py +0 -0
  217. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_screenshot.py +0 -0
  218. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_setenv.py +0 -0
  219. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_stattool.py +0 -0
  220. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_sysinfo.py +0 -0
  221. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_taskkill.py +0 -0
  222. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_textdiff.py +0 -0
  223. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_timetool.py +0 -0
  224. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_tomltool.py +0 -0
  225. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_txttool.py +0 -0
  226. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_urlcheck.py +0 -0
  227. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_urltool.py +0 -0
  228. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_websave.py +0 -0
  229. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_which.py +0 -0
  230. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_writefile.py +0 -0
  231. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_xmltool.py +0 -0
  232. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_yamtool.py +0 -0
  233. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_cli_zipencrypt.py +0 -0
  234. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_console.py +0 -0
  235. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_context.py +0 -0
  236. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_dsl_actions.py +0 -0
  237. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_e2e_cli.py +0 -0
  238. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_e2e_tools.py +0 -0
  239. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_e2e_workflow.py +0 -0
  240. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_engine_executors.py +0 -0
  241. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_engine_task_command.py +0 -0
  242. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_env_persist.py +0 -0
  243. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_fcmd.py +0 -0
  244. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_graph.py +0 -0
  245. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_init.py +0 -0
  246. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_lazylog.py +0 -0
  247. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_models.py +0 -0
  248. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_models_pdf.py +0 -0
  249. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_orchestration_conditions.py +0 -0
  250. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_orchestration_yaml_loader.py +0 -0
  251. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_perf_baseline.py +0 -0
  252. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_profiling.py +0 -0
  253. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_report.py +0 -0
  254. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_task.py +0 -0
  255. {fcmd-0.3.7 → fcmd-0.3.8}/tests/test_toolkit.py +0 -0
  256. {fcmd-0.3.7 → fcmd-0.3.8}/tox.ini +0 -0
@@ -1,5 +1,5 @@
1
1
  [tool.bumpversion]
2
- current_version = "0.3.7"
2
+ current_version = "0.3.8"
3
3
  commit = true
4
4
  exclude = ["template/*"]
5
5
  message = "chore: 更新版本 {current_version} → {new_version}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: fcmd
3
- Version: 0.3.7
3
+ Version: 0.3.8
4
4
  Summary: 极速 Python 工具集应用:DAG 任务调度 + 组合 CLI
5
5
  Author: fcmd
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fcmd"
3
- version = "0.3.7"
3
+ version = "0.3.8"
4
4
  description = "极速 Python 工具集应用:DAG 任务调度 + 组合 CLI"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -20,7 +20,7 @@
20
20
 
21
21
  from typing import Any
22
22
 
23
- __version__ = "0.3.7"
23
+ __version__ = "0.3.8"
24
24
 
25
25
  __all__ = [
26
26
  "Context",
@@ -20,8 +20,12 @@ from __future__ import annotations
20
20
 
21
21
  import contextlib
22
22
  import importlib
23
+ import importlib.util
23
24
  import logging
25
+ import os
24
26
  import pkgutil
27
+ import sys
28
+ from pathlib import Path
25
29
  from typing import TYPE_CHECKING
26
30
 
27
31
  from fcmd.console import get_console
@@ -194,6 +198,7 @@ def _register_tool(module_path: str, tool_name: str) -> None:
194
198
  """
195
199
  _TOOL_MODULES.setdefault(tool_name, module_path)
196
200
  _TOOL_ALIASES.setdefault(tool_name, tool_name)
201
+ _seed_main_module_alias(module_path)
197
202
  try:
198
203
  mod = importlib.import_module(module_path)
199
204
  except (ImportError, OSError) as exc:
@@ -205,9 +210,63 @@ def _register_tool(module_path: str, tool_name: str) -> None:
205
210
  _TOOL_ALIASES.setdefault(alias, tool_name)
206
211
 
207
212
 
213
+ def _seed_main_module_alias(module_path: str) -> None:
214
+ """独立入口场景下把 ``__main__`` 别名到真实模块名,防止二次导入。
215
+
216
+ 独立入口(fspack 包装器 ``runpy.run_module`` / ``python -m`` / 直接执行
217
+ 模块文件)以 ``__main__`` 身份执行工具模块:``@fx.tool`` 装饰器已在模块
218
+ 顶层执行并注册过子命令,但真实模块名不在 ``sys.modules`` 中。若发现阶段
219
+ 直接 ``import_module``,模块会被重新执行,装饰器再次注册同一子命令并抛出
220
+ ``ValueError``。此处按 ``__file__`` 匹配后预置 ``sys.modules``,使后续
221
+ 导入命中缓存,注册表保持单一实例。
222
+ """
223
+ if module_path in sys.modules:
224
+ return
225
+ main_mod = sys.modules.get("__main__")
226
+ if main_mod is None:
227
+ return
228
+ main_file = getattr(main_mod, "__file__", None)
229
+ if not main_file:
230
+ return
231
+ try:
232
+ spec = importlib.util.find_spec(module_path)
233
+ except (ImportError, AttributeError, ValueError):
234
+ return
235
+ if spec is None or not spec.origin:
236
+ return
237
+ try:
238
+ same = Path(main_file).samefile(spec.origin)
239
+ except OSError:
240
+ same = os.path.normcase(str(Path(main_file).resolve())) == os.path.normcase(str(Path(spec.origin).resolve()))
241
+ if same:
242
+ sys.modules[module_path] = main_mod
243
+
244
+
208
245
  def resolve_tool(name: str) -> str | None:
209
- """解析工具名,返回规范名或 None。"""
210
- return _TOOL_ALIASES.get(name)
246
+ """解析工具名,返回规范名或 None。
247
+
248
+ 解析顺序:
249
+ 1. 精确匹配别名表(``_TOOL_ALIASES`` 直接 lookup)
250
+ 2. 自动简化匹配:输入补 ``tool`` / ``cmd`` 后缀后作为规范名在
251
+ ``_TOOL_ALIASES.values()``(全部已注册工具的规范名集合)中
252
+ 存在时,视为用户写了简写自动补全
253
+ (如 ``git`` → ``gittool``、``path`` → ``pathtool``)。
254
+ 规范名集合唯一(``{values}`` 去重后),不会出现多候选歧义。
255
+ """
256
+ # 1. 精确匹配
257
+ direct = _TOOL_ALIASES.get(name)
258
+ if direct is not None:
259
+ return direct
260
+
261
+ # 2. 自动简化:尝试补常见后缀
262
+ # 在全部规范工具名集合中查找,覆盖 Python 模块工具与 DSL 声明式工具
263
+ canonical_names = set(_TOOL_ALIASES.values())
264
+ for suffix in ("tool", "cmd"):
265
+ candidate = name + suffix
266
+ if candidate in canonical_names:
267
+ return candidate
268
+
269
+ return None
211
270
 
212
271
 
213
272
  def tool_names() -> list[str]:
@@ -84,7 +84,9 @@ _PIP_INDEX_URLS: dict[str, str] = {
84
84
  "tsinghua": "https://pypi.tuna.tsinghua.edu.cn/simple",
85
85
  "aliyun": "https://mirrors.aliyun.com/pypi/simple/",
86
86
  "huaweicloud": "https://mirrors.huaweicloud.com/repository/pypi/simple/",
87
+ "tencent": "https://mirrors.cloud.tencent.com/pypi/simple",
87
88
  "ustc": "https://pypi.mirrors.ustc.edu.cn/simple/",
89
+ "bfsu": "https://mirrors.bfsu.edu.cn/pypi/web/simple",
88
90
  "zju": "https://mirrors.zju.edu.cn/pypi/simple/",
89
91
  }
90
92
 
@@ -92,7 +94,9 @@ _PIP_TRUSTED_HOSTS: dict[str, str] = {
92
94
  "tsinghua": "pypi.tuna.tsinghua.edu.cn",
93
95
  "aliyun": "mirrors.aliyun.com",
94
96
  "huaweicloud": "mirrors.huaweicloud.com",
97
+ "tencent": "mirrors.cloud.tencent.com",
95
98
  "ustc": "pypi.mirrors.ustc.edu.cn",
99
+ "bfsu": "mirrors.bfsu.edu.cn",
96
100
  "zju": "mirrors.zju.edu.cn",
97
101
  }
98
102
 
@@ -146,6 +150,16 @@ _CONDA_MIRROR_URLS: dict[str, list[str]] = {
146
150
  "https://mirrors.aliyun.com/anaconda/cloud/menpo/",
147
151
  "https://mirrors.aliyun.com/anaconda/cloud/pytorch/",
148
152
  ],
153
+ "huaweicloud": [
154
+ "https://mirrors.huaweicloud.com/anaconda/pkgs/main/",
155
+ "https://mirrors.huaweicloud.com/anaconda/pkgs/free/",
156
+ "https://mirrors.huaweicloud.com/anaconda/pkgs/r/",
157
+ "https://mirrors.huaweicloud.com/anaconda/pkgs/msys2/",
158
+ "https://mirrors.huaweicloud.com/anaconda/pkgs/pro/",
159
+ "https://mirrors.huaweicloud.com/anaconda/cloud/conda-forge/",
160
+ "https://mirrors.huaweicloud.com/anaconda/cloud/bioconda/",
161
+ "https://mirrors.huaweicloud.com/anaconda/cloud/pytorch/",
162
+ ],
149
163
  }
150
164
 
151
165
  _RUSTUP_MIRRORS: dict[str, dict[str, str]] = {
@@ -164,6 +178,16 @@ _RUSTUP_MIRRORS: dict[str, dict[str, str]] = {
164
178
  "RUSTUP_UPDATE_ROOT": "https://mirrors.ustc.edu.cn/rust-static/rustup",
165
179
  "TOML_REGISTRY": "https://mirrors.ustc.edu.cn/crates.io-index/",
166
180
  },
181
+ "huaweicloud": {
182
+ "RUSTUP_DIST_SERVER": "https://mirrors.huaweicloud.com/rustup",
183
+ "RUSTUP_UPDATE_ROOT": "https://mirrors.huaweicloud.com/rustup/rustup",
184
+ "TOML_REGISTRY": "https://mirrors.huaweicloud.com/crates.io-index/",
185
+ },
186
+ "bfsu": {
187
+ "RUSTUP_DIST_SERVER": "https://mirrors.bfsu.edu.cn/rust-static",
188
+ "RUSTUP_UPDATE_ROOT": "https://mirrors.bfsu.edu.cn/rust-static/rustup",
189
+ "TOML_REGISTRY": "https://mirrors.bfsu.edu.cn/crates.io-index/",
190
+ },
167
191
  }
168
192
 
169
193
  _RUST_SCCACHE_DIR: Path = Path.home() / ".cargo" / "sccache"
@@ -227,6 +251,9 @@ _DOCKER_REGISTRY_MIRRORS: list[str] = [
227
251
  "https://registry.cn-hangzhou.aliyuncs.com",
228
252
  "https://docker.m.daocloud.io",
229
253
  "https://hub-mirror.c.163.com",
254
+ "https://docker.1ms.run",
255
+ "https://docker.xuanyuan.me",
256
+ "https://mirror.ccs.tencentyun.com",
230
257
  ]
231
258
  _DOCKER_DAEMON_PATH: Path = Path("/etc/docker/daemon.json")
232
259
 
@@ -264,7 +291,7 @@ def setup_python_mirror(mirror: str = "auto") -> None:
264
291
  Parameters
265
292
  ----------
266
293
  mirror:
267
- 镜像源名称:tsinghua/aliyun/huaweicloud/ustc/zju;``auto`` 时探测
294
+ 镜像源名称:tsinghua/aliyun/huaweicloud/tencent/ustc/bfsu/zju;``auto`` 时探测
268
295
  pip 服务各候选镜像(pypi 地址)并选用最快的可达镜像,全部不可达
269
296
  回退 aliyun(默认 ``auto``)
270
297
  """
@@ -300,7 +327,7 @@ def setup_conda_mirror(mirror: str = "auto") -> None:
300
327
  Parameters
301
328
  ----------
302
329
  mirror:
303
- 镜像源名称:tsinghua/ustc/bfsu/aliyun;``auto`` 时探测 Conda 服务
330
+ 镜像源名称:tsinghua/ustc/bfsu/aliyun/huaweicloud;``auto`` 时探测 Conda 服务
304
331
  各候选镜像(anaconda 频道地址,与 pypi 地址不同)并选用最快的可达
305
332
  镜像,全部不可达回退 aliyun(默认 ``auto``)
306
333
  """
@@ -334,8 +361,8 @@ def setup_python_env(mirror: str = "auto") -> None:
334
361
  Parameters
335
362
  ----------
336
363
  mirror:
337
- 镜像源名称:pip 支持 tsinghua/aliyun/huaweicloud/ustc/zju,
338
- Conda 支持 tsinghua/ustc/bfsu/aliyun;``auto`` 按服务独立自动选优
364
+ 镜像源名称:pip 支持 tsinghua/aliyun/huaweicloud/tencent/ustc/bfsu/zju,
365
+ Conda 支持 tsinghua/ustc/bfsu/aliyun/huaweicloud;``auto`` 按服务独立自动选优
339
366
  (默认 ``auto``)
340
367
  """
341
368
  setup_python_mirror(mirror)
@@ -353,7 +380,7 @@ def _setup_rustup_mirror(mirror: str) -> None:
353
380
  Parameters
354
381
  ----------
355
382
  mirror:
356
- 镜像源名称:tsinghua/ustc/aliyun(已由调用方解析,不含 ``auto``)
383
+ 镜像源名称:tsinghua/ustc/aliyun/huaweicloud/bfsu(已由调用方解析,不含 ``auto``)
357
384
  """
358
385
  if not mirror_supported(mirror, _RUSTUP_MIRRORS):
359
386
  print(f"未知 Rust 镜像源: {mirror}")
@@ -382,7 +409,7 @@ def _setup_cargo_mirror(mirror: str) -> None:
382
409
  Parameters
383
410
  ----------
384
411
  mirror:
385
- 镜像源名称:tsinghua/ustc/aliyun(已由调用方解析,不含 ``auto``)
412
+ 镜像源名称:tsinghua/ustc/aliyun/huaweicloud/bfsu(已由调用方解析,不含 ``auto``)
386
413
  """
387
414
  if not mirror_supported(mirror, _RUSTUP_MIRRORS):
388
415
  print(f"未知 Rust 镜像源: {mirror}")
@@ -413,7 +440,7 @@ def _setup_rust_mirror(mirror: str = "auto") -> None:
413
440
  Parameters
414
441
  ----------
415
442
  mirror:
416
- 镜像源名称:tsinghua/ustc/aliyun;``auto`` 时 rustup 与 cargo 分别
443
+ 镜像源名称:tsinghua/ustc/aliyun/huaweicloud/bfsu;``auto`` 时 rustup 与 cargo 分别
417
444
  独立探测选优(rustup 分发地址与 crates.io 索引地址不同,各站可达性
418
445
  可能不一致,选优结果可能不同),全部不可达各自回退 aliyun
419
446
  (默认 ``auto``)
@@ -427,27 +454,45 @@ def _download_rustup() -> None:
427
454
  """下载 Rustup 安装脚本(跨平台,已安装 rustup 时跳过)。
428
455
 
429
456
  Linux 下载 ``rustup-init.sh``,Windows 下载 ``rustup-init.exe``。
457
+ 平台下载命令缺失时(Windows 无 powershell、Linux 无 curl)提示
458
+ 手动下载并跳过。
430
459
  """
431
460
  if shutil.which("rustup") is not None:
432
461
  print("rustup 已安装,跳过下载")
433
462
  return
434
463
 
435
464
  if sys.platform == "win32":
465
+ if shutil.which("powershell") is None:
466
+ print("未找到 powershell,请手动下载 rustup-init.exe:")
467
+ print(f" {_RUSTUP_DOWNLOAD_URL_WINDOWS}")
468
+ return
436
469
  print("下载 rustup-init.exe...")
437
- run_command(
438
- [
439
- "powershell",
440
- "-Command",
441
- "Invoke-WebRequest",
442
- "-Uri",
443
- _RUSTUP_DOWNLOAD_URL_WINDOWS,
444
- "-OutFile",
445
- "rustup-init.exe",
446
- ],
447
- )
470
+ try:
471
+ run_command(
472
+ [
473
+ "powershell",
474
+ "-Command",
475
+ "Invoke-WebRequest",
476
+ "-Uri",
477
+ _RUSTUP_DOWNLOAD_URL_WINDOWS,
478
+ "-OutFile",
479
+ "rustup-init.exe",
480
+ ],
481
+ )
482
+ except RuntimeError as e:
483
+ print(f"下载失败: {e},请手动下载 rustup-init.exe:")
484
+ print(f" {_RUSTUP_DOWNLOAD_URL_WINDOWS}")
448
485
  else:
486
+ if shutil.which("curl") is None:
487
+ print("未找到 curl,请手动下载 rustup-init.sh:")
488
+ print(f" {_RUSTUP_DOWNLOAD_URL_LINUX}")
489
+ return
449
490
  print("下载 rustup-init.sh...")
450
- run_command(["curl", "-fsSL", _RUSTUP_DOWNLOAD_URL_LINUX, "-o", "rustup-init.sh"])
491
+ try:
492
+ run_command(["curl", "-fsSL", _RUSTUP_DOWNLOAD_URL_LINUX, "-o", "rustup-init.sh"])
493
+ except RuntimeError as e:
494
+ print(f"下载失败: {e},请手动下载 rustup-init.sh:")
495
+ print(f" {_RUSTUP_DOWNLOAD_URL_LINUX}")
451
496
 
452
497
 
453
498
  @fcmd.tool("envdev", subcommand="install-rust", help="安装 Rust 工具链", hidden=True)
@@ -478,7 +523,7 @@ def setup_rust_env(mirror: str = "auto", rust_version: str = "stable") -> None:
478
523
  Parameters
479
524
  ----------
480
525
  mirror:
481
- 镜像源名称:tsinghua/ustc/aliyun;``auto`` 按服务独立自动选优
526
+ 镜像源名称:tsinghua/ustc/aliyun/huaweicloud/bfsu;``auto`` 按服务独立自动选优
482
527
  (默认 ``auto``)
483
528
  rust_version:
484
529
  Rust 版本:``stable`` / ``nightly`` / ``beta``(默认 ``stable``)
@@ -1,7 +1,7 @@
1
1
  """envdev_go - Go 开发环境配置(镜像源 + 工具链)。
2
2
 
3
3
  配置 GOPROXY 镜像并可选安装 gvm(Go Version Manager)。
4
- 国内主流镜像:goproxy.cn、aliyun、ustc、goproxy.io。
4
+ 国内主流镜像:goproxy.cn、aliyun、ustc、huaweicloud、tencent、goproxy.io。
5
5
  """
6
6
 
7
7
  from __future__ import annotations
@@ -21,6 +21,8 @@ _GO_PROXY_MIRRORS: dict[str, str] = {
21
21
  "goproxy": "https://goproxy.cn,direct",
22
22
  "aliyun": "https://mirrors.aliyun.com/goproxy/,direct",
23
23
  "ustc": "https://mirrors.ustc.edu.cn/goproxy/,direct",
24
+ "huaweicloud": "https://mirrors.huaweicloud.com/goproxy/,direct",
25
+ "tencent": "https://mirrors.cloud.tencent.com/goproxy/,direct",
24
26
  "goproxy_io": "https://goproxy.io,direct",
25
27
  }
26
28
 
@@ -52,7 +54,7 @@ def _setup_go_mirror(mirror: str = "auto") -> None:
52
54
  Parameters
53
55
  ----------
54
56
  mirror:
55
- 镜像源名称:goproxy / aliyun / ustc / goproxy_io;``auto`` 时探测
57
+ 镜像源名称:goproxy / aliyun / ustc / huaweicloud / tencent / goproxy_io;``auto`` 时探测
56
58
  GOPROXY 服务各候选镜像并选用最快的可达镜像,全部不可达回退 goproxy
57
59
  (默认 ``auto``)
58
60
  """
@@ -121,7 +123,7 @@ def setup_go_env(mirror: str = "auto", install_gvm: bool = False) -> None:
121
123
  Parameters
122
124
  ----------
123
125
  mirror:
124
- 镜像源名称:goproxy / aliyun / ustc / goproxy_io;``auto`` 按服务
126
+ 镜像源名称:goproxy / aliyun / ustc / huaweicloud / tencent / goproxy_io;``auto`` 按服务
125
127
  自动选优(默认 ``auto``)
126
128
  install_gvm:
127
129
  是否同时安装 gvm(默认 False)
@@ -1,7 +1,7 @@
1
1
  """envdev_java - Java 开发环境配置(Maven 镜像 + JDK)。
2
2
 
3
3
  配置 Maven settings.xml 镜像仓库,并可选安装 SDKMAN(用于管理 JDK 版本)。
4
- 国内主流 Maven 镜像:阿里云、华为云。
4
+ 国内主流 Maven 镜像:阿里云、华为云、腾讯云、中科大。
5
5
  """
6
6
 
7
7
  from __future__ import annotations
@@ -18,6 +18,7 @@ __all__ = ["setup_java_env"]
18
18
  _MAVEN_MIRRORS: dict[str, str] = {
19
19
  "aliyun": "https://maven.aliyun.com/repository/public",
20
20
  "huaweicloud": "https://repo.huaweicloud.com/repository/maven",
21
+ "tencent": "https://mirrors.cloud.tencent.com/nexus/repository/maven-public/",
21
22
  "ustc": "https://mirrors.ustc.edu.cn/apache/maven/repository/public",
22
23
  }
23
24
 
@@ -54,7 +55,7 @@ def _setup_maven_mirror(mirror: str = "auto") -> None:
54
55
  Parameters
55
56
  ----------
56
57
  mirror:
57
- 镜像源名称:aliyun / huaweicloud / ustc;``auto`` 时探测 Maven
58
+ 镜像源名称:aliyun / huaweicloud / tencent / ustc;``auto`` 时探测 Maven
58
59
  服务各候选镜像并选用最快的可达镜像,全部不可达回退 aliyun
59
60
  (默认 ``auto``)
60
61
  """
@@ -110,7 +111,7 @@ def setup_java_env(mirror: str = "auto", install_sdkman: bool = False) -> None:
110
111
  Parameters
111
112
  ----------
112
113
  mirror:
113
- 镜像源名称:aliyun / huaweicloud / ustc;``auto`` 按服务自动选优
114
+ 镜像源名称:aliyun / huaweicloud / tencent / ustc;``auto`` 按服务自动选优
114
115
  (默认 ``auto``)
115
116
  install_sdkman:
116
117
  是否同时安装 SDKMAN(默认 False)
@@ -4,6 +4,9 @@
4
4
  # isub(fn 子命令)与 main 入口。DSL 字段速查见 README
5
5
  # 「命令定义 DSL」。
6
6
 
7
+ [commands.gittool]
8
+ aliases = ["git"]
9
+
7
10
  # 链式内部子命令:_init → _add → _commit(needs 为 DAG 依赖边,链式保证
8
11
  # 执行顺序);when 探针守卫复刻 Python 版「已有仓库不重复 init / 无更改
9
12
  # 不提交」语义,探针不满足 → SKIPPED(命令退出码 0)。a/i 聚合经
@@ -0,0 +1,56 @@
1
+ # sshcopyid - SSH 公钥部署工具(DSL 声明)
2
+ #
3
+ # 设计要点:
4
+ # 1) 远端脚本统一走 stdin 流(cat >> authorized_keys),公钥文件重定向到
5
+ # ssh stdin,**不把公钥内容插值进远端 bash 命令字符串**——避免
6
+ # echo '{key}' 的引号断裂、awk 判重复杂度等问题,一次一条、幂等追加。
7
+ # 2) 平台分支:
8
+ # - Linux:sshpass -e 从 SSHPASS 环境变量读密码,**密码不进命令行 argv**
9
+ # (安全);shell 重定向把公钥文件送入 ssh stdin。
10
+ # - Windows:OpenSSH 不带 sshpass,也无等价替代;用 ssh 交互式
11
+ # 手动输一次密码,tty=true 让 SSH 的密码提示透传到终端;公钥文件
12
+ # 走 cmd.exe stdin 重定向(Windows subprocess shell=True 默认
13
+ # 用 cmd.exe,type / < file 语法均可用)。
14
+ # 3) password 参数 Linux 分支消费(SSHPASS env),Win11 分支忽略。
15
+
16
+ [commands.sshcopyid]
17
+ help = "部署 SSH 公钥到远程服务器"
18
+ description = "SSH 公钥部署工具(Linux: sshpass 自动密码,Windows: SSH 交互式手动输一次)"
19
+ when = { path = "{keypath}", expect = "exists" }
20
+
21
+ # ---- Linux / macOS 分支 ----
22
+ # shell=True 走 bash/sh,SSHPASS 由 env 注入 subprocess 环境变量
23
+ unix.cmd = "sshpass -e ssh -p {port} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout={timeout} {username}@{hostname} \"mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys\" < \"{keypath}\""
24
+ unix.env = { SSHPASS = "{password}" }
25
+
26
+ # ---- Windows 分支 ----
27
+ # shell=True 走 cmd.exe(Windows subprocess 默认),stdin 重定向 < 文件可用
28
+ # 无 sshpass,SSH 需要交互式密码输入 → tty=true 透传终端
29
+ win.cmd = "ssh -p {port} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout={timeout} {username}@{hostname} \"mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys\" < \"{keypath}\""
30
+ win.tty = true
31
+
32
+ message = "SSH 密钥已部署到 {username}@{hostname}:{port}"
33
+ fail_message = "部署失败,可手动执行: ssh-copy-id -p {port} {username}@{hostname}"
34
+
35
+ [commands.sshcopyid.args.hostname]
36
+ help = "远程服务器主机名或 IP 地址"
37
+
38
+ [commands.sshcopyid.args.username]
39
+ help = "远程服务器用户名"
40
+
41
+ [commands.sshcopyid.args.password]
42
+ help = "远程服务器密码(Linux 经 SSHPASS 环境变量传递,不进命令行;Windows 分支忽略此参数)"
43
+
44
+ [commands.sshcopyid.args.port]
45
+ type = "int"
46
+ help = "SSH 端口(默认 22)"
47
+ default = 22
48
+
49
+ [commands.sshcopyid.args.keypath]
50
+ help = "公钥文件路径(默认 ~/.ssh/id_rsa.pub)"
51
+ default = "~/.ssh/id_rsa.pub"
52
+
53
+ [commands.sshcopyid.args.timeout]
54
+ type = "int"
55
+ help = "SSH 连接超时秒数(默认 30)"
56
+ default = 30
@@ -27,10 +27,14 @@ from __future__ import annotations
27
27
 
28
28
  from .actions import Action, action, action_names, get_action, has_action
29
29
  from .decl import CommandDecl, CommandDeclError, ParamDecl, ToolDecl, parse_command_table, parse_tool_table
30
- from .entry import infer_tool_name, run_named
31
30
  from .loader import builtin_tool_decls, user_tool_decls
32
31
  from .synth import build_tool_spec, select_platform_cmd
33
32
 
33
+ # entry 子模块不在包级 re-export:runpy.run_module("fcmd.dsl.entry") 等路径
34
+ # 会先把目标模块占位进 sys.modules 再导入父包,父包 __init__ 里的
35
+ # ``from .entry import ...`` 会触发 Python RuntimeWarning。
36
+ # 需直接引用请从 ``fcmd.dsl.entry`` 导入。
37
+
34
38
  __all__ = [
35
39
  "Action",
36
40
  "CommandDecl",
@@ -43,10 +47,8 @@ __all__ = [
43
47
  "builtin_tool_decls",
44
48
  "get_action",
45
49
  "has_action",
46
- "infer_tool_name",
47
50
  "parse_command_table",
48
51
  "parse_tool_table",
49
- "run_named",
50
52
  "select_platform_cmd",
51
53
  "user_tool_decls",
52
54
  ]
@@ -89,8 +89,11 @@ _TOP_KEYS = frozenset(
89
89
  # 执行策略(与 ToolSpec.strategy 的 Literal 取值一致)
90
90
  _STRATEGIES: frozenset[str] = frozenset({"sequential", "thread", "async", "dependency"})
91
91
 
92
- # 平台子表(win/unix)内合法键
93
- _PLATFORM_KEYS = frozenset({"cmd"})
92
+ # 平台子表(win/unix)内合法键:cmd + 可选 tty/env 平台级覆盖
93
+ # - cmd:该平台专属命令(字符串 / 字符串数组)
94
+ # - tty:布尔,覆盖顶层 tty;未声明(None)表示继承顶层默认 False
95
+ # - env:字符串值映射,覆盖顶层 env 同名键;未声明(None)表示继承顶层
96
+ _PLATFORM_KEYS = frozenset({"cmd", "tty", "env"})
94
97
 
95
98
  # 参数声明表内合法键(on 仅 type=bool:truthy 时向 cmd 追加的固定 token;
96
99
  # default_env 仅 type=str:CLI 值等于 default 时的环境变量回退链)
@@ -212,6 +215,11 @@ class CommandDecl:
212
215
  win_cmd: str | tuple[str, ...] | None = None
213
216
  unix_cmd: str | tuple[str, ...] | None = None
214
217
  cmd: str | tuple[str, ...] | None = None
218
+ # 平台级覆盖(None 表示未声明,合成时继承顶层)
219
+ win_tty: bool | None = None
220
+ win_env: dict[str, str] | None = None
221
+ unix_tty: bool | None = None
222
+ unix_env: dict[str, str] | None = None
215
223
  description: str = ""
216
224
  aliases: tuple[str, ...] = ()
217
225
  hidden: bool = False
@@ -326,22 +334,47 @@ def _normalize_cmd(name: str, where: str, value: Any) -> str | tuple[str, ...] |
326
334
  raise CommandDeclError(f"命令 {name!r} 的 {where} 须是字符串或非空字符串数组,实际: {value!r}")
327
335
 
328
336
 
329
- def _parse_platform_cmd(name: str, key: str, value: Any) -> str | tuple[str, ...] | None:
330
- """解析平台子表(win/unix):仅允许含 cmd 键的表。
337
+ def _parse_platform_block(
338
+ name: str, key: str, value: Any
339
+ ) -> tuple[str | tuple[str, ...] | None, bool | None, dict[str, str] | None]:
340
+ """解析平台子表(win/unix):允许含 cmd / tty / env 三个键。
341
+
342
+ Returns
343
+ -------
344
+ tuple
345
+ (cmd, tty, env)——任一未声明时为 ``None``(表示继承顶层)
331
346
 
332
347
  Raises
333
348
  ------
334
349
  CommandDeclError
335
- 子表结构非法(非表 / 含未知键 / cmd 值非法)
350
+ 子表结构非法(非表 / 含未知键 / cmd/tty/env 值非法)
336
351
  """
337
352
  if value is None:
338
- return None
353
+ return None, None, None
339
354
  if not isinstance(value, Mapping):
340
355
  raise CommandDeclError(f'命令 {name!r} 的 {key} 须是表(如 `{key}.cmd = "..."`),实际: {value!r}')
341
356
  unknown = set(value) - _PLATFORM_KEYS
342
357
  if unknown:
343
358
  raise CommandDeclError(f"命令 {name!r} 的 {key} 表含未知键: {sorted(unknown)}")
344
- return _normalize_cmd(name, f"{key}.cmd", value.get("cmd"))
359
+
360
+ cmd = _normalize_cmd(name, f"{key}.cmd", value.get("cmd"))
361
+
362
+ # tty:布尔,未声明 None
363
+ tty_raw = value.get("tty", None)
364
+ if tty_raw is not None and not isinstance(tty_raw, bool):
365
+ raise CommandDeclError(f"命令 {name!r} 的 {key}.tty 须是布尔值,实际: {tty_raw!r}")
366
+ tty = tty_raw # None 继承顶层
367
+
368
+ # env:字符串值映射,未声明 None
369
+ env_raw = value.get("env", None)
370
+ if env_raw is not None:
371
+ if not isinstance(env_raw, Mapping) or not all(isinstance(v, str) for v in env_raw.values()):
372
+ raise CommandDeclError(f"命令 {name!r} 的 {key}.env 须是字符串值映射,实际: {env_raw!r}")
373
+ env: dict[str, str] | None = dict(env_raw)
374
+ else:
375
+ env = None
376
+
377
+ return cmd, tty, env
345
378
 
346
379
 
347
380
  def _check_default_type(name: str, pname: str, ptype: str, default: Any) -> None:
@@ -831,8 +864,8 @@ def parse_command_table(name: str, table: Mapping[str, Any], *, subcommand: bool
831
864
  if not isinstance(hidden, bool):
832
865
  raise CommandDeclError(f"命令 {name!r} 的 hidden 须是布尔值")
833
866
 
834
- win_cmd = _parse_platform_cmd(name, "win", table.get("win"))
835
- unix_cmd = _parse_platform_cmd(name, "unix", table.get("unix"))
867
+ win_cmd, win_tty, win_env = _parse_platform_block(name, "win", table.get("win"))
868
+ unix_cmd, unix_tty, unix_env = _parse_platform_block(name, "unix", table.get("unix"))
836
869
  cmd = _normalize_cmd(name, "cmd", table.get("cmd"))
837
870
  has_cmd = not (win_cmd is None and unix_cmd is None and cmd is None)
838
871
  action_name = _parse_action(name, table.get("action"))
@@ -883,6 +916,10 @@ def parse_command_table(name: str, table: Mapping[str, Any], *, subcommand: bool
883
916
  win_cmd=win_cmd,
884
917
  unix_cmd=unix_cmd,
885
918
  cmd=cmd,
919
+ win_tty=win_tty,
920
+ win_env=win_env,
921
+ unix_tty=unix_tty,
922
+ unix_env=unix_env,
886
923
  description=description,
887
924
  aliases=tuple(aliases_raw),
888
925
  hidden=hidden,
@@ -932,13 +969,13 @@ def parse_tool_table(name: str, table: Mapping[str, Any]) -> ToolDecl:
932
969
  has_flat_scalar = bool(flat_scalar_keys & set(table))
933
970
 
934
971
  def _is_flat_platform(k: str, v: Any) -> bool:
935
- """win/unix 为 flat 平台子表:值是非 Mapping(标量)或仅含 cmd 键的小表。"""
972
+ """win/unix 为 flat 平台子表:值是非 Mapping(标量)或键全集 <= _PLATFORM_KEYS 的小表。"""
936
973
  if k not in platform_keys:
937
974
  return False
938
975
  if not isinstance(v, Mapping):
939
976
  return True
940
- # 值为 dict 且只含 cmd 键 → 平台子表 win.cmd / unix.cmd
941
- return set(v.keys()) <= {"cmd"}
977
+ # 值为 dict 且键全集在 _PLATFORM_KEYS 内 → 平台子表 win.{cmd,tty,env}
978
+ return set(v.keys()) <= _PLATFORM_KEYS
942
979
 
943
980
  def _is_flat_args(k: str, v: Any) -> bool:
944
981
  """args 为 flat 键:值是 Mapping(参数声明表)。"""
@@ -949,11 +986,11 @@ def parse_tool_table(name: str, table: Mapping[str, Any]) -> ToolDecl:
949
986
  sub_keys = [
950
987
  k for k, v in table.items() if isinstance(v, Mapping) and k not in _TOP_KEYS and not _is_flat_args(k, v)
951
988
  ]
952
- # win/unix 值为 Mapping 且含 help(非平台子表)时归入子命令表
989
+ # win/unix 值为 Mapping 且含非平台键(如 help)时归入子命令表
953
990
  sub_keys.extend(
954
991
  k
955
992
  for k, v in table.items()
956
- if isinstance(v, Mapping) and k in platform_keys and set(v.keys()) > {"cmd"} # 非纯平台子表(有 help 等其他键)
993
+ if isinstance(v, Mapping) and k in platform_keys and set(v.keys()) - _PLATFORM_KEYS # 非纯平台子表
957
994
  )
958
995
  sub_keys = list(dict.fromkeys(sub_keys)) # 去重保序
959
996
 
@@ -263,6 +263,26 @@ def build_tool_spec(
263
263
  else:
264
264
  func = _synthesize_func(decl)
265
265
  param_help = {p.name: p.help for p in decl.args if p.help}
266
+
267
+ # 平台级 tty/env 覆盖:win32 优先 win_tty/win_env,其余优先 unix_tty/unix_env;
268
+ # 平台级未声明(None)时继承顶层;env 做字典合并(平台级覆盖同名键)。
269
+ if platform == "win32":
270
+ plat_tty = decl.win_tty
271
+ plat_env = decl.win_env
272
+ else:
273
+ plat_tty = decl.unix_tty
274
+ plat_env = decl.unix_env
275
+ resolved_tty = plat_tty if plat_tty is not None else decl.tty
276
+ resolved_env: dict[str, str] | None
277
+ if plat_env is None:
278
+ resolved_env = dict(decl.env) if decl.env else None
279
+ elif decl.env is None:
280
+ resolved_env = dict(plat_env)
281
+ else:
282
+ merged = dict(decl.env)
283
+ merged.update(plat_env) # 平台级覆盖同名键
284
+ resolved_env = merged
285
+
266
286
  return ToolSpec(
267
287
  name=tool_name or decl.name,
268
288
  subcommand=subcommand,
@@ -275,12 +295,12 @@ def build_tool_spec(
275
295
  cmd=None if act is not None or (decl.needs and not _has_any_cmd(decl)) else select_platform_cmd(decl, platform),
276
296
  param_help=param_help,
277
297
  cwd=decl.cwd,
278
- env=dict(decl.env) if decl.env else None,
298
+ env=resolved_env,
279
299
  timeout=decl.timeout,
280
300
  needs=decl.needs,
281
301
  strategy=cast("Literal['sequential', 'thread', 'async', 'dependency'] | None", decl.strategy),
282
302
  allow_upstream_skip=decl.allow_upstream_skip,
283
- passthrough=decl.tty,
303
+ passthrough=resolved_tty,
284
304
  )
285
305
 
286
306