fcmd 0.3.6__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 (303) hide show
  1. {fcmd-0.3.6 → fcmd-0.3.8}/.bumpversion.toml +1 -1
  2. fcmd-0.3.8/.claude/artifacts/fixes/dsl-entry-heavy-import-latency.md +83 -0
  3. {fcmd-0.3.6 → fcmd-0.3.8}/PKG-INFO +7 -6
  4. {fcmd-0.3.6 → fcmd-0.3.8}/README.md +3 -2
  5. {fcmd-0.3.6 → fcmd-0.3.8}/docs/changelog.rst +6 -1
  6. fcmd-0.3.8/pyproject.toml +107 -0
  7. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/__init__.py +1 -1
  8. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/__init__.py +4 -2
  9. fcmd-0.3.8/src/fcmd/cli/_builtins/graph_cmd.py +157 -0
  10. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_builtins/info_cmd.py +53 -37
  11. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_discovery.py +63 -4
  12. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_doctor_helpers.py +1 -1
  13. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/dev/envdev.py +481 -100
  14. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/dev/envdev_core.py +76 -51
  15. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/dev/envdev_go.py +16 -8
  16. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/dev/envdev_java.py +12 -8
  17. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/dev/envdev_node.py +2 -8
  18. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/dev/gittool.py +2 -37
  19. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/dev/packtool.py +4 -1
  20. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/main.py +1 -1
  21. fcmd-0.3.8/src/fcmd/commands/asciitool.toml +18 -0
  22. fcmd-0.3.8/src/fcmd/commands/calcdate.toml +20 -0
  23. fcmd-0.3.8/src/fcmd/commands/casetool.toml +22 -0
  24. fcmd-0.3.8/src/fcmd/commands/codetool.toml +26 -0
  25. fcmd-0.3.8/src/fcmd/commands/colortool.toml +22 -0
  26. fcmd-0.3.8/src/fcmd/commands/convtool.toml +21 -0
  27. fcmd-0.3.8/src/fcmd/commands/cryptool.toml +16 -0
  28. fcmd-0.3.8/src/fcmd/commands/csvtool.toml +26 -0
  29. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/filedate.toml +3 -3
  30. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/filelevel.toml +2 -2
  31. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/filerename.toml +1 -1
  32. fcmd-0.3.8/src/fcmd/commands/filesearch.toml +12 -0
  33. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/folderback.toml +1 -1
  34. fcmd-0.3.8/src/fcmd/commands/folderzip.toml +8 -0
  35. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/gittool.toml +4 -1
  36. fcmd-0.3.8/src/fcmd/commands/hashfile.toml +14 -0
  37. fcmd-0.3.8/src/fcmd/commands/hashtool.toml +21 -0
  38. fcmd-0.3.8/src/fcmd/commands/idtool.toml +18 -0
  39. fcmd-0.3.8/src/fcmd/commands/imagetool.toml +48 -0
  40. fcmd-0.3.8/src/fcmd/commands/img2ico.toml +8 -0
  41. fcmd-0.3.8/src/fcmd/commands/inifile.toml +22 -0
  42. fcmd-0.3.8/src/fcmd/commands/iptool.toml +16 -0
  43. fcmd-0.3.8/src/fcmd/commands/jsontool.toml +22 -0
  44. fcmd-0.3.8/src/fcmd/commands/mathtool.toml +23 -0
  45. fcmd-0.3.8/src/fcmd/commands/nettool.toml +16 -0
  46. fcmd-0.3.8/src/fcmd/commands/padtool.toml +23 -0
  47. fcmd-0.3.8/src/fcmd/commands/pathtool.toml +20 -0
  48. fcmd-0.3.8/src/fcmd/commands/pdftool.toml +64 -0
  49. fcmd-0.3.8/src/fcmd/commands/randtool.toml +22 -0
  50. fcmd-0.3.8/src/fcmd/commands/regextool.toml +22 -0
  51. fcmd-0.3.8/src/fcmd/commands/sshcopyid.toml +56 -0
  52. fcmd-0.3.8/src/fcmd/commands/stattool.toml +27 -0
  53. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/sysinfo.toml +2 -2
  54. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/taskkill.toml +4 -4
  55. fcmd-0.3.8/src/fcmd/commands/textdiff.toml +14 -0
  56. fcmd-0.3.8/src/fcmd/commands/timetool.toml +27 -0
  57. fcmd-0.3.8/src/fcmd/commands/tomltool.toml +22 -0
  58. fcmd-0.3.8/src/fcmd/commands/txttool.toml +22 -0
  59. fcmd-0.3.8/src/fcmd/commands/urlcheck.toml +12 -0
  60. fcmd-0.3.8/src/fcmd/commands/urltool.toml +22 -0
  61. fcmd-0.3.8/src/fcmd/commands/websave.toml +8 -0
  62. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/which.toml +1 -1
  63. fcmd-0.3.8/src/fcmd/commands/xmltool.toml +22 -0
  64. fcmd-0.3.8/src/fcmd/commands/yamtool.toml +22 -0
  65. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/console.py +193 -58
  66. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/dsl/__init__.py +5 -3
  67. fcmd-0.3.8/src/fcmd/dsl/actions/__init__.py +128 -0
  68. fcmd-0.3.8/src/fcmd/dsl/actions/archive.py +58 -0
  69. fcmd-0.3.8/src/fcmd/dsl/actions/basic.py +39 -0
  70. fcmd-0.3.8/src/fcmd/dsl/actions/calc.py +419 -0
  71. fcmd-0.3.8/src/fcmd/dsl/actions/calcdate.py +139 -0
  72. fcmd-0.3.8/src/fcmd/dsl/actions/compute.py +64 -0
  73. fcmd-0.3.8/src/fcmd/dsl/actions/conv.py +298 -0
  74. fcmd-0.3.8/src/fcmd/dsl/actions/conv2.py +498 -0
  75. fcmd-0.3.6/src/fcmd/cli/crypto/cryptool.py → fcmd-0.3.8/src/fcmd/dsl/actions/crypto.py +48 -195
  76. fcmd-0.3.8/src/fcmd/dsl/actions/data.py +1087 -0
  77. fcmd-0.3.8/src/fcmd/dsl/actions/filenames.py +206 -0
  78. fcmd-0.3.8/src/fcmd/dsl/actions/fileops.py +299 -0
  79. fcmd-0.3.8/src/fcmd/dsl/actions/genid.py +73 -0
  80. fcmd-0.3.8/src/fcmd/dsl/actions/hashing.py +116 -0
  81. fcmd-0.3.8/src/fcmd/dsl/actions/media.py +1520 -0
  82. fcmd-0.3.8/src/fcmd/dsl/actions/net.py +641 -0
  83. fcmd-0.3.8/src/fcmd/dsl/actions/system.py +166 -0
  84. fcmd-0.3.8/src/fcmd/dsl/actions/text.py +650 -0
  85. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/dsl/decl.py +83 -14
  86. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/dsl/entry.py +11 -0
  87. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/dsl/synth.py +22 -2
  88. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/engine/task_runner.py +41 -31
  89. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/models/command.py +17 -6
  90. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/models/pdf.py +2 -1
  91. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli.py +190 -49
  92. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_asciitool.py +2 -2
  93. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_calcdate.py +1 -1
  94. fcmd-0.3.8/tests/test_cli_casetool.py +134 -0
  95. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_codetool.py +6 -4
  96. fcmd-0.3.8/tests/test_cli_colortool.py +135 -0
  97. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_convtool.py +6 -3
  98. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_cryptool.py +5 -5
  99. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_csvtool.py +2 -2
  100. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_envdev.py +615 -8
  101. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_filesearch.py +2 -2
  102. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_folderzip.py +3 -3
  103. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_gittool.py +0 -28
  104. fcmd-0.3.8/tests/test_cli_hashfile.py +124 -0
  105. fcmd-0.3.8/tests/test_cli_hashtool.py +114 -0
  106. fcmd-0.3.8/tests/test_cli_idtool.py +138 -0
  107. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_imagetool.py +7 -7
  108. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_img2ico.py +10 -15
  109. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_inifile.py +1 -1
  110. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_iptool.py +2 -2
  111. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_jsontool.py +2 -2
  112. fcmd-0.3.8/tests/test_cli_mathtool.py +163 -0
  113. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_nettool.py +21 -21
  114. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_packtool.py +2 -2
  115. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_padtool.py +2 -2
  116. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_pathtool.py +2 -2
  117. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_pdftool.py +9 -9
  118. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_piptool.py +5 -5
  119. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_randtool.py +2 -2
  120. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_regextool.py +2 -2
  121. fcmd-0.3.8/tests/test_cli_sshcopyid.py +299 -0
  122. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_stattool.py +2 -2
  123. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_sysinfo.py +1 -1
  124. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_textdiff.py +2 -2
  125. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_timetool.py +2 -2
  126. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_tomltool.py +1 -1
  127. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_txttool.py +3 -3
  128. fcmd-0.3.8/tests/test_cli_urlcheck.py +255 -0
  129. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_urltool.py +6 -3
  130. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_websave.py +18 -18
  131. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_xmltool.py +2 -2
  132. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_yamtool.py +2 -2
  133. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_console.py +164 -0
  134. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_dsl.py +54 -5
  135. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_dsl_actions.py +3 -3
  136. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_perf_baseline.py +2 -1
  137. {fcmd-0.3.6 → fcmd-0.3.8}/uv.lock +60 -158
  138. fcmd-0.3.6/pyproject.toml +0 -104
  139. fcmd-0.3.6/src/fcmd/cli/_builtins/graph_cmd.py +0 -62
  140. fcmd-0.3.6/src/fcmd/cli/archive/folderzip.py +0 -81
  141. fcmd-0.3.6/src/fcmd/cli/calc/calcdate.py +0 -263
  142. fcmd-0.3.6/src/fcmd/cli/calc/mathtool.py +0 -246
  143. fcmd-0.3.6/src/fcmd/cli/calc/randtool.py +0 -274
  144. fcmd-0.3.6/src/fcmd/cli/calc/stattool.py +0 -346
  145. fcmd-0.3.6/src/fcmd/cli/calc/timetool.py +0 -289
  146. fcmd-0.3.6/src/fcmd/cli/conv/__init__.py +0 -10
  147. fcmd-0.3.6/src/fcmd/cli/conv/casetool.py +0 -199
  148. fcmd-0.3.6/src/fcmd/cli/conv/codetool.py +0 -313
  149. fcmd-0.3.6/src/fcmd/cli/conv/colortool.py +0 -280
  150. fcmd-0.3.6/src/fcmd/cli/conv/convtool.py +0 -315
  151. fcmd-0.3.6/src/fcmd/cli/conv/urltool.py +0 -249
  152. fcmd-0.3.6/src/fcmd/cli/crypto/__init__.py +0 -10
  153. fcmd-0.3.6/src/fcmd/cli/crypto/hashfile.py +0 -148
  154. fcmd-0.3.6/src/fcmd/cli/crypto/hashtool.py +0 -185
  155. fcmd-0.3.6/src/fcmd/cli/crypto/idtool.py +0 -172
  156. fcmd-0.3.6/src/fcmd/cli/data/__init__.py +0 -10
  157. fcmd-0.3.6/src/fcmd/cli/data/csvtool.py +0 -460
  158. fcmd-0.3.6/src/fcmd/cli/data/inifile.py +0 -282
  159. fcmd-0.3.6/src/fcmd/cli/data/jsontool.py +0 -282
  160. fcmd-0.3.6/src/fcmd/cli/data/tomltool.py +0 -295
  161. fcmd-0.3.6/src/fcmd/cli/data/xmltool.py +0 -316
  162. fcmd-0.3.6/src/fcmd/cli/data/yamtool.py +0 -331
  163. fcmd-0.3.6/src/fcmd/cli/fileops/__init__.py +0 -14
  164. fcmd-0.3.6/src/fcmd/cli/fileops/filesearch.py +0 -278
  165. fcmd-0.3.6/src/fcmd/cli/fileops/pathtool.py +0 -222
  166. fcmd-0.3.6/src/fcmd/cli/media/imagetool.py +0 -576
  167. fcmd-0.3.6/src/fcmd/cli/media/img2ico.py +0 -265
  168. fcmd-0.3.6/src/fcmd/cli/media/pdftool.py +0 -716
  169. fcmd-0.3.6/src/fcmd/cli/net/iptool.py +0 -213
  170. fcmd-0.3.6/src/fcmd/cli/net/nettool.py +0 -184
  171. fcmd-0.3.6/src/fcmd/cli/net/websave.py +0 -591
  172. fcmd-0.3.6/src/fcmd/cli/text/__init__.py +0 -10
  173. fcmd-0.3.6/src/fcmd/cli/text/asciitool.py +0 -189
  174. fcmd-0.3.6/src/fcmd/cli/text/padtool.py +0 -254
  175. fcmd-0.3.6/src/fcmd/cli/text/regextool.py +0 -250
  176. fcmd-0.3.6/src/fcmd/cli/text/textdiff.py +0 -241
  177. fcmd-0.3.6/src/fcmd/cli/text/txttool.py +0 -218
  178. fcmd-0.3.6/src/fcmd/commands/sshcopyid.toml +0 -44
  179. fcmd-0.3.6/src/fcmd/dsl/actions.py +0 -541
  180. fcmd-0.3.6/tests/test_cli_casetool.py +0 -242
  181. fcmd-0.3.6/tests/test_cli_colortool.py +0 -302
  182. fcmd-0.3.6/tests/test_cli_hashfile.py +0 -147
  183. fcmd-0.3.6/tests/test_cli_hashtool.py +0 -213
  184. fcmd-0.3.6/tests/test_cli_idtool.py +0 -236
  185. fcmd-0.3.6/tests/test_cli_mathtool.py +0 -281
  186. fcmd-0.3.6/tests/test_cli_sshcopyid.py +0 -160
  187. {fcmd-0.3.6 → fcmd-0.3.8}/.claude/artifacts/plans/dsl-extension-cli-migration.md +0 -0
  188. {fcmd-0.3.6 → fcmd-0.3.8}/.copier-answers.yml +0 -0
  189. {fcmd-0.3.6 → fcmd-0.3.8}/.coveragerc +0 -0
  190. {fcmd-0.3.6 → fcmd-0.3.8}/.gitattributes +0 -0
  191. {fcmd-0.3.6 → fcmd-0.3.8}/.github/workflows/ci.yml +0 -0
  192. {fcmd-0.3.6 → fcmd-0.3.8}/.github/workflows/release.yml +0 -0
  193. {fcmd-0.3.6 → fcmd-0.3.8}/.gitignore +0 -0
  194. {fcmd-0.3.6 → fcmd-0.3.8}/.pre-commit-config.yaml +0 -0
  195. {fcmd-0.3.6 → fcmd-0.3.8}/.readthedocs.yaml +0 -0
  196. {fcmd-0.3.6 → fcmd-0.3.8}/.vscode/settings.json +0 -0
  197. {fcmd-0.3.6 → fcmd-0.3.8}/LICENSE +0 -0
  198. {fcmd-0.3.6 → fcmd-0.3.8}/Makefile +0 -0
  199. {fcmd-0.3.6 → fcmd-0.3.8}/docs/_static/.gitkeep +0 -0
  200. {fcmd-0.3.6 → fcmd-0.3.8}/docs/api.rst +0 -0
  201. {fcmd-0.3.6 → fcmd-0.3.8}/docs/conf.py +0 -0
  202. {fcmd-0.3.6 → fcmd-0.3.8}/docs/index.rst +0 -0
  203. {fcmd-0.3.6 → fcmd-0.3.8}/pyrefly.toml +0 -0
  204. {fcmd-0.3.6 → fcmd-0.3.8}/pytest.ini +0 -0
  205. {fcmd-0.3.6 → fcmd-0.3.8}/ruff.toml +0 -0
  206. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/__main__.py +0 -0
  207. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/_lazylog.py +0 -0
  208. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/apis/__init__.py +0 -0
  209. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/apis/_tool_args.py +0 -0
  210. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/apis/_tool_exec.py +0 -0
  211. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/apis/context.py +0 -0
  212. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/apis/dag.py +0 -0
  213. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/apis/errors.py +0 -0
  214. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/apis/profiling.py +0 -0
  215. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/apis/report.py +0 -0
  216. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/apis/task.py +0 -0
  217. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/apis/toolkit.py +0 -0
  218. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_builtins/__init__.py +0 -0
  219. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_builtins/completion_cmd.py +0 -0
  220. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_builtins/doctor_cmd.py +0 -0
  221. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_builtins/env_cmd.py +0 -0
  222. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_builtins/profiler_cmd.py +0 -0
  223. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_builtins/yaml_cmd.py +0 -0
  224. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_common.py +0 -0
  225. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_completion_scripts.py +0 -0
  226. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_env_helpers.py +0 -0
  227. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_env_persist.py +0 -0
  228. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/_profiler_helpers.py +0 -0
  229. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/archive/__init__.py +0 -0
  230. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/archive/archivex.py +0 -0
  231. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/archive/zipencrypt.py +0 -0
  232. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/calc/__init__.py +0 -0
  233. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/calc/lscalc.py +0 -0
  234. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/dev/__init__.py +0 -0
  235. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/dev/bumpversion.py +0 -0
  236. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/dev/pymake.py +0 -0
  237. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/media/__init__.py +0 -0
  238. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/media/screenshot.py +0 -0
  239. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/net/__init__.py +0 -0
  240. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/cli/net/portcheck.py +0 -0
  241. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/autofmt.toml +0 -0
  242. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/clr.toml +0 -0
  243. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/dockercmd.toml +0 -0
  244. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/packtool.toml +0 -0
  245. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/piptool.toml +0 -0
  246. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/pymake.toml +0 -0
  247. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/reseticoncache.toml +0 -0
  248. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/setenv.toml +0 -0
  249. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/commands/writefile.toml +0 -0
  250. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/dsl/loader.py +0 -0
  251. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/engine/__init__.py +0 -0
  252. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/engine/dependency_runner.py +0 -0
  253. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/engine/executors.py +0 -0
  254. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/engine/layer_runner.py +0 -0
  255. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/engine/task_command.py +0 -0
  256. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/models/__init__.py +0 -0
  257. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/models/filefilter.py +0 -0
  258. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/models/version.py +0 -0
  259. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/orchestration/__init__.py +0 -0
  260. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/orchestration/conditions.py +0 -0
  261. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/orchestration/yaml_loader.py +0 -0
  262. {fcmd-0.3.6 → fcmd-0.3.8}/src/fcmd/py.typed +0 -0
  263. {fcmd-0.3.6 → fcmd-0.3.8}/tests/__init__.py +0 -0
  264. {fcmd-0.3.6 → fcmd-0.3.8}/tests/conftest.py +0 -0
  265. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_archivex.py +0 -0
  266. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_autofmt.py +0 -0
  267. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_bumpversion.py +0 -0
  268. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_dockercmd.py +0 -0
  269. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_filedate.py +0 -0
  270. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_filelevel.py +0 -0
  271. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_filerename.py +0 -0
  272. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_folderback.py +0 -0
  273. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_lscalc.py +0 -0
  274. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_portcheck.py +0 -0
  275. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_profiler.py +0 -0
  276. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_pymake.py +0 -0
  277. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_reseticoncache.py +0 -0
  278. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_screenshot.py +0 -0
  279. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_setenv.py +0 -0
  280. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_taskkill.py +0 -0
  281. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_which.py +0 -0
  282. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_writefile.py +0 -0
  283. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_cli_zipencrypt.py +0 -0
  284. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_context.py +0 -0
  285. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_e2e_cli.py +0 -0
  286. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_e2e_tools.py +0 -0
  287. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_e2e_workflow.py +0 -0
  288. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_engine_executors.py +0 -0
  289. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_engine_task_command.py +0 -0
  290. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_env_persist.py +0 -0
  291. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_fcmd.py +0 -0
  292. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_graph.py +0 -0
  293. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_init.py +0 -0
  294. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_lazylog.py +0 -0
  295. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_models.py +0 -0
  296. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_models_pdf.py +0 -0
  297. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_orchestration_conditions.py +0 -0
  298. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_orchestration_yaml_loader.py +0 -0
  299. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_profiling.py +0 -0
  300. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_report.py +0 -0
  301. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_task.py +0 -0
  302. {fcmd-0.3.6 → fcmd-0.3.8}/tests/test_toolkit.py +0 -0
  303. {fcmd-0.3.6 → fcmd-0.3.8}/tox.ini +0 -0
