@contextecf/guardian-cli 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.
package/README.md ADDED
@@ -0,0 +1,218 @@
1
+ # Project Guardian CLI
2
+
3
+ Project Guardian is a local-first Personal Context Fabric for AI prompt
4
+ governance, local receipts, policy packs, MCP tools, and browser prompt checks.
5
+
6
+ ## One-Line Install
7
+
8
+ Install the CLI globally, CodeLedger-style:
9
+
10
+ ```bash
11
+ npm install -g @contextecf/guardian-cli
12
+ guardian setup
13
+ ```
14
+
15
+ Then open the Control Tower in your default browser:
16
+
17
+ ```bash
18
+ guardian launch
19
+ ```
20
+
21
+ The same daemon-backed launch path is also available as:
22
+
23
+ ```bash
24
+ guardian tower
25
+ guardian control-tower
26
+ ```
27
+
28
+ Or run setup without a global install:
29
+
30
+ ```bash
31
+ npx @contextecf/guardian-cli@latest setup
32
+ ```
33
+
34
+ The installed binary is `guardian`.
35
+
36
+ Guardian CLI requires Node.js 22 or newer. The release clean-room install smoke
37
+ uses a Node 22 trixie Docker image so native SQLite dependencies are tested
38
+ against the same Node and Linux glibc floor expected for public npm users.
39
+
40
+ ## First Run
41
+
42
+ ```bash
43
+ guardian setup
44
+ guardian doctor
45
+ guardian readiness
46
+ guardian launch
47
+ guardian status
48
+ guardian open
49
+ guardian policy list
50
+ guardian marketplace list
51
+ guardian posture list
52
+ guardian preferences show
53
+ guardian privacy show
54
+ guardian mcp install
55
+ guardian daemon pair --json
56
+ guardian desktop execute --input=/path/to/approved-action.json --yes
57
+ ```
58
+
59
+ `guardian setup` is the one-command first-run path after `npm install -g` or
60
+ through `npx`. It creates or reuses the local profile, keeps local-first privacy
61
+ defaults, runs doctor/data checks, writes Guardian-owned MCP snippets under the
62
+ Guardian profile directory, starts or reuses the local daemon, opens the Control
63
+ Tower unless `--print` is supplied, and returns browser-extension setup guidance
64
+ without printing the runtime token. It does not install the native host manifest
65
+ or write external AI tool config unless the user runs the explicit follow-up
66
+ commands.
67
+
68
+ `guardian extension native-host install --extension-id=<id>` writes the
69
+ Guardian browser native messaging helper and manifest. On macOS/Linux it writes
70
+ the browser manifest path directly. On Windows it writes the helper, `.cmd`
71
+ launcher, and manifest under `GUARDIAN_HOME/native-host`, then prints exact HKCU
72
+ `reg add`/`reg delete` commands for reviewed registration. Windows users can run
73
+ `guardian extension native-host install --extension-id=<id> --write-registry
74
+ --yes` to perform the HKCU registration through argv-based `reg add` and write a
75
+ token-free proof that `guardian extension native-host status --json` can verify.
76
+
77
+ `guardian launch`, `guardian tower`, and `guardian control-tower` start or reuse
78
+ the local daemon and then open the Control Tower in the default browser. During
79
+ the MVP, that daemon exposes a lightweight metadata-only status page at the
80
+ default URL. Re-running `guardian launch`, `guardian tower`,
81
+ `guardian control-tower`, or `guardian start` first checks the requested
82
+ authenticated loopback health endpoint and reuses the existing daemon when it is
83
+ already reachable. Use `guardian daemon serve` when you want the foreground
84
+ developer process instead. Use `guardian launch --print`,
85
+ `guardian tower --print`, or `guardian control-tower --print` to print the URL
86
+ without opening a browser.
87
+
88
+ `guardian open` launches the already configured local Control Tower URL in the
89
+ default browser without starting the daemon. It uses the installed
90
+ profile/default loopback URL unless supplied with a loopback URL through `--url`
91
+ or `GUARDIAN_CONTROL_TOWER_URL`; it refuses non-loopback URLs.
92
+
93
+ `guardian stop` sends an authenticated local loopback request to the running
94
+ daemon and then marks the runtime stopped in the local profile. It does not
95
+ print the runtime token and it refuses non-loopback stop URLs.
96
+
97
+ `guardian status` reports whether Guardian is installed, which Control Tower URL
98
+ is configured, and whether the daemon answers an authenticated local health
99
+ probe. It never prints the local runtime token.
100
+
101
+ `guardian readiness` separates the CodeLedger-style npm preview install path
102
+ from the full production release claim. It reports npm preview readiness from
103
+ the protected package evidence and npm publish dry-run, while keeping full
104
+ production release blocked until signed native installers, browser-store
105
+ distribution, high-risk desktop action execution, and autonomous local app execution
106
+ are proven. SQLite page-level encryption is proven for the local
107
+ Personal ECL store when `GUARDIAN_SQLITE_PAGE_ENCRYPTION_KEY` is configured.
108
+ Use `guardian readiness --strict`
109
+ in operator automation when the command should exit nonzero unless both preview
110
+ and full production claims are ready.
111
+
112
+ The daemon-served Control Tower includes a Release & Doctor section that mirrors
113
+ the local `guardian doctor` and `guardian status` evidence: doctor pass/warn/fail
114
+ counts, protected release evidence status, package metadata, checksum count, and
115
+ source/source-map/workspace-runtime-import boundary state. It remains
116
+ metadata-only and does not expose the runtime token.
117
+
118
+ `guardian privacy show` reports the local-first privacy posture, including
119
+ metadata-only defaults, raw content capture, cloud sync, local app autopilot,
120
+ receipt raw-content state, and pending encryption-at-rest controls. It never
121
+ prints the local runtime token.
122
+
123
+ `guardian key-store install --yes` stores a Guardian local-data key through the
124
+ platform OS credential store using stdin-only secret input: macOS Keychain,
125
+ Windows DPAPI, or Linux Secret Service. `guardian key-store status`,
126
+ `guardian data status`, `guardian privacy show`, and `guardian doctor` surface
127
+ only token/key-free proof metadata.
128
+
129
+ `guardian policy list`, `guardian policy enable <pack-id>`, and
130
+ `guardian policy disable <pack-id>` let users manage preset policy packs after
131
+ install. Guardian persists the active selection in `profile.json` and
132
+ `policy-packs.json`, rejects unknown pack IDs, and keeps at least one pack
133
+ active so the local runtime does not accidentally run without guardrails.
134
+
135
+ `guardian marketplace list`, `guardian marketplace show <pack-id>`, and
136
+ `guardian marketplace submit-template --json` expose the first browse-only
137
+ Policy Pack Marketplace metadata surface. Users and administrators can inspect
138
+ publisher, distribution class, review status, compatibility, price/license,
139
+ proven/not-proven claims, limitations, and custom-pack submission shape before
140
+ connecting anything. Marketplace packs cannot bypass Guardian's local policy
141
+ engine, confirmation gates, provider/source/app revocations, or receipts.
142
+
143
+ `guardian posture list` and `guardian posture set
144
+ <calm|balanced|guided|high_assurance|autopilot_lite>` let users manage the
145
+ superordinate Guardian Posture Profile above individual policy packs and
146
+ preferences. Guardian persists the selected profile in `profile.json` and
147
+ `posture-profile.json`, shows the behavior preview in Control Tower, and does
148
+ not silently enable raw capture, cloud sync, or local app autopilot.
149
+
150
+ `guardian preferences show`, `guardian preferences coach
151
+ <off|quiet|balanced|hands_on>`, and `guardian preferences learning <on|off>`
152
+ let users decide how often Prompt Coach should tag along and whether the local
153
+ Learning Graph is enabled. Guardian persists these choices in `profile.json`
154
+ and `preferences.json`; Prompt Coach opt-out is honored by the local daemon
155
+ without disabling policy checks.
156
+
157
+ `guardian install`, `guardian doctor`, and `guardian mcp install` do not print
158
+ the local runtime token. The token is emitted only by the explicit
159
+ `guardian daemon pair --json` handoff command so the browser extension can be
160
+ paired deliberately.
161
+
162
+ `guardian desktop execute --input=/path/to/approved-action.json --yes` is the
163
+ first conservative desktop adapter. It consumes an approved MCP local-action
164
+ response, verifies the desktop execution plan hash, requires a second local
165
+ confirmation flag, refuses high-risk action types, opens only bounded
166
+ `http://` or `https://` URL targets in the MVP, emits the
167
+ `guardian_desktop_url_open` adapter id/version/capability proof, and writes a
168
+ metadata-only Personal ECL receipt. It does not execute
169
+ send/delete/pay/publish/system-change actions.
170
+
171
+ `guardian desktop safety-smoke --json` is the release-readiness smoke for this
172
+ surface. It keeps local app autopilot off, blocks a high-risk send action
173
+ before adapter invocation, exercises the bounded low-risk desktop-browser open
174
+ adapter path with a simulated open, and emits token-safe metadata-only receipt
175
+ and event-chain evidence. It does not authorize autopilot or close a production
176
+ gate.
177
+
178
+ ## Privacy Defaults
179
+
180
+ Guardian starts local-first:
181
+
182
+ - raw content capture off
183
+ - cloud sync off
184
+ - learning graph opt-in
185
+ - local app autopilot off
186
+ - metadata-only receipts by default
187
+
188
+ ## Package Boundary
189
+
190
+ The npm package publishes bundled CLI/runtime JavaScript, TypeScript
191
+ declarations, and this README. Guardian workspace packages are bundled into the
192
+ CLI entrypoints so `npx @contextecf/guardian-cli@latest setup` can run outside
193
+ the monorepo. The native SQLite adapter remains a normal `better-sqlite3`
194
+ runtime dependency.
195
+
196
+ Source files, source maps, and source-controlled release gates remain in the
197
+ private repository and should be validated before broad distribution.
198
+
199
+ Release operators can run `npm run guardian:release:doctor` from the repo root
200
+ for the complete protected-release doctor before publishing. For a release
201
+ candidate artifact, set `GUARDIAN_RELEASE_CANDIDATE=/path/to/artifact.zip` and
202
+ run `npm run guardian:release:audit`; the audit runs the same doctor and scans
203
+ the candidate with the protected IP scanner. The audit also honors
204
+ `GUARDIAN_RELEASE_CLAIM`; it defaults to `preview`, while
205
+ `GUARDIAN_RELEASE_CLAIM=production` fails until every not-proven production gate
206
+ is closed in release evidence. Before npm publication, run
207
+ `npm run guardian:npm:publish:dry-run` to exercise
208
+ `npm publish --dry-run --json` against the packed Guardian CLI tarball and add
209
+ that result to the npm package evidence. For the final pre-publish operator
210
+ gate, run `npm run guardian:npm:publish:ready`; it repeats the protected npm
211
+ doctor with the dry-run enabled, records readiness evidence, and prints the
212
+ exact `npm publish <tarball> --access public` command without executing it.
213
+
214
+ When an installed profile contains `release/release-evidence.json`,
215
+ `guardian doctor` verifies the protected package evidence schema, expected-file
216
+ allowlist, source/source-map exclusions, unpublished workspace import boundary,
217
+ and checksum manifest. `guardian status --json` surfaces the same
218
+ metadata-only release-evidence state without printing runtime tokens.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};