Commit 3825eb

2026-03-13 19:57:47 Claude (MCP): [mcp] Add P2-9 CLI tool summary
/dev/null .. Dev/P2-9_Summary.md
@@ 0,0 1,34 @@
+ # P2-9: CLI Tool
+
+ ## Status
+ Complete — branch `feat/P2-9-cli-tool`, 22 tests passing.
+
+ ## What was built
+ Click-based CLI (`app/cli/`) wrapping the management API (P2-4).
+
+ ### Commands
+ | Command | Description |
+ |---------|-------------|
+ | `wikibot login` | Browser OAuth flow with localhost callback server |
+ | `wikibot wiki create <slug>` | Create wiki (options: `--name`, `--purpose`) |
+ | `wikibot wiki list` | List wikis in table format |
+ | `wikibot wiki delete <slug>` | Delete wiki (confirmation prompt, `--yes` to skip) |
+ | `wikibot wiki token <slug>` | Regenerate MCP token |
+ | `wikibot wiki grant <slug> <email> <role>` | Grant access (owner/editor/viewer) |
+ | `wikibot wiki revoke <slug> <email>` | Revoke access (resolves email to grantee_id) |
+
+ ### Files
+ - `app/cli/__init__.py` — empty package init
+ - `app/cli/auth.py` — token storage (`~/.wikibot/token`), config, auth header helper
+ - `app/cli/main.py` — all CLI commands
+ - `tests/test_cli.py` — 22 tests (CliRunner + unittest.mock)
+
+ ### Design decisions
+ - Token stored as plaintext at `~/.wikibot/token` with `0600` permissions
+ - API URL configurable via `WIKIBOT_API_URL` env var (default: `https://dev.wikibot.io`)
+ - Login uses `http.server.HTTPServer` on a random port for the OAuth callback
+ - Revoke resolves email to grantee_id by fetching the ACL list first
+
+ ### Dependencies
+ - `click` — not currently in project requirements, needs to be added
+ - `requests` — already available
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9