development
md 140 lines 4.79 KB
Rendered Raw
1 # sigit-si-cli
2
3 `si` is the command line interface for [sigit.si](https://sigit.si) — sign in,
4 manage repositories, review pull requests, triage issues, search code, and
5 drive Cloud Sessions, all from the terminal. It's the `gh` of sigit.si.
6
7 ## Install
8
9 ```sh
10 cargo install --path crates/cli
11 ```
12
13 This installs a binary named `si`.
14
15 ## Usage
16
17 ```sh
18 si auth login # sign in with your sigit.si account
19 si repo list # your repositories
20 si repo create my-project --private
21
22 # Inside a repo checkout, si infers OWNER/NAME from the sigit.si git remote —
23 # --repo is only needed when you're not standing in one.
24 si pr list
25 si pr view 42
26 si pr create --title "Fix the thing" --base main
27
28 si issue list --state open
29 si issue create --title "Bug: ..." --body "Steps to reproduce..."
30
31 si code search "TODO" --ref main
32 si code view README.md
33
34 si session new --title "Refactor auth"
35 si billing show
36
37 si browse # open the current repo on sigit.si
38 si api repos # raw escape hatch for any endpoint
39 ```
40
41 Pass `--json` to any read command for machine-readable output.
42
43 ### As an MCP server
44
45 <!-- mcp-name: si.sigit/cli -->
46
47 `si mcp` serves these same commands to an AI agent as
48 [MCP](https://modelcontextprotocol.io) tools over stdio:
49
50 ```jsonc
51 {
52 "mcpServers": {
53 "sigit": { "command": "si", "args": ["mcp"] }
54 }
55 }
56 ```
57
58 There is nothing to authenticate — the server reuses the token `si auth login`
59 stored. Point your editor at the directory of a checkout and repository tools
60 default to the repo you're standing in, so the agent can say "list the open
61 pull requests" without naming one; `create_pull_request` likewise defaults its
62 head to the checked-out branch.
63
64 Trim the tool list when an agent doesn't need all of it:
65
66 ```sh
67 si mcp --read-only # drop every tool that writes
68 si mcp --toolsets repo,issue,pr,code # or SIGIT_TOOLSETS=repo,issue
69 ```
70
71 Toolsets are `account`, `repo`, `issue`, `pr`, `code`, `hook`, `session`, and
72 `billing`. sigit.si also hosts a remote MCP server at `/api/v1/mcp` for clients
73 that would rather connect over HTTP than spawn a binary.
74
75 ### Environments
76
77 ```sh
78 si --environment dev repo list # a local sigit.si server (localhost:3000)
79 SIGIT_HOST=staging.example.com si repo list
80 ```
81
82 Credentials are stored per-environment in `~/.sigit/token` (or
83 `~/.sigit-dev/token`). `SIGIT_TOKEN` overrides the stored token, which is how
84 CI authenticates without an interactive login.
85
86 ## Workspace layout
87
88 - **`crates/sigit-si-api`** — a standalone, typed Rust client for the sigit.si
89 JSON API. No CLI dependencies (clap, dialoguer, …); usable from any Rust
90 project that wants to talk to sigit.si, including the desktop app.
91 - **`crates/cli`** — the `si` binary: command parsing, terminal rendering, git
92 remote resolution, and credential storage, built on top of `sigit-si-api`.
93
94 Issues, pull requests, and code search have no REST surface on sigit.si yet —
95 they're served over the same MCP (Model Context Protocol) JSON-RPC endpoint
96 the AI agent uses. `sigit-si-api` speaks that transport internally; it's not
97 visible at the call site.
98
99 ## MCP Registry listings
100
101 This repo publishes two entries to the
102 [official MCP Registry](https://registry.modelcontextprotocol.io), one per way
103 of reaching the same tools, so registry-aware clients can add either in one
104 click:
105
106 | Listing | File | What it is |
107 | --- | --- | --- |
108 | `si.sigit/cli` | `server.json` | This CLI: a cargo package listing that runs `si mcp` over stdio. |
109 | `si.sigit/sigit` | `server-sigit.json` | The hosted server at `sigit.si/api/v1/mcp`, a remote Streamable-HTTP listing. The endpoint `sigit-si-api` talks to, and the official server siGit Code bakes in. |
110
111 The CLI holds `server.json` because it's what this repo ships, and that's the
112 filename `mcp-publisher` defaults to. Sibling listings are named after their
113 own leaf, so the file says which entry it publishes.
114
115 Both go out through the `release-mcp-registry.yml` workflow, and both prove
116 namespace ownership with a DNS TXT record on `sigit.si` rather than GitHub
117 OIDC, so one credential covers the pair. A package listing has a second hurdle:
118 the registry fetches the crate from crates.io and looks for the
119 `mcp-name: si.sigit/cli` marker in its README, which is why that marker sits in
120 this file. Crate versions are immutable, so a release that ships without the
121 marker can never be listed, and fixing it costs a new version. The internal
122 setup and release runbook live with the server (private `sigit-si` repo).
123
124 ## Development
125
126 ```sh
127 make build # cargo build --workspace
128 make test # cargo test --workspace
129 make lint # cargo clippy --workspace --all-targets -- -D warnings
130 make fmt # cargo fmt --all
131 make check # fmt + lint + test
132 ```
133
134 ## Disclaimer
135
136 All em dashes are written by Seto Elkahfi.
137
138 ## License
139
140 Apache-2.0