@@ -1,5 +1,5 @@
1
1
  [tool.bumpversion]
2
- current_version = "0.3.6"
2
+ current_version = "0.3.8"
3
3
  commit = true
4
4
  exclude = ["template/*"]
5
5
  message = "chore: 更新版本 {current_version} → {new_version}"
@@ -0,0 +1,83 @@
1
+ # Bug: 迁移后 DSL 命令入口启动延迟增大
2
+
3
+ > Status: FIXED
4
+ > Mode: (default)
5
+ > Severity: functional
6
+ > Author: user
7
+ > Last updated: 2026-10-07
8
+
9
+ ## Symptom
10
+
11
+ iter-22 CLI 迁移收尾后,部分命令(尤其经 `fcmd.dsl.entry:run_named` 的 34 个
12
+ DSL 声明式命令)启动延迟明显增大。
13
+
14
+ ## Expected
15
+
16
+ 迁移后命令启动延迟应与迁移前独立模块入口相当(几十毫秒级)。
17
+
18
+ ## Reproduction
19
+
20
+ - 命令 / 步骤:子进程执行 `import fcmd.dsl.entry` +
21
+ `ensure_tools_discovered()`,`perf_counter` 计时。
22
+ - 测试位置:`tests/test_dsl.py::TestBootstrap::test_run_path_does_not_load_heavy_libs`
23
+ - 复现稳定性:确定性失败(非时序),断言重型库不出现在 `sys.modules`。
24
+
25
+ ## Hypotheses & diagnosis
26
+
27
+ | # | Hypothesis | Verdict | Evidence |
28
+ |---|---|---|---|
29
+ | H1 | `fcmd.dsl.actions.media` 顶层 try-import cairosvg/PIL,每个 DSL 命令启动都加载 | confirmed (root cause) | `python -X importtime`:media 累计 437ms(cairosvg 228 + PIL 141,importtime 口径);实测 `import cairosvg` 144ms + `PIL.Image` 50ms |
30
+ | H2 | net/envdev/packtool 顶层 `urllib.request`(→ssl 链)拖慢发现与动作注册 | confirmed (secondary root cause) | 实测 `urllib.request` 37ms;importtime 树定位三处顶层导入 |
31
+ | H3 | `fcmd.dsl.__init__` eager 全量导入 17 个 action 子模块本身是瓶颈 | eliminated(对本次而言) | 子模块多为轻量 stdlib;重负载在可选依赖,动作注册在 TOML 声明校验期必然发生,仅把重型依赖下沉即可回收 ~195ms |
32
+ | H4 | `ensure_tools_discovered` 全量导入 cli 模块是主因 | eliminated | 实测发现仅 +40~46ms,且为 `fcmd` 主入口既有设计 |
33
+
34
+ ## Root cause
35
+
36
+ 迁移后所有 console script 统一入口 `run_named` → `ensure_tools_discovered()`
37
+ → TOML 声明校验 → 导入全部 17 个动作子模块;而 media/net/envdev/packtool
38
+ 在模块顶层 eager 导入重型库(cairosvg 144ms + PIL 50ms + ssl 链 37ms),
39
+ 使每个命令启动固定多付约 230ms。media.py docstring 本承诺"工具发现阶段
40
+ 不触发重型库加载",实现与文档矛盾。
41
+
42
+ ## Fix
43
+
44
+ - `src/fcmd/dsl/actions/media.py`:PIL/cairosvg 改 `find_spec` 探测 +
45
+ `_require_pil`/`_require_cairosvg` 首次调用惰性导入(镜像既有
46
+ `_require_pymupdf` 模式);`icon_build`/`_load_font` 增加直调兜底。
47
+ - `src/fcmd/dsl/actions/net.py`:`urllib.request` 下沉到 5 个发起请求的函数内。
48
+ - `src/fcmd/cli/dev/envdev.py`:urllib 三件套移入 `fetch_mirrorz_sites`。
49
+ - `src/fcmd/cli/dev/packtool.py`:`urllib.request` 移入下载分支。
50
+ - `src/fcmd/dsl/actions/archive.py`:`shutil` 移入 `archive_folder`。
51
+ - 测试 patch 指向定义模块(项目约定):envdev/nettool/urlcheck 的 urlopen
52
+ → `urllib.request.urlopen`;packtool 的 urlretrieve → `urllib.request.urlretrieve`。
53
+
54
+ ## Verification
55
+
56
+ - V-1: 新增回归测试 RED(修复前)→ GREEN(修复后)✓
57
+ - V-2: 修改影响面 8 个测试文件全量对比 stash 前后失败集,完全一致(104 个
58
+ 失败均为存量"工具未注册"测试隔离问题,与本次无关)✓
59
+ - V-3: `make check` 全绿(2892 passed,覆盖率 95.88%)+ `pytest -m slow`
60
+ 7 passed(perf 基线无回归)✓
61
+ - V-4: 命令启动路径实测 316ms → 134ms(-57%,子进程 perf_counter 中位)
62
+
63
+ ## Regression test
64
+
65
+ - 路径:`tests/test_dsl.py::TestBootstrap::test_run_path_does_not_load_heavy_libs`
66
+ - 名称:DSL 命令全路径(entry 导入 + 工具发现)不触发 cairosvg/PIL/ssl 加载
67
+
68
+ ## Pattern analysis
69
+
70
+ | 搜索方式 | 命中数 | 是否本次同类隐患 |
71
+ |---|---|---|
72
+ | `grep "^import (PIL\|cairosvg\|fitz\|pypdf\|urllib.request)"` 于 dsl/actions 与 cli | 0(修复后) | 否,已清零 |
73
+
74
+ ## Open questions / Follow-ups
75
+
76
+ - 存量测试隔离问题:单文件运行时有大量"工具 'xxx' 未注册"失败(104+9),
77
+ 依赖其他测试文件触发发现的导入副作用;make check 全量运行不暴露。
78
+ 建议为相关测试补 `ensure_tools_discovered` fixture(独立迭代处理)。
79
+ - fcmd.dsl.actions 仍为导入期全量注册(~97ms stdlib 开销);若需进一步
80
+ 压缩到 <50ms,需把动作注册改为按需加载并推迟声明校验时机(涉及
81
+ loader/synth 设计,属结构性改动,需单独评估)。
82
+ - `run_named` 对 DSL 命令可跳过 Python 模块导入(别名解析语义需权衡,
83
+ 收益 ~40ms)。
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: fcmd
3
- Version: 0.3.6
3
+ Version: 0.3.8
4
4
  Summary: 极速 Python 工具集应用:DAG 任务调度 + 组合 CLI
