Adopt users activate with --yes gate and --dry-run preview

seal-use users activate <userId> shipped in v0.4.0 as scaffolding for
the automated delegation flow but never made it onto the documented
surface, while sealUserActivate stayed reachable through the MCP write
gateway — an undocumented, ungated mutation. Adopt it:

- Document in the help registry (users area).
- Require --yes like its siblings delete/reset-password (CLI layer
  only; the MCP capability call path is unchanged).
- Wire the --dry-run preview already supported by the capability.
- Cover the gate and the preview in users.test.ts and
  dry-run-gates.test.ts.
This commit is contained in:
gitea committed 2026-10-25 00:56:23 +08:00
1 parent c05b0dc459
commit d5725e12d1
5 files changed
+50 -2

No files matched your search

+22
View File
@@ -133,6 +133,28 @@ describe("users command confirmation gates", () => {
expect(result.exitCode).toBe(0);
});
test("users activate refuses without --yes and never reaches the API", async () => {
setupMockEnv();
const mutations = trackUserMutationRequests();
const result = await runCli(["users", "activate", "user-123"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(10);
expect(result.stderr).toContain("Refusing to activate user 'user-123' without --yes.");
expect(mutations).toEqual([]);
});
test("users activate runs with --yes", async () => {
setupMockEnv();
trackUserMutationRequests();
const result = await runCli(["users", "activate", "user-123", "--yes"]);
expect(result.isError).toBe(false);
expect(result.exitCode).toBe(0);
});
test("usage line mentions --yes when the id is missing", async () => {
setupMockEnv();