agenshield 0.1.0

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 (184) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/LICENSE +201 -0
  3. package/README.md +91 -0
  4. package/package.json +61 -0
  5. package/src/cli.d.ts +25 -0
  6. package/src/cli.d.ts.map +1 -0
  7. package/src/cli.js +78 -0
  8. package/src/cli.js.map +1 -0
  9. package/src/commands/daemon.d.ts +11 -0
  10. package/src/commands/daemon.d.ts.map +1 -0
  11. package/src/commands/daemon.js +107 -0
  12. package/src/commands/daemon.js.map +1 -0
  13. package/src/commands/dev.d.ts +15 -0
  14. package/src/commands/dev.d.ts.map +1 -0
  15. package/src/commands/dev.js +387 -0
  16. package/src/commands/dev.js.map +1 -0
  17. package/src/commands/doctor.d.ts +11 -0
  18. package/src/commands/doctor.d.ts.map +1 -0
  19. package/src/commands/doctor.js +129 -0
  20. package/src/commands/doctor.js.map +1 -0
  21. package/src/commands/index.d.ts +12 -0
  22. package/src/commands/index.d.ts.map +1 -0
  23. package/src/commands/index.js +12 -0
  24. package/src/commands/index.js.map +1 -0
  25. package/src/commands/setup.d.ts +13 -0
  26. package/src/commands/setup.d.ts.map +1 -0
  27. package/src/commands/setup.js +203 -0
  28. package/src/commands/setup.js.map +1 -0
  29. package/src/commands/status.d.ts +11 -0
  30. package/src/commands/status.d.ts.map +1 -0
  31. package/src/commands/status.js +63 -0
  32. package/src/commands/status.js.map +1 -0
  33. package/src/commands/uninstall.d.ts +11 -0
  34. package/src/commands/uninstall.d.ts.map +1 -0
  35. package/src/commands/uninstall.js +164 -0
  36. package/src/commands/uninstall.js.map +1 -0
  37. package/src/detect/index.d.ts +9 -0
  38. package/src/detect/index.d.ts.map +1 -0
  39. package/src/detect/index.js +9 -0
  40. package/src/detect/index.js.map +1 -0
  41. package/src/dev-tui/DevApp.d.ts +13 -0
  42. package/src/dev-tui/DevApp.d.ts.map +1 -0
  43. package/src/dev-tui/DevApp.js +118 -0
  44. package/src/dev-tui/DevApp.js.map +1 -0
  45. package/src/dev-tui/DevSetupApp.d.ts +22 -0
  46. package/src/dev-tui/DevSetupApp.d.ts.map +1 -0
  47. package/src/dev-tui/DevSetupApp.js +407 -0
  48. package/src/dev-tui/DevSetupApp.js.map +1 -0
  49. package/src/dev-tui/components/ActionMenu.d.ts +11 -0
  50. package/src/dev-tui/components/ActionMenu.d.ts.map +1 -0
  51. package/src/dev-tui/components/ActionMenu.js +25 -0
  52. package/src/dev-tui/components/ActionMenu.js.map +1 -0
  53. package/src/dev-tui/components/ActionResult.d.ts +12 -0
  54. package/src/dev-tui/components/ActionResult.d.ts.map +1 -0
  55. package/src/dev-tui/components/ActionResult.js +27 -0
  56. package/src/dev-tui/components/ActionResult.js.map +1 -0
  57. package/src/dev-tui/components/DevConfirm.d.ts +22 -0
  58. package/src/dev-tui/components/DevConfirm.d.ts.map +1 -0
  59. package/src/dev-tui/components/DevConfirm.js +73 -0
  60. package/src/dev-tui/components/DevConfirm.js.map +1 -0
  61. package/src/dev-tui/components/DevModeSelect.d.ts +12 -0
  62. package/src/dev-tui/components/DevModeSelect.d.ts.map +1 -0
  63. package/src/dev-tui/components/DevModeSelect.js +69 -0
  64. package/src/dev-tui/components/DevModeSelect.js.map +1 -0
  65. package/src/dev-tui/components/LogViewer.d.ts +11 -0
  66. package/src/dev-tui/components/LogViewer.d.ts.map +1 -0
  67. package/src/dev-tui/components/LogViewer.js +18 -0
  68. package/src/dev-tui/components/LogViewer.js.map +1 -0
  69. package/src/dev-tui/components/PathPrompt.d.ts +13 -0
  70. package/src/dev-tui/components/PathPrompt.d.ts.map +1 -0
  71. package/src/dev-tui/components/PathPrompt.js +48 -0
  72. package/src/dev-tui/components/PathPrompt.js.map +1 -0
  73. package/src/dev-tui/components/StatusBar.d.ts +13 -0
  74. package/src/dev-tui/components/StatusBar.d.ts.map +1 -0
  75. package/src/dev-tui/components/StatusBar.js +36 -0
  76. package/src/dev-tui/components/StatusBar.js.map +1 -0
  77. package/src/dev-tui/index.d.ts +7 -0
  78. package/src/dev-tui/index.d.ts.map +1 -0
  79. package/src/dev-tui/index.js +5 -0
  80. package/src/dev-tui/index.js.map +1 -0
  81. package/src/dev-tui/runner.d.ts +17 -0
  82. package/src/dev-tui/runner.d.ts.map +1 -0
  83. package/src/dev-tui/runner.js +53 -0
  84. package/src/dev-tui/runner.js.map +1 -0
  85. package/src/dev-tui/state.d.ts +34 -0
  86. package/src/dev-tui/state.d.ts.map +1 -0
  87. package/src/dev-tui/state.js +77 -0
  88. package/src/dev-tui/state.js.map +1 -0
  89. package/src/index.d.ts +15 -0
  90. package/src/index.d.ts.map +1 -0
  91. package/src/index.js +19 -0
  92. package/src/index.js.map +1 -0
  93. package/src/setup-server/index.d.ts +8 -0
  94. package/src/setup-server/index.d.ts.map +1 -0
  95. package/src/setup-server/index.js +7 -0
  96. package/src/setup-server/index.js.map +1 -0
  97. package/src/setup-server/routes.d.ts +22 -0
  98. package/src/setup-server/routes.d.ts.map +1 -0
  99. package/src/setup-server/routes.js +279 -0
  100. package/src/setup-server/routes.js.map +1 -0
  101. package/src/setup-server/server.d.ts +16 -0
  102. package/src/setup-server/server.d.ts.map +1 -0
  103. package/src/setup-server/server.js +125 -0
  104. package/src/setup-server/server.js.map +1 -0
  105. package/src/setup-server/sse.d.ts +31 -0
  106. package/src/setup-server/sse.d.ts.map +1 -0
  107. package/src/setup-server/sse.js +76 -0
  108. package/src/setup-server/sse.js.map +1 -0
  109. package/src/setup-server/static.d.ts +11 -0
  110. package/src/setup-server/static.d.ts.map +1 -0
  111. package/src/setup-server/static.js +33 -0
  112. package/src/setup-server/static.js.map +1 -0
  113. package/src/utils/daemon.d.ts +63 -0
  114. package/src/utils/daemon.d.ts.map +1 -0
  115. package/src/utils/daemon.js +377 -0
  116. package/src/utils/daemon.js.map +1 -0
  117. package/src/utils/find-test-harness.d.ts +5 -0
  118. package/src/utils/find-test-harness.d.ts.map +1 -0
  119. package/src/utils/find-test-harness.js +23 -0
  120. package/src/utils/find-test-harness.js.map +1 -0
  121. package/src/utils/index.d.ts +8 -0
  122. package/src/utils/index.d.ts.map +1 -0
  123. package/src/utils/index.js +8 -0
  124. package/src/utils/index.js.map +1 -0
  125. package/src/utils/privileges.d.ts +51 -0
  126. package/src/utils/privileges.d.ts.map +1 -0
  127. package/src/utils/privileges.js +125 -0
  128. package/src/utils/privileges.js.map +1 -0
  129. package/src/utils/sudo-env.d.ts +27 -0
  130. package/src/utils/sudo-env.d.ts.map +1 -0
  131. package/src/utils/sudo-env.js +63 -0
  132. package/src/utils/sudo-env.js.map +1 -0
  133. package/src/wizard/App.d.ts +6 -0
  134. package/src/wizard/App.d.ts.map +1 -0
  135. package/src/wizard/App.js +215 -0
  136. package/src/wizard/App.js.map +1 -0
  137. package/src/wizard/Uninstall.d.ts +16 -0
  138. package/src/wizard/Uninstall.d.ts.map +1 -0
  139. package/src/wizard/Uninstall.js +163 -0
  140. package/src/wizard/Uninstall.js.map +1 -0
  141. package/src/wizard/components/AdvancedConfig.d.ts +42 -0
  142. package/src/wizard/components/AdvancedConfig.d.ts.map +1 -0
  143. package/src/wizard/components/AdvancedConfig.js +131 -0
  144. package/src/wizard/components/AdvancedConfig.js.map +1 -0
  145. package/src/wizard/components/Confirm.d.ts +31 -0
  146. package/src/wizard/components/Confirm.d.ts.map +1 -0
  147. package/src/wizard/components/Confirm.js +148 -0
  148. package/src/wizard/components/Confirm.js.map +1 -0
  149. package/src/wizard/components/Header.d.ts +6 -0
  150. package/src/wizard/components/Header.d.ts.map +1 -0
  151. package/src/wizard/components/Header.js +11 -0
  152. package/src/wizard/components/Header.js.map +1 -0
  153. package/src/wizard/components/ModeSelect.d.ts +12 -0
  154. package/src/wizard/components/ModeSelect.d.ts.map +1 -0
  155. package/src/wizard/components/ModeSelect.js +74 -0
  156. package/src/wizard/components/ModeSelect.js.map +1 -0
  157. package/src/wizard/components/PasscodeSetup.d.ts +16 -0
  158. package/src/wizard/components/PasscodeSetup.d.ts.map +1 -0
  159. package/src/wizard/components/PasscodeSetup.js +119 -0
  160. package/src/wizard/components/PasscodeSetup.js.map +1 -0
  161. package/src/wizard/components/ProgressBar.d.ts +12 -0
  162. package/src/wizard/components/ProgressBar.d.ts.map +1 -0
  163. package/src/wizard/components/ProgressBar.js +18 -0
  164. package/src/wizard/components/ProgressBar.js.map +1 -0
  165. package/src/wizard/components/StepList.d.ts +12 -0
  166. package/src/wizard/components/StepList.d.ts.map +1 -0
  167. package/src/wizard/components/StepList.js +37 -0
  168. package/src/wizard/components/StepList.js.map +1 -0
  169. package/src/wizard/components/Summary.d.ts +12 -0
  170. package/src/wizard/components/Summary.d.ts.map +1 -0
  171. package/src/wizard/components/Summary.js +44 -0
  172. package/src/wizard/components/Summary.js.map +1 -0
  173. package/src/wizard/engine.d.ts +29 -0
  174. package/src/wizard/engine.d.ts.map +1 -0
  175. package/src/wizard/engine.js +866 -0
  176. package/src/wizard/engine.js.map +1 -0
  177. package/src/wizard/index.d.ts +8 -0
  178. package/src/wizard/index.d.ts.map +1 -0
  179. package/src/wizard/index.js +8 -0
  180. package/src/wizard/index.js.map +1 -0
  181. package/src/wizard/types.d.ts +190 -0
  182. package/src/wizard/types.d.ts.map +1 -0
  183. package/src/wizard/types.js +193 -0
  184. package/src/wizard/types.js.map +1 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ All notable changes to `agenshield` will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2026-02-03
11
+
12
+ ### Added
13
+
14
+ - Initial release
15
+ - CLI entrypoint with setup wizard placeholder
16
+ - Project structure and build configuration
package/LICENSE ADDED
@@ -0,0 +1,201 @@
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
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # AgenShield CLI (agenshield)
2
+
3
+ AgenShield CLI is the operator-facing entry point for installing, diagnosing, and managing the AgenShield sandbox on a host machine. It wraps setup, status reporting, daemon lifecycle, and uninstall flows, and provides an interactive Ink-based wizard.
4
+
5
+ ## Purpose
6
+ - Bootstrap a secure sandboxed environment for an agent runtime (presets like OpenClaw or custom targets).
7
+ - Report security posture and installation health.
8
+ - Start/stop the local AgenShield daemon service.
9
+ - Roll back an AgenShield installation using a recorded backup.
10
+
11
+ ## Commands
12
+ - `setup` - Interactive setup wizard (Ink/React).
13
+ - `status` - Quick status summary (human or JSON).
14
+ - `doctor` - Diagnostics for prerequisites, installation, and security status.
15
+ - `daemon` - Start/stop/restart/status for the daemon service.
16
+ - `uninstall` - Roll back a prior installation (requires backup).
17
+
18
+ Run `agenshield --help` for the full help output and examples.
19
+
20
+ ## Usage
21
+ ```bash
22
+ # Show help
23
+ agenshield --help
24
+
25
+ # Status summary
26
+ agenshield status
27
+ agenshield status --json
28
+
29
+ # Diagnostics
30
+ agenshield doctor
31
+ agenshield doctor --json
32
+
33
+ # Setup (requires root unless --dry-run)
34
+ sudo agenshield setup
35
+
36
+ # Manage daemon
37
+ sudo agenshield daemon start
38
+ agenshield daemon status
39
+ sudo agenshield daemon stop
40
+
41
+ # Uninstall (requires backup created during setup)
42
+ sudo agenshield uninstall
43
+ ```
44
+
45
+ ## Configuration (Environment Variables)
46
+ The setup wizard consumes options through environment variables. The CLI sets these when you pass flags:
47
+
48
+ - `AGENSHIELD_TARGET` - preset name (e.g. `openclaw`, `custom`).
49
+ - `AGENSHIELD_ENTRY_POINT` - entry point for `custom` target.
50
+ - `AGENSHIELD_BASE_NAME` - base name for users/groups.
51
+ - `AGENSHIELD_PREFIX` - optional name prefix (useful for test installs).
52
+ - `AGENSHIELD_BASE_UID` - base UID for created users.
53
+ - `AGENSHIELD_DRY_RUN` - `true` to avoid making changes.
54
+ - `AGENSHIELD_SKIP_CONFIRM` - `true` to skip confirmations.
55
+ - `AGENSHIELD_VERBOSE` - `true` for verbose wizard output.
56
+
57
+ ## Architecture
58
+ - `libs/cli/src/cli.ts` - Commander entry point and command registration.
59
+ - `libs/cli/src/commands/*` - Individual command implementations.
60
+ - `libs/cli/src/wizard/*` - Ink/React setup wizard UI and engine.
61
+ - `libs/cli/src/utils/privileges.ts` - Root checks and privilege helpers.
62
+ - `libs/cli/src/utils/daemon.ts` - Daemon lifecycle helpers.
63
+
64
+ The CLI relies on `@agenshield/sandbox` for detection, setup, uninstall, and security checks.
65
+
66
+ ## Limitations and Caveats
67
+ - Many flows are macOS-specific because the underlying sandbox tooling is macOS-only (`dscl`, `sandbox-exec`, LaunchDaemons).
68
+ - `setup`, `daemon start/stop/restart`, and `uninstall` require root access.
69
+ - `doctor --fix` is accepted but currently does not perform any automatic fixes.
70
+ - `uninstall --prefix` is accepted but not yet wired into uninstall logic.
71
+ - The wizard reads configuration from environment variables only; it does not persist CLI flags on its own.
72
+
73
+ ## Development
74
+ ```bash
75
+ # Run in dev mode (no build)
76
+ npx nx run cli:dev
77
+
78
+ # Build
79
+ npx nx build cli
80
+ ```
81
+
82
+ ## Contribution Guide
83
+ - Keep CLI output deterministic; prefer JSON outputs for machine-readable modes.
84
+ - Reuse `ensureRoot()` for privileged operations for consistent messaging.
85
+ - Prefer adding new features as separate command files under `src/commands/`.
86
+
87
+ ## Agent Notes
88
+ - Add a new command by creating `src/commands/<name>.ts`, exporting it in `src/commands/index.ts`, and registering it in `src/cli.ts`.
89
+ - The setup wizard is driven by `src/wizard/engine.ts`; it expects configuration via env vars listed above.
90
+ - `@agenshield/sandbox` is the authoritative source for user/group creation, directory layout, and security checks.
91
+ - The CLI itself does not talk to the broker directly; it primarily orchestrates system setup and daemon management.
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "agenshield",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "AgenShield - CLI for managing AI agent security sandbox",
6
+ "main": "./src/index.js",
7
+ "types": "./src/index.d.ts",
8
+ "bin": {
9
+ "agenshield": "./src/cli.js"
10
+ },
11
+ "exports": {
12
+ "./package.json": "./package.json",
13
+ ".": {
14
+ "types": "./src/index.d.ts",
15
+ "import": "./src/index.js",
16
+ "default": "./src/index.js"
17
+ }
18
+ },
19
+ "engines": {
20
+ "node": ">=22.0.0"
21
+ },
22
+ "author": "Agen.co",
23
+ "license": "MIT",
24
+ "homepage": "https://github.com/agen-co/agenshield",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/agen-co/agenshield.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/agen-co/agenshield/issues"
31
+ },
32
+ "keywords": [
33
+ "ai",
34
+ "security",
35
+ "agent",
36
+ "cli",
37
+ "sandbox"
38
+ ],
39
+ "dependencies": {
40
+ "@agenshield/ipc": "0.1.0",
41
+ "@agenshield/sandbox": "0.1.0",
42
+ "@agenshield/daemon": "0.1.0",
43
+ "commander": "^14.0.0",
44
+ "ink": "^5.2.0",
45
+ "ink-spinner": "^5.0.0",
46
+ "ink-select-input": "^6.0.0",
47
+ "ink-text-input": "^6.0.0",
48
+ "react": "^18.3.1",
49
+ "yaml": "^2.7.1",
50
+ "fastify": "^5.7.0",
51
+ "@fastify/static": "^8.3.0",
52
+ "@fastify/cors": "^11.0.0"
53
+ },
54
+ "devDependencies": {
55
+ "@types/node": "^24.0.0",
56
+ "@types/react": "^18.3.0",
57
+ "tsx": "^4.21.0",
58
+ "typescript": "^5.9.3"
59
+ },
60
+ "module": "./src/index.js"
61
+ }
package/src/cli.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * AgenShield CLI
4
+ *
5
+ * Security CLI for AI agents. Provides commands for setting up, managing,
6
+ * and monitoring the AgenShield security sandbox.
7
+ *
8
+ * @example
9
+ * ```bash
10
+ * # Show help
11
+ * agenshield --help
12
+ *
13
+ * # Check status
14
+ * agenshield status
15
+ *
16
+ * # Run setup wizard
17
+ * agenshield setup
18
+ *
19
+ * # Manage daemon
20
+ * agenshield daemon start
21
+ * agenshield daemon status
22
+ * ```
23
+ */
24
+ export {};
25
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;GAqBG"}
package/src/cli.js ADDED
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * AgenShield CLI
4
+ *
5
+ * Security CLI for AI agents. Provides commands for setting up, managing,
6
+ * and monitoring the AgenShield security sandbox.
7
+ *
8
+ * @example
9
+ * ```bash
10
+ * # Show help
11
+ * agenshield --help
12
+ *
13
+ * # Check status
14
+ * agenshield status
15
+ *
16
+ * # Run setup wizard
17
+ * agenshield setup
18
+ *
19
+ * # Manage daemon
20
+ * agenshield daemon start
21
+ * agenshield daemon status
22
+ * ```
23
+ */
24
+ import { Command } from 'commander';
25
+ import { detectPrivileges } from './utils/privileges.js';
26
+ import { createSetupCommand, createStatusCommand, createDoctorCommand, createDaemonCommand, createUninstallCommand, createDevCommand, } from './commands/index.js';
27
+ // Package version - will be replaced during build
28
+ const VERSION = '0.1.0';
29
+ /**
30
+ * Create and configure the main CLI program
31
+ */
32
+ function createProgram() {
33
+ const program = new Command();
34
+ const priv = detectPrivileges();
35
+ program
36
+ .name('agenshield')
37
+ .description('AgenShield - Security CLI for AI agents')
38
+ .version(VERSION, '-V, --version', 'Output the version number')
39
+ .addHelpText('after', `
40
+ Current user: ${priv.username} (UID: ${priv.uid})${priv.isRoot ? ' [ROOT]' : ''}
41
+
42
+ Examples:
43
+ $ agenshield status Check current status
44
+ $ agenshield doctor Run diagnostics
45
+ $ agenshield setup Run setup wizard
46
+ $ agenshield daemon start Start daemon
47
+ $ agenshield dev Dev mode with interactive TUI
48
+ $ agenshield dev clean Clean dev environment
49
+ $ agenshield dev shell Open sandboxed agent shell
50
+ $ agenshield uninstall Reverse isolation
51
+ `);
52
+ // Register commands
53
+ program.addCommand(createSetupCommand());
54
+ program.addCommand(createStatusCommand());
55
+ program.addCommand(createDoctorCommand());
56
+ program.addCommand(createDaemonCommand());
57
+ program.addCommand(createUninstallCommand());
58
+ program.addCommand(createDevCommand());
59
+ return program;
60
+ }
61
+ /**
62
+ * Main entry point
63
+ */
64
+ async function main() {
65
+ const program = createProgram();
66
+ try {
67
+ await program.parseAsync(process.argv);
68
+ }
69
+ catch (err) {
70
+ console.error('Error:', err.message);
71
+ process.exit(1);
72
+ }
73
+ }
74
+ main().catch((err) => {
75
+ console.error('Fatal error:', err);
76
+ process.exit(1);
77
+ });
78
+ //# sourceMappingURL=cli.js.map
package/src/cli.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,kDAAkD;AAClD,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB;;GAEG;AACH,SAAS,aAAa;IACpB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,gBAAgB,EAAE,CAAC;IAEhC,OAAO;SACJ,IAAI,CAAC,YAAY,CAAC;SAClB,WAAW,CAAC,yCAAyC,CAAC;SACtD,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,2BAA2B,CAAC;SAC9D,WAAW,CACV,OAAO,EACP;gBACU,IAAI,CAAC,QAAQ,UAAU,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;CAW9E,CACI,CAAC;IAEJ,oBAAoB;IACpB,OAAO,CAAC,UAAU,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACzC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAEvC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAEhC,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAG,GAAa,CAAC,OAAO,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n/**\n * AgenShield CLI\n *\n * Security CLI for AI agents. Provides commands for setting up, managing,\n * and monitoring the AgenShield security sandbox.\n *\n * @example\n * ```bash\n * # Show help\n * agenshield --help\n *\n * # Check status\n * agenshield status\n *\n * # Run setup wizard\n * agenshield setup\n *\n * # Manage daemon\n * agenshield daemon start\n * agenshield daemon status\n * ```\n */\n\nimport { Command } from 'commander';\nimport { detectPrivileges } from './utils/privileges.js';\nimport {\n createSetupCommand,\n createStatusCommand,\n createDoctorCommand,\n createDaemonCommand,\n createUninstallCommand,\n createDevCommand,\n} from './commands/index.js';\n\n// Package version - will be replaced during build\nconst VERSION = '0.1.0';\n\n/**\n * Create and configure the main CLI program\n */\nfunction createProgram(): Command {\n const program = new Command();\n const priv = detectPrivileges();\n\n program\n .name('agenshield')\n .description('AgenShield - Security CLI for AI agents')\n .version(VERSION, '-V, --version', 'Output the version number')\n .addHelpText(\n 'after',\n `\nCurrent user: ${priv.username} (UID: ${priv.uid})${priv.isRoot ? ' [ROOT]' : ''}\n\nExamples:\n $ agenshield status Check current status\n $ agenshield doctor Run diagnostics\n $ agenshield setup Run setup wizard\n $ agenshield daemon start Start daemon\n $ agenshield dev Dev mode with interactive TUI\n $ agenshield dev clean Clean dev environment\n $ agenshield dev shell Open sandboxed agent shell\n $ agenshield uninstall Reverse isolation\n`\n );\n\n // Register commands\n program.addCommand(createSetupCommand());\n program.addCommand(createStatusCommand());\n program.addCommand(createDoctorCommand());\n program.addCommand(createDaemonCommand());\n program.addCommand(createUninstallCommand());\n program.addCommand(createDevCommand());\n\n return program;\n}\n\n/**\n * Main entry point\n */\nasync function main(): Promise<void> {\n const program = createProgram();\n\n try {\n await program.parseAsync(process.argv);\n } catch (err) {\n console.error('Error:', (err as Error).message);\n process.exit(1);\n }\n}\n\nmain().catch((err) => {\n console.error('Fatal error:', err);\n process.exit(1);\n});\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Daemon command
3
+ *
4
+ * Manages the AgenShield daemon (start, stop, restart, status).
5
+ */
6
+ import { Command } from 'commander';
7
+ /**
8
+ * Create the daemon command with subcommands
9
+ */
10
+ export declare function createDaemonCommand(): Command;
11
+ //# sourceMappingURL=daemon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon.d.ts","sourceRoot":"","sources":["../../../src/commands/daemon.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmCpC;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CA+E7C"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Daemon command
3
+ *
4
+ * Manages the AgenShield daemon (start, stop, restart, status).
5
+ */
6
+ import { Command } from 'commander';
7
+ import { getDaemonStatus, startDaemon, stopDaemon, restartDaemon, DAEMON_CONFIG, } from '../utils/daemon.js';
8
+ /**
9
+ * Show daemon status
10
+ */
11
+ async function showDaemonStatus() {
12
+ const status = await getDaemonStatus();
13
+ console.log('AgenShield Daemon Status');
14
+ console.log('========================\n');
15
+ if (status.running) {
16
+ console.log('Status: \x1b[32m● Running\x1b[0m');
17
+ if (status.pid) {
18
+ console.log(`PID: ${status.pid}`);
19
+ }
20
+ if (status.port) {
21
+ console.log(`Port: ${status.port}`);
22
+ }
23
+ if (status.uptime) {
24
+ console.log(`Uptime: ${status.uptime}`);
25
+ }
26
+ console.log(`URL: http://${DAEMON_CONFIG.HOST}:${DAEMON_CONFIG.PORT}`);
27
+ }
28
+ else {
29
+ console.log('Status: \x1b[31m○ Stopped\x1b[0m');
30
+ }
31
+ }
32
+ /**
33
+ * Create the daemon command with subcommands
34
+ */
35
+ export function createDaemonCommand() {
36
+ const cmd = new Command('daemon').description('Manage the AgenShield daemon');
37
+ // daemon start
38
+ cmd
39
+ .command('start')
40
+ .description('Start the daemon')
41
+ .option('-f, --foreground', 'Run in foreground (blocking)')
42
+ .action(async (options) => {
43
+ console.log('Starting AgenShield daemon...');
44
+ const result = await startDaemon({ foreground: options.foreground });
45
+ if (result.success) {
46
+ console.log(`\x1b[32m✓ ${result.message}\x1b[0m`);
47
+ if (result.pid) {
48
+ console.log(` PID: ${result.pid}`);
49
+ }
50
+ console.log(` URL: http://${DAEMON_CONFIG.HOST}:${DAEMON_CONFIG.PORT}`);
51
+ }
52
+ else {
53
+ console.log(`\x1b[31m✗ ${result.message}\x1b[0m`);
54
+ process.exit(1);
55
+ }
56
+ });
57
+ // daemon stop
58
+ cmd
59
+ .command('stop')
60
+ .description('Stop the daemon')
61
+ .action(async () => {
62
+ console.log('Stopping AgenShield daemon...');
63
+ const result = await stopDaemon();
64
+ if (result.success) {
65
+ console.log(`\x1b[32m✓ ${result.message}\x1b[0m`);
66
+ }
67
+ else {
68
+ console.log(`\x1b[31m✗ ${result.message}\x1b[0m`);
69
+ process.exit(1);
70
+ }
71
+ });
72
+ // daemon restart
73
+ cmd
74
+ .command('restart')
75
+ .description('Restart the daemon')
76
+ .action(async () => {
77
+ console.log('Restarting AgenShield daemon...');
78
+ const result = await restartDaemon();
79
+ if (result.success) {
80
+ console.log(`\x1b[32m✓ ${result.message}\x1b[0m`);
81
+ }
82
+ else {
83
+ console.log(`\x1b[31m✗ ${result.message}\x1b[0m`);
84
+ process.exit(1);
85
+ }
86
+ });
87
+ // daemon status (default action)
88
+ cmd
89
+ .command('status')
90
+ .description('Show daemon status')
91
+ .option('-j, --json', 'Output as JSON')
92
+ .action(async (options) => {
93
+ if (options.json) {
94
+ const status = await getDaemonStatus();
95
+ console.log(JSON.stringify(status, null, 2));
96
+ }
97
+ else {
98
+ await showDaemonStatus();
99
+ }
100
+ });
101
+ // Default action when no subcommand is provided
102
+ cmd.action(async () => {
103
+ await showDaemonStatus();
104
+ });
105
+ return cmd;
106
+ }
107
+ //# sourceMappingURL=daemon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daemon.js","sourceRoot":"","sources":["../../../src/commands/daemon.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Daemon command\n *\n * Manages the AgenShield daemon (start, stop, restart, status).\n */\n\nimport { Command } from 'commander';\nimport {\n getDaemonStatus,\n startDaemon,\n stopDaemon,\n restartDaemon,\n DAEMON_CONFIG,\n} from '../utils/daemon.js';\n\n/**\n * Show daemon status\n */\nasync function showDaemonStatus(): Promise<void> {\n const status = await getDaemonStatus();\n\n console.log('AgenShield Daemon Status');\n console.log('========================\\n');\n\n if (status.running) {\n console.log('Status: \\x1b[32m● Running\\x1b[0m');\n if (status.pid) {\n console.log(`PID: ${status.pid}`);\n }\n if (status.port) {\n console.log(`Port: ${status.port}`);\n }\n if (status.uptime) {\n console.log(`Uptime: ${status.uptime}`);\n }\n console.log(`URL: http://${DAEMON_CONFIG.HOST}:${DAEMON_CONFIG.PORT}`);\n } else {\n console.log('Status: \\x1b[31m○ Stopped\\x1b[0m');\n }\n}\n\n/**\n * Create the daemon command with subcommands\n */\nexport function createDaemonCommand(): Command {\n const cmd = new Command('daemon').description('Manage the AgenShield daemon');\n\n // daemon start\n cmd\n .command('start')\n .description('Start the daemon')\n .option('-f, --foreground', 'Run in foreground (blocking)')\n .action(async (options) => {\n console.log('Starting AgenShield daemon...');\n\n const result = await startDaemon({ foreground: options.foreground });\n\n if (result.success) {\n console.log(`\\x1b[32m✓ ${result.message}\\x1b[0m`);\n if (result.pid) {\n console.log(` PID: ${result.pid}`);\n }\n console.log(` URL: http://${DAEMON_CONFIG.HOST}:${DAEMON_CONFIG.PORT}`);\n } else {\n console.log(`\\x1b[31m✗ ${result.message}\\x1b[0m`);\n process.exit(1);\n }\n });\n\n // daemon stop\n cmd\n .command('stop')\n .description('Stop the daemon')\n .action(async () => {\n console.log('Stopping AgenShield daemon...');\n\n const result = await stopDaemon();\n\n if (result.success) {\n console.log(`\\x1b[32m✓ ${result.message}\\x1b[0m`);\n } else {\n console.log(`\\x1b[31m✗ ${result.message}\\x1b[0m`);\n process.exit(1);\n }\n });\n\n // daemon restart\n cmd\n .command('restart')\n .description('Restart the daemon')\n .action(async () => {\n console.log('Restarting AgenShield daemon...');\n\n const result = await restartDaemon();\n\n if (result.success) {\n console.log(`\\x1b[32m✓ ${result.message}\\x1b[0m`);\n } else {\n console.log(`\\x1b[31m✗ ${result.message}\\x1b[0m`);\n process.exit(1);\n }\n });\n\n // daemon status (default action)\n cmd\n .command('status')\n .description('Show daemon status')\n .option('-j, --json', 'Output as JSON')\n .action(async (options) => {\n if (options.json) {\n const status = await getDaemonStatus();\n console.log(JSON.stringify(status, null, 2));\n } else {\n await showDaemonStatus();\n }\n });\n\n // Default action when no subcommand is provided\n cmd.action(async () => {\n await showDaemonStatus();\n });\n\n return cmd;\n}\n"]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Dev command
3
+ *
4
+ * Runs AgenShield in dev mode with an interactive TUI for testing sandbox actions.
5
+ *
6
+ * First run: wizard-like interactive setup (prerequisites, mode selection, confirmation).
7
+ * Subsequent runs: detects existing dev user, skips setup, starts daemon, opens TUI.
8
+ * `agenshield dev clean`: stops daemon, removes dev users/groups, cleans state.
9
+ */
10
+ import { Command } from 'commander';
11
+ /**
12
+ * Create the dev command
13
+ */
14
+ export declare function createDevCommand(): Command;
15
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8YpC;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAkC1C"}