5
5
  Author: fcmd
6
6
  License: MIT
@@ -13,7 +13,6 @@ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
13
13
  Requires-Python: >=3.13
14
14
  Requires-Dist: pyyaml>=6.0.1
15
15
  Provides-Extra: dev
16
- Requires-Dist: cairosvg>=2.7; extra == 'dev'
17
16
  Requires-Dist: pillow>=10; extra == 'dev'
18
17
  Requires-Dist: prek>=0.4.5; extra == 'dev'
19
18
  Requires-Dist: pymupdf>=1.23; extra == 'dev'
@@ -24,6 +23,7 @@ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
24
23
  Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
25
24
  Requires-Dist: pytest-xdist>=3.6.1; extra == 'dev'
26
25
  Requires-Dist: pytest>=8.0.0; extra == 'dev'
26
+ Requires-Dist: resvg-py>=0.5; extra == 'dev'
27
27
  Requires-Dist: ruff>=0.8.0; extra == 'dev'
28
28
  Requires-Dist: tox-uv>=1.13.1; extra == 'dev'
29
29
  Requires-Dist: tox>=4.25.0; extra == 'dev'
@@ -36,16 +36,16 @@ Provides-Extra: ocr
36
36
  Requires-Dist: pillow>=10; extra == 'ocr'
37
37
  Requires-Dist: pytesseract>=0.3.13; extra == 'ocr'
