fcmd 0.3.5__tar.gz → 0.3.7__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 (335) hide show
  1. {fcmd-0.3.5 → fcmd-0.3.7}/.bumpversion.toml +1 -1
  2. fcmd-0.3.7/.claude/artifacts/fixes/dsl-entry-heavy-import-latency.md +83 -0
  3. fcmd-0.3.7/.claude/artifacts/plans/dsl-extension-cli-migration.md +180 -0
  4. {fcmd-0.3.5 → fcmd-0.3.7}/PKG-INFO +136 -8
  5. {fcmd-0.3.5 → fcmd-0.3.7}/README.md +132 -4
  6. {fcmd-0.3.5 → fcmd-0.3.7}/docs/changelog.rst +6 -1
  7. fcmd-0.3.7/pyproject.toml +107 -0
  8. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/__init__.py +1 -1
  9. fcmd-0.3.7/src/fcmd/_lazylog.py +57 -0
  10. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/apis/_tool_args.py +27 -10
  11. fcmd-0.3.7/src/fcmd/apis/_tool_exec.py +646 -0
  12. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/apis/dag.py +5 -2
  13. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/apis/report.py +4 -2
  14. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/apis/task.py +13 -6
  15. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/apis/toolkit.py +6 -0
  16. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/__init__.py +4 -2
  17. fcmd-0.3.7/src/fcmd/cli/_builtins/graph_cmd.py +157 -0
  18. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_builtins/info_cmd.py +53 -37
  19. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_discovery.py +110 -8
  20. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_doctor_helpers.py +2 -1
  21. fcmd-0.3.7/src/fcmd/cli/dev/envdev.py +1115 -0
  22. fcmd-0.3.7/src/fcmd/cli/dev/envdev_core.py +183 -0
  23. fcmd-0.3.7/src/fcmd/cli/dev/envdev_go.py +131 -0
  24. fcmd-0.3.7/src/fcmd/cli/dev/envdev_java.py +120 -0
  25. fcmd-0.3.7/src/fcmd/cli/dev/envdev_node.py +109 -0
  26. fcmd-0.3.7/src/fcmd/cli/dev/gittool.py +68 -0
  27. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/dev/packtool.py +10 -60
  28. fcmd-0.3.7/src/fcmd/cli/dev/pymake.py +73 -0
  29. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/main.py +14 -9
  30. fcmd-0.3.7/src/fcmd/commands/asciitool.toml +18 -0
  31. fcmd-0.3.7/src/fcmd/commands/autofmt.toml +25 -0
  32. fcmd-0.3.7/src/fcmd/commands/calcdate.toml +20 -0
  33. fcmd-0.3.7/src/fcmd/commands/casetool.toml +22 -0
  34. fcmd-0.3.7/src/fcmd/commands/clr.toml +10 -0
  35. fcmd-0.3.7/src/fcmd/commands/codetool.toml +26 -0
  36. fcmd-0.3.7/src/fcmd/commands/colortool.toml +22 -0
  37. fcmd-0.3.7/src/fcmd/commands/convtool.toml +21 -0
  38. fcmd-0.3.7/src/fcmd/commands/cryptool.toml +16 -0
  39. fcmd-0.3.7/src/fcmd/commands/csvtool.toml +26 -0
  40. fcmd-0.3.7/src/fcmd/commands/dockercmd.toml +24 -0
  41. fcmd-0.3.7/src/fcmd/commands/filedate.toml +13 -0
  42. fcmd-0.3.7/src/fcmd/commands/filelevel.toml +10 -0
  43. fcmd-0.3.7/src/fcmd/commands/filerename.toml +18 -0
  44. fcmd-0.3.7/src/fcmd/commands/filesearch.toml +12 -0
  45. fcmd-0.3.7/src/fcmd/commands/folderback.toml +11 -0
  46. fcmd-0.3.7/src/fcmd/commands/folderzip.toml +8 -0
  47. fcmd-0.3.7/src/fcmd/commands/gittool.toml +100 -0
  48. fcmd-0.3.7/src/fcmd/commands/hashfile.toml +14 -0
  49. fcmd-0.3.7/src/fcmd/commands/hashtool.toml +21 -0
  50. fcmd-0.3.7/src/fcmd/commands/idtool.toml +18 -0
  51. fcmd-0.3.7/src/fcmd/commands/imagetool.toml +48 -0
  52. fcmd-0.3.7/src/fcmd/commands/img2ico.toml +8 -0
  53. fcmd-0.3.7/src/fcmd/commands/inifile.toml +22 -0
  54. fcmd-0.3.7/src/fcmd/commands/iptool.toml +16 -0
  55. fcmd-0.3.7/src/fcmd/commands/jsontool.toml +22 -0
  56. fcmd-0.3.7/src/fcmd/commands/mathtool.toml +23 -0
  57. fcmd-0.3.7/src/fcmd/commands/nettool.toml +16 -0
  58. fcmd-0.3.7/src/fcmd/commands/packtool.toml +34 -0
  59. fcmd-0.3.7/src/fcmd/commands/padtool.toml +23 -0
  60. fcmd-0.3.7/src/fcmd/commands/pathtool.toml +20 -0
  61. fcmd-0.3.7/src/fcmd/commands/pdftool.toml +64 -0
  62. fcmd-0.3.7/src/fcmd/commands/piptool.toml +83 -0
  63. fcmd-0.3.7/src/fcmd/commands/pymake.toml +170 -0
  64. fcmd-0.3.7/src/fcmd/commands/randtool.toml +22 -0
  65. fcmd-0.3.7/src/fcmd/commands/regextool.toml +22 -0
  66. fcmd-0.3.7/src/fcmd/commands/reseticoncache.toml +20 -0
  67. fcmd-0.3.7/src/fcmd/commands/setenv.toml +9 -0
  68. fcmd-0.3.7/src/fcmd/commands/sshcopyid.toml +44 -0
  69. fcmd-0.3.7/src/fcmd/commands/stattool.toml +27 -0
  70. fcmd-0.3.7/src/fcmd/commands/sysinfo.toml +10 -0
  71. fcmd-0.3.7/src/fcmd/commands/taskkill.toml +17 -0
  72. fcmd-0.3.7/src/fcmd/commands/textdiff.toml +14 -0
  73. fcmd-0.3.7/src/fcmd/commands/timetool.toml +27 -0
  74. fcmd-0.3.7/src/fcmd/commands/tomltool.toml +22 -0
  75. fcmd-0.3.7/src/fcmd/commands/txttool.toml +22 -0
  76. fcmd-0.3.7/src/fcmd/commands/urlcheck.toml +12 -0
  77. fcmd-0.3.7/src/fcmd/commands/urltool.toml +22 -0
  78. fcmd-0.3.7/src/fcmd/commands/websave.toml +8 -0
  79. fcmd-0.3.7/src/fcmd/commands/which.toml +12 -0
  80. fcmd-0.3.7/src/fcmd/commands/writefile.toml +5 -0
  81. fcmd-0.3.7/src/fcmd/commands/xmltool.toml +22 -0
  82. fcmd-0.3.7/src/fcmd/commands/yamtool.toml +22 -0
  83. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/console.py +193 -58
  84. fcmd-0.3.7/src/fcmd/dsl/__init__.py +52 -0
  85. fcmd-0.3.7/src/fcmd/dsl/actions/__init__.py +128 -0
  86. fcmd-0.3.7/src/fcmd/dsl/actions/archive.py +58 -0
  87. fcmd-0.3.7/src/fcmd/dsl/actions/basic.py +39 -0
  88. fcmd-0.3.7/src/fcmd/dsl/actions/calc.py +419 -0
  89. fcmd-0.3.7/src/fcmd/dsl/actions/calcdate.py +139 -0
  90. fcmd-0.3.7/src/fcmd/dsl/actions/compute.py +64 -0
  91. fcmd-0.3.7/src/fcmd/dsl/actions/conv.py +298 -0
  92. fcmd-0.3.7/src/fcmd/dsl/actions/conv2.py +498 -0
  93. fcmd-0.3.5/src/fcmd/cli/crypto/cryptool.py → fcmd-0.3.7/src/fcmd/dsl/actions/crypto.py +48 -195
  94. fcmd-0.3.7/src/fcmd/dsl/actions/data.py +1087 -0
  95. fcmd-0.3.7/src/fcmd/dsl/actions/filenames.py +206 -0
  96. fcmd-0.3.7/src/fcmd/dsl/actions/fileops.py +299 -0
  97. fcmd-0.3.7/src/fcmd/dsl/actions/genid.py +73 -0
  98. fcmd-0.3.7/src/fcmd/dsl/actions/hashing.py +116 -0
  99. fcmd-0.3.7/src/fcmd/dsl/actions/media.py +1520 -0
  100. fcmd-0.3.7/src/fcmd/dsl/actions/net.py +641 -0
  101. fcmd-0.3.7/src/fcmd/dsl/actions/system.py +166 -0
  102. fcmd-0.3.7/src/fcmd/dsl/actions/text.py +650 -0
  103. fcmd-0.3.7/src/fcmd/dsl/decl.py +1000 -0
  104. fcmd-0.3.7/src/fcmd/dsl/entry.py +59 -0
  105. fcmd-0.3.7/src/fcmd/dsl/loader.py +97 -0
  106. fcmd-0.3.7/src/fcmd/dsl/synth.py +289 -0
  107. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/engine/dependency_runner.py +59 -8
  108. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/engine/executors.py +19 -7
  109. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/engine/layer_runner.py +10 -3
  110. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/engine/task_command.py +13 -4
  111. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/engine/task_runner.py +16 -6
  112. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/models/pdf.py +2 -1
  113. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli.py +127 -60
  114. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_asciitool.py +2 -2
  115. fcmd-0.3.7/tests/test_cli_autofmt.py +117 -0
  116. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_calcdate.py +1 -1
  117. fcmd-0.3.7/tests/test_cli_casetool.py +134 -0
  118. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_codetool.py +6 -4
  119. fcmd-0.3.7/tests/test_cli_colortool.py +135 -0
  120. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_convtool.py +6 -3
  121. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_cryptool.py +5 -5
  122. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_csvtool.py +2 -2
  123. fcmd-0.3.7/tests/test_cli_dockercmd.py +137 -0
  124. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_envdev.py +493 -7
  125. fcmd-0.3.7/tests/test_cli_filedate.py +118 -0
  126. fcmd-0.3.7/tests/test_cli_filelevel.py +127 -0
  127. fcmd-0.3.7/tests/test_cli_filerename.py +221 -0
  128. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_filesearch.py +2 -2
  129. fcmd-0.3.7/tests/test_cli_folderback.py +108 -0
  130. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_folderzip.py +3 -3
  131. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_gittool.py +85 -46
  132. fcmd-0.3.7/tests/test_cli_hashfile.py +124 -0
  133. fcmd-0.3.7/tests/test_cli_hashtool.py +114 -0
  134. fcmd-0.3.7/tests/test_cli_idtool.py +138 -0
  135. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_imagetool.py +7 -7
  136. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_img2ico.py +6 -5
  137. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_inifile.py +1 -1
  138. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_iptool.py +2 -2
  139. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_jsontool.py +2 -2
  140. fcmd-0.3.7/tests/test_cli_mathtool.py +163 -0
  141. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_nettool.py +21 -21
  142. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_packtool.py +72 -59
  143. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_padtool.py +2 -2
  144. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_pathtool.py +2 -2
  145. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_pdftool.py +9 -9
  146. fcmd-0.3.7/tests/test_cli_piptool.py +181 -0
  147. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_pymake.py +9 -3
  148. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_randtool.py +2 -2
  149. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_regextool.py +2 -2
  150. fcmd-0.3.7/tests/test_cli_reseticoncache.py +120 -0
  151. fcmd-0.3.7/tests/test_cli_setenv.py +87 -0
  152. fcmd-0.3.7/tests/test_cli_sshcopyid.py +160 -0
  153. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_stattool.py +2 -2
  154. fcmd-0.3.7/tests/test_cli_sysinfo.py +88 -0
  155. fcmd-0.3.7/tests/test_cli_taskkill.py +133 -0
  156. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_textdiff.py +2 -2
  157. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_timetool.py +2 -2
  158. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_tomltool.py +1 -1
  159. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_txttool.py +3 -3
  160. fcmd-0.3.7/tests/test_cli_urlcheck.py +255 -0
  161. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_urltool.py +6 -3
  162. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_websave.py +18 -18
  163. fcmd-0.3.7/tests/test_cli_which.py +82 -0
  164. fcmd-0.3.7/tests/test_cli_writefile.py +88 -0
  165. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_xmltool.py +2 -2
  166. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_yamtool.py +2 -2
  167. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_console.py +164 -0
  168. fcmd-0.3.7/tests/test_dsl.py +2622 -0
  169. fcmd-0.3.7/tests/test_dsl_actions.py +174 -0
  170. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_e2e_cli.py +1 -0
  171. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_e2e_workflow.py +3 -1
  172. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_engine_executors.py +244 -2
  173. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_engine_task_command.py +65 -0
  174. fcmd-0.3.7/tests/test_lazylog.py +55 -0
  175. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_perf_baseline.py +2 -1
  176. {fcmd-0.3.5 → fcmd-0.3.7}/uv.lock +60 -160
  177. fcmd-0.3.5/pyproject.toml +0 -104
  178. fcmd-0.3.5/src/fcmd/apis/_tool_exec.py +0 -340
  179. fcmd-0.3.5/src/fcmd/cli/_builtins/graph_cmd.py +0 -62
  180. fcmd-0.3.5/src/fcmd/cli/archive/folderzip.py +0 -81
  181. fcmd-0.3.5/src/fcmd/cli/calc/calcdate.py +0 -263
  182. fcmd-0.3.5/src/fcmd/cli/calc/mathtool.py +0 -246
  183. fcmd-0.3.5/src/fcmd/cli/calc/randtool.py +0 -274
  184. fcmd-0.3.5/src/fcmd/cli/calc/stattool.py +0 -346
  185. fcmd-0.3.5/src/fcmd/cli/calc/timetool.py +0 -289
  186. fcmd-0.3.5/src/fcmd/cli/conv/__init__.py +0 -10
  187. fcmd-0.3.5/src/fcmd/cli/conv/casetool.py +0 -199
  188. fcmd-0.3.5/src/fcmd/cli/conv/codetool.py +0 -313
  189. fcmd-0.3.5/src/fcmd/cli/conv/colortool.py +0 -280
  190. fcmd-0.3.5/src/fcmd/cli/conv/convtool.py +0 -315
  191. fcmd-0.3.5/src/fcmd/cli/conv/urltool.py +0 -249
  192. fcmd-0.3.5/src/fcmd/cli/crypto/__init__.py +0 -10
  193. fcmd-0.3.5/src/fcmd/cli/crypto/hashfile.py +0 -148
  194. fcmd-0.3.5/src/fcmd/cli/crypto/hashtool.py +0 -185
  195. fcmd-0.3.5/src/fcmd/cli/crypto/idtool.py +0 -172
  196. fcmd-0.3.5/src/fcmd/cli/data/__init__.py +0 -10
  197. fcmd-0.3.5/src/fcmd/cli/data/csvtool.py +0 -460
  198. fcmd-0.3.5/src/fcmd/cli/data/inifile.py +0 -282
  199. fcmd-0.3.5/src/fcmd/cli/data/jsontool.py +0 -282
  200. fcmd-0.3.5/src/fcmd/cli/data/tomltool.py +0 -295
  201. fcmd-0.3.5/src/fcmd/cli/data/xmltool.py +0 -316
  202. fcmd-0.3.5/src/fcmd/cli/data/yamtool.py +0 -331
  203. fcmd-0.3.5/src/fcmd/cli/dev/autofmt.py +0 -66
  204. fcmd-0.3.5/src/fcmd/cli/dev/dockercmd.py +0 -53
  205. fcmd-0.3.5/src/fcmd/cli/dev/envdev.py +0 -667
  206. fcmd-0.3.5/src/fcmd/cli/dev/gittool.py +0 -198
  207. fcmd-0.3.5/src/fcmd/cli/dev/piptool.py +0 -200
  208. fcmd-0.3.5/src/fcmd/cli/dev/pymake.py +0 -312
  209. fcmd-0.3.5/src/fcmd/cli/fileops/__init__.py +0 -10
  210. fcmd-0.3.5/src/fcmd/cli/fileops/filedate.py +0 -173
  211. fcmd-0.3.5/src/fcmd/cli/fileops/filelevel.py +0 -148
  212. fcmd-0.3.5/src/fcmd/cli/fileops/filerename.py +0 -219
  213. fcmd-0.3.5/src/fcmd/cli/fileops/filesearch.py +0 -278
  214. fcmd-0.3.5/src/fcmd/cli/fileops/folderback.py +0 -104
  215. fcmd-0.3.5/src/fcmd/cli/fileops/pathtool.py +0 -222
  216. fcmd-0.3.5/src/fcmd/cli/fileops/writefile.py +0 -40
  217. fcmd-0.3.5/src/fcmd/cli/media/imagetool.py +0 -576
  218. fcmd-0.3.5/src/fcmd/cli/media/img2ico.py +0 -265
  219. fcmd-0.3.5/src/fcmd/cli/media/pdftool.py +0 -716
  220. fcmd-0.3.5/src/fcmd/cli/net/iptool.py +0 -213
  221. fcmd-0.3.5/src/fcmd/cli/net/nettool.py +0 -184
  222. fcmd-0.3.5/src/fcmd/cli/net/sshcopyid.py +0 -95
  223. fcmd-0.3.5/src/fcmd/cli/net/websave.py +0 -591
  224. fcmd-0.3.5/src/fcmd/cli/system/__init__.py +0 -10
  225. fcmd-0.3.5/src/fcmd/cli/system/clr.py +0 -64
  226. fcmd-0.3.5/src/fcmd/cli/system/reseticoncache.py +0 -76
  227. fcmd-0.3.5/src/fcmd/cli/system/setenv.py +0 -46
  228. fcmd-0.3.5/src/fcmd/cli/system/sysinfo.py +0 -121
  229. fcmd-0.3.5/src/fcmd/cli/system/taskkill.py +0 -100
  230. fcmd-0.3.5/src/fcmd/cli/system/which.py +0 -66
  231. fcmd-0.3.5/src/fcmd/cli/text/__init__.py +0 -10
  232. fcmd-0.3.5/src/fcmd/cli/text/asciitool.py +0 -189
  233. fcmd-0.3.5/src/fcmd/cli/text/padtool.py +0 -254
  234. fcmd-0.3.5/src/fcmd/cli/text/regextool.py +0 -250
  235. fcmd-0.3.5/src/fcmd/cli/text/textdiff.py +0 -241
  236. fcmd-0.3.5/src/fcmd/cli/text/txttool.py +0 -218
  237. fcmd-0.3.5/tests/test_cli_autofmt.py +0 -145
  238. fcmd-0.3.5/tests/test_cli_casetool.py +0 -242
  239. fcmd-0.3.5/tests/test_cli_clr.py +0 -110
  240. fcmd-0.3.5/tests/test_cli_colortool.py +0 -302
  241. fcmd-0.3.5/tests/test_cli_dockercmd.py +0 -151
  242. fcmd-0.3.5/tests/test_cli_filedate.py +0 -146
  243. fcmd-0.3.5/tests/test_cli_filelevel.py +0 -232
  244. fcmd-0.3.5/tests/test_cli_filerename.py +0 -455
  245. fcmd-0.3.5/tests/test_cli_folderback.py +0 -152
  246. fcmd-0.3.5/tests/test_cli_hashfile.py +0 -147
  247. fcmd-0.3.5/tests/test_cli_hashtool.py +0 -213
  248. fcmd-0.3.5/tests/test_cli_idtool.py +0 -236
  249. fcmd-0.3.5/tests/test_cli_mathtool.py +0 -281
  250. fcmd-0.3.5/tests/test_cli_piptool.py +0 -336
  251. fcmd-0.3.5/tests/test_cli_reseticoncache.py +0 -116
  252. fcmd-0.3.5/tests/test_cli_setenv.py +0 -63
  253. fcmd-0.3.5/tests/test_cli_sshcopyid.py +0 -95
  254. fcmd-0.3.5/tests/test_cli_sysinfo.py +0 -118
  255. fcmd-0.3.5/tests/test_cli_taskkill.py +0 -151
  256. fcmd-0.3.5/tests/test_cli_which.py +0 -74
  257. fcmd-0.3.5/tests/test_cli_writefile.py +0 -69
  258. {fcmd-0.3.5 → fcmd-0.3.7}/.copier-answers.yml +0 -0
  259. {fcmd-0.3.5 → fcmd-0.3.7}/.coveragerc +0 -0
  260. {fcmd-0.3.5 → fcmd-0.3.7}/.gitattributes +0 -0
  261. {fcmd-0.3.5 → fcmd-0.3.7}/.github/workflows/ci.yml +0 -0
  262. {fcmd-0.3.5 → fcmd-0.3.7}/.github/workflows/release.yml +0 -0
  263. {fcmd-0.3.5 → fcmd-0.3.7}/.gitignore +0 -0
  264. {fcmd-0.3.5 → fcmd-0.3.7}/.pre-commit-config.yaml +0 -0
  265. {fcmd-0.3.5 → fcmd-0.3.7}/.readthedocs.yaml +0 -0
  266. {fcmd-0.3.5 → fcmd-0.3.7}/.vscode/settings.json +0 -0
  267. {fcmd-0.3.5 → fcmd-0.3.7}/LICENSE +0 -0
  268. {fcmd-0.3.5 → fcmd-0.3.7}/Makefile +0 -0
  269. {fcmd-0.3.5 → fcmd-0.3.7}/docs/_static/.gitkeep +0 -0
  270. {fcmd-0.3.5 → fcmd-0.3.7}/docs/api.rst +0 -0
  271. {fcmd-0.3.5 → fcmd-0.3.7}/docs/conf.py +0 -0
  272. {fcmd-0.3.5 → fcmd-0.3.7}/docs/index.rst +0 -0
  273. {fcmd-0.3.5 → fcmd-0.3.7}/pyrefly.toml +0 -0
  274. {fcmd-0.3.5 → fcmd-0.3.7}/pytest.ini +0 -0
  275. {fcmd-0.3.5 → fcmd-0.3.7}/ruff.toml +0 -0
  276. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/__main__.py +0 -0
  277. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/apis/__init__.py +0 -0
  278. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/apis/context.py +0 -0
  279. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/apis/errors.py +0 -0
  280. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/apis/profiling.py +0 -0
  281. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_builtins/__init__.py +0 -0
  282. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_builtins/completion_cmd.py +0 -0
  283. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_builtins/doctor_cmd.py +0 -0
  284. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_builtins/env_cmd.py +0 -0
  285. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_builtins/profiler_cmd.py +0 -0
  286. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_builtins/yaml_cmd.py +0 -0
  287. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_common.py +0 -0
  288. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_completion_scripts.py +0 -0
  289. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_env_helpers.py +0 -0
  290. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_env_persist.py +0 -0
  291. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/_profiler_helpers.py +0 -0
  292. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/archive/__init__.py +0 -0
  293. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/archive/archivex.py +0 -0
  294. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/archive/zipencrypt.py +0 -0
  295. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/calc/__init__.py +0 -0
  296. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/calc/lscalc.py +0 -0
  297. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/dev/__init__.py +0 -0
  298. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/dev/bumpversion.py +0 -0
  299. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/media/__init__.py +0 -0
  300. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/media/screenshot.py +0 -0
  301. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/net/__init__.py +0 -0
  302. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/cli/net/portcheck.py +0 -0
  303. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/engine/__init__.py +0 -0
  304. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/models/__init__.py +0 -0
  305. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/models/command.py +0 -0
  306. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/models/filefilter.py +0 -0
  307. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/models/version.py +0 -0
  308. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/orchestration/__init__.py +0 -0
  309. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/orchestration/conditions.py +0 -0
  310. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/orchestration/yaml_loader.py +0 -0
  311. {fcmd-0.3.5 → fcmd-0.3.7}/src/fcmd/py.typed +0 -0
  312. {fcmd-0.3.5 → fcmd-0.3.7}/tests/__init__.py +0 -0
  313. {fcmd-0.3.5 → fcmd-0.3.7}/tests/conftest.py +0 -0
  314. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_archivex.py +0 -0
  315. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_bumpversion.py +0 -0
  316. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_lscalc.py +0 -0
  317. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_portcheck.py +0 -0
  318. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_profiler.py +0 -0
  319. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_screenshot.py +0 -0
  320. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_cli_zipencrypt.py +0 -0
  321. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_context.py +0 -0
  322. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_e2e_tools.py +0 -0
  323. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_env_persist.py +0 -0
  324. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_fcmd.py +0 -0
  325. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_graph.py +0 -0
  326. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_init.py +0 -0
  327. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_models.py +0 -0
  328. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_models_pdf.py +0 -0
  329. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_orchestration_conditions.py +0 -0
  330. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_orchestration_yaml_loader.py +0 -0
  331. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_profiling.py +0 -0
  332. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_report.py +0 -0
  333. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_task.py +0 -0
  334. {fcmd-0.3.5 → fcmd-0.3.7}/tests/test_toolkit.py +0 -0
  335. {fcmd-0.3.5 → fcmd-0.3.7}/tox.ini +0 -0
