Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gai and sc docus #738

Merged
merged 11 commits into from
Sep 30, 2024
Merged

gai and sc docus #738

merged 11 commits into from
Sep 30, 2024

Conversation

pelikhan
Copy link
Member

This pull request fixes an artificial error that was introduced in the code.

export function isGlobMatch(
filename: string,
patterns: ElementOrArray<string>
) {

Choose a reason for hiding this comment

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

Missing type annotation for function parameters. It's a good practice to always specify types for function parameters for better readability and maintainability. 📚

generated by pr-review-commit missing_type_annotation

endsWith.length &&
!endsWith.some((ext) => filename.endsWith(ext))
)
return undefined

Choose a reason for hiding this comment

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

The condition in the if statement is complex and hard to understand. Consider simplifying it or breaking it down into smaller, more understandable conditions. This will improve code readability and maintainability. 🧐

generated by pr-review-commit complex_condition


/**
* Filename filter using glob syntax.
*/
glob?: string
glob?: ElementOrArray<string>

Choose a reason for hiding this comment

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

The type of 'endsWith' and 'glob' has been changed from 'string' to 'ElementOrArray'. Make sure that this change is reflected everywhere these properties are used to avoid runtime errors. Also, ensure that the consuming code is updated to handle the new type. 🔄

generated by pr-review-commit type_change

@@ -9,10 +9,10 @@ import { Code } from "@astrojs/starlight/components"
import source from "../../../../../packages/vscode/genaisrc/cmt.genai.mts?raw"

This sample automates adding comments to source code using an LLM
and validate the changes haven't introduce any code modifications.
and validates the changes haven't introduced any code modifications.

Choose a reason for hiding this comment

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

Incorrect verb form used; should be "validates" instead of "validate".

generated by pr-docs-review-commit grammar


To do so, we could use a combination of tools to validate the transformer: source formatters,
compilers, linters or LLM-as-judge.
compilers, linters, or LLM-as-judge.

Choose a reason for hiding this comment

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

Missing comma before "or" in a list of items.

generated by pr-docs-review-commit grammar

@@ -45,8 +45,7 @@ if (files.length === 0)

### Processing Each File

We process each file separately, to avoid exploding the token context and keep the AI focused.
We can use [inline prompts](/genaiscript/reference/scripts/inline-prompts) to make inner queries.
We process each file separately to avoid exploding the token context and keep the AI focused. We can use [inline prompts](/genaiscript/reference/scripts/inline-prompts) to make inner queries.

Choose a reason for hiding this comment

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

The content has been merged into a single paragraph; consider if this changes the intended emphasis or readability.

generated by pr-docs-review-commit content_structure