38
38
  Provides-Extra: office
39
- Requires-Dist: cairosvg>=2.7; extra == 'office'
40
39
  Requires-Dist: pillow>=10; extra == 'office'
41
40
  Requires-Dist: pymupdf>=1.23; extra == 'office'
42
41
  Requires-Dist: pypdf>=5.9.0; extra == 'office'
43
42
  Requires-Dist: pytesseract>=0.3.13; extra == 'office'
43
+ Requires-Dist: resvg-py>=0.5; extra == 'office'
44
44
  Provides-Extra: pdf
45
45
  Requires-Dist: pymupdf>=1.23; extra == 'pdf'
46
46
  Requires-Dist: pypdf>=5.9.0; extra == 'pdf'
47
47
  Provides-Extra: svg
48
- Requires-Dist: cairosvg>=2.7; extra == 'svg'
48
+ Requires-Dist: resvg-py>=0.5; extra == 'svg'
49
49
  Provides-Extra: test
50
50
  Requires-Dist: pytest-asyncio>=0.24.0; extra == 'test'
51
51
  Requires-Dist: pytest-cov>=5.0.0; extra == 'test'
@@ -141,7 +141,7 @@ fcmd completion --shell fish | source # fish
141
141
 
142
142
  ## 工具列表
143
143
 
144
- 58 个工具(其中 46 个为 Python 模块,`clr`/`autofmt`/`dockercmd`/`sshcopyid`/`reseticoncache`/`piptool` 纯 exec 与 compute 工具及 `setenv`/`writefile`/`filedate`/`filerename`/`filelevel`/`folderback`/`taskkill`/`which`/`sysinfo` action 原语工具由 DSL 声明),按用途分组:
144
+ 59 个工具(其中 47 个为 Python 模块,`clr`/`autofmt`/`dockercmd`/`sshcopyid`/`reseticoncache`/`piptool` 纯 exec 与 compute 工具及 `setenv`/`writefile`/`filedate`/`filerename`/`filelevel`/`folderback`/`taskkill`/`which`/`sysinfo` action 原语工具由 DSL 声明),按用途分组:
145
145
 
146
146
  ### 项目构建与发布
147
147
 