@@ -1,5 +1,5 @@
1
1
  [tool.bumpversion]
2
- current_version = "0.3.5"
2
+ current_version = "0.3.7"
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)。
@@ -0,0 +1,180 @@
1
+ # DSL 扩展与更多 CLI 脚本配置迁移 Implementation Plan
2
+
3
+ > Status: APPROVED
4
+ > Source: user request(无 spec;需求摘要见下)
5
+ > Mode: (default) Planner → Architect → Critic,1 轮迭代通过
6
+ > Iterations: 1 / 3
7
+ > Author: zhou
8
+ > Last updated: 2026-10-05
9
+
10
+ ## Requirements summary
11
+
12
+ 将 fcmd 中更多 exec 型 CLI 子命令迁移到 TOML 命令定义 DSL(`src/fcmd/commands/*.toml`)。
13
+ 经代码核验,剩余可迁移目标被两个 DSL 能力缺口阻塞:
14
+
15
+ 1. **list 参数**:`piptool i packages: list[str]` 需要 variadic positional 参数;
16
+ 引擎 argparse 层已支持 `list[X]` 注解(`apis/_tool_args.py:229,326`),但 DSL
17
+ `_PARAM_TYPES` 未收录,且 tuple cmd 的 `{占位符}` 插值是字符串级
18
+ (`apis/_tool_exec.py:125-145`),list 值会插成单个带空格 token,无 shell 执行下错误。
19
+ 2. **bool 固定 token**:`autofmt lint --fix` 需要追加 `["--fix", "--unsafe-fixes"]`;
20
+ 现 DSL bool 只能插值 `true/false`(`_tool_exec.py:112-122`),无法表达固定 token 追加。
21
+
22
+ 非候选(有 Python 逻辑,保留模块):`dockercmd`(getpass 动态默认 + 结果打印,迁移需
23
+ 为单一命令新增 env-default 能力,违反最小代码)、`reseticoncache`(平台守卫 + 文件存在
24
+ 判断)、`sshcopyid`(远程脚本构造)、`bumpversion`(两阶段版本扫描)、`envdev*`、
25
+ `packtool`、`archivex`、`nettool`、`iptool`、`setenv`、`writefile`。
26
+
27
+ ## Acceptance criteria
28
+
29
+ - AC-1: DSL 支持 `type="list"` 参数——positional(无 default)映射 `list[str]` 注解,
30
+ tuple cmd 中**独占占位符项**(整项恰为 `{name}`)按元素展开,str cmd 中按空格拼接
31
+ (沿用 `_value_to_cmd_str`);测试覆盖两种 cmd 形态。
32
+ - AC-2: DSL 支持 bool 参数 `on` 字段——值为 truthy 时向 cmd 尾部追加固定 token 元组;
33
+ `on` 仅 `type="bool"` 合法,非 bool 声明报 `CommandDeclError`;测试覆盖启用/未启用/
34
+ 校验失败。
35
+ - AC-3: `autofmt` 两个子命令(fmt/lint)全部迁入 `src/fcmd/commands/autofmt.toml`,
36
+ Python 模块 `src/fcmd/cli/dev/autofmt.py` 删除。
37
+ - AC-4: `piptool` 的 `i`/`up` 迁入 `src/fcmd/commands/piptool.toml`;模块
38
+ `src/fcmd/cli/dev/piptool.py` 仅保留 `u`/`r`/`f` + main;合并注册后
39
+ `fcmd piptool --help` 同时可见 5 个子命令。
40
+ - AC-5: `make check` 本地全绿(ruff/pyrefly/全量测试),覆盖率不低于 95.5%。
41
+
42
+ ## RALPLAN-DR
43
+
44
+ ### Principles
45
+
46
+ - 最小代码:只为解锁真实迁移目标扩展 DSL,不为单一命令加能力(env-default 因
47
+ dockercmd 一个候选而被砍)。
48
+ - 沿用既有抽象:list 展开复用引擎既有 `list[X]`→nargs 推导与 `_value_to_cmd_str`;
49
+ bool on-token 注入沿用 `__dsl_empty_body__` 的函数属性模式,不膨胀 ToolSpec。
50
+ - 外科手术式改动:只动 DSL 三处与被迁移模块,不顺手重构 `_tool_exec` 其他逻辑。
51
+ - 行为变化显式声明:迁移导致的输出差异标注"待用户复核"。
52
+
53
+ ### Decision drivers
54
+
55
+ 1. 迁移收益(解锁多少子命令)vs DSL 复杂度。
56
+ 2. 用户级 `~/.fcmd/commands.toml` 同样受益于 list/on(通用能力,非内置专用)。
57
+ 3. 回归风险:引擎插值路径是热路径(所有 DSL 命令共用),改动必须向后兼容。
58
+
59
+ ### Viable options
60
+
61
+ **Option A: 最小 DSL 扩展 + 定向迁移(选定)**
62
+ - 实现思路:DSL 增 `type="list"` 与 bool `on` 两个字段级能力;迁移 autofmt 全部 +
63
+ piptool i/up;dockercmd 等保留 Python。
64
+ - 改动文件:`dsl/decl.py`、`dsl/synth.py`、`apis/_tool_exec.py`、新建
65
+ `commands/autofmt.toml`、`commands/piptool.toml`、删 `cli/dev/autofmt.py`、瘦
66
+ `cli/dev/piptool.py`、测试、README DSL 速查。
67
+ - Pros:解锁 4 个子命令;两个能力均为通用 DSL 语义(用户级配置同享);改动面小。
68
+ - Cons:`_expand_cmd_placeholders` 增加元素级展开分支(热路径多一个 isinstance 判断);
69
+ autofmt 的完成提示 print 丢失。
70
+
71
+ **Option B: 零 DSL 扩展,仅迁今日可表达者**
72
+ - 实现思路:只迁 `piptool up`(零参数纯 exec)。
73
+ - Pros:零引擎改动。
74
+ - Cons:只解锁 1 个子命令,不满足"更多 CLI 脚本迁移"目标。
75
+ - Invalidation rationale:收益过低,rejected。
76
+
77
+ **Option C: 大而全扩展(list + on + env-default + post-run 消息钩子),迁 autofmt/piptool/dockercmd 全部**
78
+ - 实现思路:为 dockercmd 的 `getpass.getuser()` 增加 `{env:USERNAME}` 式默认值,
79
+ 为结果打印增加 post-run 消息字段。
80
+ - Cons:env-default 与 post-run 消息各只服务一个候选命令(单次使用不抽象);
81
+ post-run 消息钩子改变 DSL 定位(纯 exec/编排 → 混入展示逻辑); rejected。
82
+
83
+ ### Implementation steps(基于 Option A)
84
+
85
+ 1. **decl.py 扩类型与参数键** — `src/fcmd/dsl/decl.py:44`(`_PARAM_TYPES` 增
86
+ `"list"`)、`decl.py:73`(`_PARAM_KEYS` 增 `"on"`)、`decl.py:163-189`
87
+ (`ParamDecl` 增 `on: tuple[str, ...] = ()` 字段与 docstring)、`decl.py:261-337`
88
+ 附近参数校验(`on` 仅 `type="bool"` 合法、元素非空,违反抛 `CommandDeclError`)。
89
+ 2. **synth.py 类型映射与 on 注入** — `src/fcmd/dsl/synth.py:39`
90
+ (`_TYPE_MAP["list"] = list[str]`);`synth.py:88-122` `_synthesize_func` 末尾
91
+ 注入 `dsl_command.__dsl_param_on__ = {p.name: p.on for p in decl.args if p.on}`
92
+ (沿用 `__dsl_empty_body__` 函数属性模式,零 ToolSpec 改动)。
93
+ 3. **_tool_exec.py 展开语义** — `src/fcmd/apis/_tool_exec.py:138-145`
94
+ `_expand_cmd_placeholders`:
95
+ - tuple/list cmd 项若**整项恰为 `{name}`** 且对应值为 list → 以元素逐项替换该
96
+ 位置(元素级展开);部分占位(`prefix-{name}`)且值为 list 时保持现状
97
+ (`_value_to_cmd_str` 空格拼接),并在 decl.py 校验期对"签名内 list 参数在
98
+ cmd 项中以非独占形式出现"给出 `CommandDeclError`(声明期即可判定)。
99
+ - 展开后按 `getattr(spec.func, "__dsl_param_on__", {})` 对 truthy bool 值向
100
+ cmd 尾部追加 token 元组。
101
+ 4. **新建 commands/autofmt.toml** — `src/fcmd/commands/autofmt.toml`:多子命令形态;
102
+ `fmt`(args.target type=path default=".",cmd `["ruff","format","{target}"]`);
103
+ `lint`(args.target 同上 + args.fix type=bool default=false
104
+ `on=["--fix","--unsafe-fixes"]`,cmd `["ruff","check","{target}"]`)。
105
+ 注意 `default="."` 使 target 成为选项(现状为 positional 带 default,签名语义
106
+ 一致);如需保持 positional 语义则 target 不写 default 而在 cmd 侧无占位回退——
107
+ 以现状签名(`target: str = "."` → 选项)为准。
108
+ 5. **新建 commands/piptool.toml** — `src/fcmd/commands/piptool.toml`:
109
+ `i`(args.packages type=list 无 default → positional nargs,cmd
110
+ `["pip","install","{packages}"]`);`up`(零参,cmd
111
+ `["python","-m","pip","install","--upgrade","pip"]`)。
112
+ 6. **瘦身/删除模块** — 删除 `src/fcmd/cli/dev/autofmt.py`;`src/fcmd/cli/dev/piptool.py`
113
+ 删除 `pip_install`/`pip_upgrade` 及 `__all__` 对应项(`_get_installed_packages` 等
114
+ 私有辅助仅 u/r/f 使用者保留)。
115
+ 7. **测试** — `tests/test_dsl.py`:list 类型解析/校验(含非独占占位报错)、on 字段
116
+ 校验(非 bool 报错)、合成签名 list 注解、展开语义(tuple 独占展开 / str 空格
117
+ 拼接 / on 追加);`tests/test_cli_autofmt*` 改走 DSL 注册入口或随模块删除;
118
+ `tests/test_cli_piptool*` 删 i/up 用例、补合并注册后 5 子命令可见性断言
119
+ (AC-4)。
120
+ 8. **README 同步** — README「命令定义 DSL」字段速查补 `type="list"` 与 `on`。
121
+
122
+ ### Workspace setup
123
+
124
+ - 实施前运行 `git status --short` 与 `git branch --show-current`。
125
+ - 本项目惯例为 main 分支直接小步提交(`make push`),历次迭代未用 worktree;沿用
126
+ 项目惯例,不建 worktree。若工作区不干净,先与用户确认是否混入既有改动。
127
+
128
+ ## Risks & mitigations
129
+
130
+ | Risk | Mitigation |
131
+ |---|---|
132
+ | 元素级展开改变既有 str 插值行为(回归) | 仅"独占占位符 + list 值"走新分支,str 值路径不变;`tests/test_dsl.py` 补回归用例(既有 pymake/gittool 全量用例作回归网) |
133
+ | 非 shell tuple cmd 中 list 部分占位产生错误单 token | decl.py 声明期校验直接报错(签名内类型可查),不给运行时静默错误机会 |
134
+ | `__dsl_param_on__` 依赖函数属性约定,跨模块脆弱 | 与 `__dsl_empty_body__` 同模式且同文件族维护;在 synth.py docstring 注明契约 |
135
+ | autofmt 迁移后丢失完成提示输出 | 行为变化显式记录,标注"待用户复核";如需保留,后续评估 post-run 消息能力(本次不做) |
136
+ | piptool i 空 packages → `pip install` 无参报错 | 与 Python 版现状一致(positional 至少一参,argparse 拦截),行为不变 |
137
+ | 覆盖率回落(新分支未覆盖) | 新分支逐条配测试;AC-5 以 cov ≥ 95.5% 为门禁 |
138
+
139
+ ## Verification steps
140
+
141
+ - AC-1/AC-2:`uv run pytest tests/test_dsl.py -k "list or on_token"` 全绿。
142
+ - AC-3:`uv run fcmd autofmt fmt --target src`、`uv run fcmd autofmt lint --fix`
143
+ 行为正确;仓库内 `grep -r "autofmt" src/fcmd/cli` 无残留。
144
+ - AC-4:`uv run fcmd piptool --help` 可见 i/u/r/f/up 五个子命令;`uv run fcmd piptool i --help`
145
+ 显示 packages positional。
146
+ - AC-5:`make check` 本地全绿,cov ≥ 95.5%。
147
+
148
+ ## ADR
149
+
150
+ - **Decision**: DSL 新增 `type="list"` 参数与 bool 参数 `on` 固定 token 两个通用能力,
151
+ 据此将 autofmt 全部子命令与 piptool 的 i/up 迁入内置 TOML;其余含 Python 逻辑的
152
+ 模块保留。
153
+ - **Drivers**: 迁移收益/复杂度比(driver 1 起决定作用);用户级配置同享通用能力
154
+ (driver 2);热路径向后兼容(driver 3)。
155
+ - **Alternatives considered**: Option B(零扩展)rejected——收益过低;Option C
156
+ (大而全)rejected——env-default/post-run 均为单次使用抽象且改变 DSL 定位。
157
+ - **Why chosen**: 两个扩展均为声明式 exec DSL 的通用语义(非单一命令定制),改动
158
+ 集中在三个文件 + 声明期校验,风险可控;迁移目标全部达成。
159
+ - **Consequences**: 用户级 commands.toml 获得同能力;`_expand_cmd_placeholders`
160
+ 语义文档化义务增加;autofmt 输出行为变化需用户复核。
161
+ - **Follow-ups**: dockercmd 若后续确认要迁,需先设计 env-default 语义(进 backlog,
162
+ 本次明确不做)。
163
+
164
+ ## Open questions
165
+
166
+ - autofmt 迁移后不再打印"ruff format 完成"类提示——**待用户复核**(默认接受丢失,
167
+ 与 pymake/gittool 已迁移子命令行为一致)。
168
+
169
+ ## Review trail
170
+
171
+ - Planner draft v1: 提出 A/B/C 三选项,选定 A(最小扩展 + 定向迁移),步骤 8 条
172
+ 全部 cite 文件与行号。
173
+ - Architect challenge v1: steelman "on-token 是为 autofmt lint 一个命令加的能力"
174
+ → 反驳成立性不足(bool flag→token 是用户级配置通用场景);确认唯一真 tension
175
+ 是热路径 `_expand_cmd_placeholders` 复杂度 vs DSL 表达力,取舍依据 = 新分支仅
176
+ 窄条件命中 + 声明期校验拦截非法形态;采纳"非独占 list 占位声明期报错"。
177
+ - Critic verdict v1: APPROVED(7 维度全过)。Reservations:(1) autofmt 输出变化
178
+ 必须显式标注待用户复核(已列入 Open questions);(2) `__dsl_param_on__` 函数
179
+ 属性契约需在 synth.py docstring 写明(已并入 step 2)。
180
+ - Final iterations: 1 / 3。
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: fcmd
3
- Version: 0.3.5
3
+ Version: 0.3.7
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 个工具模块,按用途分组:
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
 
