Skip to content

Commit eb35520

Browse files
authored
docs: add configuration section with hooks, sandbox, and settings docs (#33)
* feat: move the configuration to a separate section and add missing features * chore: rename routes, fix links and fix highlight name * fix: update configuration links
1 parent 171f8c1 commit eb35520

10 files changed

Lines changed: 810 additions & 281 deletions

File tree

astro.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ export default defineConfig({
7979
status: 301,
8080
destination: "/rover/reference/cli-reference/",
8181
},
82+
"/rover/intro/configuration": {
83+
status: 301,
84+
destination: "/rover/config/project-config",
85+
},
8286
},
8387
integrations: [
8488
// @see https://github.com/joesaby/astro-mermaid?tab=readme-ov-file#integration-order-important
@@ -105,6 +109,10 @@ export default defineConfig({
105109
label: "Key Concepts",
106110
autogenerate: { directory: "rover/concepts" },
107111
},
112+
{
113+
label: "Configuration",
114+
autogenerate: { directory: "rover/config" },
115+
},
108116
{
109117
label: "Guides",
110118
autogenerate: { directory: "rover/guides" },

src/content/docs/rover/advanced/global-store.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ This directory is created on first Rover CLI use, along with a default `rover.js
106106

107107
The `rover.json` file is the central configuration file for Rover. It stores user preferences, AI agent settings, and the registry of all projects you've used with Rover. This file is auto-generated and managed by the Rover CLI, so you don't need to edit it.
108108

109-
If you want to customize a specific project, create a [Project Configuration](/rover/intro/configuration) file.
109+
If you want to customize a specific project, create a [Project Configuration](/rover/config/project-config) file.
110110

111111
### Project Registry
112112

src/content/docs/rover/concepts/project.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,5 @@ When you run Rover commands outside a git repository, Rover operates in **global
127127
<CardGrid>
128128
<LinkCard title="Task" href="/rover/concepts/task" description="Learn how Rover manages tasks as units of work for AI agents" />
129129
<LinkCard title="Global Store" href="/rover/advanced/global-store" description="Explore the central storage location for all Rover data" />
130-
<LinkCard title="Configuration" href="/rover/intro/configuration" description="Customize Rover settings for your projects" />
130+
<LinkCard title="Configuration" href="/rover/config/project-config" description="Customize Rover settings for your projects" />
131131
</CardGrid>

src/content/docs/rover/concepts/sandbox.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Currently, sandboxes are implemented using containers. This ensures that each ta
2222
When you create a new task with `rover task`, Rover sets up a sandbox for it. This involves:
2323

2424
1. **Creating a [workspace](/rover/concepts/workspace)**, which has copy of your project files
25-
2. **Load the user configuration to set up the sandbox environment**. This includes MCP servers, environment variables, and any [other settings defined in the configuration](/rover/intro/configuration)
25+
2. **Load the user configuration to set up the sandbox environment**. This includes MCP servers, environment variables, and any [other settings defined in the configuration](/rover/config/project-config)
2626
2. **Defines an entrypoint file to initialize the sandbox environment**. This file includes setup steps like installing dependencies and starting MCP servers
2727
3. **Spinning up a containerized environment** using Docker or Podman container runtimes
2828
4. **Running the coding agent inside the sandbox**, allowing it to execute commands and make changes in isolation
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
---
2+
title: Hooks
3+
description: Run custom commands when tasks are merged, pushed, or completed
4+
sidebar:
5+
order: 3
6+
---
7+
8+
import { Aside, CardGrid, LinkCard } from '@astrojs/starlight/components';
9+
10+
Hooks let you run custom shell commands at specific points in the task lifecycle. Use them to trigger notifications, update dashboards, run CI pipelines, or integrate with other tools.
11+
12+
## Available Hooks
13+
14+
| Hook | Trigger |
15+
|------|---------|
16+
| `onMerge` | Runs after a task is successfully merged via `rover merge` |
17+
| `onPush` | Runs after a task branch is pushed via `rover push` |
18+
| `onComplete` | Runs when a task finishes (success or failure), detected via `rover list` |
19+
20+
## Configuration
21+
22+
Add hooks to your `rover.json` file:
23+
24+
```jsonc
25+
{
26+
"version": "1.2",
27+
"languages": ["typescript"],
28+
"packageManagers": ["npm"],
29+
"hooks": {
30+
"onComplete": ["./scripts/on-complete.sh"],
31+
"onMerge": ["./scripts/on-merge.sh"],
32+
"onPush": ["echo 'Task $ROVER_TASK_ID pushed'"]
33+
}
34+
}
35+
```
36+
37+
Each hook accepts an array of shell commands. Commands are executed sequentially in the order specified.
38+
39+
## Environment Variables
40+
41+
Rover passes task information to hooks via environment variables:
42+
43+
| Variable | Description | Available In |
44+
|----------|-------------|--------------|
45+
| `ROVER_TASK_ID` | The task ID | All hooks |
46+
| `ROVER_TASK_BRANCH` | The task branch name | All hooks |
47+
| `ROVER_TASK_TITLE` | The task title | All hooks |
48+
| `ROVER_TASK_STATUS` | Task status: `completed` or `failed` | `onComplete` only |
49+
50+
## Example Hook Script
51+
52+
Create a script that notifies your team when a task completes:
53+
54+
```bash
55+
#!/bin/bash
56+
# scripts/on-complete.sh
57+
58+
echo "Task $ROVER_TASK_ID ($ROVER_TASK_TITLE) finished with status: $ROVER_TASK_STATUS"
59+
60+
# Send a Slack notification
61+
if [ "$ROVER_TASK_STATUS" = "completed" ]; then
62+
curl -X POST -H 'Content-type: application/json' \
63+
--data "{\"text\":\"Task #$ROVER_TASK_ID completed: $ROVER_TASK_TITLE\"}" \
64+
"$SLACK_WEBHOOK_URL"
65+
fi
66+
```
67+
68+
Make sure to set execute permissions:
69+
70+
```sh
71+
chmod +x scripts/on-complete.sh
72+
```
73+
74+
## Hook Behavior
75+
76+
### Execution Context
77+
78+
- Hooks run in the **project directory** (where `rover.json` is located)
79+
- Commands execute via the shell (`sh -c`), supporting pipes and complex commands
80+
- Hooks inherit the current environment plus `ROVER_*` variables
81+
82+
### Error Handling
83+
84+
- Hook failures are logged as **warnings** but don't interrupt the main operation
85+
- If a hook fails, subsequent hooks in the array still execute
86+
- The primary command (`merge`, `push`, `list`) completes regardless of hook failures
87+
88+
<Aside type="tip">Hooks are designed to be non-blocking. A failing notification script won't prevent your merge from completing.</Aside>
89+
90+
### Deduplication
91+
92+
The `onComplete` hook only triggers on **new** status transitions. If a task was already completed and you run `rover list` again, the hook won't re-execute.
93+
94+
## Use Cases
95+
96+
### Notify on Completion
97+
98+
Send notifications when tasks finish:
99+
100+
```jsonc
101+
{
102+
"hooks": {
103+
"onComplete": [
104+
"curl -X POST https://api.example.com/webhook -d '{\"task\": \"$ROVER_TASK_ID\", \"status\": \"$ROVER_TASK_STATUS\"}'"
105+
]
106+
}
107+
}
108+
```
109+
110+
### Trigger CI on Push
111+
112+
Start a CI pipeline when a task branch is pushed:
113+
114+
```jsonc
115+
{
116+
"hooks": {
117+
"onPush": [
118+
"gh workflow run ci.yml --ref $ROVER_TASK_BRANCH"
119+
]
120+
}
121+
}
122+
```
123+
124+
### Update Issue Tracker on Merge
125+
126+
Close related issues when tasks are merged:
127+
128+
```jsonc
129+
{
130+
"hooks": {
131+
"onMerge": [
132+
"./scripts/close-issue.sh"
133+
]
134+
}
135+
}
136+
```
137+
138+
### Multiple Commands
139+
140+
Chain multiple commands for a single hook:
141+
142+
```jsonc
143+
{
144+
"hooks": {
145+
"onComplete": [
146+
"echo 'Task $ROVER_TASK_ID completed'",
147+
"./scripts/notify-slack.sh",
148+
"./scripts/update-dashboard.sh"
149+
]
150+
}
151+
}
152+
```
153+
154+
## Next Steps
155+
156+
<CardGrid>
157+
<LinkCard title="Project Configuration" href="/rover/config/project-config" description="Configure project-wide settings" />
158+
<LinkCard title="User Settings" href="/rover/config/user-settings" description="Configure user-specific preferences" />
159+
</CardGrid>

0 commit comments

Comments
 (0)