Skip to content

Commit

Permalink
Merge pull request #586 from linear-b/refactor-askAI
Browse files Browse the repository at this point in the history
AskAI improvements
  • Loading branch information
PavelLinearB authored Sep 9, 2024
2 parents e2f7517 + 1db811a commit 0ace09d
Show file tree
Hide file tree
Showing 13 changed files with 203 additions and 139 deletions.
13 changes: 0 additions & 13 deletions docs/automations/integrations/AI/README.md

This file was deleted.

88 changes: 0 additions & 88 deletions docs/automations/integrations/AI/askAI/README.md

This file was deleted.

32 changes: 32 additions & 0 deletions docs/automations/integrations/askAI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Integrate gitStream with AI
description: Use gitStream to integrate with AI services for Review, describe and add tests.
category: [quality, genai, copilot, tests, efficiency]
---
# Integrate gitStream with AI

<!-- --8<-- [start:examples]-->
!!! warning "Required gitStream Plugins"
This example requires you to install the [`askAI`](/filter-function-plugins/#askai) plugin.

[Learn more about gitStream plugins](/plugins/).

## Ask AI to Summarize the Changes in a PR

--8<-- "docs/automations/integrations/askAI/summarize-pr/README.md:example"

## Ask AI to Suggest Tests

--8<-- "docs/automations/integrations/askAI/add-tests/README.md:example"

## Ask AI for a Code Review

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

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

## Additional Resources

--8<-- "docs/snippets/general.md"

--8<-- "docs/snippets/automation-footer.md"
41 changes: 41 additions & 0 deletions docs/automations/integrations/askAI/add-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Automation - Ask AI to Suggest Tests
description: Use gitStream's integration with AI services to suggests additional tests
category: [quality, genai, copilot, tests, efficiency]
---
# Ask AI to Suggest Tests

<!-- --8<-- [start:example]-->
Use AI to suggests additional test cases for uncovered or modified functions in the PR, including edge cases.

!!! info "Configuration Description"

Conditions (all must be true):

* A PR is created or new code has been committed to the PR.
* The PR has a label "askai tests"

Automation Actions:

* Add a comment with suggested tests generated by an AI model

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

## Additional Resources

--8<-- "docs/snippets/general.md"

**Related Automations**:

--8<-- "docs/snippets/context-automation.md"

--8<-- "docs/snippets/automation-footer.md"
41 changes: 41 additions & 0 deletions docs/automations/integrations/askAI/code-review/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Automation - Ask AI for a Code Review
description: Use gitStream's integration with AI services to perform a comprehensive code review to your code
category: [quickstart, quality, genai, copilot, tests, efficiency]
---
# Ask AI for a Code Review

<!-- --8<-- [start:example]-->
Use AI to perform a comprehensive code review, identify bugs, security risks, performance issues, deprecated methods, and style guide violations, and suggests improvements.

!!! info "Configuration Description"

Conditions (all must be true):

* A PR is created or new code has been committed to the PR.
* The PR has a label "askai cr"

Automation Actions:

* Add a comment with a code review generated by an AI model

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

## Additional Resources

--8<-- "docs/snippets/general.md"

**Related Automations**:

--8<-- "docs/snippets/context-automation.md"

--8<-- "docs/snippets/automation-footer.md"
43 changes: 43 additions & 0 deletions docs/automations/integrations/askAI/summarize-pr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: Automation - Ask AI to Summarize the Changes in a PR
description: Use gitStream's integration with AI services to generate a summary of the changes in the PR.
category: [quality, genai, copilot, tests, efficiency]
---
# Ask AI to Summarize the Changes in a PR

<!-- --8<-- [start:example]-->
Use AI to generate a concise bullet-point summary of the changes in the pull request.

![summarized-pr](/automations/integrations/askAI/summarize-pr/summarized-pr.png)

!!! info "Configuration Description"

Conditions (all must be true):

* A PR is created or new code has been committed to the PR.
* The PR has a label "askai summarize"

Automation Actions:

* Add a comment with a summary of the PR

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

## Additional Resources

--8<-- "docs/snippets/general.md"

**Related Automations**:

--8<-- "docs/snippets/context-automation.md"

--8<-- "docs/snippets/automation-footer.md"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ automations:
args:
comment: |
# ✨ gitStream Review ✨
{{ source | askAI("Based on the given context, can you write a few bullet points about how I can improve my code? Please relate only to code diff, if it exists.", env.OPEN_AI_TOKEN) | encode }}
{{ source | askAI("
Review the PR code diff.
- Identify bugs, security risks, and performance issues
- Check for deprecated methods and style guide violations
- Provide specific improvement suggestions based on the changes", env.OPEN_AI_TOKEN) | encode }}
18 changes: 0 additions & 18 deletions docs/downloads/automation-library/integrations/askAI/askAI_QA.cm

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
manifest:
version: 1.0

triggers:
on:
- commit
- pr_created

automations:
ask_ai_describe:
if:
- {{ pr.labels | match(term="askai summarize") | some }}
run:
- action: add-comment@v1
args:
comment: |
# 📜 PR Summary 📜
{{ source | askAI("
Summarize the changes in this PR in bullet points.", env.OPEN_AI_TOKEN) | encode }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
manifest:
version: 1.0

triggers:
on:
- commit
- pr_created

automations:
ask_ai_describe:
if:
- {{ pr.labels | match(term="askai tests") | some }}
run:
- action: add-comment@v1
args:
comment: |
# 🧪 Test Suggestions 🧪
{{ source | askAI("
Identify any new or modified functions without test coverage in this PR.
Suggest specific test cases to add, including edge cases.
If all functions are covered, return 'No additional tests needed.'", env.OPEN_AI_TOKEN) | encode }}
2 changes: 1 addition & 1 deletion docs/integrations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ visible: false

<div class="integrations-card" markdown="1">
<div class="integrations-card-title" markdown="1">
[AI](/automations/integrations/AI)
[AI](/automations/integrations/askAI)
</div>
</div>

Expand Down

0 comments on commit 0ace09d

Please sign in to comment.