pyddock 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 (103) hide show
  1. pyddock-0.3.7/.hypothesis/constants/0527dc28646c9360 +4 -0
  2. pyddock-0.3.7/.hypothesis/constants/30ee1be194c33a1d +4 -0
  3. pyddock-0.3.7/.hypothesis/constants/453881856851f311 +4 -0
  4. pyddock-0.3.7/.hypothesis/constants/5f020be48d90847d +4 -0
  5. pyddock-0.3.7/.hypothesis/constants/6627988645b1286c +4 -0
  6. pyddock-0.3.7/.hypothesis/constants/671fefe2f5d9935c +4 -0
  7. pyddock-0.3.7/.hypothesis/constants/805cbcbb07e3332d +4 -0
  8. pyddock-0.3.7/.hypothesis/constants/93108f7a5abfd484 +4 -0
  9. pyddock-0.3.7/.hypothesis/constants/d115f833e13f93f9 +4 -0
  10. pyddock-0.3.7/.hypothesis/constants/df249c25d70870dc +4 -0
  11. pyddock-0.3.7/.hypothesis/constants/e2c54b7949469c07 +4 -0
  12. pyddock-0.3.7/.hypothesis/constants/e78de40070f52f91 +4 -0
  13. pyddock-0.3.7/.hypothesis/constants/e8cd7befaa4dd723 +4 -0
  14. pyddock-0.3.7/.hypothesis/unicode_data/16.0.0/charmap.json.gz +0 -0
  15. pyddock-0.3.7/.hypothesis/unicode_data/16.0.0/codec-utf-8.json.gz +0 -0
  16. {pyddock-0.3.5 → pyddock-0.3.7}/PKG-INFO +5 -7
  17. {pyddock-0.3.5 → pyddock-0.3.7}/README.md +2 -2
  18. {pyddock-0.3.5 → pyddock-0.3.7}/pyproject.toml +3 -5
  19. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/config.py +32 -34
  20. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/default_config.toml +1 -1
  21. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/executor.py +1 -0
  22. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/server.py +26 -12
  23. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/shell_executor.py +1 -0
  24. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/tools/fs_find.py +60 -67
  25. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/tools/fs_grep.py +140 -78
  26. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/venv_manager.py +129 -3
  27. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_config.py +95 -0
  28. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_file_tools.py +217 -0
  29. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_jailbreak_regression.py +1 -0
  30. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_shell_arg_paths.py +4 -0
  31. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_shell_executor.py +3 -1
  32. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_subst_trusted_path.py +2 -0
  33. pyddock-0.3.7/tests/test_venv_recreation.py +278 -0
  34. {pyddock-0.3.5 → pyddock-0.3.7}/uv.lock +582 -769
  35. {pyddock-0.3.5 → pyddock-0.3.7}/.gitignore +0 -0
  36. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/.gitignore +0 -0
  37. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/106d94c8123c0256 +0 -0
  38. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/1685e03b3aa38c02 +0 -0
  39. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/1deca112ec6f2f3c +0 -0
  40. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/2488a3a95c48acfb +0 -0
  41. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/2a94d83a13979745 +0 -0
  42. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/499f1d5a639a382a +0 -0
  43. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/4ee6f24fa151b65d +0 -0
  44. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/5b1b2189b70f5ef2 +0 -0
  45. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/5d6f8b26b2137fe1 +0 -0
  46. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/61f9b905d7da14e0 +0 -0
  47. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/67a7f4ab2d372f23 +0 -0
  48. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/6c6f5083ece3f86b +0 -0
  49. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/827e18b40f235443 +0 -0
  50. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/8401e4039d635fbc +0 -0
  51. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/8490e7baefc8c8c3 +0 -0
  52. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/a7c132b836381d0d +0 -0
  53. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/b395547bc71e5c52 +0 -0
  54. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/constants/ca50661510a40488 +0 -0
  55. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/tmp/tmpl8oe65gb +0 -0
  56. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/tmp/tmpqwper0dp +0 -0
  57. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/unicode_data/15.1.0/charmap.json.gz +0 -0
  58. {pyddock-0.3.5 → pyddock-0.3.7}/.hypothesis/unicode_data/15.1.0/codec-utf-8.json.gz +0 -0
  59. {pyddock-0.3.5 → pyddock-0.3.7}/LICENSE +0 -0
  60. {pyddock-0.3.5 → pyddock-0.3.7}/publish-to-pypi.ps1 +0 -0
  61. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/__init__.py +0 -0
  62. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/_audit_enforcement.py +0 -0
  63. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/_base.py +0 -0
  64. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/_enforcement.py +0 -0
  65. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/_fs_enforcement.py +0 -0
  66. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/_import_hook.py +0 -0
  67. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/_prewarm.py +0 -0
  68. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/_process_utils.py +0 -0
  69. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/_proxies.py +0 -0
  70. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/_runtime.py +0 -0
  71. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/_subprocess_patch.py +0 -0
  72. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/ast_validator.py +0 -0
  73. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/cli.py +0 -0
  74. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/script_registry.py +0 -0
  75. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/tools/__init__.py +0 -0
  76. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/tools/fs_append.py +0 -0
  77. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/tools/fs_delete.py +0 -0
  78. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/tools/read_file.py +0 -0
  79. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/tools/stat_file.py +0 -0
  80. {pyddock-0.3.5 → pyddock-0.3.7}/src/pyddock/tools/str_replace.py +0 -0
  81. {pyddock-0.3.5 → pyddock-0.3.7}/tests/__init__.py +0 -0
  82. {pyddock-0.3.5 → pyddock-0.3.7}/tests/_config_helpers.py +0 -0
  83. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_ast_properties.py +0 -0
  84. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_attr_reflection_hardening.py +0 -0
  85. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_audit_hook_backstop.py +0 -0
  86. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_chmod_integration.py +0 -0
  87. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_deny_always_wins.py +0 -0
  88. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_deny_messages.py +0 -0
  89. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_env_policy.py +0 -0
  90. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_executor.py +0 -0
  91. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_filesystem_guards.py +0 -0
  92. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_proxy_properties.py +0 -0
  93. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_realistic.py +0 -0
  94. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_runtime.py +0 -0
  95. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_sandbox_escape_hardening.py +0 -0
  96. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_security_guards.py +0 -0
  97. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_server.py +0 -0
  98. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_shell_properties.py +0 -0
  99. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_subprocess_enforcement.py +0 -0
  100. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_subprocess_properties.py +0 -0
  101. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_trusted_prefixes_uv_cache.py +0 -0
  102. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_venv_stamp.py +0 -0
  103. {pyddock-0.3.5 → pyddock-0.3.7}/tests/test_workspace_imports.py +0 -0
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\ast_validator.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [', ', '.', '__getattr__', '__getattribute__', 'blocked_attribute', 'blocked_call', 'blocked_import', 'blocked_reflection', 'blocked_subscript', 'getattr', 'syntax_error']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\config.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [30.0, 3600.0, ', ', '.', '.pyddock', '/', '[env]', '\\', 'agent-deny', 'allow', 'arg_paths', 'ast', 'audit', 'block_attributes', 'block_calls', 'class_allow', 'class_deny', 'command', 'default', 'default_config.toml', 'deny', 'deny-agent', 'deny-all', 'deny_messages', 'env', 'execution', 'filesystem', 'fs', 'fs-write', 'fs-write-pair', 'guards', 'imports', 'inert', 'max_timeout', 'mode', 'module_allow', 'module_deny', 'network', 'none', 'observe', 'protected', 'pyddock', 'pyddock.toml', 'read-only', 'readable_paths', 'restrictions', 'shell', 'snapshot', 'timeout', 'utf-8', 'workspace', 'writable_paths']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_audit_enforcement.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [200, 300, 384, ' | ', '"', '*', '/', '<frozen', '<frozen importlib', '<unsummarizable>', 'AGENT', 'IMPORT', 'OTHER', 'O_APPEND', 'O_CREAT', 'O_RDWR', 'O_TRUNC', 'O_WRONLY', 'TRUSTED', '\\', 'agent-deny', 'allow', 'arg_paths', 'caller', 'command', 'decision', 'deny', 'detail', 'errors', 'event', 'fs', 'fs-write', 'fs-write-pair', 'fspath', 'import-exempt', 'mode', 'network', 'observe', 'open', 'os.system', 'pid', 'reentry', 'replace', 'shell', 'socket.', 'subprocess.Popen', 'surrogateescape', 't', 'utf-8', 'workspace']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\server.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [', ', '--debug', '--workspace', '.py', '.pyddock', 'Configured commands:', 'Restrictions:', '_', '__main__', 'allow', 'content', 'context_lines', 'deny', 'end', 'end_line', 'exclude_regex', 'file_glob', 'file_regex', 'fs_append', 'fs_delete', 'fs_find', 'fs_grep', 'fs_readfile', 'fs_stat', 'fs_str_replace', 'grep_regex', 'max_results', 'max_results_per_file', 'newStr', 'oldStr', 'path', 'pyddock', 'pyddock serve', 'read_file', 'run_python', 'run_shell', 'start', 'start_line', 'stat_file', 'stdio', 'store_true', 'str_replace', 'tmp', 'utf-8', 'venv']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\shell_executor.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ ['$', ', ', '-', '-ExecutionPolicy', '-File', '-NoProfile', '.', '.bat', '.ps1', '.py', '.pyddock', '.sh', '.~', '/', '//', '/c', ':', '=', 'Bypass', '\\', '\\.', '\\/', '\\\\', '^', 'bash', 'cmd', 'command', 'default', 'deny', 'deny pattern', 'env', 'inert', 'items', 'no argument patterns', 'none', 'nt', 'output', 'powershell', 'pwsh', 'python', 'replace', 'snapshot', 'stderr', 'surrogateescape', 'tmp', 'utf-8', 'workspace']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_enforcement.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ ['*', ', ', '.', '.pyddock', '<frozen', 'PathLike', '_', '__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '_current_frames', '_getframe', '_pyddock_format_tb', 'allow', 'allowed', 'altsep', 'argv', 'ast', 'attrgetter', 'block_attributes', 'byteorder', 'class_allow', 'class_deny', 'cpu_count', 'curdir', 'deny', 'deny_messages', 'devnull', 'exc_info', 'exec_prefix', 'executable', 'exit', 'extsep', 'float_info', 'fromlist', 'fspath', 'fstat', 'getattr', 'getcwd', 'getdefaultencoding', 'getenv', 'getlogin', 'getpid', 'getrecursionlimit', 'hash_info', 'import', 'imports', 'int_info', 'level', 'linesep', 'listdir', 'lstat', 'maxsize', 'message', 'meta_path', 'mode', 'module_allow', 'module_deny', 'name', 'os', 'os.path', 'pardir', 'path', 'path_hooks', 'path_importer_cache', 'pathsep', 'pattern', 'platform', 'prefix', 'restrictions', 'scandir', 'sep', 'stat', 'stderr', 'stdin', 'stdout', 'sys', 'threading', 'urandom', 'venv', 'version', 'version_info', 'walk', 'workspace']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_subprocess_patch.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ ['$', '(none configured)', ', ', 'Popen', '^', '_SafePopen', 'allow', 'arg_paths', 'command', 'cwd', 'deny', 'deny pattern', 'env', 'imports', 'mode', 'no argument patterns', 'os', 'shell', 'subprocess', 'subprocess.Popen', 'subprocess.run', 'surrogateescape', 'utf-8', 'workspace']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_proxies.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [', ', '.', 'Lib', '_', '__', '__all__', '__dict__', '__doc__', '__file__', '__getattr__', '__getattribute__', '__loader__', '__module__', '__name__', '__package__', '__path__', '__reduce__', '__reduce_ex__', '__spec__', '_initializing', 'builtins', 'lib', 'os', 'site-packages', 'venv site-packages', 'venv symlink target']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\executor.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ ['#', '.py', '__PYDDOCK_RESULT__', '_last_expr = None', '_pyddock_bootstrap_', 'allow', 'allowed', 'arg_paths', 'ast', 'audit', 'block_attributes', 'block_calls', 'class_allow', 'class_deny', 'command', 'default', 'deny', 'deny_messages', 'disposition', 'env', 'exec(_code, _ns)', 'execution', 'filesystem', 'guards', 'import ast as _ast', 'import sys', 'imports', 'message', 'mode', 'module_allow', 'module_deny', 'nt', 'output', 'pattern', 'readable_paths', 'replace', 'restrictions', 'shell', 'stderr', 'timeout', 'utf-8', 'w', 'workspace', 'writable_paths']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_process_utils.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [65536, '/F', '/PID', '/T', ';', 'C:\\Windows', 'Environment', 'PATH', 'PYTHONIOENCODING', 'PYTHONPATH', 'Path', 'SYSTEMROOT', 'SystemRoot', 'VIRTUAL_ENV', 'VIRTUAL_ENV_PROMPT', 'absent', 'nt', 'output', 'present', 'replace', 'stderr', 'taskkill', 'utf-8', 'windir']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_fs_enforcement.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [511, 3584, '$', '*', ', ', '.', '.pyddock', '/', '<frozen', 'Lib', 'Path.chmod', 'Path.chmod()', 'Path.lchmod', 'Path.lchmod()', 'Path.mkdir', 'Path.open', 'Path.read_bytes', 'Path.read_text', 'Path.rename', 'Path.replace', 'Path.rmdir', 'Path.touch', 'Path.unlink', 'Path.write_bytes', 'Path.write_text', '\\', '\\.', '\\/', '\\\\', '^', '_io.FileIO', '_io.open', 'a', 'a+', 'a+b', 'a+t', 'ab', 'ab+', 'allow', 'at', 'at+', 'audit', 'audit.jsonl', 'builtins.open', 'command', 'deny', 'deny-agent', 'deny-all', 'disposition', 'env', 'filesystem', 'guards', 'imports', 'io.FileIO', 'io.open', 'lchmod', 'lib', 'link_to', 'mkdtemp', 'mkstemp', 'nt', 'nul', 'nul.', 'os', 'os.chmod()', 'pattern', 'r', 'r+', 'r+b', 'r+t', 'rb+', 'read', 'read-only', 'readable_paths', 'rt+', 'shell', 'tempdir', 'tempfile', 'tmp', 'w', 'w+', 'w+b', 'w+t', 'wax+', 'wb', 'wb+', 'workspace', 'writable_paths', 'write', 'wt', 'wt+', 'x', 'x+', 'x+b', 'x+t', 'xb', 'xb+', 'xt', 'xt+']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\venv_manager.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ [300, '-c', '-e', '-m', '.pyddock', 'Scripts', '_is_gil_enabled', '_workspace_hashes', 'allowlist_hash', 'bin', 'freethreaded', 'gil', 'install', 'installed.json', 'interpreter_id', 'pip', 'pyproject.toml', 'python', 'python.exe', 'pyvenv.cfg', 'setup.cfg', 'setup.py', 'utf-8', 'venv', 'venv_created', 'win32', 'workspace', '||']
@@ -0,0 +1,4 @@
1
+ # file: C:\Dev\github\pyddock\src\pyddock\_base.py
2
+ # hypothesis_version: 6.152.7
3
+
4
+ ['/', ':', '<snippet>', '\\', '__doc__', '__module__', '__name__', '__self__', 'nt', 'wrapped']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyddock
3
- Version: 0.3.5
3
+ Version: 0.3.7
4
4
  Summary: MCP server that gives AI agents pre-approved Python, shell, and file I/O tools with declarative policy controls
5
5
  Project-URL: Homepage, https://github.com/portablestew/pyddock
6
6
  Project-URL: Repository, https://github.com/portablestew/pyddock
@@ -13,12 +13,10 @@ Classifier: Development Status :: 3 - Alpha
13
13
  Classifier: Intended Audience :: Developers
14
14
  Classifier: License :: OSI Approved :: MIT License
15
15
  Classifier: Programming Language :: Python :: 3
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
19
17
  Classifier: Topic :: Security
20
18
  Classifier: Topic :: Software Development :: Libraries
21
- Requires-Python: >=3.11
19
+ Requires-Python: >=3.14
22
20
  Requires-Dist: mcp>=1.0
23
21
  Description-Content-Type: text/markdown
24
22
 
@@ -109,8 +107,8 @@ Pyddock also exposes file I/O tools that execute through the same sandbox as `ru
109
107
 
110
108
  - **`fs_readfile`** — Read a text file. Lines are 1-indexed; negative start = tail. Truncates large output with a continuation hint.
111
109
  - **`fs_stat`** — File metadata (exists, type, size, line count, modified). Returns `exists: false` for missing paths.
112
- - **`fs_find`** — Find files by name (`file_glob` match, recursive). Prunes hidden dot-directories and `exclude_regex` matches before descending (never walked, not just filtered), so large ignored trees (`.venv/`, `node_modules/`) stay fast. Returns matching relative paths, capped at `max_results`.
113
- - **`fs_grep`** — Search file contents by `grep_regex` (always case-insensitive). Same hidden-directory pruning and `exclude_regex` as `fs_find`. Returns `path:line: content` per match, capped at `max_results` and 300 chars per line, with an optional `max_results_per_file` cap. Skips binary files when scanning a directory; always searches a directly named file.
110
+ - **`fs_find`** — Find files by name (`file_glob` or `file_regex`, mutually exclusive). Prunes hidden dot-directories and `exclude_regex` matches before descending (never walked, not just filtered), so large ignored trees (`.venv/`, `node_modules/`) stay fast. Returns matching relative paths, capped at `max_results`.
111
+ - **`fs_grep`** — Search file contents by `grep_regex` (always case-insensitive). Same hidden-directory pruning, `exclude_regex`, and `file_glob`/`file_regex` file filtering as `fs_find`. Returns `path:line: content` per match with surrounding context lines (default: 1 for directory scans, 4 for single-file), capped at `max_results` and 300 chars per line, with an optional `max_results_per_file` cap. Skips binary files when scanning a directory; always searches a directly named file.
114
112
  - **`fs_append`** — Append to a file (creates if missing). Returns a unified diff.
115
113
  - **`fs_delete`** — Delete a file or empty directory. Returns a unified diff of removed content.
116
114
  - **`fs_str_replace`** — Find-and-replace exact text (unique match required). Returns a unified diff, or match diagnostics on failure.
@@ -85,8 +85,8 @@ Pyddock also exposes file I/O tools that execute through the same sandbox as `ru
85
85
 
86
86
  - **`fs_readfile`** — Read a text file. Lines are 1-indexed; negative start = tail. Truncates large output with a continuation hint.
87
87
  - **`fs_stat`** — File metadata (exists, type, size, line count, modified). Returns `exists: false` for missing paths.
88
- - **`fs_find`** — Find files by name (`file_glob` match, recursive). Prunes hidden dot-directories and `exclude_regex` matches before descending (never walked, not just filtered), so large ignored trees (`.venv/`, `node_modules/`) stay fast. Returns matching relative paths, capped at `max_results`.
89
- - **`fs_grep`** — Search file contents by `grep_regex` (always case-insensitive). Same hidden-directory pruning and `exclude_regex` as `fs_find`. Returns `path:line: content` per match, capped at `max_results` and 300 chars per line, with an optional `max_results_per_file` cap. Skips binary files when scanning a directory; always searches a directly named file.
88
+ - **`fs_find`** — Find files by name (`file_glob` or `file_regex`, mutually exclusive). Prunes hidden dot-directories and `exclude_regex` matches before descending (never walked, not just filtered), so large ignored trees (`.venv/`, `node_modules/`) stay fast. Returns matching relative paths, capped at `max_results`.
89
+ - **`fs_grep`** — Search file contents by `grep_regex` (always case-insensitive). Same hidden-directory pruning, `exclude_regex`, and `file_glob`/`file_regex` file filtering as `fs_find`. Returns `path:line: content` per match with surrounding context lines (default: 1 for directory scans, 4 for single-file), capped at `max_results` and 300 chars per line, with an optional `max_results_per_file` cap. Skips binary files when scanning a directory; always searches a directly named file.
90
90
  - **`fs_append`** — Append to a file (creates if missing). Returns a unified diff.
91
91
  - **`fs_delete`** — Delete a file or empty directory. Returns a unified diff of removed content.
92
92
  - **`fs_str_replace`** — Find-and-replace exact text (unique match required). Returns a unified diff, or match diagnostics on failure.
@@ -1,8 +1,8 @@
1
1
  [project]
2
2
  name = "pyddock"
3
- version = "0.3.5"
3
+ version = "0.3.7"
4
4
  description = "MCP server that gives AI agents pre-approved Python, shell, and file I/O tools with declarative policy controls"
5
- requires-python = ">=3.11"
5
+ requires-python = ">=3.14"
6
6
  license = "MIT"
7
7
  readme = "README.md"
8
8
  authors = [
@@ -14,9 +14,7 @@ classifiers = [
14
14
  "Intended Audience :: Developers",
15
15
  "License :: OSI Approved :: MIT License",
16
16
  "Programming Language :: Python :: 3",
17
- "Programming Language :: Python :: 3.11",
18
- "Programming Language :: Python :: 3.12",
19
- "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
20
18
  "Topic :: Software Development :: Libraries",
21
19
  "Topic :: Security",
22
20
  ]
@@ -2,7 +2,8 @@
2
2
 
3
3
  Resolution order:
4
4
  1. Base config: .pyddock/pyddock.toml in the workspace (CWD), or default_config.toml bundled with the package
5
- 2. Overlay (optional): .pyddock/pyddock.override.toml — deep-merged on top of the base
5
+ 2. Global overlay (optional): ~/.pyddock/pyddock.override.toml — deep-merged on top of the base
6
+ 3. Workspace overlay (optional): .pyddock/pyddock.override.toml — deep-merged on top (wins last)
6
7
  """
7
8
 
8
9
  from __future__ import annotations
@@ -492,6 +493,18 @@ def _parse_audit(data: dict) -> AuditConfig:
492
493
  return AuditConfig(rules=rules)
493
494
 
494
495
 
496
+ def _load_toml(path: Path) -> dict:
497
+ """Read and parse a TOML file, raising ConfigError on failure."""
498
+ try:
499
+ raw_bytes = path.read_bytes()
500
+ except OSError as e:
501
+ raise ConfigError(f"Cannot read config file {path}: {e}") from e
502
+ try:
503
+ return tomllib.loads(raw_bytes.decode("utf-8"))
504
+ except tomllib.TOMLDecodeError as e:
505
+ raise ConfigError(f"Invalid TOML in {path}: {e}") from e
506
+
507
+
495
508
  def _deep_merge(base: dict, overlay: dict) -> dict:
496
509
  """Recursively merge *overlay* on top of *base* (neither is mutated).
497
510
 
@@ -596,8 +609,11 @@ def load_config(workspace: Path | None = None) -> PyddockConfig:
596
609
  """Load and parse the pyddock configuration.
597
610
 
598
611
  Resolves the base config (workspace pyddock.toml or bundled default), then
599
- checks for an optional overlay file (.pyddock/pyddock.override.toml). If the
600
- overlay exists it is deep-merged on top of the base before parsing.
612
+ applies optional overlay files in order:
613
+ 1. ~/.pyddock/pyddock.override.toml (global user override)
614
+ 2. .pyddock/pyddock.override.toml (workspace override, wins last)
615
+
616
+ Each overlay is deep-merged on top of the accumulated config before parsing.
601
617
 
602
618
  Args:
603
619
  workspace: The workspace root directory. Defaults to CWD.
@@ -612,42 +628,24 @@ def load_config(workspace: Path | None = None) -> PyddockConfig:
612
628
  workspace = Path.cwd()
613
629
 
614
630
  config_path = resolve_config_path(workspace)
615
-
616
- try:
617
- raw_bytes = config_path.read_bytes()
618
- except OSError as e:
619
- raise ConfigError(f"Cannot read config file {config_path}: {e}") from e
620
-
621
- try:
622
- data = tomllib.loads(raw_bytes.decode("utf-8"))
623
- except tomllib.TOMLDecodeError as e:
624
- raise ConfigError(
625
- f"Invalid TOML in {config_path}: {e}"
626
- ) from e
627
-
631
+ data = _load_toml(config_path)
628
632
  logger.debug("Loaded base config from %s", config_path)
629
633
 
630
- # Check for optional overlay
634
+ # Global user override
635
+ global_override = Path.home() / ".pyddock" / "pyddock.override.toml"
636
+ if global_override.is_file():
637
+ data = _deep_merge(data, _load_toml(global_override))
638
+ logger.debug("Applied global override from %s", global_override)
639
+ else:
640
+ logger.debug("No global override found (checked %s)", global_override)
641
+
642
+ # Workspace override (wins last)
631
643
  override_path = workspace / ".pyddock" / "pyddock.override.toml"
632
644
  if override_path.is_file():
633
- try:
634
- override_bytes = override_path.read_bytes()
635
- except OSError as e:
636
- raise ConfigError(
637
- f"Cannot read override config file {override_path}: {e}"
638
- ) from e
639
-
640
- try:
641
- override_data = tomllib.loads(override_bytes.decode("utf-8"))
642
- except tomllib.TOMLDecodeError as e:
643
- raise ConfigError(
644
- f"Invalid TOML in {override_path}: {e}"
645
- ) from e
646
-
647
- data = _deep_merge(data, override_data)
648
- logger.debug("Applied overlay from %s", override_path)
645
+ data = _deep_merge(data, _load_toml(override_path))
646
+ logger.debug("Applied workspace override from %s", override_path)
649
647
  else:
650
- logger.debug("No overlay found (checked %s)", override_path)
648
+ logger.debug("No workspace override found (checked %s)", override_path)
651
649
 
652
650
  try:
653
651
  return _parse_config(data)
@@ -64,7 +64,7 @@ tempfile = true
64
64
  cryptography = true # No I/O of its own; all file access goes through Python builtins
65
65
  git = "GitPython" # [shell.git] policy enforced at the git.cmd.Git.execute chokepoint
66
66
  polars = true
67
- P4 = "p4python" # Restricted to non-submit operations
67
+ #P4 = "p4python" # Restricted to non-submit operations
68
68
 
69
69
  # Filesystem scoping for run_python.
70
70
  # Paths are relative to the workspace root (the --workspace directory or CWD).
@@ -106,6 +106,7 @@ class SubprocessExecutor:
106
106
  creationflags=subprocess.CREATE_NEW_PROCESS_GROUP
107
107
  if os.name == "nt"
108
108
  else 0,
109
+ start_new_session=(os.name != "nt"),
109
110
  startupinfo=get_startupinfo() if os.name == "nt" else None,
110
111
  )
111
112
  try:
@@ -353,25 +353,30 @@ def create_server(workspace: Path | None = None, debug: bool = False) -> FastMCP
353
353
  _fs_find_desc = (
354
354
  "Find files by name. Approximately: [p for p in os.walk(path) if file_glob matches]\n"
355
355
  "\n"
356
- "file_glob is a glob (e.g. '*.py', '**/test_*.py') matched against filenames\n"
357
- "under path (default: workspace root, must be a directory). Hidden\n"
358
- "dot-directories are pruned before descending (an explicit leading '.' in\n"
359
- "file_glob, e.g. '.env', still matches hidden files); exclude_regex\n"
360
- "(optional) prunes more by relative path. Returns matching relative paths,\n"
361
- "one per line, capped at max_results (default: 100)."
356
+ "Filenames under path (default: workspace root, must be a directory) are\n"
357
+ "matched against file_glob (e.g. '**/test_*.py') or file_regex\n"
358
+ "('test_.+\\.py'; mutually exclusive with file_glob). Hidden\n"
359
+ "dot-directories are pruned before descending (an explicit leading '.'\n"
360
+ "in file_glob, e.g. '.env', still matches hidden files); exclude_regex\n"
361
+ "(optional) prunes more by relative path. Returns matching relative\n"
362
+ "paths, one per line, capped at max_results (default: 100)."
362
363
  )
363
364
 
364
365
  @mcp.tool(name="fs_find", description=_fs_find_desc)
365
366
  async def fs_find(
366
- file_glob: str,
367
+ file_glob: str | None = None,
368
+ file_regex: str | None = None,
367
369
  path: str | None = None,
368
370
  exclude_regex: str | None = None,
369
371
  max_results: int | None = None,
370
372
  ) -> str:
371
- if not file_glob or not file_glob.strip():
372
- return "Error: 'file_glob' is required and must be non-empty."
373
+ if not file_glob and not file_regex:
374
+ return "Error: provide either 'file_glob' or 'file_regex'."
375
+ if file_glob and file_regex:
376
+ return "Error: provide file_glob or file_regex, not both."
373
377
  return await registry.execute("fs_find", {
374
378
  "file_glob": file_glob,
379
+ "file_regex": file_regex,
375
380
  "path": path,
376
381
  "exclude_regex": exclude_regex,
377
382
  "max_results": max_results,
@@ -383,9 +388,12 @@ def create_server(workspace: Path | None = None, debug: bool = False) -> FastMCP
383
388
  "each matched file.\n"
384
389
  "\n"
385
390
  "grep_regex is searched within each file matched by file_glob (glob,\n"
386
- "default '*') under path (default: workspace root). Returns\n"
387
- "'path:line: content' per match, capped at max_results (default: 100)\n"
388
- "and 300 chars per line. Optional max_results_per_file caps matches per file.\n"
391
+ "default '*') or file_regex (mutually exclusive) under path\n"
392
+ "(default: workspace root). Returns 'path:line: content' per match,\n"
393
+ "capped at max_results (default: 100) and 300 chars per line. Optional\n"
394
+ "max_results_per_file caps matches per file. context_lines controls\n"
395
+ "how many surrounding lines are shown around each match; set to 0 for\n"
396
+ "compact output.\n"
389
397
  "\n"
390
398
  "Binary files are skipped when scanning a directory path. A single named\n"
391
399
  "file is always searched."
@@ -395,20 +403,26 @@ def create_server(workspace: Path | None = None, debug: bool = False) -> FastMCP
395
403
  async def fs_grep(
396
404
  grep_regex: str,
397
405
  file_glob: str | None = None,
406
+ file_regex: str | None = None,
398
407
  path: str | None = None,
399
408
  exclude_regex: str | None = None,
400
409
  max_results: int | None = None,
401
410
  max_results_per_file: int | None = None,
411
+ context_lines: int | None = None,
402
412
  ) -> str:
403
413
  if not grep_regex:
404
414
  return "Error: 'grep_regex' is required and must be non-empty."
415
+ if file_glob and file_regex:
416
+ return "Error: provide file_glob or file_regex, not both."
405
417
  return await registry.execute("fs_grep", {
406
418
  "grep_regex": grep_regex,
407
419
  "file_glob": file_glob,
420
+ "file_regex": file_regex,
408
421
  "path": path,
409
422
  "exclude_regex": exclude_regex,
410
423
  "max_results": max_results,
411
424
  "max_results_per_file": max_results_per_file,
425
+ "context_lines": context_lines,
412
426
  })
413
427
 
414
428
  return mcp
@@ -759,6 +759,7 @@ class ShellExecutor:
759
759
  )
760
760
  if _os.name == "nt"
761
761
  else 0,
762
+ start_new_session=(_os.name != "nt"),
762
763
  startupinfo=get_startupinfo() if _os.name == "nt" else None,
763
764
  )
764
765
  try:
@@ -1,7 +1,15 @@
1
1
  """fs_find tool script.
2
2
 
3
- Find files by name under a directory. Approximately:
4
- [p for p in os.walk(path) if file_glob matches]
3
+ Find files by name. Approximately: [p for p in os.walk(path) if file_glob matches]
4
+
5
+ file_glob is a glob (e.g. '*.py', '**/test_*.py') matched against filenames
6
+ under path (default: workspace root, must be a directory). Alternatively,
7
+ file_regex provides a raw regex matched the same way (mutually exclusive
8
+ with file_glob): a pattern with no '/' matches basenames at any depth, a
9
+ pattern containing '/' matches the full relative path. Like grep_regex/
10
+ exclude_regex elsewhere in these tools, file_regex matches anywhere in the
11
+ name/path (re.search), not just the whole thing — anchor with ^/$ for an
12
+ exact match.
5
13
 
6
14
  Hidden dot-directories (and their contents) are pruned before descending —
7
15
  they are never walked, not just filtered from results — so this stays fast
@@ -13,13 +21,15 @@ match a leading dot but an explicit pattern does. Returns matching paths
13
21
  (relative to the workspace root when possible), one per line, capped at
14
22
  max_results.
15
23
  """
24
+ import glob as _glob
16
25
  import os
17
26
  import re
18
27
  import sys
19
28
  from pathlib import Path
20
29
 
21
30
  # --- Parameters ---
22
- file_glob = _PARAMS["file_glob"]
31
+ file_glob = _PARAMS.get("file_glob")
32
+ file_regex = _PARAMS.get("file_regex")
23
33
  path_str = _PARAMS.get("path") or "."
24
34
  exclude_regex = _PARAMS.get("exclude_regex")
25
35
  max_results = _PARAMS.get("max_results") or 100
@@ -48,51 +58,6 @@ def display_path(p: Path) -> str:
48
58
  return str(p)
49
59
 
50
60
 
51
- def translate_glob(pattern: str) -> str:
52
- """Translate a glob pattern to an anchored regex.
53
-
54
- Supports '*' (any run of non-separator chars), '?' (one non-separator
55
- char), '[seq]'/'[!seq]' character classes, and '**' as a recursive
56
- any-depth-of-segments wildcard. Matched against a forward-slash path.
57
- """
58
- i, n = 0, len(pattern)
59
- out: list[str] = []
60
- while i < n:
61
- c = pattern[i]
62
- i += 1
63
- if c == "*":
64
- if i < n and pattern[i] == "*":
65
- i += 1
66
- if i < n and pattern[i] == "/":
67
- i += 1
68
- out.append("(?:.*/)?")
69
- else:
70
- out.append(".*")
71
- else:
72
- out.append("[^/]*")
73
- elif c == "?":
74
- out.append("[^/]")
75
- elif c == "[":
76
- j = i
77
- if j < n and pattern[j] == "!":
78
- j += 1
79
- if j < n and pattern[j] == "]":
80
- j += 1
81
- while j < n and pattern[j] != "]":
82
- j += 1
83
- if j >= n:
84
- out.append(re.escape("["))
85
- else:
86
- stuff = pattern[i:j]
87
- if stuff.startswith("!"):
88
- stuff = "^" + stuff[1:]
89
- out.append("[" + stuff + "]")
90
- i = j + 1
91
- else:
92
- out.append(re.escape(c))
93
- return "^" + "".join(out) + "$"
94
-
95
-
96
61
  def is_hidden(name: str) -> bool:
97
62
  """True if a single path component is dot-prefixed."""
98
63
  return name.startswith(".")
@@ -106,11 +71,45 @@ def rel_posix(base: Path, dirpath: str) -> str:
106
71
  return rel.replace("\\", "/")
107
72
 
108
73
 
109
- # --- Main ---
110
- if not file_glob:
111
- print("file_glob must be non-empty.", file=sys.stderr)
74
+ # --- Input validation ---
75
+ if file_glob and file_regex:
76
+ print("Provide file_glob or file_regex, not both.", file=sys.stderr)
112
77
  sys.exit(1)
113
78
 
79
+ # Default to '*' glob when neither is specified
80
+ if not file_glob and not file_regex:
81
+ file_glob = "*"
82
+
83
+ # Build the compiled file-matching regex from whichever param was given.
84
+ if file_glob:
85
+ # glob.translate() is the stdlib's canonical glob-to-regex translator (Python 3.13+).
86
+ # include_hidden=True because pyddock handles hidden-file pruning separately in the
87
+ # walk loop (via is_hidden()/allow_hidden_files). seps="/" because rel_posix() always
88
+ # produces forward-slash paths regardless of OS.
89
+ file_pattern_rx = re.compile(
90
+ _glob.translate(file_glob, recursive=True, include_hidden=True, seps="/")
91
+ )
92
+ # A glob whose final segment starts with '.' explicitly targets hidden files.
93
+ allow_hidden_files = file_glob.rsplit("/", 1)[-1].startswith(".")
94
+ # A pattern with no '/' matches basenames only; otherwise match the full relative path.
95
+ match_basename_only = "/" not in file_glob
96
+ pattern_display = file_glob
97
+ else:
98
+ try:
99
+ file_pattern_rx = re.compile(file_regex)
100
+ except re.error as e:
101
+ print(f"Invalid file_regex '{file_regex}': {e}", file=sys.stderr)
102
+ sys.exit(1)
103
+ # Regex mode: no hidden-file allowance via pattern inspection — unlike a
104
+ # glob's leading '.', there's no reliable syntactic way to tell whether an
105
+ # arbitrary regex "means" to target a hidden file (use exclude_regex or
106
+ # point path at a hidden dir directly instead). Same basename-vs-full-path
107
+ # convention as file_glob: a pattern with no '/' matches basenames at any
108
+ # depth; a pattern containing '/' matches the full relative path.
109
+ allow_hidden_files = False
110
+ match_basename_only = "/" not in file_regex
111
+ pattern_display = file_regex
112
+
114
113
  exclude_re = None
115
114
  if exclude_regex:
116
115
  try:
@@ -119,19 +118,6 @@ if exclude_regex:
119
118
  print(f"Invalid exclude_regex '{exclude_regex}': {e}", file=sys.stderr)
120
119
  sys.exit(1)
121
120
 
122
- # Matching strategy mirrors Path.rglob(): a pattern with no '/' matches the
123
- # filename at any depth; a pattern containing '/' matches the full relative
124
- # path from `path` (e.g. '**/test_*.py').
125
- match_basename_only = "/" not in file_glob
126
- file_regex = re.compile(translate_glob(file_glob))
127
-
128
- # A glob whose final segment starts with '.' explicitly targets hidden files
129
- # (e.g. '.env', '**/.env') — mirrors shell semantics where '*' does not match
130
- # a leading dot but an explicit pattern does. Hidden DIRECTORIES are still
131
- # pruned regardless (performance); point `path` directly at one to search
132
- # inside it.
133
- allow_hidden_files = file_glob.rsplit("/", 1)[-1].startswith(".")
134
-
135
121
  path = resolve_path(path_str)
136
122
 
137
123
  if not path.exists():
@@ -176,7 +162,13 @@ for dirpath, dirnames, filenames in os.walk(path):
176
162
  skipped_excluded += 1
177
163
  continue
178
164
  target = f if match_basename_only else rel_file
179
- if not file_regex.match(target):
165
+ # search, not match/fullmatch: glob-derived patterns are anchored on
166
+ # both ends by glob.translate() itself (its regex ends in \z), so
167
+ # search() behaves identically to fullmatch() for the file_glob case.
168
+ # For file_regex, search() keeps it consistent with grep_regex/
169
+ # exclude_regex elsewhere in these tools (substring match by default;
170
+ # the caller anchors with ^/$ if they want a whole-name match).
171
+ if not file_pattern_rx.search(target):
180
172
  continue
181
173
  results.append(Path(dirpath) / f)
182
174
  if len(results) >= max_results:
@@ -185,14 +177,15 @@ for dirpath, dirnames, filenames in os.walk(path):
185
177
 
186
178
  notes = []
187
179
  if truncated:
188
- notes.append(f"Showing first {max_results} results. Narrow file_glob or path to see more.")
180
+ pattern_param = "file_glob" if file_glob else "file_regex"
181
+ notes.append(f"Showing first {max_results} results. Narrow {pattern_param} or path to see more.")
189
182
  if skipped_hidden:
190
183
  notes.append(f"{skipped_hidden} hidden file(s)/dir(s) skipped.")
191
184
  if skipped_excluded:
192
185
  notes.append(f"{skipped_excluded} excluded file(s)/dir(s) skipped.")
193
186
 
194
187
  if not results:
195
- msg = f"No files matching '{file_glob}' found under '{path_str}'."
188
+ msg = f"No files matching '{pattern_display}' found under '{path_str}'."
196
189
  if notes:
197
190
  msg += " (" + " ".join(notes) + ")"
198
191
  print(msg)