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

Add comments and documentation, replace angle brackets in CLI documentation #724

Merged
merged 5 commits into from
Sep 24, 2024

Conversation

pelikhan
Copy link
Member

@pelikhan pelikhan commented Sep 24, 2024

This pull request includes changes to add detailed comments and documentation across multiple files for clarity and understanding. It also replaces angle brackets with HTML entities in the CLI documentation to ensure proper rendering. These changes improve the readability and usability of the codebase.


  • Changed parameters presentation of several command line instructions replacing <files...> with &lt;files...&gt; to improve the readability and escape HTML characters. 🎨
  • Introduced new functionalities to the "cmt" script for formatting generated code, building it to validate, and checking modifications. 🛠️
  • Adjusted some functions descriptions and error messages improving their explanations. 📝
  • Annotated some newly introduced functions and changed code sections for more readability. 📚
  • Improved function copyPrompt adding more comments and making it more understandable. 🏆
  • Enhanced the handling of file contents in different formats like CSV, HTML, JSON, INI, and others, adding better explanations and comments in each parsing process. 📈
  • Updated markdown generation functions, providing more explanation to how they work and what they return. ✨
  • Added more context on how some important functions work, like fetching text from URL or files, resolving file data URI, handling table information and converting them into JSON or Markdown, along with functions handling global variables, etc. 🔎
  • More comments and explanation added for various functions concerning proposed changes. 📝
  • Ignored changes for import statements and minor changes related to indentation, string messages, and reorganization of the code. 🙈

generated by pr-describe

@@ -40,7 +40,7 @@ See [configuration](/genaiscript/getting-started/configuration).
npx genaiscript run <script> "**/*.md" "**/*.ts"

Choose a reason for hiding this comment

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

HTML entities should not be used in markdown files; replace '<' with '<' and '>' with '>'.

generated by pr-docs-review-commit html_entity

@@ -62,7 +62,7 @@ npx genaiscript run <script> <files> --exclude-git-ignore

Choose a reason for hiding this comment

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

HTML entities should not be used in markdown files; replace '<' with '<' and '>' with '>'.

generated by pr-docs-review-commit html_entity

## How to Run the Script

To run this script, you'll first need to install the GenAIScript CLI. [Follow the installation guide here](https://microsoft.github.io/genaiscript/getting-started/installation).

```shell
```sh

Choose a reason for hiding this comment

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

Incorrect code fence 'sh' should be 'shell' for consistency with the rest of the documentation.

generated by pr-docs-review-commit incorrect_code_fence

},
})

const { format, build } = env.vars.build

Choose a reason for hiding this comment

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

Incorrect variable access, 'env.vars.build' should be 'env.vars' to access 'format' and 'build' variables correctly.

generated by pr-docs-review-commit incorrect_variable_access

```

```sh
genaiscript run cmt --vars "build=npm run build" "format=npm run format"

Choose a reason for hiding this comment

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

Incorrect flag format, use '--vars.build="npm run build"' and '--vars.format="npm run format"' instead of the current format.

generated by pr-docs-review-commit incorrect_flag_format

Copy link

The changes in the GIT_DIFF primarily involve the addition of comments to the code to improve readability and code understanding.

The changes also include some small adjustments, such as changing the error message for unknown node types in aici.ts, updating comments in annotations.ts, and modifying variable names in chattypes.ts for better clarity.

There is no change in the functionality of the code. The modifications are solely for enhancing code documentation and readability, which is beneficial for code maintenance and collaboration.

Therefore, I can confidently say, LGTM 🚀.

generated by pr-review

## How to Run the Script

To run this script, you'll first need to install the GenAIScript CLI. [Follow the installation guide here](https://microsoft.github.io/genaiscript/getting-started/installation).

```shell
```sh

Choose a reason for hiding this comment

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

Replace 'shell' with 'sh' to maintain consistency in code block language identifiers.

generated by pr-docs-review-commit shell_to_sh

@@ -47,6 +47,9 @@ We can use [inline prompts](/genaiscript/reference/scripts/inline-prompts) to ma
for (const file of files) {
console.log(`processing ${file.filename}`)
... add comments
... format generated code (optional) -- keep things consistent
... build generated -- let's make sure it's still valid code
... check that only comments were changed -- LLM as judge

Choose a reason for hiding this comment

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

Comments in code snippets should be more descriptive and not use ellipsis '...'.

generated by pr-docs-review-commit comment_guidance

)

const modified = res.text?.includes("MODIFIED")
console.log(`code modified, reverting...`)

Choose a reason for hiding this comment

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

Console log statement 'code modified, reverting...' should be inside a conditional block to reflect the actual modification status.

generated by pr-docs-review-commit log_without_condition

@@ -71,12 +71,14 @@ export function parseAnnotations(text: string): Diagnostic[] {
* @returns A formatted GitHub Action command string.
*/
export function convertDiagnosticToGitHubActionCommand(d: Diagnostic) {
// Maps DiagnosticSeverity to GitHub Action severity strings.
const sevMap: Record<DiagnosticSeverity, string> = {

Choose a reason for hiding this comment

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

Missing semicolon

generated by pr-review-commit missing_semi

if (d.severity === "info") return `##[debug]${d.message} at ${d.filename}`
else
// Construct Azure DevOps command string with necessary details.
return `##vso[task.logissue type=${d.severity};sourcepath=${d.filename};linenumber=${d.range[0][0]}]${d.message}`

Choose a reason for hiding this comment

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

Missing semicolon

generated by pr-review-commit missing_semi

const severities: Record<string, string> = {
error: "CAUTION",
warning: "WARNING",
notice: "NOTE",
}
// Replace GitHub and Azure DevOps annotations with Markdown format.
return text

Choose a reason for hiding this comment

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

Missing semicolon

generated by pr-review-commit missing_semi

@pelikhan pelikhan merged commit fcf7adb into main Sep 24, 2024
11 checks passed
@pelikhan pelikhan deleted the srcomments branch September 24, 2024 19:02
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