Skip to content

Commit b70d915

Browse files
authored
Add docs for Managed Mode (#790)
* Update sidebar navigation structure and ordering * fixes
1 parent db81bb1 commit b70d915

File tree

2 files changed

+155
-1
lines changed

2 files changed

+155
-1
lines changed

docs/managed-mode.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# Managed Mode
2+
3+
!!! tip "Setup Configuration"
4+
Managed Mode setup is configured entirely from the LinearB platform. You do not need to setup gitStream yourself, add any GitHub Actions, or create CM rule files - all of this is handled automatically by the LinearB platform. For detailed setup instructions, see [Managing AI Services in LinearB](https://linearb.helpdocs.io/article/hvm9neua4e-managing-ai-services-in-linear-b#ai_tools_automations).
5+
6+
Managed Mode is an operation mode for LinearB AI automations where automations run on the LinearB runner as a managed service. This mode is required for accessing AI Insights and provides centralized control of AI automations through LinearB's infrastructure.
7+
8+
## Available Managed Automations
9+
10+
### AI Code Review
11+
12+
Use LinearB's AI with the `code-review` action to automatically review the introduced changes to the code. This automation triggers on non-draft PRs that were not created by bots and can be customized with specific review guidelines.
13+
14+
```yaml
15+
automations:
16+
linearb_ai_review:
17+
if:
18+
- {{ not (pr.draft or is.bot_author) }}
19+
run:
20+
- action: code-review@v1
21+
args:
22+
guidelines: {{ loadReviewGuidelines() | dump }}
23+
```
24+
25+
### AI PR Description
26+
27+
Use the `describe-changes` automation action to automatically generate and append a concise, AI-generated description to a pull request. This helps provide clear context for reviewers about the changes introduced.
28+
29+
```yaml
30+
automations:
31+
linearb_ai_description:
32+
if:
33+
- {{ not (pr.draft or is.bot_author) }}
34+
run:
35+
- action: describe-changes@v1
36+
args:
37+
concat_mode: append
38+
guidelines: {{ loadDescriptionGuidelines() | dump }}
39+
```
40+
41+
### Smart Labeling (Claude Code Detection)
42+
43+
Automatically apply labels to PRs that are assisted by Claude Code to track time savings, PR risk, and productivity lift from AI tools. This automation can detect Claude Code usage through multiple methods including co-authorship, user prompts, known users, or specific tags.
44+
45+
```yaml
46+
automations:
47+
tag_claude_in_pr:
48+
if:
49+
- {{ is.claude_author or is.claude_co_author }}
50+
run:
51+
- action: add-label@v1
52+
args:
53+
label: 🤖 Claude Code
54+
55+
tag_copilot_in_pr:
56+
if:
57+
- {{ is.copilot_author or is.copilot_co_author }}
58+
run:
59+
- action: add-label@v1
60+
args:
61+
label: 🤖 GitHub Copilot
62+
63+
tag_cursor_in_pr:
64+
if:
65+
- {{ is.cursor_author or is.cursor_co_author }}
66+
run:
67+
- action: add-label@v1
68+
args:
69+
label: 🤖 Cursor AI
70+
71+
tag_linearb_ai_in_pr:
72+
if:
73+
- {{ is.linearb_author or is.linearb_co_author }}
74+
run:
75+
- action: add-label@v1
76+
args:
77+
label: 🤖 LinearB AI
78+
79+
is:
80+
bot_author: {{ pr.author | match(list=[\"github-actions\", \"_bot_\", \"[bot]\", \"dependabot\"]) | some }}
81+
claude_author: {{ pr.author | lower | includes(regex=r/claude/) }}
82+
claude_co_author: {{ branch.commits.messages | match(regex=r/[Cc]o-[Aa]uthored-[Bb]y:.*[Cc]laude/) | some }}
83+
copilot_author: {{ pr.author | lower | includes(regex=r/copilot/) }}
84+
copilot_co_author: {{ branch.commits.messages | match(regex=r/[Cc]o-[Aa]uthored-[Bb]y:.*([Cc]opilot|[Gg]ithub.*[Cc]opilot)/) | some }}
85+
cursor_author: {{ pr.author | lower | includes(regex=r/cursor/) }}
86+
cursor_co_author: {{ branch.commits.messages | match(regex=r/[Cc]o-[Aa]uthored-[Bb]y:.*[Cc]ursor/) | some }}
87+
linearb_author: {{ pr.author | lower | includes(regex=r/^linearb/) and not (pr.author | lower | includes(regex=r/^linearbci$/)) }}
88+
linearb_co_author: {{ branch.commits.messages | match(regex=r/[Cc]o-[Aa]uthored-[Bb]y:.*(gitstream-cm|linearb).*\\[bot\\]/) | some }}
89+
```
90+
91+
### Estimated Time to Review
92+
93+
Label all PRs with an estimated number of minutes it would take someone to review. gitStream automatically updates this label whenever a PR changes, providing valuable insight for reviewers and team planning.
94+
95+
```yaml
96+
automations:
97+
estimated_time_to_review:
98+
if:
99+
- true
100+
run:
101+
- action: add-label@v1
102+
args:
103+
label: "{{ calc.etr }} min review"
104+
color: {{ colors.red if (calc.etr >= 20) else ( colors.yellow if (calc.etr >= 5) else colors.green ) }}
105+
106+
calc:
107+
etr: {{ branch | estimatedReviewTime }}
108+
109+
colors:
110+
red: 'b60205'
111+
yellow: 'fbca04'
112+
green: '0e8a16'
113+
```
114+
115+
### Dependabot Auto-merge
116+
117+
Auto-merge Dependabot PRs for patch and minor version updates. This automation helps maintain dependencies while ensuring only safe, non-breaking changes are automatically approved and merged.
118+
119+
```yaml
120+
manifest:
121+
version: 1.0
122+
123+
automations:
124+
merge_dependabot_minor:
125+
on:
126+
- pr_created
127+
- commit
128+
if:
129+
- {{ dependabot_bump == 'minor' }}
130+
- {{ branch.name | includes(term='dependabot') }}
131+
- {{ branch.author | includes(term='dependabot') }}
132+
run:
133+
- action: approve@v1
134+
- action: add-comment@v1
135+
args:
136+
comment: Dependabot `minor` version bumps are approved automatically.
137+
138+
merge_dependabot_patch:
139+
on:
140+
- pr_created
141+
- commit
142+
if:
143+
- {{ dependabot_bump == 'patch' }}
144+
- {{ branch.name | includes(term='dependabot') }}
145+
- {{ branch.author | includes(term='dependabot') }}
146+
run:
147+
- action: approve@v1
148+
- action: add-comment@v1
149+
args:
150+
comment: Dependabot `patch` version bumps are approved automatically.
151+
152+
dependabot_bump: {{ pr.description | checkDependabot | checkSemver }}
153+
```

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ nav:
1010
- Overview: index.md
1111
- Guide:
1212
- GitHub Setup: github-installation.md
13+
- GitHub Server (Custom App): custom-github-app.md
1314
- GitLab Setup: gitlab-installation.md
1415
- Bitbucket Cloud Setup: bitbucket-installation.md
15-
- Custom GitHub App (GitHub Server): custom-github-app.md
16+
- Managed Mode: managed-mode.md
1617
- How gitStream works: how-it-works.md
1718
- Your First Automation: quick-start.md
1819
- How to Test Your Automations: dry-run-mode.md

0 commit comments

Comments
 (0)