@@ -151,7 +151,7 @@ fcmd completion --shell fish | source # fish
151
151
  | `autofmt` | - | 代码格式化与检查(封装 ruff format/check) |
152
152
  | `bumpversion` | - | 版本号自动管理(patch/minor/major + git tag) |
153
153
  | `packtool` | - | Python 打包(源码/依赖/wheel/嵌入式 Python/zip/清理) |
154
- | `piptool` | - | pip 包管理(安装/卸载/重装/下载/升级/冻结) |
154
+ | `piptool` | `pipt` | pip 包管理(安装/卸载/重装/下载/升级/冻结,DSL 声明 + compute 通配符展开) |
155
155
 
156
156
  ### 文件与目录
157
157
 
@@ -220,9 +220,10 @@ fcmd completion --shell fish | source # fish
220
220
  | `which` | - | 查找可执行命令路径 |
221
221
  | `clr` | - | 跨平台清屏 |
222
222
  | `screenshot` | - | 跨平台截图(Windows PowerShell / macOS screencapture / Linux gnome-screenshot) |
223
- | `reseticoncache` | - | 重置 Windows 图标缓存(仅 Windows) |
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
 
@@ -363,6 +364,133 @@ graph = load_yaml("deploy.yaml")
363
364
  report = run(graph, strategy="dependency")
