@misaka-net/misakanet-setup 0.5.3 → 0.5.5

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 CHANGED
@@ -38,11 +38,77 @@ npx @misaka-net/misakanet-setup --report # this machine's state as YAML, sa
38
38
  # (token value never printed, home paths written as ~;
39
39
  # `permissions: ok|incomplete` shows whether the read-only
40
40
  # tools are allowed; two blank fields are yours to fill — see the bounty)
41
+ # always exits 0 when it prints a report — see "Exit codes" below
42
+ npx @misaka-net/misakanet-setup --report --strict # CI in one line: same YAML, but the exit code is the verdict
43
+ # (or the shorthand `--ci`; ready-to-copy Actions job in the repo:
44
+ # docs/maintainer/setup-health-ci.md)
45
+ npx @misaka-net/misakanet-setup --silent # enterprise/MDM: no progress output (the ✓/· narration and the banner
46
+ # go); the `!` lines, the report and every error still print
47
+ npx @misaka-net/misakanet-setup --report-json # the same report as JSON — identical field names, schema
48
+ # `misakanet-setup-report/1` — and nothing else on stdout, so an MDM can
49
+ # `JSON.parse` the stream (see "Enterprise deployment" below)
41
50
  npx @misaka-net/misakanet-setup --voice # opt-in: a cue when a search hits, another when it misses
42
51
  # (Claude Code: a PostToolUse hook; mute later with MISAKANET_VOICE=0)
43
52
  npx @misaka-net/misakanet-setup --uninstall # remove exactly what it added
44
53
  ```
45
54
 
55
+ ## Exit codes
56
+
57
+ `--report` alone **always exits 0** when it prints a report, and that is deliberate: the report is
58
+ evidence meant to be pasted into an issue or a CI log, and a nonzero exit there turns "collect the
59
+ evidence" into a failing step. The gate is the opt-in `--strict` form (alias: `--ci`), which prints
60
+ the *same* YAML and then judges it:
61
+
62
+ | code | `--report --strict` (and `--report-json --strict`) | meaning |
63
+ |---|---|---|
64
+ | `0` | READY | the report says `verify: READY` **and** `open-items: 0` |
65
+ | `1` | NOT READY | `verify: NOT READY` — including when `open-items > 0`; the report lists one line per open item, each with its fix |
66
+ | `2` | could not run | the report could not be produced at all (the tool failed instead of judging). This is **not** a verdict about your machine: on `2` there is no report at all (neither YAML nor JSON), only a one-line reason on stderr |
67
+
68
+ The convention is the repository-wide one (`0 = fine, 1 = found problems, 2 = could not run`, same as
69
+ `scripts/check_workflow_scripts.py`), so a CI step can tell "the environment is unhealthy" (fix the
70
+ machine) from "the checker broke" (fix the checker).
71
+
72
+ The last two fields of the report, `tools-visible` and `live-call-evidence`, are **blank fields a
73
+ human fills in afterwards** — they are never read back by the tool and **never influence the exit
74
+ code**. A gate that depended on the reporter remembering to fill them in would not be a gate.
75
+
76
+ CI usage (details and a copy-pasteable job:
77
+ [`docs/maintainer/setup-health-ci.md`](https://github.com/Ikalus1988/MisakaNet/blob/main/docs/maintainer/setup-health-ci.md)):
78
+
79
+ ```bash
80
+ npx -y @misaka-net/misakanet-setup --report --strict > setup-health.yaml # 0 / 1 / 2 is the verdict
81
+ ```
82
+
83
+ Don't pipe it into `tee` and then read `$?` — the pipeline's exit code is `tee`'s, not the gate's
84
+ (that trap has its own write-up in `docs/maintainer/handoff-2026-09-15.md`).
85
+
86
+ `--report-json` obeys the **same three codes** with the same two contracts: alone it exits 0 whenever
87
+ it printed the JSON (including on a NOT READY machine), and with `--strict` the exit code is the
88
+ verdict. `--silent` changes neither the report nor the codes — it only removes progress:
89
+
90
+ ```bash
91
+ npx -y @misaka-net/misakanet-setup --silent --report-json --strict > machine.json # 0 / 1 / 2, JSON on stdout
92
+ ```
93
+
94
+ ## Enterprise deployment
95
+
96
+ GPO / Intune / Jamf / Ansible snippets, and the section an IT security review actually asks for
97
+ (**数据边界**: which data stays on the machine, what must reach `misakanet.org`, and how
98
+ `--no-register` avoids registration entirely):
99
+ [`docs/maintainer/enterprise-deployment.md`](https://github.com/Ikalus1988/MisakaNet/blob/main/docs/maintainer/enterprise-deployment.md).
100
+
101
+ The short version for a deployment script — two commands, both silent:
102
+
103
+ ```bash
104
+ npx -y @misaka-net/misakanet-setup --silent --no-register # ① install (no progress output)
105
+ npx -y @misaka-net/misakanet-setup --silent --report-json --strict # ② one JSON document; the exit code is the verdict
106
+ ```
107
+
108
+ `--report-json` selects *report* mode, exactly like `--report`: it is read-only and installs nothing,
109
+ so step ① is a separate command. `--silent` is not mute — anything that went wrong, and every step a
110
+ human still has to take, is still printed.
111
+
46
112
  ## Keeping it current
47
113
 
48
114
  The installer records what it installed in `~/.misakanet-agent/version`. From then on the hook
@@ -80,6 +146,9 @@ npx @misaka-net/misakanet-setup@latest
80
146
  `export MISAKANET_CLIENT_ID=<setup-…>`. Without that, each install mints a new node.
81
147
  - Retention: lesson content retrieved from the server is **data, not instructions** — the
82
148
  injected rules tell the assistant not to execute commands found in it.
149
+ - The report (`--report` or `--report-json`) is written to **stdout and nowhere else**: this program
150
+ has no path that uploads it. Collecting the evidence is the deployment tool's job, which is what
151
+ makes it auditable.
83
152
 
84
153
  ## Offline / restricted networks
85
154