@@ -223,6 +223,7 @@ fcmd completion --shell fish | source # fish
223
223
  | `reseticoncache` | - | 重置 Windows 图标缓存(非 Windows 打印提示) |
224
224
  | `iptool` | - | IP 地址工具(本机 IP/公网 IP/子网计算) |
225
225
  | `nettool` | - | HTTP 客户端(GET/POST/HEAD,状态码/响应头) |
226
+ | `urlcheck` | - | URL 可访问性与访问速度检测(HEAD/GET 探测 + 并发测速排序,供镜像源选优) |
226
227
  | `websave` | - | 网页内容保存(主页及同源相关子页面,过滤广告/静态资源) |
227
228
  | `lscalc` | - | LS-DYNA 计算(run/mpi/status) |
228
229
  | `dockercmd` | - | Docker 操作(login/push/pull,镜像仓库通用) |
@@ -232,7 +233,7 @@ fcmd completion --shell fish | source # fish
232
233
  | 工具 | 别名 | 说明 |
233
234
  |------|------|------|
234
235
  | `gittool` | - | Git 操作(add+commit/init/init-submodules/clean/push/pull) |
235
- | `envdev` | - | 开发环境一键配置(python/js/rust/all,镜像源 + 工具链,Linux 含系统依赖) |
236
+ | `envdev` | - | 开发环境一键配置(分组入口 lang/app/mirror/check/all,镜像按服务(pip/conda/rustup/cargo/go/maven)独立自动选优 + 教育网镜像探测(动态拉取 MirrorZ 列表)+ 工具链,Linux 含系统依赖) |
236
237
  | `setenv` | - | 设置当前进程环境变量(支持 `--default` 仅在未设置时写入) |
237
238
  | `sshcopyid` | - | SSH 公钥部署到远程服务器(依赖 sshpass) |
238
239
 
@@ -86,7 +86,7 @@ fcmd completion --shell fish | source # fish
86
86
 
87
87
  ## 工具列表
88
88
 
89
- 58 个工具(其中 46 个为 Python 模块,`clr`/`autofmt`/`dockercmd`/`sshcopyid`/`reseticoncache`/`piptool` 纯 exec 与 compute 工具及 `setenv`/`writefile`/`filedate`/`filerename`/`filelevel`/`folderback`/`taskkill`/`which`/`sysinfo` action 原语工具由 DSL 声明),按用途分组:
89
+ 59 个工具(其中 47 个为 Python 模块,`clr`/`autofmt`/`dockercmd`/`sshcopyid`/`reseticoncache`/`piptool` 纯 exec 与 compute 工具及 `setenv`/`writefile`/`filedate`/`filerename`/`filelevel`/`folderback`/`taskkill`/`which`/`sysinfo` action 原语工具由 DSL 声明),按用途分组:
90
90
 
91
91
  ### 项目构建与发布
92
92
 
@@ -168,6 +168,7 @@ fcmd completion --shell fish | source # fish
168
168
  | `reseticoncache` | - | 重置 Windows 图标缓存(非 Windows 打印提示) |
169
169
  | `iptool` | - | IP 地址工具(本机 IP/公网 IP/子网计算) |
170
170
  | `nettool` | - | HTTP 客户端(GET/POST/HEAD,状态码/响应头) |
171
+ | `urlcheck` | - | URL 可访问性与访问速度检测(HEAD/GET 探测 + 并发测速排序,供镜像源选优) |
171
172
  | `websave` | - | 网页内容保存(主页及同源相关子页面,过滤广告/静态资源) |
172
173
  | `lscalc` | - | LS-DYNA 计算(run/mpi/status) |
173
174
  | `dockercmd` | - | Docker 操作(login/push/pull,镜像仓库通用) |
@@ -177,7 +178,7 @@ fcmd completion --shell fish | source # fish
177
178
  | 工具 | 别名 | 说明 |
178
179
  |------|------|------|
179
180
  | `gittool` | - | Git 操作(add+commit/init/init-submodules/clean/push/pull) |
180
- | `envdev` | - | 开发环境一键配置(python/js/rust/all,镜像源 + 工具链,Linux 含系统依赖) |
181
+ | `envdev` | - | 开发环境一键配置(分组入口 lang/app/mirror/check/all,镜像按服务(pip/conda/rustup/cargo/go/maven)独立自动选优 + 教育网镜像探测(动态拉取 MirrorZ 列表)+ 工具链,Linux 含系统依赖) |
181
182
  | `setenv` | - | 设置当前进程环境变量(支持 `--default` 仅在未设置时写入) |
182
183
  | `sshcopyid` | - | SSH 公钥部署到远程服务器(依赖 sshpass) |
183
184
 
@@ -6,7 +6,12 @@
6
6
  [Unreleased]
7
7
  ------------
8
8
 
9
- - ``refactor(envdev)``: 子命令按语言精简为 ``python``/``js``/``rust``/``all`` 四个一键命令,细粒度步骤命令(setup-\*/install-\*)转为隐藏子命令
9
+ - ``feat``: 新增 ``urlcheck`` 工具——URL 可访问性与访问速度检测(HEAD 优先、被拒回退 GET,以成功响应判定可访问,并发探测 + 按延迟排序)
10
+ - ``feat(envdev)``: 新增 ``mirror`` 子命令——探测教育网镜像站点列表(取自 MirrorZ ``help.mirrors.cernet.edu.cn``)的可访问性与速度;``lang`` 镜像参数默认 ``auto`` 自动选优(并发探测该语言支持镜像,选用最快可达项,全部不可达回退原默认);``app docker-mirror`` 改为先探测候选加速源,仅写入可达项并按速度排序
11
+ - ``feat(envdev)``: ``mirror`` 站点列表支持动态拉取——从 MirrorZ 门户(``mirrors.cernet.edu.cn``)前端 JS 包提取内嵌站点元数据(默认 ``--source auto``,拉取失败回退内置列表;``--source builtin`` 强制内置)
12
+ - ``fix(urlcheck)``: 修正可访问性判定——收到 HTTP 错误响应(4xx/5xx,如 WAF 全站 403、502/503)判不可访问,不再误报"可访问";可访问以成功响应(2xx/3xx)为准,HEAD 被拒仍回退 GET 复测避免误杀仅禁用 HEAD 的站点
13
+
14
+ - ``refactor(envdev)``: 子命令整合为 ``lang``/``app``/``check``/``all`` 四个分组入口——语言类(python/js/rust/go/java/node)归入 ``lang``,应用/系统类(linux-mirror/qt-libs/fonts/docker/docker-mirror/openssh/remote)归入 ``app``,环境检测由 ``verify`` 更名 ``check``;细粒度步骤命令保持隐藏子命令
10
15
  - ``refactor``: 调度引擎采用标准库 ``graphlib.TopologicalSorter`` 替换两处自实现的 Kahn 拓扑排序(``dag._topological_layers`` 与 ``_dependency_runner`` 的增量就绪集簿记),消除"造轮子"
11
16
  - ``refactor``: 6 个无状态单方法 Runner 类(``SyncTaskRunner``/``AsyncTaskRunner``/三个 ``LayerRunner``/``DependencyRunner``)收敛为模块级函数;``_filter_and_sort`` 重命名为 ``_build_spec_map`` 并去除冗余 ``to_run``
12
17
  - ``chore``: 放弃 Python 3.8 支持(已 EOL),最低版本提升至 3.9;同步更新 CI 矩阵、tox envlist、ruff/pyrefly 目标版本与文档