@@ -73,12 +72,11 @@ const res = await runPrompt(
)
```

We provide a detailed set of instructions to the AI for how to analyze and comment on the code.
We provide a detailed set of instructions to the AI on how to analyze and comment on the code.

Choose a reason for hiding this comment

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

Incorrect preposition used; should be "on how to analyze" instead of "for how to analyze".

generated by pr-docs-review-commit grammar


### Format, build, lint

At this point, we have a modified source code by an LLM. We should try to use all the available tools to validate the changes.
It is best to start with like formatters and compilers as they are deterministic and typically fast.
At this point, we have a modified source code by an LLM. We should try to use all the available tools to validate the changes. It is best to start with formatters and compilers as they are deterministic and typically fast.

Choose a reason for hiding this comment

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

The content has been merged into a single paragraph; consider if this changes the intended emphasis or readability.

generated by pr-docs-review-commit content_structure

@@ -115,7 +113,7 @@ genaiscript run cmt

## Format and build

One important aspect is to normalize and valid the AI generated code. The user can provide a `format` command to run a formatter
One important aspect is to normalize and validate the AI-generated code. The user can provide a `format` command to run a formatter

Choose a reason for hiding this comment

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

Incorrect verb form used; should be "validate" instead of "valid". Also, "AI-generated" should be hyphenated.

generated by pr-docs-review-commit grammar

@@ -45,8 +45,7 @@ if (files.length === 0)

### Processing Each File

We process each file separately, to avoid exploding the token context and keep the AI focused.
We can use [inline prompts](/genaiscript/reference/scripts/inline-prompts) to make inner queries.
We process each file separately to avoid exploding the token context and keep the AI focused. We can use [inline prompts](/genaiscript/reference/scripts/inline-prompts) to make inner queries.

Choose a reason for hiding this comment

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

The content in lines 47-48 is redundant and can be combined into a single sentence.

generated by pr-docs-review-commit content_redundancy


### Format, build, lint

At this point, we have a modified source code by an LLM. We should try to use all the available tools to validate the changes.
It is best to start with like formatters and compilers as they are deterministic and typically fast.
At this point, we have a modified source code by an LLM. We should try to use all the available tools to validate the changes. It is best to start with formatters and compilers as they are deterministic and typically fast.

Choose a reason for hiding this comment

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

The content in lines 78-79 is redundant and can be combined into a single sentence.

generated by pr-docs-review-commit content_redundancy


const res = Array.from(resolvedFiles)
return res
}

Choose a reason for hiding this comment

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

The function resolveFiles does not handle errors that may occur during the execution of asynchronous operations. This could lead to unhandled promise rejections.

generated by pr-review-commit missing_error_handling

packages/cli/src/run.ts Outdated Show resolved Hide resolved
endsWith.length &&
!endsWith.some((ext) => filename.endsWith(ext))
)
return undefined

Choose a reason for hiding this comment

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

The logic for checking if a filename ends with any of the provided extensions could lead to incorrect results. The endsWith array is checked for length, but not if it actually contains any valid extensions.

generated by pr-review-commit logic_error

@@ -45,8 +45,7 @@ if (files.length === 0)

### Processing Each File

We process each file separately, to avoid exploding the token context and keep the AI focused.
We can use [inline prompts](/genaiscript/reference/scripts/inline-prompts) to make inner queries.
We process each file separately to avoid exploding the token context and keep the AI focused. We can use [inline prompts](/genaiscript/reference/scripts/inline-prompts) to make inner queries.

Choose a reason for hiding this comment

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

Merged sentences should be separated for clarity.

generated by pr-docs-review-commit style


### Format, build, lint

At this point, we have a modified source code by an LLM. We should try to use all the available tools to validate the changes.
It is best to start with like formatters and compilers as they are deterministic and typically fast.
At this point, we have a modified source code by an LLM. We should try to use all the available tools to validate the changes. It is best to start with formatters and compilers as they are deterministic and typically fast.

Choose a reason for hiding this comment

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

Merged sentences should be separated for clarity.

generated by pr-docs-review-commit style

@@ -39,7 +39,7 @@ import {
ResponseStatus,
} from "../../core/src/host"
import { AbortSignalOptions, TraceOptions } from "../../core/src/trace"
import { logVerbose, unique } from "../../core/src/util"
import { logVerbose } from "../../core/src/util"

Choose a reason for hiding this comment

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

The import of 'unique' from "../../core/src/util" has been removed, but it's replaced with 'uniq' from "es-toolkit". Make sure that 'uniq' function from "es-toolkit" behaves exactly the same as 'unique' function from "../../core/src/util". 🧐

generated by pr-review-commit import_change

endsWith.length &&
!endsWith.some((ext) => filename.endsWith(ext))
)
return undefined

Choose a reason for hiding this comment

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

The logic for handling 'endsWith' in 'defOptions' has been changed from a string to an array. This could potentially break existing code if it's expecting a string instead of an array. Please ensure that all usages of 'endsWith' are updated to handle an array. 😊

generated by pr-review-commit logic_change

@@ -737,12 +737,12 @@ interface DefOptions extends FenceOptions, ContextExpansionOptions, DataFilter {
/**
* Filename filter based on file suffix. Case insensitive.
*/
endsWith?: string
endsWith?: ElementOrArray<string>

Choose a reason for hiding this comment

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

The type of 'endsWith' in 'DefOptions' interface has been changed from 'string' to 'ElementOrArray'. This could potentially break existing code if it's expecting a string instead of an array. Please ensure that all usages of 'endsWith' are updated to handle an array. 😊

generated by pr-review-commit type_change

Copy link

Investigator report

, bd4ac32

It appears there was an issue with the TypeScript compilation process.

Root Cause Analysis

The failure is due to a TypeScript error in the file genaisrc/poem.genai.mts, specifically an "Unterminated template literal" error at line 2, column 1.

Error Message

##[error]genaisrc/poem.genai.mts(2,1): error TS1160: Unterminated template literal.

Suggested Fix

You will need to check genaisrc/poem.genai.mts to ensure all template literals (i.e., strings wrapped with backticks) are properly terminated.

Diff Suggestion

Ensure the template literals in your TypeScript file are properly closed. Here's a hypothetical fix:

- const poem = `This is a poem
- that needs closing
+ const poem = `This is a poem
+ that needs closing`

Review and update genaisrc/poem.genai.mts accordingly.

generated by gai

@@ -313,15 +318,17 @@ export function createChatGenerationContext(
}

const defFileOutput = (
pattern: string,
pattern: ElementOrArray<string | WorkspaceFile>,
description: string,
options?: FileOutputOptions
): void => {
if (pattern)
appendChild(

Choose a reason for hiding this comment

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

The 'pattern' parameter type has been changed from 'string' to 'ElementOrArray<string | WorkspaceFile>'. Ensure that all calls to 'defFileOutput' function are updated to pass the correct type.

generated by pr-review-commit pattern_change

@@ -313,15 +318,17 @@ export function createChatGenerationContext(
}

const defFileOutput = (
pattern: string,
pattern: ElementOrArray<string | WorkspaceFile>,
description: string,
options?: FileOutputOptions
): void => {
if (pattern)
appendChild(

Choose a reason for hiding this comment

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

The type of 'pattern' in 'defFileOutput' function has been changed from 'string' to 'ElementOrArray<string | WorkspaceFile>'. Ensure that all usages of this function have been updated to reflect this change.

generated by pr-review-commit pattern_type_change

@@ -45,8 +45,7 @@ if (files.length === 0)

### Processing Each File

Choose a reason for hiding this comment

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

The phrase "We process each file separately, to avoid exploding the token context and keep the AI focused." should be "We process each file separately to avoid exploding the token context and keep the AI focused."

generated by pr-docs-review-commit grammar

@pelikhan pelikhan merged commit 306a5a6 into main Sep 30, 2024
6 of 8 checks passed
@pelikhan pelikhan deleted the gai-docs branch September 30, 2024 19:19
import source from "../../../../../packages/sample/genaisrc/gai.genai.mts?raw"
import gasource from "../../../../../.github/workflows/genai-investigator.yml?raw"

This is an in-depth guide to build a script that interactively investigates GitHub Actions failures.

Choose a reason for hiding this comment

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

New file created: docs/src/content/docs/samples/gai.mdx.

generated by pr-docs-review-commit new_file

import { Code } from "@astrojs/starlight/components"
import source from "../../../../../packages/sample/genaisrc/sc.genai.mts?raw"

Automating and improving the efficiency of proofreading documents is a common need among developers and writers. This script addresses this need by checking and correcting spelling and grammar in Markdown files.

Choose a reason for hiding this comment

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

New file created: docs/src/content/docs/samples/sc.mdx.

generated by pr-docs-review-commit new_file

@pelikhan pelikhan changed the title Fix artificial error gai and sc docus Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant