vbash 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. vbash-0.2.0/.env.example +11 -0
  2. vbash-0.2.0/.github/workflows/publish.yml +38 -0
  3. vbash-0.2.0/.gitignore +37 -0
  4. vbash-0.2.0/CHANGELOG.md +62 -0
  5. vbash-0.2.0/LICENSE +190 -0
  6. vbash-0.2.0/PKG-INFO +161 -0
  7. vbash-0.2.0/README.md +130 -0
  8. vbash-0.2.0/docs/API.md +161 -0
  9. vbash-0.2.0/docs/ARCHITECTURE.md +140 -0
  10. vbash-0.2.0/docs/CODEMODE.md +220 -0
  11. vbash-0.2.0/examples/pydantic_ai_agent_demo.py +179 -0
  12. vbash-0.2.0/plans/vsh_mvp_master_plan.md +1770 -0
  13. vbash-0.2.0/plans/what_vsh_covers_updated.md +1426 -0
  14. vbash-0.2.0/playground/README.md +41 -0
  15. vbash-0.2.0/playground/benchlib/__init__.py +20 -0
  16. vbash-0.2.0/playground/benchlib/cases.py +229 -0
  17. vbash-0.2.0/playground/benchlib/models.py +28 -0
  18. vbash-0.2.0/playground/benchlib/plots.py +180 -0
  19. vbash-0.2.0/playground/benchlib/report.py +112 -0
  20. vbash-0.2.0/playground/benchlib/runner.py +148 -0
  21. vbash-0.2.0/playground/benchmark_vsh_vs_native.py +111 -0
  22. vbash-0.2.0/playground/reports/baseline/plots/median_heatmap.png +0 -0
  23. vbash-0.2.0/playground/reports/baseline/plots/median_latency.png +0 -0
  24. vbash-0.2.0/playground/reports/baseline/plots/median_ratio_vs_native.png +0 -0
  25. vbash-0.2.0/playground/reports/baseline/plots/range_native.png +0 -0
  26. vbash-0.2.0/playground/reports/baseline/plots/range_vsh_apply.png +0 -0
  27. vbash-0.2.0/playground/reports/baseline/plots/range_vsh_full.png +0 -0
  28. vbash-0.2.0/playground/reports/baseline/report.md +120 -0
  29. vbash-0.2.0/playground/reports/baseline/results.json +1291 -0
  30. vbash-0.2.0/pyproject.toml +136 -0
  31. vbash-0.2.0/src/vsh/__init__.py +63 -0
  32. vbash-0.2.0/src/vsh/__main__.py +6 -0
  33. vbash-0.2.0/src/vsh/_version.py +3 -0
  34. vbash-0.2.0/src/vsh/agent/__init__.py +36 -0
  35. vbash-0.2.0/src/vsh/agent/deps.py +18 -0
  36. vbash-0.2.0/src/vsh/agent/toolset.py +90 -0
  37. vbash-0.2.0/src/vsh/cli.py +64 -0
  38. vbash-0.2.0/src/vsh/effects.py +37 -0
  39. vbash-0.2.0/src/vsh/execute/__init__.py +17 -0
  40. vbash-0.2.0/src/vsh/execute/dispatch.py +260 -0
  41. vbash-0.2.0/src/vsh/execute/read_output.py +383 -0
  42. vbash-0.2.0/src/vsh/execute/realfs.py +133 -0
  43. vbash-0.2.0/src/vsh/execute/revalidate.py +41 -0
  44. vbash-0.2.0/src/vsh/extensions/__init__.py +12 -0
  45. vbash-0.2.0/src/vsh/extensions/protocols.py +23 -0
  46. vbash-0.2.0/src/vsh/extensions/registry.py +17 -0
  47. vbash-0.2.0/src/vsh/mcp/__init__.py +28 -0
  48. vbash-0.2.0/src/vsh/mcp/codemode_server.py +114 -0
  49. vbash-0.2.0/src/vsh/mcp/prompts.py +72 -0
  50. vbash-0.2.0/src/vsh/mcp/resources.py +45 -0
  51. vbash-0.2.0/src/vsh/mcp/server.py +8 -0
  52. vbash-0.2.0/src/vsh/mcp/surface.py +22 -0
  53. vbash-0.2.0/src/vsh/mcp/tools.py +59 -0
  54. vbash-0.2.0/src/vsh/perf/__init__.py +10 -0
  55. vbash-0.2.0/src/vsh/perf/timing.py +45 -0
  56. vbash-0.2.0/src/vsh/persistence/__init__.py +9 -0
  57. vbash-0.2.0/src/vsh/persistence/store.py +74 -0
  58. vbash-0.2.0/src/vsh/plans/__init__.py +15 -0
  59. vbash-0.2.0/src/vsh/plans/approval.py +23 -0
  60. vbash-0.2.0/src/vsh/plans/fingerprint.py +25 -0
  61. vbash-0.2.0/src/vsh/plans/models.py +77 -0
  62. vbash-0.2.0/src/vsh/plans/store.py +54 -0
  63. vbash-0.2.0/src/vsh/registry/__init__.py +15 -0
  64. vbash-0.2.0/src/vsh/registry/json_schema.py +46 -0
  65. vbash-0.2.0/src/vsh/registry/search.py +45 -0
  66. vbash-0.2.0/src/vsh/registry/specs.py +360 -0
  67. vbash-0.2.0/src/vsh/runtime.py +56 -0
  68. vbash-0.2.0/src/vsh/schemas/__init__.py +57 -0
  69. vbash-0.2.0/src/vsh/schemas/cat.py +33 -0
  70. vbash-0.2.0/src/vsh/schemas/cd.py +34 -0
  71. vbash-0.2.0/src/vsh/schemas/chmod.py +31 -0
  72. vbash-0.2.0/src/vsh/schemas/common.py +139 -0
  73. vbash-0.2.0/src/vsh/schemas/copy.py +33 -0
  74. vbash-0.2.0/src/vsh/schemas/du.py +28 -0
  75. vbash-0.2.0/src/vsh/schemas/echo.py +40 -0
  76. vbash-0.2.0/src/vsh/schemas/find.py +38 -0
  77. vbash-0.2.0/src/vsh/schemas/grep.py +42 -0
  78. vbash-0.2.0/src/vsh/schemas/head.py +26 -0
  79. vbash-0.2.0/src/vsh/schemas/ln.py +33 -0
  80. vbash-0.2.0/src/vsh/schemas/ls.py +37 -0
  81. vbash-0.2.0/src/vsh/schemas/mkdir.py +30 -0
  82. vbash-0.2.0/src/vsh/schemas/move.py +32 -0
  83. vbash-0.2.0/src/vsh/schemas/nl.py +26 -0
  84. vbash-0.2.0/src/vsh/schemas/pwd.py +27 -0
  85. vbash-0.2.0/src/vsh/schemas/remove.py +31 -0
  86. vbash-0.2.0/src/vsh/schemas/rg.py +39 -0
  87. vbash-0.2.0/src/vsh/schemas/sed.py +60 -0
  88. vbash-0.2.0/src/vsh/schemas/sort.py +27 -0
  89. vbash-0.2.0/src/vsh/schemas/stat.py +23 -0
  90. vbash-0.2.0/src/vsh/schemas/tail.py +29 -0
  91. vbash-0.2.0/src/vsh/schemas/touch.py +28 -0
  92. vbash-0.2.0/src/vsh/schemas/wc.py +35 -0
  93. vbash-0.2.0/src/vsh/session/__init__.py +19 -0
  94. vbash-0.2.0/src/vsh/session/resolver.py +76 -0
  95. vbash-0.2.0/src/vsh/session/state.py +36 -0
  96. vbash-0.2.0/src/vsh/simulate/__init__.py +14 -0
  97. vbash-0.2.0/src/vsh/simulate/approval_levels.py +74 -0
  98. vbash-0.2.0/src/vsh/simulate/engine.py +316 -0
  99. vbash-0.2.0/src/vsh/simulate/models.py +41 -0
  100. vbash-0.2.0/src/vsh/simulate/policy.py +103 -0
  101. vbash-0.2.0/src/vsh/simulate/protected_paths.py +109 -0
  102. vbash-0.2.0/src/vsh/simulate/renderer.py +5 -0
  103. vbash-0.2.0/src/vsh/snapshot/__init__.py +10 -0
  104. vbash-0.2.0/src/vsh/snapshot/builder.py +85 -0
  105. vbash-0.2.0/src/vsh/snapshot/fingerprint.py +55 -0
  106. vbash-0.2.0/src/vsh/snapshot/models.py +28 -0
  107. vbash-0.2.0/src/vsh/snapshot/projection.py +18 -0
  108. vbash-0.2.0/src/vsh/snapshot/refresh.py +45 -0
  109. vbash-0.2.0/tests/conftest.py +8 -0
  110. vbash-0.2.0/tests/test_agent_toolset.py +246 -0
  111. vbash-0.2.0/tests/test_approval_levels.py +51 -0
  112. vbash-0.2.0/tests/test_cli.py +44 -0
  113. vbash-0.2.0/tests/test_execute.py +56 -0
  114. vbash-0.2.0/tests/test_execute_coverage.py +374 -0
  115. vbash-0.2.0/tests/test_execute_dispatch.py +120 -0
  116. vbash-0.2.0/tests/test_extensions.py +39 -0
  117. vbash-0.2.0/tests/test_main.py +20 -0
  118. vbash-0.2.0/tests/test_mcp.py +69 -0
  119. vbash-0.2.0/tests/test_mcp_codemode.py +186 -0
  120. vbash-0.2.0/tests/test_perf_timing.py +77 -0
  121. vbash-0.2.0/tests/test_persistence.py +29 -0
  122. vbash-0.2.0/tests/test_protected_paths.py +95 -0
  123. vbash-0.2.0/tests/test_read_output.py +428 -0
  124. vbash-0.2.0/tests/test_registry.py +184 -0
  125. vbash-0.2.0/tests/test_registry_json_schema.py +89 -0
  126. vbash-0.2.0/tests/test_registry_search.py +21 -0
  127. vbash-0.2.0/tests/test_release.py +22 -0
  128. vbash-0.2.0/tests/test_runtime.py +278 -0
  129. vbash-0.2.0/tests/test_runtime_ledger.py +27 -0
  130. vbash-0.2.0/tests/test_schemas_shell.py +78 -0
  131. vbash-0.2.0/tests/test_session.py +65 -0
  132. vbash-0.2.0/tests/test_simulate_engine.py +221 -0
  133. vbash-0.2.0/tests/test_simulate_limits.py +105 -0
  134. vbash-0.2.0/tests/test_simulate_policy.py +59 -0
  135. vbash-0.2.0/tests/test_snapshot_builder.py +60 -0
  136. vbash-0.2.0/uv.lock +4269 -0
  137. vbash-0.1.0/PKG-INFO +0 -6
  138. vbash-0.1.0/README.md +0 -0
  139. vbash-0.1.0/main.py +0 -6
  140. vbash-0.1.0/pyproject.toml +0 -7
  141. vbash-0.1.0/setup.cfg +0 -4
  142. vbash-0.1.0/vbash.egg-info/PKG-INFO +0 -6
  143. vbash-0.1.0/vbash.egg-info/SOURCES.txt +0 -7
  144. vbash-0.1.0/vbash.egg-info/top_level.txt +0 -1
  145. /vbash-0.1.0/vbash.egg-info/dependency_links.txt → /vbash-0.2.0/src/vsh/py.typed +0 -0