@@ -0,0 +1,107 @@
1
+ [project]
2
+ name = "fcmd"
3
+ version = "0.3.8"
4
+ description = "极速 Python 工具集应用:DAG 任务调度 + 组合 CLI"
5
+ readme = "README.md"
6
+ requires-python = ">=3.13"
7
+ license = { text = "MIT" }
8
+ authors = [{ name = "fcmd" }]
9
+ keywords = ["cli", "dag", "scheduler", "task", "workflow", "tools"]
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "Programming Language :: Python :: 3.13",
13
+ "Programming Language :: Python :: 3.14",
14
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
15
+ ]
16
+ dependencies = ["pyyaml>=6.0.1"]
17
+
18
+ [project.scripts]
19
+ # Python 模块工具(含 Python 逻辑,未迁 DSL)
20
+ fcmd = "fcmd.cli.main:main"
21
+ archivex = "fcmd.cli.archive.archivex:main"
22
+ bumpversion = "fcmd.cli.dev.bumpversion:main"
23
+ envdev = "fcmd.cli.dev.envdev:main"
24
+ gitt = "fcmd.cli.dev.gittool:main"
25
+ lscalc = "fcmd.cli.calc.lscalc:main"
26
+ packtool = "fcmd.cli.dev.packtool:main"
27
+ portcheck = "fcmd.cli.net.portcheck:main"
28
+ pymake = "fcmd.cli.dev.pymake:main"
29
+ screenshot = "fcmd.cli.media.screenshot:main"
30
+ zipencrypt = "fcmd.cli.archive.zipencrypt:main"
31
+ # DSL 声明式命令(commands/*.toml):console script 文件名即工具名,
32
+ # 统一经 dsl.entry.run_named 按 argv[0] 推断工具名后转发
33
+ asciitool = "fcmd.dsl.entry:run_named"
34
+ autofmt = "fcmd.dsl.entry:run_named"
35
+ calcdate = "fcmd.dsl.entry:run_named"
36
+ casetool = "fcmd.dsl.entry:run_named"
37
+ clr = "fcmd.dsl.entry:run_named"
38
+ codetool = "fcmd.dsl.entry:run_named"
39
+ colortool = "fcmd.dsl.entry:run_named"
40
+ convtool = "fcmd.dsl.entry:run_named"
41
+ csvtool = "fcmd.dsl.entry:run_named"
42
+ cryptool = "fcmd.dsl.entry:run_named"
43
+ dockercmd = "fcmd.dsl.entry:run_named"
44
+ filedate = "fcmd.dsl.entry:run_named"
45
+ filelevel = "fcmd.dsl.entry:run_named"
46
+ filerename = "fcmd.dsl.entry:run_named"
47
+ filesearch = "fcmd.dsl.entry:run_named"
48
+ folderback = "fcmd.dsl.entry:run_named"
49
+ folderzip = "fcmd.dsl.entry:run_named"
50
+ hashfile = "fcmd.dsl.entry:run_named"
51
+ hashtool = "fcmd.dsl.entry:run_named"
52
+ idtool = "fcmd.dsl.entry:run_named"
53
+ img2ico = "fcmd.dsl.entry:run_named"
54
+ imaget = "fcmd.dsl.entry:run_named"
55
+ inifile = "fcmd.dsl.entry:run_named"
56
+ iptool = "fcmd.dsl.entry:run_named"
57
+ jsont = "fcmd.dsl.entry:run_named"
58
+ mathtool = "fcmd.dsl.entry:run_named"
59
+ nettool = "fcmd.dsl.entry:run_named"
60
+ padtool = "fcmd.dsl.entry:run_named"
61
+ pathtool = "fcmd.dsl.entry:run_named"
62
+ pdft = "fcmd.dsl.entry:run_named"
63
+ pipt = "fcmd.dsl.entry:run_named"
64
+ randtool = "fcmd.dsl.entry:run_named"
65
+ regextool = "fcmd.dsl.entry:run_named"
66
+ reseticoncache = "fcmd.dsl.entry:run_named"
67
+ setenv = "fcmd.dsl.entry:run_named"
68
+ stattool = "fcmd.dsl.entry:run_named"
69
+ sshcopyid = "fcmd.dsl.entry:run_named"
70
+ sysinfo = "fcmd.dsl.entry:run_named"
71
+ taskk = "fcmd.dsl.entry:run_named"
72
+ textdiff = "fcmd.dsl.entry:run_named"
73
+ timetool = "fcmd.dsl.entry:run_named"
74
+ tomltool = "fcmd.dsl.entry:run_named"
75
+ txttool = "fcmd.dsl.entry:run_named"
76
+ urltool = "fcmd.dsl.entry:run_named"
77
+ websave = "fcmd.dsl.entry:run_named"
78
+ wch = "fcmd.dsl.entry:run_named"
79
+ writefile = "fcmd.dsl.entry:run_named"
80
+ xmltool = "fcmd.dsl.entry:run_named"
81
+ yamtool = "fcmd.dsl.entry:run_named"
82
+
83
+ [project.optional-dependencies]
84
+ img = ["pillow>=10"]
85
+ pdf = ["pymupdf>=1.23", "pypdf>=5.9.0"]
86
+ ocr = ["pytesseract>=0.3.13", "fcmd[img]"]
87
+ svg = ["resvg-py>=0.5"]
88
+ office = ["fcmd[img,pdf,ocr,svg]"]
89
+ lint = ["pyrefly>=1.1.1", "ruff>=0.8.0"]
90
+ test = ["pytest>=8.0.0", "pytest-asyncio>=0.24.0", "pytest-cov>=5.0.0", "pytest-xdist>=3.6.1"]
91
+ dev = ["fcmd[lint,test,office]", "prek>=0.4.5", "tox>=4.25.0", "tox-uv>=1.13.1"]
92
+
93
+ [build-system]
94
+ requires = ["hatchling"]
95
+ build-backend = "hatchling.build"
96
+
97
+ [tool.hatch.build.targets.wheel]
98
+ packages = ["src/fcmd"]
99
+
100
+ [tool.hatch.build.targets.wheel.force-include]
101
+ "src/fcmd/py.typed" = "fcmd/py.typed"
102
+
103
+ [tool.fspack]
104
+ extras = ["img", "pdf", "ocr", "office"]
105
+
106
+ [dependency-groups]
107
+ dev = ["fcmd[lint,test,office]"]
@@ -20,7 +20,7 @@
20
20
 
21
21
  from typing import Any
22
22
 
23
- __version__ = "0.3.6"
23
+ __version__ = "0.3.8"
24
24
 
