Skip to content

Commit 267e10f

Browse files
committed
docs: update status documentation for smart defaults
Update docs/status.md to document the new smart default behavior: - Stack discovery from current branch - New flags: --branch, --all, --ci, --trunk - CI usage examples - Updated options table with new flags - Reorganized examples section
1 parent 39ee151 commit 267e10f

1 file changed

Lines changed: 65 additions & 17 deletions

File tree

docs/status.md

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,35 @@ Show stack status with CI, approval, and merge readiness indicators.
55
## Usage
66

77
```bash
8-
gh-stack status <identifier> [OPTIONS]
9-
# or
10-
gh-stack log --status <identifier> [OPTIONS]
8+
# Infer stack from current branch (recommended)
9+
gh-stack status
10+
11+
# Infer from a specific branch
12+
gh-stack status --branch feat/my-feature
13+
14+
# List all stacks and select interactively
15+
gh-stack status --all
16+
17+
# Search by identifier in PR titles
18+
gh-stack status 'STACK-ID'
19+
20+
# CI mode (non-interactive)
21+
gh-stack status --branch $GITHUB_HEAD_REF --ci
22+
23+
# Use with log command
24+
gh-stack log --status 'STACK-ID'
1125
```
1226

27+
## Stack Discovery
28+
29+
When run without an identifier, `gh-stack status` automatically discovers your stack by:
30+
31+
1. Finding the PR for your current branch
32+
2. Walking up the PR base chain to find ancestors
33+
3. Walking down to find PRs that build on yours
34+
35+
This works with any PR structure - no special naming required.
36+
1337
## Description
1438

1539
The `status` command displays your PR stack with status bits showing:
@@ -68,19 +92,43 @@ Status: [CI | Approved | Mergeable | Stack]
6892

6993
| Flag | Description |
7094
|------|-------------|
71-
| `--no-checks` | Skip fetching CI/approval/conflict status (faster, shows basic tree) |
95+
| `--branch`, `-b` | Infer stack from this branch instead of current |
96+
| `--all`, `-a` | List all stacks and select interactively |
97+
| `--ci` | Non-interactive mode for CI environments |
98+
| `--trunk` | Override trunk branch (default: auto-detect or "main") |
99+
| `--no-checks` | Skip fetching CI/approval/conflict status (faster) |
72100
| `--no-color` | Disable colors and Unicode characters |
73101
| `--help-legend` | Show status bits legend |
74102
| `--json` | Output in JSON format |
75103
| `-C, --project <PATH>` | Path to local repository |
76104
| `-r, --repository <REPO>` | Specify repository (owner/repo) |
77105
| `-o, --origin <REMOTE>` | Git remote to use (default: origin) |
78-
| `-e, --excl <NUMBER>` | Exclude PR by number (can be used multiple times) |
106+
| `-e, --excl <NUMBER>` | Exclude PR by number (repeatable) |
107+
108+
## CI Usage
109+
110+
In CI environments, use `--ci` to disable interactive prompts:
111+
112+
```bash
113+
# Must provide branch explicitly
114+
gh-stack status --branch $GITHUB_HEAD_REF --ci
115+
116+
# Or use identifier
117+
gh-stack status 'STACK-ID' --ci
118+
119+
# JSON output for parsing
120+
gh-stack status --branch $GITHUB_HEAD_REF --ci --json
121+
```
122+
123+
The `--ci` flag will:
124+
- Fail with an error if no identifier or branch is provided
125+
- Fail if on a trunk branch without an identifier
126+
- Never prompt for user input
79127

80128
## JSON Output
81129

82130
```bash
83-
gh-stack status STACK-123 --json
131+
gh-stack status --json
84132
```
85133

86134
```json
@@ -113,41 +161,41 @@ gh-stack status STACK-123 --json
113161
The legend is shown automatically on first run. To see it again:
114162

115163
```bash
116-
gh-stack status STACK-123 --help-legend
164+
gh-stack status --help-legend
117165
```
118166

119167
The legend marker is stored in `~/.gh-stack-legend-seen`.
120168

121169
## Examples
122170

123-
### Basic usage
171+
### Infer from current branch
124172

125173
```bash
126-
gh-stack status JIRA-1234
174+
gh-stack status
127175
```
128176

129-
### Skip API calls for faster output
177+
### Infer from specific branch
130178

131179
```bash
132-
gh-stack status JIRA-1234 --no-checks
180+
gh-stack status --branch feat/my-feature
133181
```
134182

135-
### Specify repository explicitly
183+
### Skip API calls for faster output
136184

137185
```bash
138-
gh-stack status JIRA-1234 -r owner/repo
186+
gh-stack status --no-checks
139187
```
140188

141-
### Output as JSON for scripting
189+
### Specify repository explicitly
142190

143191
```bash
144-
gh-stack status JIRA-1234 --json | jq '.stack[].status.ci'
192+
gh-stack status -r owner/repo
145193
```
146194

147-
### Use with log command
195+
### Output as JSON for scripting
148196

149197
```bash
150-
gh-stack log --status JIRA-1234
198+
gh-stack status --json | jq '.stack[].status.ci'
151199
```
152200

153201
## See Also

0 commit comments

Comments
 (0)