Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Repository Overview

This is the gitStream repository - a workflow automation tool for git repositories that allows users to create automated code review workflows using YAML and Jinja2 templates. gitStream processes Continuous Merge (CM) files (`.cm` extension) that define automations for pull/merge requests across GitHub, GitLab, and Bitbucket.

## Development Commands

### Documentation Server
The documentation is built using MkDocs Material theme.

```bash
# Set up Python virtual environment (Python <= 3.10 required)
python -m venv .venv
. ./.venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Run documentation server locally
mkdocs serve # Runs at http://127.0.0.1:8000/

# Build documentation
mkdocs build
```

## Code Architecture

### Project Structure
- **docs/** - Documentation source files (Markdown)
- `automations/` - Automation examples and library
- `downloads/` - Downloadable CM files and templates
- `integrations/` - Third-party integration documentation
- `screenshots/` - Documentation images
- **plugins/filters/** - JavaScript filter function plugins that extend gitStream capabilities
- Each plugin has its own directory with `index.js`, `README.md`, and optional test files
- Plugins enable custom data processing and external API integrations
- **site/** - Generated documentation site (do not edit directly)
- **automations/** - Example automation configurations
- **tutorials/** - Tutorial projects demonstrating gitStream usage

### Core Concepts

1. **CM Files (.cm)**: YAML + Jinja2 configuration files that define automation rules
- Located in `.cm/` directory at repository root
- Can also be defined at organization level in a special `cm` repository
- Each file must contain `manifest:` and `automations:` sections

2. **Automation Components**:
- **Context Variables**: Pre-defined objects like `files`, `branch`, `repo` providing PR metadata
- **Filter Functions**: Functions applied to variables using pipe operator `|`
- **Automation Actions**: Actions like `add-comment`, `set-required-approvals`, `add-label`
- **Custom Expressions**: Reusable Jinja2 expressions defined in CM files

3. **Plugin System**: JavaScript plugins in `plugins/filters/` that create new filter functions
- Each plugin exports a filter function that can be used in CM files
- Plugins can connect to external APIs or perform complex data processing

### Key Files
- `mkdocs.yml` - Documentation site configuration
- `requirements.txt` - Python dependencies for documentation
- `.cm/*.cm` - Repository-level automation rules
- `docs/downloads/gitstream.cm` - Default automation template

## Important Notes

- When editing CM files, preserve YAML indentation as it's significant
- Organization-level rules can be overridden by repository-level rules with the same identifier
- The identifier is composed of filename + automation name (e.g., `gitstream/safe_changes`)
- gitStream triggers on PR creation and updates by default, with configurable explicit triggers
- Draft PRs are ignored by default (configurable via explicit triggers on GitHub)
60 changes: 32 additions & 28 deletions docs/automations/integrations/LinearBAI/code-review/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ category: [quality, genai, efficiency, quickstart]
starter_kits: [genai]
quickstart: true
---
# Code Review Using LinearB's AI :material-star-circle:
# Code Review Using LinearB's AI

<!-- --8<-- [start:example]-->
Use LinearB's AI with the [`code-review`](/automation-actions/#code-review) action to automatically review the introduced changes to the code.
Expand All @@ -24,8 +24,6 @@ Use LinearB's AI with the [`code-review`](/automation-actions/#code-review) acti
* Perform an AI-driven code review and append the review comments to the PR.
* Use `guidelines` to add your prompts to the team or org review

=== "For GitHub"

!!! example "Configuration Example"
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/code-review.cm"
Expand All @@ -36,38 +34,44 @@ Use LinearB's AI with the [`code-review`](/automation-actions/#code-review) acti
</span>
</div>

=== "For GitLab"
#### Localization Support

!!! example "Configuration Example"
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/code-review-gl.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/LinearBAI/code-review-gl.cm){ .md-button }
</span>
</div>
You can request the AI to provide code review comments in your preferred language by adding it to the guidelines:

=== "For Bitbucket"
```yaml+jinja
automations:
linearb_ai_review:
if:
- {{ not pr.draft }}
run:
- action: code-review@v1
args:
guidelines: |
- Use Spanish language for all comments
- Focus on code quality and best practices
```

!!! example "Configuration Example"
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/code-review-bb.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/LinearBAI/code-review-bb.cm){ .md-button }
</span>
</div>
#### Repository rules file example

!!! tip "`./REVIEW_RULES.md` example"
1. Add the rules file to your repo root:

```title="./REVIEW_RULES.md"
- Do not comment on missing documentation.
- Do not comment on missing tests.
- For JavaScript code, enforce using camelCase for variables and functions.
```

This file should be created in your repo root:
2. Load the file in the code review automation:

```
1. Do not comment on missing documentation.
2. Do not comment on missing tests.
3. For JavaScript code, enforce using camelCase for variables and functions.
automations:
linearb_ai_review:
if:
- {{ not pr.draft }}
run:
- action: code-review@v1
args:
guidelines: {{ "./REVIEW_RULES.md" | readFile() | dump }}
```

<!-- --8<-- [end:example]-->
Expand Down
66 changes: 41 additions & 25 deletions docs/automations/integrations/LinearBAI/describe-pr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ category: [quality, genai, efficiency, quickstart]
starter_kits: [genai]
quickstart: true
---
# Add PR Description Using LinearB's AI :material-star-circle:
# PR Description Using LinearB's AI

<!-- --8<-- [start:example]-->
Use the [`describe-changes`](/automation-actions/#describe-changes) automation action to automatically generate and append a concise, AI-generated description to a pull request. This ensures that all PRs include meaningful and helpful descriptions, improving review efficiency.
Expand All @@ -22,8 +22,6 @@ Use the [`describe-changes`](/automation-actions/#describe-changes) automation a

* Append the AI-generated description to the PR description.

=== "For GitHub"

!!! example "Configuration Example"
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/describe-pr.cm"
Expand All @@ -34,29 +32,47 @@ Use the [`describe-changes`](/automation-actions/#describe-changes) automation a
</span>
</div>

=== "For GitLab"

!!! example "Configuration Example"
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/describe-pr-gl.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/LinearBAI/describe-pr-gl.cm){ .md-button }
</span>
</div>
#### Localization Support

You can request the AI to add PR descriptions in your preferred language by adding it to the guidelines:

```yaml+jinja
automations:
linearb_ai_desc:
if:
- {{ not pr.draft }}
run:
- action: describe-changes@v1
args:
concat_mode: append
guidelines: |
- Use Korean language for all comments
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧾 Readability - Misleading Terminology: Change "Use Korean language for all comments" to "Use Korean language for all descriptions" to accurately reflect that this generates PR descriptions.

Suggested change
- Use Korean language for all comments
- Use Korean language for all descriptions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧾 Readability - Terminology Inconsistency: Change "Use Korean language for all comments" to "Use Korean language for all descriptions" or "Use Korean language for all PR descriptions".

Suggested change
- Use Korean language for all comments
- Use Korean language for all PR descriptions

```

#### Repository rules file example

1. Add the rules file to your repo root:

```title="./DESCRIPTION_RULES.md"
- Add emojis to highlight important changes.
- Use clear and concise language.
- Avoid using jargon or technical terms.
```

2. Load the file in the PR descriptions automation:

```
automations:
linearb_ai_desc:
if:
- {{ not pr.draft }}
run:
- action: describe-changes@v1
args:
concat_mode: append
guidelines: {{ "./DESCRIPTION_RULES.md" | readFile() | dump }}
```

=== "For Bitbucket"

!!! example "Configuration Example"
```yaml+jinja
--8<-- "docs/downloads/automation-library/integrations/LinearBAI/describe-pr-bb.cm"
```
<div class="result" markdown>
<span>
[:octicons-download-24: Download this example as a CM file.](/downloads/automation-library/integrations/LinearBAI/describe-pr-bb.cm){ .md-button }
</span>
</div>
<!-- --8<-- [end:example]-->

## Additional Resources
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 3 additions & 3 deletions docs/integrations/LinearBAI.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ category: [quality, genai, copilot, tests, efficiency]

!!! tip "User Commands"

LinearB's AI is available also with user commands, read more about them [here](/user-commands)
LinearB's AI is available also with `/gs` user commands, read more about them [here](/user-commands).

<!-- --8<-- [start:examples]-->

## Automation Examples

### Use LinearB's AI for a comprehensive Code Review :material-star-circle:
### Code Review using LinearB's AI

--8<-- "docs/automations/integrations/LinearBAI/code-review/README.md:example"

### Add PR Description Using LinearB's AI :material-star-circle:
### PR Description Using LinearB's AI

--8<-- "docs/automations/integrations/LinearBAI/describe-pr/README.md:example"

Expand Down