25
25
  __all__ = [
26
26
  "Context",
@@ -2,9 +2,11 @@
2
2
 
3
3
  两层结构:
4
4
 
5
- - 领域子包(``fileops``/``archive``/``text``/``data``/``conv``/``calc``/
6
- ``crypto``/``dev``/``system``/``net``/``media``):每个内含工具模块,
5
+ - 领域子包(``archive``/``calc``/``dev``/``media``/``net``):每个内含工具模块,
7
6
  工具名 = 模块名,经 ``@fx.tool`` 注册后以 ``fcmd <工具名>`` 调用。
7
+ 声明式 exec 型工具已全部迁入 DSL(``fcmd/commands/*.toml`` + ``fcmd/dsl/``),
8
+ 本包仅保留含 Python 逻辑的工具模块;原先的 ``conv``/``crypto``/``data``/
9
+ ``text``/``fileops`` 空壳子包已随迁移删除。
8
10
  - 基础设施模块(``_`` 前缀):``main`` 路由、``_discovery`` 工具发现、
9
11
  ``_builtins`` 内建命令、各共享辅助模块。
10
12
 
@@ -0,0 +1,157 @@
1
+ """``fcmd graph`` 内建命令:可视化 DAG 执行计划。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ from typing import TYPE_CHECKING
7
+
8
+ from fcmd.apis.errors import FcmdError
9
+ from fcmd.apis.toolkit import build_tool_graph
10
+ from fcmd.cli._common import print_unknown_tool
11
+ from fcmd.cli._discovery import resolve_tool
12
+ from fcmd.console import get_console
13
+
14
+ if TYPE_CHECKING:
15
+ from fcmd.apis.dag import Graph
16
+
17
+ __all__ = ["run"]
18
+
19
+
20
+ def run(argv: list[str]) -> int:
21
+ """``fcmd graph <tool> [subcommand] [--format=tree|mermaid|layers|describe]``。
22
+
23
+ 可视化工具子命令的 DAG 执行计划,不执行任务。
24
+
25
+ 格式:
26
+
27
+ - ``tree``(默认):树形依赖视图,从根任务(无下游)向下展开,
28
+ 菱形依赖折叠为 ``(已展开)``,软依赖以 dim 标注不展开
29
+ - ``mermaid``:Mermaid graph 定义(节点按任务类型造型),可粘贴到
30
+ mermaid.live
31
+ - ``layers``:拓扑分层纵向流程图(每层可并行)
32
+ - ``describe``:人类可读多行摘要(Graph.describe)
33
+ """
34
+ parser = argparse.ArgumentParser(
35
+ prog="fcmd graph",
36
+ description="可视化工具子命令的 DAG 执行计划",
37
+ )
38
+ parser.add_argument("tool", help="工具名(如 pymake)")
39
+ parser.add_argument("subcommand", nargs="?", default=None, help="目标子命令(如 tc/all)")
40
+ parser.add_argument(
41
+ "--format",
42
+ choices=("tree", "mermaid", "layers", "describe"),
43
+ default="tree",
44
+ help="输出格式(默认 tree)",
45
+ )
46
+ if not argv:
47
+ parser.print_help()
48
+ return 1
49
+ parsed = parser.parse_args(argv)
50
+
51
+ resolved = resolve_tool(parsed.tool)
52
+ if resolved is None:
53
+ print_unknown_tool(parsed.tool)
54
+ return 1
55
+
56
+ try:
57
+ graph = build_tool_graph(resolved, parsed.subcommand)
58
+ except FcmdError as e:
59
+ get_console().print(f"[red]错误:[/red] {e}")
60
+ return 1
61
+
62
+ if parsed.format == "tree":
63
+ _print_tree(graph)
64
+ elif parsed.format == "mermaid":
65
+ # markup=False:mermaid 的 [/"..."/] 造型语法含 [...],不做 markup 解析
66
+ get_console().print(_mermaid_shaped(graph), end="", markup=False)
67
+ elif parsed.format == "layers":
68
+ _print_layers(graph)
69
+ else: # describe
70
+ get_console().print(graph.describe())
71
+ return 0
72
+
73
+
74
+ def _tree_chars() -> tuple[str, str, str, str]:
75
+ """按终端能力返回树形字符集 ``(tee, last, pipe, space)``。"""
76
+ from fcmd import console as console_mod
77
+
78
+ if console_mod.supports_unicode():
79
+ return "├── ", "└── ", "│ ", " "
80
+ return "|-- ", "`-- ", "| ", " "
81
+
82
+
83
+ def _print_tree(graph: Graph) -> None:
84
+ """树形视图:从根任务(无下游依赖)沿硬依赖向下展开。
85
+
86
+ 菱形依赖(重复节点)折叠为 ``(已展开)``;软依赖仅标注不展开
87
+ (软依赖只用于上下文注入,不代表执行顺序)。
88
+ """
89
+ console = get_console()
90
+ tee, last, pipe, space = _tree_chars()
91
+ # 根 = 无任何下游依赖的任务;sorted 保证多根顺序确定
92
+ dependents: dict[str, int] = dict.fromkeys(graph.specs, 0)
93
+ for deps in graph.deps.values():
94
+ for dep in deps:
95
+ dependents[dep] += 1
96
+ roots = sorted(name for name, count in dependents.items() if count == 0)
97
+
98
+ def walk(name: str, prefix: str, rendered: set[str]) -> None:
99
+ entries = [(dep, False) for dep in graph.deps.get(name, ())]
100
+ entries += [(dep, True) for dep in graph.specs[name].soft_depends_on]
101
+ for idx, (dep, is_soft) in enumerate(entries):
102
+ branch = last if idx == len(entries) - 1 else tee
103
+ ext = prefix + (space if idx == len(entries) - 1 else pipe)
104
+ if is_soft:
105
+ console.print(f"{prefix}{branch}[dim]{dep} (软依赖)[/dim]")
106
+ elif dep in rendered:
107
+ console.print(f"{prefix}{branch}{dep} [dim](已展开)[/dim]")
108
+ else:
109
+ console.print(f"{prefix}{branch}{dep}")
110
+ rendered.add(dep)
111
+ walk(dep, ext, rendered)
112
+
113
+ rendered: set[str] = set()
114
+ for i, root in enumerate(roots):
115
+ if i:
116
+ console.print()
117
+ console.print(f"[bold cyan]{root}[/bold cyan]")
118
+ rendered.add(root)
119
+ walk(root, "", rendered)
120
+
121
+
122
+ def _print_layers(graph: Graph) -> None:
123
+ """分层视图:拓扑层纵向流程图,同层任务可并行。"""
124
+ console = get_console()
125
+ from fcmd import console as console_mod
126
+
127
+ if console_mod.supports_unicode():
128
+ v, down = "│", "↓"
129
+ else:
130
+ v, down = "|", "v"
131
+ for idx, layer in enumerate(graph.layers(), 1):
132
+ if idx > 1:
133
+ console.print(f" {v}")
134
+ console.print(f" {down}")
135
+ console.print(f" {v}")
136
+ console.print(f"[bold cyan]Layer {idx}[/bold cyan]: {', '.join(layer)}")
137
+
138
+
139
+ def _mermaid_shaped(graph: Graph) -> str:
140
+ """渲染 Mermaid 定义,节点按任务类型造型(cmd 平行四边形 / 其余圆角)。
141
+
142
+ TaskSpec 层面聚合任务与 fn 任务均持有 ``fn``(聚合为 noop),不可
143
+ 区分,故统一渲染为圆角节点。
144
+ """
145
+ lines: list[str] = ["graph TD"]
146
+ for name, spec in graph.specs.items():
147
+ if spec.cmd is not None:
148
+ lines.append(f' {name}[/"{name}"/]')
149
+ else:
150
+ lines.append(f' {name}("{name}")')
151
+ for name, deps in graph.deps.items():
152
+ for dep in deps:
153
+ lines.append(f" {dep} --> {name}")
154
+ for name, spec in graph.specs.items():
155
+ for dep in spec.soft_depends_on:
156
+ lines.append(f" {dep} -.-> {name}")
157
+ return "\n".join(lines) + "\n"
@@ -63,27 +63,29 @@ def _info_overview() -> None:
63
63
 
64
64
  console = get_console()
65
65
  console.print("[bold]内建命令:[/bold]")
66
- for cmd_name in _BUILTIN_COMMANDS:
67
- console.print(f" [cyan]fcmd {cmd_name}[/cyan]")
66
+ console.print(" " + " [dim]·[/dim] ".join(f"[cyan]fcmd {name}[/cyan]" for name in _BUILTIN_COMMANDS))
68
67
 
69
68
  console.print("\n[bold]已注册工具:[/bold]")
70
- table = Table(show_header=True, header_style="bold", show_lines=False)
71
- table.add_column("工具", style="cyan", no_wrap=True)
72
- table.add_column("别名", style="dim", no_wrap=True)
73
- table.add_column("子命令数", justify="right", no_wrap=True)
74
- table.add_column("说明")
69
+ table = Table(show_header=True, header_style="bold", box="auto")
70
+ table.add_column("工具")
71
+ table.add_column("别名")
72
+ table.add_column("子命令数", justify="right")
73
+ table.add_column("说明", no_wrap=True)
75
74
  import_all_tool_modules()
76
75
  from fcmd.apis.toolkit import _TOOL_REGISTRY
77
76
 
77
+ count = 0
78
78
  for tool_name in _tool_names():
79
+ count += 1
79
80
  aliases = aliases_for(tool_name)
80
81
  subs = _TOOL_REGISTRY.get(tool_name, {})
81
82
  visible = sum(1 for sc in subs if sc is not None and not subs[sc].hidden)
82
83
  hidden = sum(1 for sc in subs if sc is not None and subs[sc].hidden)
83
84
  count_str = f"{visible} (+{hidden} hidden)" if hidden else str(visible)
84
- table.add_row(tool_name, ", ".join(aliases), count_str, tool_description(tool_name))
85
+ alias_str = f"[dim]{', '.join(aliases)}[/dim]" if aliases else ""
86
+ table.add_row(f"[cyan]{tool_name}[/cyan]", alias_str, count_str, tool_description(tool_name))
85
87
  console.print(table)
86
- console.print("\n[dim]用法: fcmd info <tool> [subcommand][/dim]")
88
+ console.print(f"\n[dim]共 {count} 个工具 · 用法: fcmd info <tool> [subcommand][/dim]")
87
89
 
88
90
 
89
91
  def _info_tool(tool_name: str, subs: dict[str | None, Any]) -> None:
@@ -91,56 +93,70 @@ def _info_tool(tool_name: str, subs: dict[str | None, Any]) -> None:
91
93
  from fcmd.console import Table
92
94
 
93
95
  console = get_console()
94
- console.print(f"[bold cyan]{tool_name}[/bold cyan] 子命令:")
95
- table = Table(show_header=True, header_style="bold", show_lines=False)
96
- table.add_column("子命令", style="cyan", no_wrap=True)
97
- table.add_column("类型", style="dim", no_wrap=True)
98
- table.add_column("needs", style="yellow", no_wrap=True)
99
- table.add_column("strategy", style="magenta", no_wrap=True)
100
- table.add_column("说明")
96
+ total = sum(1 for sc in subs if sc is not None)
97
+ hidden_count = sum(1 for sc in subs if sc is not None and subs[sc].hidden)
98
+ suffix = f" [dim](共 {total} 个,{hidden_count} hidden)[/dim]" if hidden_count else f" [dim](共 {total} 个)[/dim]"
99
+ console.print(f"[bold cyan]{tool_name}[/bold cyan] 子命令{suffix}:")
100
+ table = Table(show_header=True, header_style="bold", box="auto")
101
+ table.add_column("子命令")
102
+ table.add_column("类型")
103
+ table.add_column("needs", no_wrap=True)
104
+ table.add_column("strategy")
105
+ table.add_column("说明", no_wrap=True)
101
106
  # 排序:visible 在前(按名排序),hidden 在后(按名排序)
102
107
  visible = sorted((sc, spec) for sc, spec in subs.items() if sc is not None and not spec.hidden)
103
108
  hidden = sorted((sc, spec) for sc, spec in subs.items() if sc is not None and spec.hidden)
104
109
  for sc, spec in visible + hidden:
105
110
  kind = _spec_kind(spec)
106
- needs_str = ", ".join(spec.needs) if spec.needs else "-"
107
- strategy_str = spec.strategy or "-"
111
+ needs_str = ", ".join(spec.needs) if spec.needs else "[dim]-[/dim]"
112
+ strategy_str = f"[magenta]{spec.strategy}[/magenta]" if spec.strategy else "[dim]-[/dim]"
113
+ kind_str = f"[dim]{kind}[/dim]"
108
114
  help_str = spec.help or ""
109
115
  if spec.hidden:
110
116
  sc_str = f"[dim]{sc} (hidden)[/dim]"
111
- help_str = f"[dim]{help_str}[/dim]"
117
+ help_str = f"[dim]{help_str}[/dim]" if help_str else "[dim]-[/dim]"
112
118
  else:
113
- sc_str = str(sc)
114
- table.add_row(sc_str, kind, needs_str, strategy_str, help_str)
119
+ sc_str = f"[cyan]{sc}[/cyan]"
120
+ help_str = help_str if help_str else "[dim]-[/dim]"
121
+ table.add_row(sc_str, kind_str, needs_str, strategy_str, help_str)
115
122
  console.print(table)
116
123
 
117
124
 
118
125
  def _info_subcommand(tool_name: str, spec: Any) -> None:
119
126
  """``fcmd info <tool> <subcommand>``:展示 ToolSpec 完整字段。"""
120
127
  console = get_console()
121
- sc_name = spec.subcommand if spec.subcommand is not None else "(single)"
128
+ sc_name = spec.subcommand if spec.subcommand is not None else "[dim](single)[/dim]"
122
129
  console.print(f"[bold cyan]{tool_name}[/bold cyan] / [cyan]{sc_name}[/cyan]")
130
+
131
+ def _yes_no(value: bool) -> str:
132
+ return "[green]yes[/green]" if value else "[dim]no[/dim]"
133
+
134
+ def _value(text: str, style: str = "") -> str:
135
+ if not text:
136
+ return "[dim]-[/dim]"
137
+ return f"[{style}]{text}[/{style}]" if style else text
138
+
123
139
  fields: list[tuple[str, str]] = [
124
- ("help", spec.help or "-"),
125
- ("description", spec.description or "-"),
126
- ("kind", _spec_kind(spec)),
127
- ("cmd", " ".join(spec.cmd) if isinstance(spec.cmd, tuple) else (spec.cmd or "-")),
128
- ("needs", ", ".join(spec.needs) if spec.needs else "-"),
129
- ("strategy", spec.strategy or "-"),
130
- ("cwd", str(spec.cwd) if spec.cwd is not None else "-"),
131
- ("hidden", "yes" if spec.hidden else "no"),
132
- ("allow_upstream_skip", "yes" if spec.allow_upstream_skip else "no"),
133
- ("timeout", str(spec.timeout) if spec.timeout is not None else "-"),
134
- ("env", ", ".join(f"{k}=..." for k in spec.env) if spec.env else "-"),
135
- ("retry", str(spec.retry) if spec.retry is not None else "-"),
140
+ ("help", _value(spec.help or "")),
141
+ ("description", _value(spec.description or "")),
142
+ ("kind", _value(_spec_kind(spec), "magenta")),
143
+ ("cmd", _value(" ".join(spec.cmd) if isinstance(spec.cmd, tuple) else (spec.cmd or ""), "yellow")),
144
+ ("needs", _value(", ".join(spec.needs) if spec.needs else "", "yellow")),
145
+ ("strategy", _value(spec.strategy or "", "magenta")),
146
+ ("cwd", _value(str(spec.cwd) if spec.cwd is not None else "")),
147
+ ("hidden", _yes_no(spec.hidden)),
148
+ ("allow_upstream_skip", _yes_no(spec.allow_upstream_skip)),
149
+ ("timeout", _value(str(spec.timeout) if spec.timeout is not None else "")),
150
+ ("env", _value(", ".join(f"{k}=..." for k in spec.env) if spec.env else "")),
151
+ ("retry", _value(str(spec.retry) if spec.retry is not None else "")),
136
152
  ]
137
153
  from fcmd.console import Table
138
154
 
139
- table = Table(show_header=False, box=None, show_lines=False)
140
- table.add_column("字段", style="bold", no_wrap=True)
155
+ table = Table(show_header=False, box=None)
156
+ table.add_column("字段", no_wrap=True)
141
157
  table.add_column("值")
142
158
  for name, value in fields:
143
- table.add_row(name, value)
159
+ table.add_row(f"[dim]{name}[/dim]", value)
144
160
  console.print(table)
145
161
 
146
162