@@ -0,0 +1,11 @@
1
+ # Copy to .env and fill in your values.
2
+ MODEL_NAME=openrouter:anthropic/claude-sonnet-4
3
+ OPENROUTER_API_KEY=sk-or-your-key-here
4
+
5
+ # Optional vsh persistence
6
+ # VSH_DATA_DIR=~/.vsh
7
+ # VSH_PERSIST=1
8
+
9
+ # Optional CodeMode MCP custom instructions
10
+ # VSH_CODEMODE_INSTRUCTIONS=Prefer vsh_rg over vsh_grep.
11
+ # VSH_CODEMODE_INSTRUCTIONS_FILE=.vsh/codemode-instructions.md
@@ -0,0 +1,38 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - v*
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ publish:
14
+ name: Build and publish
15
+ runs-on: ubuntu-latest
16
+ environment:
17
+ name: pypi
18
+ url: https://pypi.org/project/vbash/
19
+ permissions:
20
+ id-token: write
21
+ contents: read
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v5
25
+
26
+ - name: Install uv
27
+ uses: astral-sh/setup-uv@v6
28
+ with:
29
+ enable-cache: true
30
+
31
+ - name: Install Python
32
+ run: uv python install 3.12
33
+
34
+ - name: Build distributions
35
+ run: uv build
36
+
37
+ - name: Publish to PyPI
38
+ run: uv publish
vbash-0.2.0/.gitignore ADDED
@@ -0,0 +1,37 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ .eggs/
9
+ *.egg
10
+
11
+ # Virtual environments
12
+ .venv/
13
+ venv/
14
+
15
+ # Tooling
16
+ .pytest_cache/
17
+ .ruff_cache/
18
+ .mypy_cache/
19
+ .ty_cache/
20
+ .coverage
21
+ htmlcov/
22
+ .hypothesis/
23
+
24
+ # Editors / OS
25
+ .DS_Store
26
+ .idea/
27
+ .vscode/
28
+ *.swp
29
+ *.swo
30
+
31
+ # Local env
32
+ .env
33
+ .env.*
34
+ !.env.example
35
+
36
+ # Playground benchmark artifacts
37
+ playground/reports/2026*
@@ -0,0 +1,62 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ ## [Unreleased]
6
+
7
+ ### Added
8
+
9
+ - Protected workspace path policy (`VSH_PROTECTED_PATTERNS`, `VSH_PROTECTED_PATTERNS_FILE`)
10
+ - Approval tiers on `SimulationResult` (`read_only`, `mutation`, `destructive`)
11
+ - `auto_approve_plan()` for read-only auto-approval; `approve_plan(..., auto=True)`
12
+ - Read command stdout capture in `ActualEffects.stdout` (`vsh.execute.read_output`)
13
+ - Execution timing fields: `simulation_time_ms`, `execution_time_ms`, `total_time_ms`
14
+ - `VSH_MAX_TOUCHED_PATHS` simulation limit (default `500`)
15
+ - Shell previews quote paths with `shlex.quote`
16
+
17
+ ### Fixed
18
+
19
+ - `vsh_list` now rejects workspace escapes (`/`, `..`, paths outside the root) during simulation
20
+ - Execution layer enforces workspace boundaries via `ExecutionContext.resolve_within_workspace`
21
+
22
+ ## [0.2.0] - 2026-06-08
23
+
24
+ ### Added
25
+
26
+ - CodeMode FastMCP server (`vsh serve-codemode`, `vsh-codemode`) with workflow prompts
27
+ - CodeMode custom instructions via CLI (`-i`, `-f`), env vars, and `create_codemode_server(custom_instructions=...)`
28
+ - Real filesystem executor (`vsh.execute.apply_command`, `execute_approved`)
29
+ - Pre-execution drift detection via path fingerprints (`vsh.execute.revalidate_plan`)
30
+ - Plan fingerprints and touched-path basis on every simulation
31
+ - Optional JSON persistence (`VSH_DATA_DIR`, `VSH_PERSIST`)
32
+ - Extension hook registry for hydration, semantic analyzers, shadow workspaces
33
+ - `vsh_sort` command
34
+ - Gemini-safe inlined JSON schemas (`inline_json_schema`)
35
+ - Documentation: `docs/ARCHITECTURE.md`, `docs/API.md`, `docs/CODEMODE.md`
36
+
37
+ ### Changed
38
+
39
+ - `shell_preview` now uses `command.to_shell()` instead of `repr(command)`
40
+ - `approve_with_warning` plans are execution-eligible (still gated by raw shell match)
41
+ - `ExecutionResult` includes `revalidation`, `actual_effects`, `matches_prediction`
42
+ - Snapshot builder ignores `.venv`, `node_modules`, `dist`, `build`, `target`
43
+ - Version bumped to `0.2.0` (23 commands)
44
+
45
+ ### Fixed
46
+
47
+ - pydantic-ai / Gemini tool schema failures from `$defs/SideEffect` references
48
+
49
+ ## [0.1.0] - 2026-06-08
50
+
51
+ First public v0 release.
52
+
53
+ ### Added
54
+
55
+ - Typed command registry with JSON schema export for workspace commands
56
+ - `StructuredCommand` models with canonical shell previews and side-effect metadata
57
+ - Workspace snapshot graph builder with protected-root policy
58
+ - Simulation engine with approve / reject / warn decisions
59
+ - Plan store, approval tokens, and execution eligibility checks
60
+ - FastMCP server exposing search, schema, snapshot, simulate, approve, and execute tools
61
+ - CLI: `vsh search`, `vsh schema`, `vsh names`, `vsh serve`
62
+ - pydantic-ai `FunctionToolset` integration (`vsh.agent`)
vbash-0.2.0/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 vsh contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
vbash-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.4
2
+ Name: vbash
3
+ Version: 0.2.0
4
+ Summary: vsh is a validation-first command engine for agent workspaces.
5
+ License: Apache-2.0
6
+ License-File: LICENSE
7
+ Keywords: agents,commands,mcp,simulation,workspaces
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Requires-Python: >=3.11
15
+ Requires-Dist: click>=8.1.8
16
+ Requires-Dist: dotenv>=0.9.9
17
+ Requires-Dist: fastmcp>=2.0
18
+ Requires-Dist: pydantic>=2.7
19
+ Requires-Dist: python-dotenv>=1.2.2
20
+ Provides-Extra: agent
21
+ Requires-Dist: pydantic-ai>=0.2; extra == 'agent'
22
+ Provides-Extra: dev
23
+ Requires-Dist: basedpyright; extra == 'dev'
24
+ Requires-Dist: matplotlib; extra == 'dev'
25
+ Requires-Dist: pydantic-ai>=0.2; extra == 'dev'
26
+ Requires-Dist: pytest; extra == 'dev'
27
+ Requires-Dist: pytest-cov; extra == 'dev'
28
+ Requires-Dist: ruff; extra == 'dev'
29
+ Requires-Dist: ty; extra == 'dev'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # vsh
33
+
34
+ Validation-first command engine for AI agents operating on workspaces.
35
+
36
+ `vsh` is not a POSIX shell emulator. It is a **safe command planning and execution control layer** for AI agents: shell-like intent becomes typed `StructuredCommand` models, side effects are simulated on a workspace snapshot, plans are approved, drift is revalidated, and only then are mutations applied to the real filesystem. Read commands validate path access and return captured stdout on execution; simulation does not stream file contents.
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ uv sync
42
+ ```
43
+
44
+ `uv sync` installs the project plus `dev` and `agent` dependency groups (including `pydantic-ai`).
45
+
46
+ For pip-only workflows:
47
+
48
+ ```bash
49
+ python -m venv .venv
50
+ source .venv/bin/activate
51
+ pip install -e ".[dev,agent]"
52
+ ```
53
+
54
+ ## Quick start
55
+
56
+ ```bash
57
+ vsh search ls
58
+ vsh schema vsh_list
59
+ vsh serve
60
+ ```
61
+
62
+ ## End-to-end lifecycle
63
+
64
+ ```python
65
+ from vsh import LsCommand
66
+ from vsh.execute import execute_approved
67
+ from vsh.plans import approve_plan
68
+ from vsh.simulate.engine import simulate_command
69
+ from vsh.snapshot.builder import snapshot_workspace
70
+
71
+ workspace = "/path/to/project"
72
+ snapshot = snapshot_workspace(workspace, cwd=workspace)
73
+ result = simulate_command(LsCommand(path=".", all=True), snapshot)
74
+ token = approve_plan(result.plan_id)
75
+ execution = execute_approved(token.token)
76
+
77
+ print(execution.applied, execution.matches_prediction)
78
+ ```
79
+
80
+ Flow: **search → get_schema → snapshot → simulate → approve → execute_approved**
81
+
82
+ ## Documentation
83
+
84
+ - [Architecture](docs/ARCHITECTURE.md) — modules, lifecycle, drift detection, persistence
85
+ - [API reference](docs/API.md) — public Python/MCP surface
86
+ - [CodeMode MCP server](docs/CODEMODE.md) — discovery-first FastMCP server and prompts
87
+
88
+ ## MCP
89
+
90
+ `vsh serve` starts the default FastMCP server.
91
+
92
+ For **CodeMode-style discovery** (search → schema on demand → simulate → approve → execute), use the dedicated server:
93
+
94
+ ```bash
95
+ vsh serve-codemode
96
+ # or
97
+ vsh-codemode
98
+ ```
99
+
100
+ See [docs/CODEMODE.md](docs/CODEMODE.md) for the CodeMode inspiration, prompts, and client config examples.
101
+
102
+ Both servers expose the same compact tool surface:
103
+
104
+ - tools: `search`, `get_schema`, `snapshot_workspace`, `simulate`, `approve`, `execute_approved`
105
+ - resources: workspace snapshot/projection, command spec cards, simulation records
106
+
107
+ ## pydantic-ai agent
108
+
109
+ ```bash
110
+ cp .env.example .env
111
+ # fill in MODEL_NAME and OPENROUTER_API_KEY
112
+
113
+ uv run python examples/pydantic_ai_agent_demo.py --mode live
114
+ ```
115
+
116
+ ```python
117
+ from pydantic_ai import Agent
118
+ from vsh.agent import VshAgentDeps, create_vsh_function_toolset
119
+
120
+ deps = VshAgentDeps.from_path("/path/to/workspace")
121
+ agent = Agent(
122
+ os.environ["MODEL_NAME"],
123
+ deps_type=VshAgentDeps,
124
+ toolsets=[create_vsh_function_toolset()],
125
+ )
126
+ ```
127
+
128
+ ## Configuration
129
+
130
+ | Variable | Default | Purpose |
131
+ |----------|---------|---------|
132
+ | `VSH_DATA_DIR` | `~/.vsh` | JSON persistence directory |
133
+ | `VSH_PERSIST` | `1` | Set `0` to disable disk writes |
134
+ | `VSH_PROTECTED_PATTERNS` | built-in defaults | Comma-separated protected path globs |
135
+ | `VSH_PROTECTED_PATTERNS_FILE` | — | Newline-separated protected globs file |
136
+ | `VSH_MAX_TOUCHED_PATHS` | `500` | Simulation limit for touched paths |
137
+ | `MODEL_NAME` | — | Live agent model id (demo) |
138
+
139
+ ## Development
140
+
141
+ ```bash
142
+ ruff check src tests
143
+ ruff format src tests
144
+ ty check
145
+ basedpyright src tests
146
+ pytest tests/
147
+ ```
148
+
149
+ ## Performance benchmarks
150
+
151
+ Compare every vsh command against native shell (5 runs, median + min/max, plots):
152
+
153
+ ```bash
154
+ uv run python playground/benchmark_vsh_vs_native.py
155
+ ```
156
+
157
+ Reports land in `playground/reports/<timestamp>/`. See [playground/README.md](playground/README.md).
158
+
159
+ ## License
160
+
161
+ Apache-2.0
vbash-0.2.0/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # vsh
2
+
3
+ Validation-first command engine for AI agents operating on workspaces.
4
+
5
+ `vsh` is not a POSIX shell emulator. It is a **safe command planning and execution control layer** for AI agents: shell-like intent becomes typed `StructuredCommand` models, side effects are simulated on a workspace snapshot, plans are approved, drift is revalidated, and only then are mutations applied to the real filesystem. Read commands validate path access and return captured stdout on execution; simulation does not stream file contents.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ uv sync
11
+ ```
12
+
13
+ `uv sync` installs the project plus `dev` and `agent` dependency groups (including `pydantic-ai`).
14
+
15
+ For pip-only workflows:
16
+
17
+ ```bash
18
+ python -m venv .venv
19
+ source .venv/bin/activate
20
+ pip install -e ".[dev,agent]"
21
+ ```
22
+
23
+ ## Quick start
24
+
25
+ ```bash
26
+ vsh search ls
27
+ vsh schema vsh_list
28
+ vsh serve
29
+ ```
30
+
31
+ ## End-to-end lifecycle
32
+
33
+ ```python
34
+ from vsh import LsCommand
35
+ from vsh.execute import execute_approved
36
+ from vsh.plans import approve_plan
37
+ from vsh.simulate.engine import simulate_command
38
+ from vsh.snapshot.builder import snapshot_workspace
39
+
40
+ workspace = "/path/to/project"
41
+ snapshot = snapshot_workspace(workspace, cwd=workspace)
42
+ result = simulate_command(LsCommand(path=".", all=True), snapshot)
43
+ token = approve_plan(result.plan_id)
44
+ execution = execute_approved(token.token)
45
+
46
+ print(execution.applied, execution.matches_prediction)
47
+ ```
48
+
49
+ Flow: **search → get_schema → snapshot → simulate → approve → execute_approved**
50
+
51
+ ## Documentation
52
+
53
+ - [Architecture](docs/ARCHITECTURE.md) — modules, lifecycle, drift detection, persistence
54
+ - [API reference](docs/API.md) — public Python/MCP surface
55
+ - [CodeMode MCP server](docs/CODEMODE.md) — discovery-first FastMCP server and prompts
56
+
57
+ ## MCP
58
+
59
+ `vsh serve` starts the default FastMCP server.
60
+
61
+ For **CodeMode-style discovery** (search → schema on demand → simulate → approve → execute), use the dedicated server:
62
+
63
+ ```bash
64
+ vsh serve-codemode
65
+ # or
66
+ vsh-codemode
67
+ ```
68
+
69
+ See [docs/CODEMODE.md](docs/CODEMODE.md) for the CodeMode inspiration, prompts, and client config examples.
70
+
71
+ Both servers expose the same compact tool surface:
72
+
73
+ - tools: `search`, `get_schema`, `snapshot_workspace`, `simulate`, `approve`, `execute_approved`
74
+ - resources: workspace snapshot/projection, command spec cards, simulation records
75
+
76
+ ## pydantic-ai agent
77
+
78
+ ```bash
79
+ cp .env.example .env
80
+ # fill in MODEL_NAME and OPENROUTER_API_KEY
81
+
82
+ uv run python examples/pydantic_ai_agent_demo.py --mode live
83
+ ```
84
+
85
+ ```python
86
+ from pydantic_ai import Agent
87
+ from vsh.agent import VshAgentDeps, create_vsh_function_toolset
88
+
89
+ deps = VshAgentDeps.from_path("/path/to/workspace")
90
+ agent = Agent(
91
+ os.environ["MODEL_NAME"],
92
+ deps_type=VshAgentDeps,
93
+ toolsets=[create_vsh_function_toolset()],
94
+ )
95
+ ```
96
+
97
+ ## Configuration
98
+
99
+ | Variable | Default | Purpose |
100
+ |----------|---------|---------|
101
+ | `VSH_DATA_DIR` | `~/.vsh` | JSON persistence directory |
102
+ | `VSH_PERSIST` | `1` | Set `0` to disable disk writes |
103
+ | `VSH_PROTECTED_PATTERNS` | built-in defaults | Comma-separated protected path globs |
104
+ | `VSH_PROTECTED_PATTERNS_FILE` | — | Newline-separated protected globs file |
105
+ | `VSH_MAX_TOUCHED_PATHS` | `500` | Simulation limit for touched paths |
106
+ | `MODEL_NAME` | — | Live agent model id (demo) |
107
+
108
+ ## Development
109
+
110
+ ```bash
111
+ ruff check src tests
112
+ ruff format src tests
113
+ ty check
114
+ basedpyright src tests
115
+ pytest tests/
116
+ ```
117
+
118
+ ## Performance benchmarks
119
+
120
+ Compare every vsh command against native shell (5 runs, median + min/max, plots):
121
+
122
+ ```bash
123
+ uv run python playground/benchmark_vsh_vs_native.py
124
+ ```
125
+
126
+ Reports land in `playground/reports/<timestamp>/`. See [playground/README.md](playground/README.md).
127
+
128
+ ## License
129
+
130
+ Apache-2.0