364
365
  ```
365
366
 
367
+ ## 命令定义 DSL
368
+
369
+ exec 型简单命令无需编写 Python 模块,用 TOML 声明即可注册为工具。两种形态:**单命令**(`[commands.<name>]`,如内置的 `clr`)与**多子命令**(`[commands.<tool>.<sub>]`,如内置的 `pymake`/`gittool`/`autofmt` 纯 exec 子命令)。两级配置:包内 `fcmd/commands/*.toml`(出厂命令,按工具拆分为多个 TOML 文件)与 `${FCMD_HOME:-~/.fcmd}/commands.toml`(用户自定义,同名可覆盖内置单命令;与 Python 模块工具重名时 Python 优先,多子命令形态逐子命令合并注册——同名子命令先注册者优先,用户仅可新增子命令)。
370
+
371
+ ```toml
372
+ # ~/.fcmd/commands.toml
373
+ [commands.hello]
374
+ help = "向某人问好"
375
+ cmd = "echo 你好 {name} x{count}"
376
+ cwd = "/tmp" # 可选:工作目录(支持 {参数名} 插值)
377
+ timeout = 30 # 可选:超时秒数
378
+ env = { LANG = "zh" } # 可选:环境变量(值支持插值)
379
+ message = "同步完成: {name}" # 可选:执行成功后打印的完成消息(支持插值,dry-run 不打印;目标被 when 守卫跳过时不打印)
380
+ fail_message = "同步失败" # 可选:执行失败后打印的失败消息(支持插值,如修复提示)
381
+
382
+ [commands.hello.args.name] # 无 default → positional 参数
383
+ help = "目标名字"
384
+
385
+ [commands.hello.args.count]
386
+ type = "int" # str(默认)/int/float/bool/path/choices/list
387
+ default = 1 # 有 default → --count 选项(list 无 default → positional 多值)
388
+ help = "次数"
389
+
390
+ [commands.publish] # {参数名:content} 文件内容插值:读取文件内容(展开 ~,utf-8,去首尾空白)替换进 cmd
391
+ help = "发布文件备注"
392
+ cmd = ["notes-cli", "publish", "--text", "{note:content}"]
393
+ [commands.publish.args.note]
394
+ type = "path" # content 插值仅支持 type=str/path 参数
395
+ default = "~/note.txt"
396
+
397
+ [commands.pkg.install] # list 参数:独占占位符按元素展开(无 shell 每元素一个 token)
398
+ help = "批量安装"
399
+ cmd = ["pip", "install", "{packages}"]
400
+ [commands.pkg.install.args.packages]
401
+ type = "list"
402
+ help = "包名列表"
403
+
404
+ [commands.fmttool.lint] # bool 参数 on:值为真时向 cmd 尾部追加固定 token
405
+ help = "检查并可选自动修复"
406
+ cmd = ["ruff", "check", "{target}"]
407
+ [commands.fmttool.lint.args.target]
408
+ type = "str"
409
+ default = "."
410
+ [commands.fmttool.lint.args.fix]
411
+ type = "bool"
412
+ default = false
413
+ on = ["--fix", "--unsafe-fixes"]
414
+
415
+ [commands.deploy.build] # when 守卫:探针不满足 → SKIPPED(命令退出码 0)
416
+ help = "有代码变更才构建"
417
+ cmd = ["make", "build"]
418
+ when = {cmd = "git status --porcelain", expect = "nonempty"} # 探针 cmd/path 二选一,支持 {参数名} 插值
419
+ allow_upstream_skip = true # 上游被跳过时豁免执行(默认连坐跳过)
420
+
421
+ [commands.backup.files] # 探针 expect:cmd 用 nonempty/empty/success/failure,path 用 exists/missing
422
+ help = "目录已备份则跳过"
423
+ cmd = ["robocopy", "{source}", "{dest}", "/mir"]
424
+ when = {path = "{dest}", expect = "missing"} # path 探针支持插值与 ~ 展开
425
+
426
+ [commands.deploy.all] # 聚合可声明 args:值经共享变量流入子任务插值
427
+ help = "构建并部署"
428
+ needs = ["build"]
429
+ [commands.deploy.all.args.tag]
430
+ type = "str"
431
+ default = "latest"
432
+
433
+ [commands.dockercmd.login] # tty 透传:stdout/stderr 不捕获(交互式命令)
434
+ help = "登录 Docker 镜像仓库"
435
+ cmd = ["docker", "login", "--username", "{username}", "{registry}"]
436
+ tty = true # 密码提示可见可输入
437
+ message = "已登录镜像仓库: {registry} (用户: {username})"
438
+ [commands.dockercmd.login.args.username]
439
+ default = ""
440
+ default_env = ["USERNAME", "LOGNAME", "USER", "LNAME"] # 值等于 default 时按链取第一个非空环境变量
441
+
442
+ [commands.setenv] # action 原语:进程内动作(fn 任务,非 subprocess)
443
+ help = "设置环境变量"
444
+ action = "setenv" # 内建动作名;参数 schema 来自动作实现签名(禁声明 args)
445
+ message = "环境变量 {name} 已设置"
446
+
447
+ [commands.pkg.u] # compute 计算原语:采集→计算→注入 exec 参数(输出管道)
448
+ help = "卸载包(支持通配符)"
449
+ cmd = ["pip", "uninstall", "-y", "{expanded}"]
450
+ [commands.pkg.u.args.packages]
451
+ type = "list"
452
+ [commands.pkg.u.compute]
453
+ action = "pip_expand" # 计算动作:输入按实现签名取 CLI 变量,返回值注入 {expanded}
454
+ as = "expanded" # 空结果(空 list/空串)→ SKIPPED;同链同名只计算一次
455
+
456
+ [commands.sync]
457
+ help = "同步(跨平台示例)"
458
+ win.cmd = "robocopy src dst /mir" # 字符串 → shell 执行
459
+ unix.cmd = ["rsync", "-a", "src/", "dst"] # 数组 → 无 shell(注入面最小)
460
+ aliases = ["sy"]
461
+
462
+ # 多子命令形态:与 Python 模块同名的工具逐子命令合并注册
463
+ [commands.mytool.go]
464
+ help = "执行构建"
465
+ cmd = ["make", "build"]
466
+
467
+ [commands.mytool.all]
468
+ help = "聚合(needs 编排,无 cmd)"
469
+ needs = ["go"]
470
+ strategy = "thread" # sequential/thread/async/dependency
471
+ ```
472
+
473
+ ```bash
474
+ fcmd hello world --count 3 # echo 你好 world x3
475
+ fcmd sy # 别名调用
476
+ fcmd mytool all # 聚合:先 go 后 all(thread 并行)
477
+ ```
478
+
479
+ 能力边界:单命令与多子命令 exec 形态(平台分支 / 参数(含 list 多值、bool on 固定 token 与 default_env 环境回退链) / 插值(含 `{参数名:content}` 文件内容插值) / cwd / env / timeout / when 守卫探针(支持参数插值与返回码判定)/ needs 聚合(含 allow_upstream_skip 豁免连坐)/ 聚合 args 共享插值 / tty 透传 / message 与 fail_message post-run 消息 / strategy / action 内建动作原语(进程内 fn 任务,参数 schema 来自动作实现签名)/ compute 计算原语(进程内计算动作返回值注入 exec 参数,输出管道形态));matrix/if 条件编排属 YAML 编排的领地。
480
+
481
+ ### DSL 逻辑边界
482
+
483
+ 判断一段命令逻辑能否迁入 DSL:
484
+
485
+ | 类别 | 判定 | 例子 |
486
+ |------|------|------|
487
+ | 纯 exec(含 when 守卫与聚合编排) | 可迁 DSL | `gittool a/i`(守卫链 `_init`/`_add`/`_commit`)、`piptool d/f`、`dockercmd login`(tty 透传 + default_env 环境回退)、`sshcopyid`(when 探针 + env 插值传 SSHPASS + `{参数名:content}` 公钥内容)、`reseticoncache`(win shell 链 + unix 提示分支) |
488
+ | 输出管道(采集→计算→注入 exec 参数) | 可迁 DSL(compute 计算原语) | `piptool u/r`(`pip list` 采集 + 通配符展开/受保护包过滤注入 uninstall/install 参数;r 经 `_uninstall`/`_install` 隐藏链编排) |
489
+ | 输出管道(计算主体为进程内逻辑,输出解析仅子步骤) | 保留 Python | `portcheck`(socket 探测主体 + lsof/netstat 占用查询回显) |
490
+ | 动态遍历(运行时枚举文件系统) | 保留 Python | `gittool isub`、`envdev` 系列 |
491
+ | 进程内副作用(无法映射为子进程) | 副作用型动作可迁 DSL(action 原语) | `setenv`/`writefile`/`filedate`/`filerename`/`filelevel`/`folderback`/`taskkill`/`which`/`sysinfo`(已迁入 action 原语;taskkill 逐条目过程回显 + 绝对路径防递归,which 逐条查找回显,sysinfo 诊断信息打印,均无返回值消费);`pathtool`/`filesearch`/`nettool`/`iptool` 产出计算结果(路径解析计算/搜索结果/HTTP 响应/IP 解析),非副作用型动作,保留 Python |
492
+ | 多步有状态流程 | 保留 Python | `bumpversion`、`packtool` |
493
+
366
494
  ## 执行策略
367
495
 
368
496
  四种策略通过 `fx.run(graph, strategy=...)` 或 `fcmd yaml --strategy ...` 指定: