srvgov-cli 0.2.0 → 0.4.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 (2) hide show
  1. package/README.md +80 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -26,6 +26,9 @@ srvgov ctx use dev -o json
26
26
  srvgov status -o json
27
27
  srvgov ports -o json
28
28
  srvgov logs --unit sshd --since "1 hour ago" --lines 50 -o json
29
+ srvgov svc status sshd -o json
30
+ srvgov file stat /etc/hosts -o json
31
+ srvgov docker list -o json
29
32
  srvgov exec --dry-run "uptime" -o json
30
33
  srvgov exec "uptime" -o json
31
34
  srvgov audit query --limit 20 -o json
@@ -93,6 +96,83 @@ operators. `ports` falls back from `ss` to `netstat`. Unit logs fall back from
93
96
  adds `sudo`; unavailable PID/process fields remain empty. Log text, process
94
97
  names, generated command text, caller output, and audit records are redacted.
95
98
 
99
+ ## Service Control
100
+
101
+ `svc` exposes only a fixed service-operation whitelist. Unit names are treated
102
+ as literal shell words, and every generated `systemctl` command goes through
103
+ the same classifier and authorization path as `exec`.
104
+
105
+ ```bash
106
+ # R0 read, still audited
107
+ srvgov svc status nginx -o json
108
+
109
+ # R2 change: human-supplied reason, ticket, and confirmation
110
+ srvgov svc restart nginx \
111
+ --reason "apply reviewed configuration" --ticket OPS-123 --yes -o json
112
+ ```
113
+
114
+ Available actions are `status`, `start`, `stop`, `restart`, `reload`, `enable`,
115
+ and `disable`, for one unit at a time. Protected contexts raise service changes
116
+ from R2 to R3 and additionally require human-supplied `--allow-destructive`.
117
+ `svc` does not expose power, isolate, mask, or arbitrary systemctl operations.
118
+
119
+ ## File Operations
120
+
121
+ File reads are structured R0 operations and remain audited:
122
+
123
+ ```bash
124
+ srvgov file read /etc/hosts --max-bytes 1048576 -o json
125
+ srvgov file stat /etc/hosts -o json
126
+ srvgov file list /var/log -o json
127
+ ```
128
+
129
+ Writes use `tee -- '<path>'` with content streamed over SSH stdin. They are R2
130
+ for ordinary paths and R3 for sensitive paths such as SSH authorization files,
131
+ shell dotfiles, and crontabs.
132
+
133
+ ```bash
134
+ printf '%s\n' 'enabled=true' | srvgov file write /tmp/app.conf \
135
+ --reason "update reviewed configuration" --ticket OPS-123 --yes -o json
136
+
137
+ srvgov file write /tmp/app.conf --content "enabled=true" \
138
+ --reason "update reviewed configuration" --ticket OPS-123 --yes -o json
139
+ ```
140
+
141
+ Without `--content`, stdin is the file content and explicit `--yes` is required
142
+ before authorization. With `--content`, stdin is never read and interactive
143
+ confirmation remains available. Write output and audit records never contain
144
+ file content; audit stores only the redacted path, byte count, and SHA-256.
145
+ Writes are direct and non-atomic; temporary-file plus rename is not implemented
146
+ in this release. `file` never uses SFTP and never adds `sudo`.
147
+
148
+ ## Docker Governance
149
+
150
+ Docker reads provide stable, redacted structures:
151
+
152
+ ```bash
153
+ srvgov docker list -o json
154
+ srvgov docker inspect api -o json
155
+ srvgov docker logs api --tail 100 -o json
156
+ ```
157
+
158
+ `docker list`, `inspect`, and `logs` are audited R0 operations. Inspect uses a
159
+ remote fixed-field projection and excludes container environment variables and
160
+ the full inspect document. Logs default to 100 lines and accept `--tail`
161
+ between 1 and 10000.
162
+
163
+ Lifecycle changes are R2 and require human authorization:
164
+
165
+ ```bash
166
+ srvgov docker restart api \
167
+ --reason "restart after reviewed deployment" --ticket OPS-123 --yes -o json
168
+ ```
169
+
170
+ The fixed whitelist contains only `ps`/`list`, `inspect`, `logs`, `start`,
171
+ `stop`, `restart`, and `rm`, one container at a time. It never exposes Docker
172
+ run, create, exec, build, copy, compose, or prune. Protected contexts raise
173
+ lifecycle changes to R3 and require human-supplied `--allow-destructive`.
174
+ Container identifiers are shell-quoted.
175
+
96
176
  ## Governed Execution
97
177
 
98
178
  Preview without connecting or executing:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "srvgov-cli",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Governed remote server command execution CLI for AI agents",
5
5
  "bin": {
6
6
  "srvgov": "bin/srvgov-cli.js",